refactor(flow): let each step kind own how it reads - #744
Draft
latekvo wants to merge 1 commit into
Draft
Conversation
The recorder's summary and the runner's report target were two switches over FlowStep["kind"], in two files, each with its own selector and condition spellings — a new step kind could get wording on one surface and silently fall through the other's default arm. Both now come from one definition per kind, keyed by FlowStep["kind"] so a new kind is a compile error until it says how it reads. Same shape as a tool owning its own log wording in ToolDefinition.interaction. Rendering is unchanged: every summary line and report target is byte-for-byte what the switches produced.
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.
Stacked on #574.
Summary
summarizeSteps(flow-finish-recording.ts) was a 50-lineswitchoverFlowStep["kind"].stepTarget(flow-run.ts) was a second one, over the same union, with its own selector and condition spellings. Neither could be found from the other, andsummarizeSteps'case "tool": default:arm meant a step kind added without wording rendered as atool:step instead of failing.Both surfaces now read from one definition per kind — the same shape as a tool owning its own log wording in
ToolDefinition.interaction(#582):Keying the record by
FlowStep["kind"]is what replaces the default arm: a new kind is a compile error until it says how it reads on both surfaces. That also retires therenderToolArgsinterpolation guard, which existed only because the default arm could hand it a step with noargsfield.flow-run.tssheds 98 lines and six imports;flow-finish-recording.tssheds 118 and is now just the tool. The two shared label templates (conditionLabelparameterized by selector spelling, and a newwhenLabelfor the platform-vs-UI guard arm) mean the recorder'swhen:tail and the runner's no longer duplicate the platform arm.Test
Rendering is unchanged — every summary line and report target is byte-for-byte what the switches produced.
argspath. Identical on all of them. Mutating two renderings (equalscomparator, default scroll direction) failed it, so it discriminates.packages/tool-server/test/flows/flow-step-definitions.test.ts, kept: 47 assertions pinning the exact summary line and report target of every kind, in a table keyed byFlowStep["kind"]so a new kind failstypecheck:testshere too (verified by deleting thewaitentry:TS1360). Deleting a kind from the definitions record fails the build the same way (TS2741).npm run build,eslint --max-warnings 0,prettier --check .,npm run typecheck:tests --workspaces: clean.packages/tool-server: 311 files / 3596 tests passed.packages/argent-cli: 24 files / 461 tests passed.Note this PR targets
feat/concurrent-flow-recordings, and the Unit Tests workflow only runs on PRs intomain— the runs above are the signal until #574 lands.