Expand description
M6: content-addressed store. Spec §4.
Filesystem layout (§4.2):
<root>/
├── stages/
│ └── <SigId>/
│ ├── implementations/
│ │ ├── <StageId>.ast.json
│ │ └── <StageId>.metadata.json
│ ├── tests/
│ │ └── <test_id>.json
│ ├── specs/
│ │ └── <spec_id>.json
│ └── lifecycle.json
└── traces/
└── <run_id>/
└── trace.jsonThe filesystem is canonical. We don’t ship index.db (the spec calls
it a cache); the in-memory index is rebuilt on Store::open by
scanning the filesystem. Acceptance §4.6 requires that this rebuild
produces identical results regardless of cache state — the obvious way
to honor that is to keep the cache trivially derivable.
Modules§
- policy
<store>/policy.json— local trust policy.- users
<store>/users.json— actor identity (lex-tea v3d, #172).
Structs§
- Branch
- Candidate
Info - Per-candidate metadata surfaced by
Store::list_candidates(#294). Returned sorted byop_idfor deterministic output. - GcPlan
- The plan for a single GC pass: which ops survive (with the
reason) and which are slated for deletion.
apply_gc(plan)turns this into actual filesystem changes. - Lifecycle
- Per-
SigIdlifecycle log: append-only list of state transitions for every implementation that’s ever been published under this signature. - Merge
Conflict - Merge
Entry - Merge
Record - Merge
Report - Merge
Resolution Checker - Adapter turning a
Store+ dst branch into alex_vcs::ResolutionCheckerfor one merge session. - Merge
Summary - Metadata
- Per-implementation metadata (
<StageId>.metadata.json). - Operation
- The operation as a whole — its kind and the causal predecessors
it assumes. The
OpIdis computed from this plus a sorted view ofparents. - Operation
Record - An operation paired with its computed
OpIdand the resulting stage transition. This is what gets persisted under<root>/ops/<OpId>.json. - Plan
- Result envelope returned by
Store::plan. - Plan
Path - One linear chain from
goalto a leaf, with its total cost and the union of effects along it. - Publish
Op - One applied operation within a
PublishOutcome. - Publish
Outcome - The outcome returned by
Store::publish_program. - Replay
Outcome - The result of comparing a regenerated candidate against an op’s
recorded output (#836 G3), returned by
Store::replay_compareafter it emits theReplayattestation. - Replay
Request - Everything a regenerator needs to replay an op (#836 G3), produced
by
Store::replay_request. The model call is external: a harness feedsprompt+parent_programtomodel, then hands the regenerated stage toStore::replay_compare. - Session
Budget - Rollup of a single session’s budget spend.
- Spec
- A spec attached to a SigId (spec §4.4). Kept opaque here — the spec-checker (M10) interprets its body.
- Stage
Delta - On-disk format of a delta-encoded stage.
- Stage
History Entry - One entry in the per-
SigIdstage history surfaced byStore::sig_history. Newest-first ordering is the responsibility of the producer. - Store
- Test
- A test attached to a SigId (spec §4.4).
- Transition
Enums§
- Branch
Advance - Outcome of
Store::advance_branch_head_ff— how the ref moved. - Operation
Kind - The kinds of operations that produce stage transitions. Mirrors
the initial set in #129; new kinds (
MoveBetweenFiles,SplitFunction,ExtractType) can be added later as long as they’re appended at the end of this enum or use explicit#[serde(rename = "...")]tags so existingOpIds stay stable. - Retention
Reason - Why an op survived a GC plan. Serialized as JSON in the
lex op gc --dry-runenvelope so reviewers can see the reasoning per op. - Stage
Status - Stage
Transition - Effect of applying an operation on a stage’s content-addressed
identity. Used as the
producesfield of anOperationRecordso consumers can answer “after this op, what’s the head stage for this SigId?” without rerunning the apply step. - Store
Error
Constants§
- DEFAULT_
BRANCH - DELTA_
CHAIN_ CAP - Maximum length of a delta chain. Past this, [
encode] yieldsNoneso the caller writes a full snapshot. The cap is a pragmatic balance between disk savings and reconstruction cost — 32 keeps the worst-caseget_astat 32 file reads + 32 splices, which dominates over filesystem latency. - DELTA_
RATIO_ THRESHOLD - A new stage is delta-encoded when the middle (non-shared) bytes are at most this fraction of the new stage’s size. Below the threshold the delta is a clear win; above it, the metadata overhead and the indirection cost of reconstruction usually outweigh the byte savings.
Type Aliases§
- OpId
- Identity of an operation.
(kind, payload, parents)SHA-256 in lowercase hex (64 chars). Two operations with identical payloads and parent sets produce identicalOpIds; the store dedupes on this.