Skip to content

Commit cbc020e

Browse files
committed
test(delegation): pin the child half of the parent-claim repair abort
What: the parent-half claim test now also asserts the child record reached `interrupted` before the parent half aborted. The doc block on `writeAdministrativeRepair` splits the abort outcome by half instead of claiming nothing is committed in both cases. Why: the test asserted only the parent half, so it passed whether or not the child half committed. Skipping the child write left every existing assertion green, which means the "child half committed, parent half aborted" shape the test is named for was never pinned. Impact: test-only assertion plus a comment correction. No production behavior change; the changed-executable-line count drops from 496 to 493 because the rewritten comment sits inside a counted span.
1 parent a9d4c51 commit cbc020e

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/core/task-persistence/TaskHistoryStore.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,14 @@ export class TaskHistoryStore {
10331033
* again in safeWriteJson's `preCommit`, synchronously and immediately before
10341034
* the commit rename. That window is the only one that can still change: the
10351035
* merge above already ran under the target's advisory lock, so no peer can
1036-
* write, and only an in-process claim can land. A claim observed there aborts
1037-
* with NOTHING committed, so the parent half never runs and the live session
1038-
* keeps its record, its claim, and its delegation link.
1036+
* write, and only an in-process claim can land.
1037+
*
1038+
* What an abort leaves behind depends on the half. A claim on the child
1039+
* aborts with NOTHING committed, so the parent half never runs and the live
1040+
* session keeps its record, its claim, and its delegation link. A claim on
1041+
* the parent aborts only the parent half, after the child half already
1042+
* committed as `interrupted`: the delegation link survives, which is what
1043+
* keeps the resumed parent's session recoverable.
10391044
*/
10401045
private async writeAdministrativeRepair(
10411046
target: HistoryItem,

‎src/core/task-persistence/__tests__/TaskHistoryStore.reconciliation.spec.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3980,6 +3980,7 @@ describe("TaskHistoryStore under-lock repair guards and heartbeat release", () =
39803980
// The child half committed (the repair was already past its guard), but
39813981
// the parent half aborted: the link is intact and the parent's claim
39823982
// survives, so the resumed parent keeps its heartbeat and its shield.
3983+
expect(s.get(childId)?.status).toBe("interrupted")
39833984
expect(s.get(parentId)?.status).toBe("delegated")
39843985
expect(s.get(parentId)?.awaitingChildId).toBe(childId)
39853986
const owned = (s as unknown as { locallyActiveTaskIds: Set<string> }).locallyActiveTaskIds

0 commit comments

Comments
 (0)