Repository navigation
Description
Ledger absorption: part writes compose into the parent
Parent: #228 · Blocks: #TBD3, #TBD4 · First in sequence — kills the data-loss bug and proves the invariant the rest stands on.
Problem
A task family's product is defined by its ledger — the list of paths the family wrote, which stageTaskWork stages and landMirror lays back into the ground. Today the ledger is per-node and does not compose.
Concretely: a mirror-mode parent (plain-folder ground) that divides work gets parts that write into the parent's mirror directory. At landing, landMirror copies home only the parent's own wrote list (task_run.go:5530). A part's files never reach the person's folder unless the parent happened to re-declare them on its files: line. That is silent work loss — the task reports done, the check passes against the mirror, and the person's folder is missing the parts' output.
The same gap exists one level down: at depth 2, a grandchild's writes must reach the root ledger or they strand in an intermediate tree.
Decision
Absorb part ledgers into the parent on landing, recursively. When a part lands, its shipped paths append to the parent's ledger. The rule:
The ledger decides what ships; the repository decides how it merges.
Repo grounds already work this way (stageTaskWork stages the ledger, not the directory). This change gives folder families the same law, so landMirror ships the family's product, not the parent's slice.
Acceptance
- A mirror-mode parent that divides work lands its parts' files into the person's folder without any
files:re-declaration. - Depth-2: a grandchild's writes reach the root ledger and ship.
- A part file the parent also wrote (same path) is refused at admission — see #TBD3 (this issue must not mask overlap by absorbing it).
restoreFromFolder(audit) sees the family's full product in the mirror.- No change to repo-worktree behavior (ledger already composes there via merge).
Notes for the implementer
- The absorption point is the part-landing path in
workTaskNode/ the completion fold, notlandMirroritself —landMirrorshould keep reading one ledger; the fix is that the ledger is now complete. changedinrunTaskChildis the per-node list; the parent's effective ledger ischanged ∪ (landed parts' changed). Find where the parent'schangedis finalized beforecomeHome/landMirrorand absorb there.mergePaths(task_run.go:5996) is the existing ordered-dedup helper — reuse it.- Emptiness law: a part that wrote nothing absorbs nothing.
Verification recipe
- Build a scripted nest (see
task_nest_test.go'sdivideNest): parent in mirror mode on at.TempDir()ground with a couple of files. - Script the parent to
divide_workinto two parts; script each part towritea distinct file. - Land the family. Assert the ground folder contains the parent's file and both parts' files.
- Repeat at depth 2 (part divides again) and assert the grandchild's file reaches the ground.
Drafted with CodeAF · reviewed and owned by the author
Activity
test: a family's fixture answers as the part it is, not as the siblin…
task families: uniform part-brief composition — harness composes fami…
task families: an end-to-end lane that proves parts work apart and la…
task families: an end-to-end lane that proves parts work apart and la…
task families: an end-to-end lane that proves parts work apart and la…
task families: a real-model end-to-end lane on both grounds (#280)
task families: the two roads the family work lands in have too many e…
task families: complexity debt on the division and landing seams — ex…