Repository navigation
Description
Epic: Providers · Feature: #836 file provider
Found, 2026-09-22, darwin/arm64, running lane 17 (#904)
With #904's ledger ladder in place -- etag comparison, and a Tree with no producer recording its etag only --
writ deploy common on this machine still took 182 seconds. A goroutine dump 40 s in shows the run's single
ledger capture in Snapshot -> ledgerDigest -> directory.Digest -> merkleRoot over file:., the home
directory. The tree rule did not fire because the entry carries a producer:
- id: res-1
uri: tag:devlore.noblefactor.com,2026-01-01:file:.#github.com/NobleFactor/devlore-cli/pkg/op/provider/file.Directory
producer_id: file.mkdir-1
state: active
etag: 8b4079219a18e182c9e02e12512614d9521572dda87700f983c8a01c66604cf6
No digest: the walk ran to the first socket (~/.gnupg/S.gpg-agent.extra), errored, and the error was dropped.
182 seconds to record nothing. The receipt holds 52 directory entries, every one stamped file.mkdir-N; 22 carry
a digest.
Mechanism
deploy plans one file.mkdir per distinct target parent (cmd/writ/writ/deploy/plan.go:400,
planParentDirectories): ., .config, .claude, .config/git, ... Mkdir
(pkg/op/provider/file/provider.go:357) then:
- observes the leaf for an occupant (the file.mkdir ignores --conflict: anything that is not a directory at its path fails the deploy under every policy, while file.link and file.copy replace it #822 conflict seam);
- mints its product with the caller's stamp --
NewDirectory(runtimeEnvironment, activationRecord.CallerID, path)
-- and interns it, a product; - walks up to the closest existing directory, and when that is the leaf itself returns the product with no
receipt: "the directory exists, and there is nothing to compensate".
Step 2 claims production before step 3 learns whether anything was produced. A mkdir that made nothing leaves an
entry that says it made the directory. The catalog has two doors -- Discover for what a run found, GetOrCreate
for what a run made -- and records faithfully whichever one the provider walks through; Mkdir walks through the
producer door before it knows which is true. The catalog needs no change; Mkdir does.
Why it matters beyond the walk
A trace records what a run left and what it replaced. The home directory is neither: writ did not make it,
replace it, or leave it; it is the base of operation. A Merkle root over it answers no question the trace asks --
it moves whenever anything in the home directory moves and attributes every change on the machine to a run that
touched three dotfiles -- and the ledger, the drift attribution and any later reconcile all read the false stamp
and draw the false conclusion that home is ours. The etag is the whole record a boundary deserves: it was there,
with this identity, when the run ended.
The fix, ruled 2026-09-22
Mkdir observes first and claims truthfully: when the directory already exists the product is a discovery
(DiscoverDirectory, no producer, no receipt -- the receipt it already returns); when mkdirAll creates it the
product is a production (NewDirectory with the caller's stamp, the MutationCreateDir receipt with its
boundary), as today. The returned Directory is the same value either way. TestMkdir_Idempotent asserts the
empty stamp over an existing directory; TestMkdir_CreatesDirectory asserts the caller's stamp over a created
one; #904's tree rule then exempts every found parent.
Acceptance
-
Mkdirover an existing directory returns aDirectorywhoseProducerID()is empty and no receipt, Active:TestMkdir_Idempotent(2026-09-22) -
Mkdirthat creates a directory returns aDirectorystamped with the caller and theMutationCreateDirreceipt:TestMkdir_CreatesDirectory(2026-09-22) - the receipt of
writ deploy commonshowsfile:.with noproducer_idand nodigest: darwin 26 parents, linux 25, windows 20 -- all Active, etag only (2026-09-22) -
writ deploy commonon this machine ends in under five seconds (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's third box): 3.4 s and 4.0 s (2026-09-22)
Plan and design documents
| Kind | Document |
|---|---|
| Plan | docs/plans/fix/904-ledger-snapshot.md -- lane 17's plan carries this as Phase 6's finding |
| Design | docs/architecture/4-resource-management.md §3 |
Activity