refactor(stores): model execution and workflow-diff state as status enums#5197
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview For execution, For workflow diff, Adds focused unit tests for status→flag mapping, transitions, and no-drift invariants; execution tests run under Reviewed by Cursor Bugbot for commit ad97d21. Configure here. |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 40ed2ec. Configure here.
Greptile SummaryThis PR replaces independent boolean flags in the
Confidence Score: 5/5Safe to merge — the change is a contained store refactor with no consumer-visible API breakage and thorough test coverage. The enum-based approach eliminates an entire class of illegal state combinations that previously had to be guarded at runtime. All ~40 consumers keep reading the same derived booleans unchanged, backward compatibility is maintained by spreading the derived flags directly onto the stored state objects, and 58 unit tests verify exhaustive status→boolean mapping and critical transition invariants. The setIsExecuting and setIsDebugging reimplementations are byte-identical in effect to the old code, confirmed by test coverage. No files require special attention. All changes are well-scoped to store internals and helpers. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph ExecutionStatus
EI[idle\nisExecuting=false\nisDebugging=false]
ER[running\nisExecuting=true\nisDebugging=false]
ED[debugging\nisExecuting=true\nisDebugging=true]
end
subgraph WorkflowDiffStatus
DN[none\nhasActiveDiff=false\nisShowingDiff=false\nisDiffReady=false]
DS[staged\nhasActiveDiff=true\nisShowingDiff=false\nisDiffReady=true]
DW[showing\nhasActiveDiff=true\nisShowingDiff=true\nisDiffReady=true]
end
EI -->|setIsExecuting true| ER
EI -->|setIsDebugging true| ED
ER -->|setIsDebugging true| ED
ER -->|setIsExecuting false| EI
ED -->|setIsDebugging false| ER
ED -->|setIsExecuting false| EI
ED -->|setIsExecuting true| ED
DN -->|showDiff / _batchedStateUpdate| DW
DS -->|toggleDiffView| DW
DW -->|toggleDiffView| DS
DS -->|clearDiff / RESET| DN
DW -->|clearDiff / RESET| DN
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph ExecutionStatus
EI[idle\nisExecuting=false\nisDebugging=false]
ER[running\nisExecuting=true\nisDebugging=false]
ED[debugging\nisExecuting=true\nisDebugging=true]
end
subgraph WorkflowDiffStatus
DN[none\nhasActiveDiff=false\nisShowingDiff=false\nisDiffReady=false]
DS[staged\nhasActiveDiff=true\nisShowingDiff=false\nisDiffReady=true]
DW[showing\nhasActiveDiff=true\nisShowingDiff=true\nisDiffReady=true]
end
EI -->|setIsExecuting true| ER
EI -->|setIsDebugging true| ED
ER -->|setIsDebugging true| ED
ER -->|setIsExecuting false| EI
ED -->|setIsDebugging false| ER
ED -->|setIsExecuting false| EI
ED -->|setIsExecuting true| ED
DN -->|showDiff / _batchedStateUpdate| DW
DS -->|toggleDiffView| DW
DW -->|toggleDiffView| DS
DS -->|clearDiff / RESET| DN
DW -->|clearDiff / RESET| DN
Reviews (5): Last reviewed commit: "refactor(stores): model execution and wo..." | Re-trigger Greptile |
Greptile SummaryThis PR replaces independent boolean fields (
Confidence Score: 5/5Safe to merge — the refactor is mechanical and all consumer call sites remain unchanged. All state transitions are covered by tests that assert both the enum value and its derived booleans, so a drift between them would be caught immediately. The behavioral changes are intentional and correctly implemented: setIsExecuting(true) always clears the run path, setIsDebugging(false) preserves status when not in debugging mode, and setIsExecuting(false) always returns to idle. The only finding is a minor docstring inaccuracy on setIsDebugging. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph ExecutionStore["Execution Store"]
EI[idle\nisExecuting=false\nisDebugging=false]
ER[running\nisExecuting=true\nisDebugging=false]
ED[debugging\nisExecuting=true\nisDebugging=true]
EI -->|setIsExecuting true| ER
ER -->|setIsDebugging true| ED
ED -->|setIsDebugging false| ER
ER -->|setIsExecuting false| EI
ED -->|setIsExecuting false| EI
ED -->|setIsExecuting true\n+ clearRunPath| ED
end
subgraph DiffStore["Workflow-Diff Store"]
DN[none\nhasActiveDiff=false\nisShowingDiff=false\nisDiffReady=false]
DS[staged\nhasActiveDiff=true\nisShowingDiff=false\nisDiffReady=true]
DW[showing\nhasActiveDiff=true\nisShowingDiff=true\nisDiffReady=true]
DN -->|setProposedChanges| DW
DW -->|toggleDiffView| DS
DS -->|toggleDiffView| DW
DW -->|clearDiff| DN
DS -->|clearDiff| DN
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph ExecutionStore["Execution Store"]
EI[idle\nisExecuting=false\nisDebugging=false]
ER[running\nisExecuting=true\nisDebugging=false]
ED[debugging\nisExecuting=true\nisDebugging=true]
EI -->|setIsExecuting true| ER
ER -->|setIsDebugging true| ED
ED -->|setIsDebugging false| ER
ER -->|setIsExecuting false| EI
ED -->|setIsExecuting false| EI
ED -->|setIsExecuting true\n+ clearRunPath| ED
end
subgraph DiffStore["Workflow-Diff Store"]
DN[none\nhasActiveDiff=false\nisShowingDiff=false\nisDiffReady=false]
DS[staged\nhasActiveDiff=true\nisShowingDiff=false\nisDiffReady=true]
DW[showing\nhasActiveDiff=true\nisShowingDiff=true\nisDiffReady=true]
DN -->|setProposedChanges| DW
DW -->|toggleDiffView| DS
DS -->|toggleDiffView| DW
DW -->|clearDiff| DN
DS -->|clearDiff| DN
end
Reviews (2): Last reviewed commit: "refactor(stores): model execution and wo..." | Re-trigger Greptile |
40ed2ec to
ad97d21
Compare
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ad97d21. Configure here.
|
@greptile review |
Summary
executionandworkflow-diffZustand stores from independent booleans (boolean-soup) to a single discriminatedstatusenum as the source of truth, with derived boolean selectors.ExecutionStatus = 'idle' | 'running' | 'debugging'→ derivesisExecuting/isDebugging.WorkflowDiffStatus = 'none' | 'staged' | 'showing'→ deriveshasActiveDiff/isShowingDiff/isDiffReady.isDebugging && !isExecuting,isShowingDiff && !hasActiveDiff) are now unrepresentable; the former runtime guards become compile-time-correct transitions. Matches the existingHydrationPhaseconvention.setIsExecuting(true)now always clears the run path (as before), independent of resulting status.Type of Change
Testing
running/preserve ondebugging, diff toggle guard, clear/RESET, undo-redo writers).tsc0 errors (compiles all consumers against the new types), Biome clean.Checklist