Expand description
The schema-version-2 journal records of one commit transaction and their filenames.
What:
The schema-version-2 journal records of one commit transaction and their filenames;
encoding and parsing live in transaction_journal_encode.rs and
transaction_journal_parse.rs.
Why:
State files are created exclusively and never rewritten,
so a crash leaves the newest
complete state readable;
recovery in either wrapper reads the records the other wrote
(src/policy-engine/commit-transaction-journal-states.ts and
commit-transaction-journal-parse.ts).
Every missing or mistyped field fails closed
with the record and field named.
In TS you’d write (pseudocode):
const preparing = parsePreparingRecord(bytes); await writeJournalRecord({ directory, filename, record });Structs§
- Added
Path - What: One policy-added path, or one selected path whose worktree copy receives settled bytes: its mode, the blob before the commit and the blob the commit lands. Why: After landing, the worktree copy is replaced only while it still holds the original.
- File
Identity - What: A file identity recorded without hashes: device and inode as decimal text. Why: Recovery proves an artifact is the exact file written, not one put in its place.
- Index
Lock Record - What:
index-lock-<n>.json: identity of the realindex.lockattemptncreated, written right after creating it. Why: Recovery can prove ownership of the lock before any landing record exists. - Landing
Record - What:
landing-<n>.json: one landing attempt inside the critical section. Why: Recovery decides from it whether the attempt landed and completes or discards it. - Lock
Identity - What:
The identity of the real
index.locka transaction created. Why: Recovery removes a realindex.lockonly when it is provably the transaction’s own. - Prepared
Record - What:
prepared.json: the verified prepared commit in the shadow repository. Why: Landing and recovery need the commit, its tree and the worktree completions. - Preparing
Record - What:
preparing.json: invocation capture facts written before any Git mutation. Why: Recovery learns from it where every piece of the transaction lives.
Enums§
- Base
- What: The target at invocation, or the expected old target of a landing. Why: An unborn branch has no commit; compare-and-swap then expects the all-zero OID.
- Conclusion
- What: The commit kind that decides whether a moved target fails instead of replaying. Why: An amend or a conclusion cannot replay onto a moved branch.
- Landing
Operation - What: What a landing attempt installs: a commit, or a normalization that installs only index and worktree bytes. Why: A normalization never moves the target, so recovery checks it did not move.
- RefFormat
- What: The ref storage backend of the real repository. Why: The shadow ref snapshot and the conclusion pseudorefs differ by backend.
- Symbolic
Head - What:
The symbolic
HEADtarget at invocation. Why: A branch switch between preparation and landing fails the commit. - Transaction
Mode - What: How the commit selects its content. Why: Explicit-path commits build the tree from the base plus selected paths; index commits use the captured index.
Constants§
- INDEX_
INSTALLED_ FILENAME - Index installation completion marker filename.
- JOURNAL_
SCHEMA_ VERSION - Journal schema version of every per-transaction state record.
- PREPARED_
FILENAME - Prepared commit record filename.
- PREPARING_
FILENAME - Invocation capture record filename.
- REF_
UPDATED_ FILENAME - Landed commit record filename.
Functions§
- index_
lock_ record_ filename - What:
The index-lock record filename of one attempt.
Why:
See
pre_landing_index_filename. - landing_
record_ filename - What:
The landing record filename of one attempt.
Why:
See
pre_landing_index_filename. - post_
index_ filename - What:
The post-index artifact filename of one attempt.
Why:
See
pre_landing_index_filename. - pre_
landing_ index_ filename - What: The numbered artifact and record filenames of one landing attempt. Why: Every writer and reader names them the same way.