Repository navigation
A node has one open visit, outside a fan-out - #137
Conversation
A start that names an iteration is the walk's own, and the walk posts none while a visit is open. One posted anyway for a node whose visit of another iteration is open used to open a second visit on that node. The store now refuses it as VisitAlreadyOpen, and the dispatcher dead-letters the event without failing the run, which has a visit open and goes on. Fan-out branches share an iteration and open side by side as before. Two tests that used the refused call as a shortcut to two open visits now make the second one as a branch of the same iteration. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Lore is reviewing this PR — 38f963de-fbd3-4706-b4bc-8c9aedc62724. Submit a review that requests changes to have Lore push a fix for it. Comment |
Lore code reviewReviewed revision The story the tests tellThe engine now refuses to open a second visit of a node while an earlier visit of it is still open. A start event that asks for one is dead-lettered and leaves the run open. Parallel visits are told apart by branch number instead of iteration. The full story, with its testsThe store refuses to open iteration 2 of a node while that node's iteration 1 visit is still open. It fails with the error 'node "author" already has an open visit, iteration 1'. A second test shows the refusal leaves no trace: the run still has only the iteration 1 visit. Tests: The dispatcher applies the same rule to events. A work start that names iteration 2 while the iteration 1 visit is open is dead-lettered, so it is not acknowledged as handled. The run stays open, with no outcome and no finish time. Tests: Tests that need two visits open at once now pass a branch number as a fourth argument, with iteration 1 and branch 1, instead of asking for iteration 2. Two open visits of one node are told apart by branch. This still works for finding the most recently opened visit as the current node, and for numbering journal records that two visits write at the same moment. Tests: Gaps
What the checks readThe story holds. The story holds: the store refuses a second open visit of a node, the dispatcher dead-letters it and leaves the run open, and parallel visits are told apart by branch number. The new text in docs/assembly_run_storage.md matches the code except for its claim that no test covered the guard, which a store test contradicts; the new spec paragraph describes behaviour the code holds but links no test. |
There was a problem hiding this comment.
Lore review — Changes suggested
2 gaps separate the story the tests tell from the implementation, the issue and the changed documents.
Must fix (1) · Consider (1) · Nits (0)
Reviewed by claude-sonnet-5-5
Submit a review that requests changes to have Lore push a fix for it. Comment @lore review to re-run the review.
Posted by floor, visit 135458fd-154b-424c-905a-4ced3103abc8.
|
|
||
| **A start from outside closes open human visits first.** The walk posts a start event with an iteration. A person or an outside system posts one without. A start without one is a start by hand, whatever its name. The store closes any open human visit of that run as `cancelled`, opens the node at its next iteration, and records who asked. The edge back then opens the human node at its next iteration, which keeps the kernel's replay consistent. A redelivered start by hand finds the visit it already opened and opens nothing. | ||
|
|
||
| **A node has one open visit, outside a fan-out.** A start that names an iteration is the walk's own, and the walk posts none while a visit is open. One that arrives anyway for a node whose visit of another iteration is open, such as an event posted with full credentials, is refused as `VisitAlreadyOpen` and its event dead-lettered. It is the one refusal that does not fail the run: the run has a visit open and goes on when that visit reports. Without the guard a second visit opened on the node, a state the walk never makes and no test covered. |
There was a problem hiding this comment.
issue (blocking): Contradiction: Guard said to have no test
The statement ends by saying the second-visit state was something 'no test covered'. packages/store/src/assembly-run-store-hand.test.ts has two tests in AssemblyRunStore.openVisit. One asserts that openVisit(runId, "author", 2) is refused with node "author" already has an open visit, iteration 1 while iteration 1 is open. The other asserts that only iteration 1 remains after that refusal. So the guard is covered by tests.
Evidence: packages/store/src/assembly-run-store-hand.test.ts:62; packages/store/src/assembly-run-store-hand.test.ts:67; packages/store/src/assembly-run-store.ts:215; apps/api/src/engine/dispatcher.ts:145
| **A node has one open visit, outside a fan-out.** A start that names an iteration is the walk's own, and the walk posts none while a visit is open. One that arrives anyway for a node whose visit of another iteration is open, such as an event posted with full credentials, is refused as `VisitAlreadyOpen` and its event dead-lettered. It is the one refusal that does not fail the run: the run has a visit open and goes on when that visit reports. Without the guard a second visit opened on the node, a state the walk never makes and no test covered. | |
| **A node has one open visit, outside a fan-out.** A start that names an iteration is the walk's own, and the walk posts none while a visit is open. One that arrives anyway for a node whose visit of another iteration is open, such as an event posted with full credentials, is refused as `VisitAlreadyOpen` and its event dead-lettered. It is the one refusal that does not fail the run: the run has a visit open and goes on when that visit reports. Without the guard a second visit opened on the node, a state the walk never makes. |
There was a problem hiding this comment.
Applied in efd1343. The phrase meant that nothing covered the state before this change, but as written it read as if the guard had no test. The sentence now ends at "a state the walk never makes".
| A report from an event needs a visit that is open at the node. With none, nothing happens. | ||
|
|
||
| A start for a node that already has an open visit, sent with no iteration (a start by hand), returns that visit and opens nothing. The walk itself opens no visit while any visit of the run is open. | ||
| A start for a node that already has an open visit, sent with no iteration (a start by hand), returns that visit and opens nothing. The walk itself opens no visit while any visit of the run is open. A start that names another iteration of a node with an open visit is refused with `node "N" already has an open visit, iteration I`. The run and its open visit stay as they were. The branches of a [fan-out](#6-fan-out) share one iteration, so they open side by side. |
There was a problem hiding this comment.
question (non-blocking): No test link: Open-visit start rules have no linked test
This spec paragraph states behaviour a test could prove: a hand start returns the open visit, a start naming another iteration is refused with a given message, and the run and its open visit stay unchanged. It links no test. Tests that look relevant already exist in packages/store/src/assembly-run-store-hand.test.ts, around lines 62-75.
Evidence: packages/store/src/assembly-run-store.ts:215; packages/store/src/assembly-run-store.ts:222; packages/store/src/assembly-run-store-hand.test.ts:62
There was a problem hiding this comment.
No change. The tests exist, as you found (assembly-run-store-hand.test.ts for the refusal and for the start by hand, dispatcher.test.ts for the run staying open and the event being dead-lettered). This page links no test for any of its statements, so adding links here alone would make it inconsistent. Linking the specification to its tests is worth doing for the whole page in one change.
… otherwise Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A start event that names an iteration is the walk's own, and the walk posts none while a visit of the run is open. Nothing stopped one from arriving anyway: posted with full credentials for a node whose visit of another iteration was still open, it opened a second visit on that node. A collection review asked whether two reviews could run at once on one node, and the honest answer was that the specification did not say and the store did not prevent it.
The store now refuses such a start with
node "N" already has an open visit, iteration I. The dispatcher dead-letters the event and leaves the run as it was. That last part is the reason the refusal has its own type,VisitAlreadyOpen: every other refused start fails the run aserror, because a node that cannot open would leave it with nothing open, and here the run has a visit open and goes on when it reports.What does not change: a start by hand, with no iteration, still returns the node's open visit and opens nothing. A redelivered start for the same iteration still finds its own visit. The branches of a fan-out share one iteration, so they still open side by side.
Two existing store tests used the refused call as a shortcut to get two open visits in a run. Neither is about a second iteration, so each now makes its second visit as a branch of the same iteration, and what they assert is unchanged.
Run semantics and the storage design document say all of this.
One limit, as before this change: the check and the insert are not in one transaction, so two starts for two different iterations of one node handled at the same instant could both pass. The walk never posts that, and a person's start takes the other path.
Checked: assembly-lines 199 tests, store 407, API 414, each after rebuilding what it imports; typecheck and ESLint clean on the whole repo.
🤖 Generated with Claude Code