check/fmt: read several files as one script set; report and pair stub-then-real flows (#905 part 2) - #908
Merged
Conversation
…exiting The check command's body becomes runCheckFile, which returns the exit code where it called os.Exit. Behaviour is unchanged for the one file check takes; it lets a caller check several files and combine their codes (#905). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r stub-then-real flows (#905) check and fmt --upgrade take several files, run in the order given. A flow two create-or-modify statements of the set declare - a stub, then the real flow - is reported as MDL-STUB01 (a warning) naming both statements, and fmt --upgrade decides the language header for the files sharing such a flow together: all take it or none does. Decided file by file, the stub's file was declined the header while the real flow's file took it, and run in order the mdl 0 stub rebuilt the real flow every run while the mdl 1 real statement was refused, with mx check clean. One file alone is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an already-headed file is reported, not declined (#905) canTakeHeader read any written header as 'already under it', so a stub pinned `mdl 0;` let its real file take `mdl 1;` and the pair split again. A file already carrying the header cannot be declined it (fmt never removes one); fmt now says the pair stays split instead of 'no language header added'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed '{1}' template (#905)
A log, show message or validation feedback whose message is an expression
(`'failed for ' + $User/Name`) is stored as the template '{1}' with the
expression as its parameter, and describe prints that form. declaredMatches
compared the two spellings as different statements, so wherever the built
comparison does not decide (a spliced or Studio Pro-drawn flow) the
statement diff replaced the activity on every run: absorbed by the write
elision on the main path, refused under mdl 1 when the message sits in a
stored activity's error handler ("cannot replace … it has an error
handler"). That was the second run of CapTrack's ACT_Export_Excel once the
splice could grow it.
matchValue normalises the three statements to the builder's stored form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eturn when spliced (#905) Under mdl 1, `create or modify` refused to grow a stored flow by an activity whose custom error handler ends in `return` ("an error handler in the fragment ends at an end event of its own … a return inside an error handler is not spliced yet"), as an insert or a replace, on every run; mdl 0 rebuilt the flow. On CapTrack this left a stub-then-real pair with the placeholder stored. The handler is built by a child flowBuilder whose returnEndIDs never reached the parent, so cutFragment took the handler's return end event for one the builder added. addErrorHandlerFlow now carries them up: the return is a new end event of the flow, placed where the builder drew it relative to the fragment, like a guard clause's (#888), and checkRoom/checkBranches refuse where it would be drawn over or across stored content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #905
Part 2 of #905: find stub-then-real script sets. The splice fix for the underlying refusal (G2) is the parallel PR on
fix/905-splice-error-handler-return. This PR does not touch mfmutator.What changes
checkandfmtnow take several files and read them as one script set, run in the order given. Before this, both took exactly one file, and so didexec, so no command ever saw the set. One file alone behaves exactly as before.cmd/mxcli/script_set.go:findFlowRedeclarationsfinds a microflow or nanoflow that twocreate or modifystatements declare, in different files of the set or twice in one file. Each site is reported asfile:linewith its language version.-p) prints an MDL-STUB01 warning before the per-file checks. It names both statements, says when they are under different headers, and advises dropping the stub, since a self-recursive flow is created in one statement after A recursive microflow cannot be created in one statement (exec: microflow not found; check passes) #843. It is a warning, so the exit code is unchanged. A structured--formatis refused for several files because it writes one document per script.-p, exec would refuse a statement (MDL-V1-REBUILD) and--force-headeris not given. The per-file verdict is the same code (headerRefusals).--force-headerputs the header on both.docs-site/src/appendixes/error-messages.md, with a CHANGELOG entry and a finding incmd-mxcli.jsonl.runCheckFile, which returns its exit code where it calledos.Exit.Design choices
execstill takes one file. Running a set through one exec is a follow-up.Test plan
TestFmtUpgrade_ScriptSetDecidesStubThenRealHeaderTogether(PedApp copy; the real flow is stored by mxcli). The stub's file is refused under mdl 1 (it changes a loop body). Over the set, neither file takes the header and MDL-STUB01 is reported with bothfile:line. Controls: the real file alone takes the header (single file unchanged), and it also takes it in a set with no redeclaration.--force-headerputs it on both.TestCheck_ScriptSetWarnsOnStubThenReal: warns with both sites, exit 0. Controls: a set with no redeclaration, and the same pair in one file checked alone, give no warning.TestFindFlowRedeclarations: cross-file and in-file pairs, quoted names andcreate or replace nanoflow, plaincreateignored, line numbers, mixed versions, file grouping.repros3/stub-then-real-loses-flowby hand with this build:fmt --upgrade -p -wover both files declines the header on both. Exec of the stub and then the real file, run twice, leaves the real flow stored (call … on error/log … 'done'), where the original repro left the placeholder.make build,go test ./cmd/mxcli/...(pass),make lint,make check-conformance,make check-findings. No write path changed, so neither the twice-exec rule nor the GUID rules apply, and I did not run the integration suites.🤖 Generated with Claude Code