Expand description
captured.json,
landed-capture records,
their recording and pruning.
What:
captured.json (a transaction’s position in its worktree’s capture order) and the
landed-capture records,
with recording after a landing and pruning.
Why:
Replay decides a path both a prepared commit and an earlier-landed commit captured from
this worktree by capture order;
a landed record is kept while any published transaction
may replay over it and pruned after (src/policy-engine/commit-capture-order-journal.ts,
commit-capture-order-records.ts,
commit-capture-order-prune.ts).
In TS you’d write (pseudocode):
await recordLandedCaptureOrWarn({ gitDir, transactionDirectory, transactionId, landedOid });
await pruneLandedCaptures({ gitDir, registryRoot });Structs§
- Captured
Record - What:
captured.json: the capture stamp, the next sequence read before the preparation base, and the Latin-1 decoded paths the capture read from the worktree. Why: The record pins landed records against pruning and names the captured paths. - Landed
Capture Record - What:
One landed-capture record.
Why:
LandedCaptureRecord, written right after a compare-and-swap.
Constants§
- CAPTURED_
FILENAME - Capture-order record filename inside a transaction directory.
- LANDED_
DIRECTORY_ NAME - Landed-record directory name inside the store.
- LANDED_
RECORD_ SUFFIX - Landed-record filename suffix.
- LANDED_
SCHEMA_ VERSION - Landed-record schema version.
Functions§
- encode_
captured_ record - What:
Encode
captured.jsonin the incumbent’s field order, with a newline. Why: The capture writes exactly these bytes. - encode_
landed_ capture_ record - What:
Encode a landed record in the incumbent’s field order,
with a newline.
Why:
landedRecordOfbuilds the object in this order beforeJSON.stringify. - landed_
record_ directory - What:
The landed-record directory of a worktree.
Why:
landedRecordDirectory. - list_
landed_ record_ names - What:
The landed-record filenames,
or none when the directory is absent.
Why:
listLandedRecordNames. - parse_
captured_ record - What:
Parse
captured.json. Why:parseCapturedRecord. - parse_
landed_ capture_ record - What:
Parse one landed record.
Why:
parseLandedCaptureRecord. - prune_
landed_ captures - What:
Remove every landed record no published transaction can replay over;
returns how many.
Never fails:
a failure is reported and the records stay for the next pruning.
Why:
pruneLandedCapturesruns after every transaction removes its directory and after startup recovery, so the last transaction leaves no record behind. - read_
captured_ record - What:
A transaction’s
captured.json, or nothing when it has not captured yet. Why:readCapturedRecord. - record_
landed_ capture - What:
Record the capture of a commit that just landed,
or that recovery found landed;
returns
whether the transaction had a capture to record.
An existing record is kept.
Why:
recordLandedCapture: only after the compare-and-swap succeeded. - record_
landed_ capture_ or_ warn - What:
Record a landed capture as
record_landed_capturedoes, but report a failure as a warning instead of returning it. Why:recordLandedCaptureOrWarn: the commit already landed; a missing record only sends its paths through subsumption in later replays.