Skip to content

Ledger: the record a run leaves of its catalog #909

Open
1 of 1 issue completed
Open

Description

@David-Noble-at-work

The ledger is the record, fixed when the run ends. ResourceLedgerSnapshot and LedgerEntrySnapshot (pkg/op/resource_catalog.go) are the catalog's projection into the trace: every generation in append order with its id, URI, producer, state, destroyer, etag and digest, plus the root the run bound.

When it is written

Once per run, by Run's and ResumeUnwind's defers (captureLedgerSnapshot), and carried in Trace.Catalog. Trace() after Run projects that capture; it does not take another (devlore-cli#904's correction of 2026-09-21).

What it records, and why

A trace records what a run left and what it replaced. The record therefore carries a content fingerprint for what the run made -- so a later run can ask whether it changed and a reconcile can tell our drift from someone else's -- and identity alone for what the run merely found. The rules, ruled 2026-09-21 under devlore-cli#904 (§9 items 20 and 21):

  • every Active entry records its etag (one lstat);
  • the digest is carried forward from the prior record when the id and etag match, and computed only when they do not;
  • a tree the run only found records its etag and no digest; a tree the run made records both.

Its consumers

Resume rehydrates a catalog from it (Rehydrate), ids preserved. Readback reads its etags and digests for drift attribution, keyed by deployed target and source. Receipts reference its ids.

Boundary with the catalog

The catalog (its sibling feature) is the live model; the ledger is what it said at the end. A wrong fact in the live model reaches the record unchanged, so a catalog bug shows up here first -- which is how devlore-cli#907 was found.

Documents

Kind Document
Design docs/architecture/4-resource-management.md §5.5, §9

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions