Skip to content

The ledger snapshot compares before it hashes, a tree the run only found records its etag, and mkdir claims what it made - #911

Merged
David-Noble-at-work merged 1 commit into
developfrom
fix/904-ledger-snapshot
Sep 22, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
fix/904-ledger-snapshot

Conversation

@David-Noble-at-work

@David-Noble-at-work David-Noble-at-work commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lanes 17 and 19 of #887: PR E.

  • The ledger compares before it hashes (#904) —
    ResourceCatalog.Snapshot(prior) records every Active entry's etag (one lstat) and carries the prior's digest
    forward when the id and etag match; only a new id, a moved etag or an errored prior digest is hashed. Run's and
    ResumeUnwind's defers pass the executor's capture; Trace() after Run projects it. §9 item 20.
  • A tree the run only found records its etag; a tree the run made keeps its digest (The ledger snapshot digests every Active resource, twice per run: a discovered directory boundary such as ~ is Merkle-walked (1.7M files) at the end of every deploy, silently, and the walk is discarded #904, ruled 2026-09-21) —
    the Tree contract in pkg/op, implemented by file.Directory; a Tree with no producer records no digest, so a
    boundary such as ~ is never Merkle-walked, while a directory writ made can still be asked whether it changed.
    §9 item 21.
  • Mkdir claims what it made (#907, ruled 2026-09-22)
    — it observed the leaf after minting its product with the caller's stamp, so every parent deploy plans a mkdir
    for, the home directory included, entered the catalog as made. Now it observes first: a directory that exists is
    returned as the discovery the boundary walk made, verified Active, with no producer and no receipt; a directory it
    creates is its product, stamped and undone by its receipt.
  • Corrected in the plan — the deploy path captures once, not twice: after Run the environment is gone and
    Trace() reuses the capture.

Evidence

Machine Build writ deploy common Receipt: directories ✓
darwin/arm64 (here) 409d1e89-dirty 3.4 s and 4.0 s, exit 0, 111 links (182 s on 2026-09-21) 26 Active, 0 producers, 26 etags, 0 digests ✓
danoble-ud24-1.local linux/arm64 same, snapshotted first common noblefactor-ops 166 files: 0.84 s under stop, 0.56 s under replace; upgrade nothing 25 Active, 0 producers, 25 etags, 0 digests; 193 method receipts span 5 ms, written 2 ms after the last ✓
danoble-wd11-3.local windows/arm64 same, snapshotted first common noblefactor-ops --allow-dirty 70 links, 1 skipped: 12.2 s under stop, 15.4 s under replace; upgrade no copied files 20 Active, 0 producers, 20 etags, 0 digests; 91 method receipts span 9 ms, written 18 ms after the last ✓

Both VMs: self install 3/3; base and team unset, set by URL (git-named clones), set by path unchanged; personal by
path. Bare writ deploy refuses on both, requires at least 1 arg(s): #843,
open, not this lane. The method-receipt timings are decoded from the UUIDv7 transaction_ids; the reader is
#910.

Test plan

  • make check green; make test-scenario green (8 passes)
  • six ledger tests count Digest() calls (resource_ledger_snapshot_test.go, graph_executor_test.go);
    TestMkdir_Idempotent, TestMkdir_CreatesDirectory, TestDirectory_IsTree
  • coverage: total 63.0%; pkg/op 75.3%, pkg/op/provider/file 66.7%; Snapshot 100%, ledgerDigest 100%,
    Mkdir 81.1%, IsTree 100%. Complexity: Mkdir 17 → 14, ledgerDigest 9, foundDirectory 4. Size:
    resource_catalog.go 1137, provider.go 2570, resource_ledger_snapshot_test.go 405
  • owner's row: writ deploy common --conflict=replace 2026-09-22 11:04, 111 links
  • both VMs, above; raw logs kept under build/e2e/904-*.log

Time

Marker UTC Elapsed
opened (first commit) 2026-09-22T10:39:40Z —
submitted (PR opened) 2026-09-22T10:39:46Z 0 h after opened
merged 2026-09-22T10:50:08Z 0.2 h after submitted; 0.2 h in all

Computed by the algorithm of noblefactor-ops#188 at merge.

https://claude.ai/code/session_01SqQVFZz7AdiLZkGoAcUqRW

…und records its etag, and mkdir claims what it made

writ deploy common spent 182 s after its last unit: the ledger capture asked every Active
entry for its digest, and a directory's digest is a Merkle root, so the home directory --
cataloged as a product of the mkdir that found it -- was walked to the first socket and the
error dropped.

ResourceCatalog.Snapshot takes the prior snapshot and carries a digest forward when the id and
etag match; a Tree with no producer records its etag alone; a produced tree keeps both tiers.
The executor passes its capture at both sites. file.Mkdir observes first: a directory that
exists is returned as the discovery the boundary walk made, verified Active, with no producer
and no receipt; a directory it creates is its product, stamped and undone by its receipt.

Six ledger tests count Digest() calls; Mkdir's two tests assert the stamp, the receipt and the
state; §9 items 20 and 21 record the rulings. Deploy here: 3.4 s. Linux 0.84 s, Windows 12.2 s
with the capture at 2 ms and 18 ms after the last commit.

Closes #904
Closes #907

Claude-Session: https://claude.ai/code/session_01SqQVFZz7AdiLZkGoAcUqRW
@David-Noble-at-work David-Noble-at-work self-assigned this Sep 22, 2026
@David-Noble-at-work
David-Noble-at-work merged commit 7535089 into develop Sep 22, 2026
13 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the fix/904-ledger-snapshot branch September 22, 2026 10:50
David-Noble-at-work added a commit that referenced this pull request Sep 22, 2026
…d is written, the ladder, and what a receipt means (#912)

4-resource-management.md gains §5.8, four subsections against pkg/op/resource_catalog.go: the
catalog as the live model and its doors, each door the claim it makes; the ledger as the record
captured once at the end of Run, its fields split into identity and observation, its readers;
the etag/digest ladder in both its applications, with a found tree recording its etag alone;
and a field-by-field table of what a reader of a receipt may rely on, including what an empty
digest means and the UUIDv7 commit stamp as the only clock the record carries.

One word, one thing: "ledger" names the record only. The catalog's storage is the entries, in
§2, §3, §4 and in twenty-two comments of resource_catalog.go. The status file carries the
revision and the rows for PR #911 and this section.

Closes #906

Claude-Session: https://claude.ai/code/session_01SqQVFZz7AdiLZkGoAcUqRW

Co-authored-by: David Noble <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant