Repository navigation
fix(workflow-code): leave out stored edges every save drops, so get then apply is a no-op - #10563
waleedlatif1 wants to merge 4 commits into
Conversation
…hen apply is a no-op Stored edges into a trigger, to or from a note, or across a loop or parallel boundary made an unchanged source get then apply refuse (E_TARGET_TRIGGER, E_EDGE_NOTE, E_EDGE_SCOPE), though every save already drops them (validateEdges in prepareWorkflowStateForPersistence). - One rule for both: getWorkflowEdgeDropKind in @sim/workflow-types, called by validateEdges and by canonicalize. Canonicalize now leaves these edges out with W_CANON_EDGE_DROPPED (replacing E_CANON_EDGE_SCOPE), so get never prints them and an unchanged apply is a true no-op that writes nothing. - Compile's trigger check matches persistence (legacy starter included); a new edge of these kinds written in source is still refused. - Apply gates and the locked-block assert judge the stored graph as a save keeps it, so a dropped edge next to a locked block neither refuses a no-op nor fails the commit. - An apply that writes counts the edges the save removes in diff.edges.removed and repeats the warning. - generateRejectedCorpus becomes generateDroppedEdgeCorpus: each kind, stored (warning, no refusal, no-op, written state) and written anew (still E_*).
…ged apply A condition or router storing an empty branch list ([] or '[]') printed with no entries, compiled to rows: null and materialized null over the stored list, so an unchanged get then apply wrote. Compile now keeps the stored empty list when the source writes no entries for a block that continues one. Registry corpus gains empty-list and empty-list-text branch cases for both blocks.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; the protected-block merge no longer restores dropped connections. SummaryThe PR leaves out stored connections that every save drops, so unchanged source can apply without changing the workflow.
No new actionable issues were found.
|
There was a problem hiding this comment.
All reported issues were addressed across 20 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
… every save drops A write that moved a block into the scope of a locked block could bring back a stored edge every save drops: the protected-block merge restored it from the unfiltered stored graph, and once both ends shared a scope the save kept it. The merge now starts from the stored edges a save keeps.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
An unchanged
source get→source applyno longer refuses a workflow because it stores an edge that every save already drops.What changed: canonicalize now leaves out the three kinds of stored edge that
validateEdges(run byprepareWorkflowStateForPersistenceon every save, and by the editor and realtime) drops:starterEach one gets a
W_CANON_EDGE_DROPPEDwarning that names its kind. Before this change, compile refused them (E_TARGET_TRIGGER,E_EDGE_NOTE,E_CANON_EDGE_SCOPE), so the code path refused workflows the editor saves without complaint.What
source getreturns: it no longer prints these edges and returns the warning, so an unchanged apply diffs as a no-op and writes nothing.What an apply that does write does: it repeats the warning and counts the edge in
diff.edges.removed, because the save drops it.A new edge of these kinds written in source is still refused with the same
E_*code.One shared rule:
getWorkflowEdgeDropKindin@sim/workflow-typesnow holds it.validateEdgesand canonicalize both use it, so they can't drift apart.starter, so an edge into it compiled and was then dropped silently on save.Locked blocks: the stored-graph comparisons in the apply gates (
findLockedBlockRefusals) and inassertLockedBlocksPreservednow use the saved edge set.Empty branch lists: a Condition or Router that stores an empty branch list (
[]or'[]') keeps it through an unchanged apply. Compile used to writenullover it. This case used to be hidden behind the refusal.Code removed:
E_CANON_EDGE_SCOPE. The docs (SYNTAX.md, diagnostics and syntax pages) and the OpenAPI document are regenerated.Type of Change
Testing
generateDroppedEdgeCorpus(replaces the rejected-edge corpus) covers a loop child's error edge leaving the loop, an edge into Start, an edge into the legacystarter, and an edge out of a note.E_*code. Before the change this already held for every case exceptstarter.stored-shapescases for an empty branch list onconditionandrouter_v2, stored as[]and as'[]'. All four failed P0/P1/P2/P6/P7 before the fix.gates.ts,source-commit.ts,finalize.ts,canonicalize/edges.ts), and its test then failed.lib/workflows/{code,application,editing,persistence},stores/workflowsandlib/workspace-sourcesuites pass (1200 tests).bun run generate,type-check,lint:checkandcheck:api-validation:strictpass.Checklist