Skip to content

The temporal snapshot, stage SN-1: the landing log, and the two forms of removal - #92

Merged
ascalva merged 30 commits into
mainfrom
feat/snapshot-landing-log
Nov 12, 2026
Merged

ascalva merged 30 commits into
mainfrom
feat/snapshot-landing-log

Conversation

@ascalva

@ascalva ascalva commented Nov 12, 2026

Copy link
Copy Markdown
Owner

This pull request does two things for dn-temporal-snapshot, merged in #91. It records the owner's decision of 2026-11-11 on what a retire does to the past, with the theorems it rests on, and closes the six findings the review of #91 left open (part A, the design). And it builds the design's first stage, SN-1, the landing log, as section 12 lists it: the catalog's past in two tables of its own file, written by the catalog's six writing methods in the transaction of the row each writes, with its reads, its tests, its ledger rows and its measurements on a copy of the corpus instance's catalog (part B). Nothing reads the log yet. What it changes for a process, the secret it needs at the first open of a catalog and for the writes that append to the log, which the daemon's plists now carry, is stated under Notes, with what it leaves to the owner before deploying: one decision, and two writers that have no secret yet.

Abstract

The catalog of the store maps each path to the content it holds now and is rewritten in place, so it has no past: nothing records which content a path held before, or whether it was deleted. The landing log is that past. It is appended to by the catalog's six writing methods in the transaction of the row each writes, so the catalog is the fold of the log and no caller can write one without the other. A row carries a salted commitment that a hash chain covers, so a purge empties a row and the chain still verifies; a row names its path by a keyed hash whose key is split between the file and a secret outside it, so a hole still shadows the path's earlier versions, the key it keeps cannot be tested against a guess of the path without the secret, and once no version of a path keeps its content no row names it. The design takes two forms of removal, by its owner's decision: a retire leaves the item's history readable at the cuts where it existed, with no seal, and a note written later at its path takes a fresh identity; a purge leaves a hole at every cut. Five laws of the design (append invariance, monotonicity, composition, idempotence, and a derived view as a function of the prefixes) enter the ledger of laws as 47 statements machine-checked in Lean 4, and a property test checks the code's reads against them over random sequences of writes. On a copy of a catalog of 400,274 items the migration that writes the log takes 6.7 s and 429 bytes a row, the stage adds 51 to 86 µs to a key's write, and a read of one path at a cut takes 14 to 19 µs. Measuring at that size also found a query plan that walked the whole chain on every write, and that reading every head costs what building the answer costs.

The article is papers/2026-11-11-landing-log/paper.tex (nine pages); part A updated papers/2026-11-10-temporal-snapshot/paper.tex.

What changes

Part A: the owner's decision and the open findings (design work)

  • The decision (D3, decided 2026-11-11). Removal has two forms. A retire is the shallow one: the item leaves the present, its history stays readable at the cuts where it existed, no seal is applied, and a note written later at the same path takes a fresh identity, so that it does not inherit the retired note's versions. The purge of section 6.1 is the deep one: a hole at every cut, every derived answer at a past cut becoming what it would have been had the item never landed. The note carries it wherever the design rested on the seal (1.2, 3.2, 3.6, 4.1, 6.2 rewritten with what the decision costs, 7, 10, 13), and the build order moves the seal and the unseal out of SN-3, which becomes the two forms of removal and owns the fresh identity.
  • The theorems it rests on (formal/Palace/Snapshot.lean, eighteen theorems, two of them controls): with no seal the history of a key at a cut is its landings inside the cut, append invariant, a prefix of the later history, every landing at the head, and ending with what the stricter seal serves; with a fresh identity at a retired path (lives) the identity a landing takes is a function of the events before it, the history of the identity a path holds is the path's landings since its last retire, and a retired identity keeps its life at every later cut. The two seals stay as proved facts of the model. Attacks and controls on seeds 521 to 528.
  • The six open findings, closed in the note and the article: an authored supersession reads its two notes' landings (listed and filtered by two recorded log positions); a second declaration of a pair rewrites its note (decl gets a chain-table row a declaration under a salted commitment); the resolver reads the bounds of the three resolved references and no position recorded for the filter; the dispositions are read at a position on a verdicts chain; the CI witness's attestation of a commit is listed and filtered; and the article's two sentences the review found wrong, on what a resolved pass reference takes down and on the resolver's bound, are corrected.

Part B: SN-1, the landing log (the build)

  • core/stores/landings.py, core/stores/catalog.py. The tables landing_chains and landings with their three indexes, created by the catalog's migration after it fills doc_id; on a catalog with rows and no log, the genesis of each class followed by a horizon, in one transaction. The log written inside record, tombstone, relabel_provenance, migrate_rekey_doc_id, remove and remove_digest, so a deferred() batch carries its log rows, and each write in a batch is a savepoint, so a write that fails leaves neither of its rows even when the batch's caller catches the error and goes on; a write that changes nothing appends nothing; relabel_provenance rewrites the label in landing_chains and no row. remove empties every row of a path as section 6.1 says, the key, the position, the commitment and the hash kept; remove_digest empties the rows of the digest by their positions and, for a path none of whose versions then keeps its content, the path's other rows too, so no row names a purged note; it walks the log twice, for the digest and for the names. att_head is NULL. The reads on VaultCatalog: chains, head, read_at, state_at, history_at, heads_at, read_between, verify, which also fails a row without its salt that keeps any content a purge empties.
  • The version at the key's write. record gains version, passed where the place keeps a version chain: the two key writes of Writer.finish (core/ingest/writer.py, the version just appended or found: the two call sites, and three lines that take it from the chain) and VaultSync.sync_path (core/ingest/sync.py). Nothing else in writer.py changes.
  • The secret. The keyed hash of a path needs the instance's landing-log secret, read as the repository reads every instance's secret: get_secret, from the environment, Keychain-backed, the instance's own item (landing-log-key, <id>.landing-log-key for a named instance). Whatever appends a row or seeks a path's rows by their key needs it: without it the genesis, a record or a tombstone that changes the catalog, the re-key and remove raise LandingLogKeyMissing and write nothing, and so do the two reads by path, state_at and history_at. A relabel, a purge by digest, a write that changes nothing and the other reads need none. Another value is refused by the chain's key check (LandingLogKeyMismatch). scripts/run_with_secrets.sh carries the item; the daemon's two plists (ops/lifecycle/com.mind-palace.palace.plist and its daemon twin) now run under it, since the daemon writes the catalog and palace deploy installs a plist that changed; and the runbook's section 0 says how to place the item, in ouroboros's keychain too for the daemon twin (docs/runbooks/plane-migration.md section 7), and which processes need it.
  • Tests, tests/property/test_landing_log.py, 22: SNP-1 to SNP-5 from a random catalog's genesis over random sequences of catalog writes with retires, renames, relabels, re-keys and both purges (after every write the catalog is the fold of the log, every chain verifies, no row carries att_head, a hole keeps no content, every name the log carries is carried by a version that keeps its content, and a change of identity follows a move; every cut taken reads after every later write the rows of every chain and each path's last event in each, and the state of every path over a class while the class's chains are the ones it had, up to the holes a purge leaves; the reads are prefixes, a checkpoint continued over the delta is the catalog, the state at the head is the catalog's row, and the seek, the closing-stamp read and the fold agree at every position, the genesis's included, with no path alive twice). The stage's cases: a record that changes nothing and a store the UNCHANGED check skips write no row; the writer, its batched landing too, and the sync carry each landing's version; a change of identity moves first and a re-key carries the version; each of the six writes, killed or failed between its two rows, leaves neither, in a batch too when its caller goes on, while the batch's other writes, before it and after it, commit; a failed batch leaves no log row; the genesis equals the catalog, closes each tombstoned path's store and ends at a horizon; a relabel into a class with rows changes no row, closed rows and holes included; a history over two chains of a class follows its rule; a purged old version of a live path is a hole by all three reads, and a purge of every version of a deleted note leaves no row, and after a vacuum no byte, that names it; verify fails on an edited row and on a hole that keeps any one column of its content; the secret is needed by what appends or seeks a path by its key and by nothing else, and another is refused; every statement by path is planned on the key index, and a purge by digest walks the log twice. A small fixture, tests/fixtures/landing_writes.py, gives the six writes to a killed process. The suite's fixture gives every test a fixed secret.
  • The ledger. docs/LAWS.md family XVI, the temporal snapshot, rows SNP-1 to SNP-5 (statements as section 10 gives them, the reads as anchors, the tests as falsifiers, the declarations section 10 lists, controls included); the 47 declarations carry their law in bold, are restated in formal/Spec/Snapshot.lean over Palace/Snapshot/Defs.lean and named in formal/comparator.json. SNP-6 to SNP-10 stay design theorems. SNP-1's row says a relabel, which the model leaves out, moves a chain to another class, so a read by class at a past cut follows the chain's class now while a read by chain does not change.
  • Measurements, eval/landing_log_bench.py with its record docs/experiments/landing-log-2026-11-11.md, and in the note's section 11. A key's write is timed three ways: as built, with the log's rows switched off, and as the catalog made it before SN-1.
  • The note says what was built, where the build departed from section 3.2 and 6.1, section 12's SN-1 as built, and what is left open (below).

Measurements

Two runs on copy-on-write clones of the corpus instance's catalog (400,274 rows, all observed, active); the original was never opened. Apple M2 Pro, Python 3.15.2, SQLite 3.54.1, other work running, the load average between 2.7 and 3.9; the harness peaked at 692 MB resident.

measurement result
the migration: tables, indexes, genesis of one chain of 400,276 rows 6.71 to 6.73 s; the fold equals the catalog
bytes a row (table, key index) 429 (381, 47); the file 162.7 MB to 334.1 MB
verify, every commitment and hash 3.07 to 3.08 s
state_at of one path at the middle cut; its keyed hash 13.7 to 16.5 µs; 1.6 to 1.7 µs
history_at of one path 15.5 to 18.9 µs
read_at, read_between, 1,000 positions 3.2 to 3.4 ms
heads_at at a tenth, the middle, the head 0.15 s, 0.79 s, 1.62 s (the walk in SQL 6, 29 to 30, 59 to 60 ms)
heads_at of new chains of 30,000 and 100,000 paths 111 to 112 ms, 374 to 376 ms: 3.5 to 3.6 µs a head returned beyond the walk (3.6 to 3.9 on the corpus's chain)
a key's write in a batch of 10,000: as built, the log's rows off, before SN-1 new path 55.7 to 57.4, 10.4 to 10.5, 4.6 to 4.7 µs; new version 119.1 to 120.3, 45.0 to 46.0, 34.5 to 34.7 µs: SN-1 adds 51 to 53 and 84 to 86 µs, 0.16 to 0.28 percent of a lazy landing's 31 ms

Gates

The branch was then rebased onto main at 0a5fba27, after #90 merged. Only README.md conflicted, and core/ingest/writer.py merged with the two key writes as they were. The gates below ran before the rebase, on the old base. After it, the README's test count is set by arithmetic and not by a run: main's 3,651 plus this stage's 22 is 3,673. The 180 tests of the five test files main gained or changed with #90 pass on the rebased head; nothing else was run again, and CI on the pushed head is the check.

Run in this worktree as CI runs them, on the branch's last change to code, tests and texts, each process under 4 GB resident; the README's counts were set from these runs after them:

  • uv run ruff check .: clean.
  • uv run python scripts/check_imports.py: the core firewall and the worker boundary hold.
  • uv run mypy core agents eval ops scheduler scripts: no issues in 371 source files; uv run mypy: 67 errors, the tests/ baseline.
  • uv run python -m ops.type_gate: membership, bare ignores and the inner ring clean; the one parked shim finding is unchanged.
  • The deterministic tier, as .github/workflows/ci.yml runs it (with coverage): 3,655 passed, 11 skipped, 21 deselected; 77% coverage, in 267 s at a load average of 4.1 to 5.4, peak 1.9 GB resident. The 22 tests of tests/property/test_landing_log.py are this stage's.
  • formal/check.sh: green on the branch's last change to a Lean statement, before review: 375 statements judged identical by the in-process comparison (37,590 constants compared), 105 rows, 381 cited declarations and 92 law markers consistent, 5,250 declarations audited on the standard axioms with no sorry, 56,231 replayed by Lean's kernel, leanchecker-paranoid, lean4lean, con-leche, con-ron and nanoda. Review changed a module docstring of formal/Spec/Snapshot.lean, a comment of formal/PalaceTest/Snapshot.lean and the ledger's rows; on that tree the source check, lake build --wfail Palace, lake build Spec, lake test (every attack and control), the mk_all checks, the sorry budget, the escape grep and the ledger cross-reference (105 rows, 381 cited, 92 markers, 375 statements) are green. The second review changed no Lean file; on the final tree the source check, both builds, lake test, lake lint, the mk_all checks, the sorry budget (0 of 0), the escape grep and the ledger cross-reference (105 rows, 381 cited, 92 markers, 375 statements) are green, the builds and the attacks served from Lake's cache of that tree. The audit, the export with its kernel replay and the in-process comparison were not run again: each has a process past 4 GB resident on this machine, and no declaration or statement changed. The attacks and controls were raised by part A from 227 and 203 to 232 and 206, and part B left them there.
  • scripts/build_papers.sh: every article builds clean, this one at nine pages and the design's at ten, with no undefined reference or citation and no overfull box.
  • Seeded bugs: of 58, one at a time (the review's 50, one rewritten for the batch's savepoints, and 8 for the review's fixes), every one fails the suite on hypothesis seed 1 but one that changes nothing, a write of a null over a null; the two that only the property test catches fail it on seeds 2 to 5 as well. The second review seeded 29 more, of which four passed: a batch whose failed write rolled back the whole transaction, the batched landing's version dropped, and a Landing.content that left out the title, or everything but the bookmark. With the tests it asked for, all 29, and three seeded in the purge's emptying by position, fail the suite on seed 1 (load 3.9 to 4.2); the four and the three fail it on seed 2 as well, the three on seed 3.

Notes

  • A decision for the owner before deploying: the genesis at the first open. Every process that opens the catalog runs its migration, a reader's included (the MCP server, the sentence's executor, the spine, the query modes, the launcher), and on a catalog that has rows and no log the migration writes the genesis. So the first process to open the catalog after the deploy needs the secret, raising LandingLogKeyMissing without it, and holds the write lock for the genesis, 6.7 s on the corpus's catalog, while other openers wait up to two minutes. After the genesis a reader needs no secret and opens as fast as before. The design's rule that the genesis refuses loudly without the secret and its line that no reader's behaviour changes cannot both hold while every open runs the migration. Either the genesis moves to a writer's first write, or to an owner-run migration, and an open without the secret skips it; or SN-1 is stated as changing what the first open needs, and every process that may open the catalog first runs with the secret. That choice is the owner's. Under either, every writer needs the secret, the daemon first, and palace deploy installs the committed plist when it changed (ops/lifecycle/launcher.py:1071-1078), so this branch runs both plists (ops/lifecycle/com.mind-palace.palace.plist and its daemon twin) under scripts/run_with_secrets.sh; the daemon twin runs as ouroboros and reads that account's keychain, where the runbooks place the item as they place the unseal key. The item must be in the Keychain before the deploy, or the daemon stops at its first open; a process that opens the catalog before the daemon has written the genesis needs it too. A named instance reads <id>.landing-log-key, and the wrapper refuses a named instance, so its process must be given the item under that name. A lost secret leaves the log unwritable.
  • Two more writers that have no secret yet, for the owner to settle with the decision above. Both fail loudly and lose nothing, and both stay refused until their process is given the item.
    • The heartbeat. Its dialogue sync (com.mind-palace.tick, installed by stack up) lands new turns in its own process when no daemon run is live, so it writes the catalog. Its plist runs with no secret, and a test pins that. After this build such a sync is refused with LandingLogKeyMissing, and the turns land once the daemon is live. The second review left this open, as a low finding: either the tick runs under the wrapper, or the runbook names it as a writer that waits for the daemon.
    • The code instance, since A palace without vectors: lexical code ingestion for a coding agent #90. The post-merge hook syncs the named instance code (.githooks/post-merge), which reads code.landing-log-key. The hook's environment holds no secret, and scripts/run_with_secrets.sh refuses a named instance. So after this build the hook's sync is refused, without blocking the pull, until the item exists and reaches the hook. This branch was built before A palace without vectors: lexical code ingestion for a coding agent #90 merged and does not change the hook. A named instance needs a way to be given its own items; that is a small follow-up, and its shape (the wrapper reading <id>.<name> under an overlay, or the hook reading the Keychain itself) is the owner's call.
  • Where the code contradicted the note, and what the build changed. The note's fold read a move as no row, but the catalog keeps a renamed path's row, tombstoned; the fold is now stated as the catalog keeps it. A change of class is a sixth kind, leave, since one kind cannot fold both a rename's tombstone and a path's departure from a chain. The genesis writes a renamed path's tombstone as a move, as tombstone does, where the note said retire. The key of a path takes half its key from the instance's secret, outside the file, where the note had the chain's bytes alone in the file; landing_chains gains a key_check column. And a purge by digest, as section 6.1 stated it, would have left a deleted note's retire naming its path, its identity and the date of its delete after every version was purged, against D14; it now empties a path's tombstones with its last version. Each is marked in sections 3.2 and 6.1.
  • What measuring found. The update that writes the closing stamp took the primary key and walked the chain, about 40 ms a landing at the corpus's size; it now names the key index, as the reads did, and a test asks every statement by path to be planned on it. Each write's savepoint in a batch kept its journal in a temporary file, which doubled a key's write (105 to 108 µs for a new path); the catalog's connection now keeps its temporary store in memory, where it costs about 6 µs. The record's first control, the write with the log's rows switched off, kept the read of the row before and the transaction SN-1 added, so its 42 to 69 µs were what the log's rows add; the third arm is the write before SN-1.
  • Every head costs what building the answer costs, and SNF-6 is met. The walk is 0.14 to 0.15 µs an event; each head returned costs 3.5 to 3.9 µs more, building its row in Python, so a chain of 30,002 events reads every head in 0.11 s, under section 4.2's 250,000-event threshold. Kept heads at recorded cuts shorten the walk and not the building, so they do not answer it. Nothing reads every head yet. The owner has since decided the shape (2026-11-11): a cut becomes a lazy object, read only where an operation needs it, so this eager list is replaced and not tuned. That is the next pull request of the snapshot's build, on top of this one; the size threshold of section 4.2 was not ruled on and stays as it is.
  • Rollback drops the two tables; the next open of a build with the log writes a new genesis, numbering chains and positions from 1 again. Nothing at SN-1 relies on more than that, but SN-3's fresh identity is named by a position, so SN-3 decides what keeps a name from being given twice across a rollback. A build without the log that wrote the catalog while the tables stayed would leave the log behind the catalog, which nothing detects yet.
  • A purge's bytes. A purge empties the log's rows, but SQLite keeps the bytes it frees in the file until it is vacuumed, as it does for the catalog's deleted row; a copy of the file taken before then holds them. Clearing them is SN-3's reach, and the stage's test checks the file after a vacuum.
  • Open in the design, for later stages: the migration's count of identities that run across a retire sees only what the log recorded since its genesis, and not a note landed at a path a rename left (section 6.2); the exception for a note that declares its identity is graded as the design's reading of the decision, for the owner to confirm, with a falsifier, SNF-17.
  • Not verified here: the comparator under bwrap (the gate compared in-process on macOS; CI runs lake comparator --paranoid), and, after review, the audit, the export and the in-process comparison (above); the papers workflow's TeX Live; the daemon, under either plist and its wrapper, or a named instance, with the secret placed; a whole landing batch through the writer measured with and without the log (the overhead measured is the catalog's writes, and a vault landing also reads its version chain once more, unmeasured); a purge, several classes or identities apart from paths at the corpus's size.

Merge order

This is rebased onto main after #90, whose changes to core/ingest/writer.py sit in other hunks than this stage's (Writer.finish only: the two key writes pass version, and three lines take it from the version chain). #89 is still open and changes README.md's badges and counts too; whichever of the two merges second rebases and recomputes the counts. This also changes the two lifecycle plists and docs/runbooks/plane-migration.md, which #89 does not.

Before a deploy of this stage: the landing-log item must be in the Keychain, the decision on the genesis taken, and the two writers above settled.

🤖 Generated with Claude Code

ascalva and others added 30 commits November 12, 2026 04:13
The owner decided on 2026-11-11 that a retire is the shallow removal: the
item leaves the present, its history stays readable at the cuts where it
existed, no seal is applied, and a note written later at the same path
takes a fresh identity. The library proved the two seals; this adds what
the decision rests on, over the same model.

With no seal the history of a key at a cut is its landings inside the cut
(landingsAt): append invariant, a prefix of the history at a later cut,
every landing at the head, and holding as its end everything the stricter
seal serves. With a fresh identity at a retired path (lives: the path with
the number of its retires before the event) the identity a landing takes
is a function of the events before it, the history of the identity a path
holds at a cut is the path's landings since its last retire, and a retired
identity keeps the life it had at every cut that holds its retire. Two
controls: an identity used again after its retire inherits the retired
item's versions, and under the seal a later retire empties a history that
was served.

Eighteen theorems, two of them controls. The seals' theorems stay.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Seeds 521 to 528 on the model's own definitions. Five attacks survive all
500 instances: the history with no seal is unchanged by growth, a retire
included; it ends with what the stricter seal serves and grows by prefix;
under fresh identities the history of the identity a path holds is the
path's landings since its last retire; a retired identity keeps its life
at every later cut; the identity a landing takes is a function of the
events before it. Three controls are refuted: the sealed history taken for
append invariant, a path's identity used again after its retire, and a
retired identity's history taken for empty.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The owner decided D3 on 2026-11-11, against the note's recommendation:
removal has two forms. A retire is the shallow one: the item leaves the
present, its history stays readable at the cuts where it existed, no seal
is applied, and a note written later at the same path takes a fresh
identity. The purge of section 6.1 is the deep one. The note carries the
decision wherever the design rested on the seal: decisions 4 and 6 of
1.2, the log's kinds and columns (no unseal, one horizon column), 3.6,
the reads of 4.1 and 7, section 6.2 rewritten with what the decision
costs and why the fresh identity removes the failure the stricter seal
was recommended for, the laws of section 10, D3 recorded as decided, and
the build order: the seal and the unseal leave SN-3, which becomes the
two forms of removal and owns the fresh identity, since that changes what
the writer admits, needs the log's positions and must be in force before
SN-4 reads a history. The two seals stay as proved facts of the model.

The six findings the review of the design left open:
- an authored supersession reads the landings of its two notes: listed
  in 3.5 and filtered by two recorded log positions;
- a second declaration of a pair rewrites its note: decl gets a
  chain-table row a declaration under a salted commitment, and 5.4 says
  the store is keyed by the pair;
- the resolver's bound is the bound of the three resolved references and
  no position recorded for the filter;
- the dispositions are read at a position on a verdicts chain, added to
  3.1, and the filter's stores are named;
- the CI witness's attestation of a commit is listed and filtered, and
  the one row the filtered read withholds at the head is stated;
- the article's sentence on model output is the article's commit.

Section 2.3's item 8 gains a second case, checked on the catalog: a new
note at a path a rename left takes the identity that moved.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two sentences the review found wrong. Resolving a pass attestation's
reference lowers the attestation ledger; a row of model output sits on a
chain no landing reads, so the article now gives the cascade for the pass
alone and says the filter takes model output with it. Algorithm 1's bound
is the bound recorded for the resolved references only, so the landing
heads a pass or a run records for the filter are not followed.

The article also states the decision on a retire, taken after it was
written: no seal, a fresh identity at a deleted note's path. The counts
are this tree's: 193 theorems, twenty controls, seeds 430 to 528, 5,250
declarations audited and 56,231 replayed. Ten pages, as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Snapshot library grew by 18 theorems, 5 attacks and 3 controls for
the retire with no seal: 1,538 theorems, 232 attacks and 206 controls,
25,649 lines of models and proofs, 5,757 of attacks, and 56,231
declarations replayed. formal/README.md names the new theorems, the two
controls and the seeds. The tests badge is not touched: no Python
changed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The catalog is rewritten in place, so it held no record of which digest
a path held when. Stage SN-1 of dn-temporal-snapshot adds that record in
the catalog's own file: two tables, landing_chains and landings, with
the three indexes of section 3.2, appended to by the catalog's six
writing methods in the transaction of the row each writes, so a
deferred() batch carries its log rows and the catalog is the fold of
the log. The migration that fills doc_id also creates the tables and,
on a catalog that has rows and no log, writes the genesis of each class
followed by a horizon. remove and remove_digest empty the rows of the
path or of the digest and keep their keys, positions, commitments and
hashes; relabel_provenance rewrites the label of a chain and no row;
record takes the version the writer appended or found (writer.py's two
key writes, sync.py's one) and appends nothing when nothing changes.

The reads are on VaultCatalog: chains, head, read_at, state_at,
history_at, heads_at, read_between and verify. Nothing reads them yet.

The keyed hash of a path needs a secret, read as the repository reads
an instance's secrets: get_secret, from the environment, the
instance's own item. Without it the genesis and every write raise
LandingLogKeyMissing and write nothing; another value is refused by
the chain's key check. A read needs no secret.

Two departures from the note's section 3.2, both for the fold: a path
that changes class leaves its chain with a sixth kind, leave, since the
move that a rename's tombstone writes must fold to the catalog's
tombstoned row; and the genesis writes a tombstoned path's tombstone as
a move where another active path holds its identity, as tombstone does.

tests/property/test_landing_log.py checks SNP-1 to SNP-5 over random
catalog writes with retires, renames, relabels, re-keys and purges, and
the stage's cases; the suite's fixture gives every test a fixed secret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catalog's landing log keys its hash of a path with landing-log-key,
which has no switch: the first open of a catalog that has rows writes
the genesis and every catalog write appends, so a process that writes
the catalog refuses to without it. The wrapper now carries the item
from the Keychain, and the runbook's section 0 says how to place it,
that the daemon must run under the wrapper before the build is
deployed, what a named instance reads, that a lost secret leaves the
log unwritable, and that a rollback drops the two tables. The secrets
map gains its row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The landing log is the first code that relies on the snapshot's laws,
so the five it transcribes enter docs/LAWS.md as the temporal snapshot,
family XVI: append invariance, monotonicity, composition, idempotence,
and a derived view as a function of the prefixes. Each row cites the
declarations section 10 of dn-temporal-snapshot lists for it, the
controls among them, anchors to the catalog's reads, and names the
property tests of tests/property/test_landing_log.py as its falsifiers.

The 47 cited declarations carry their law in bold at the head of their
docstrings (head_readAt gains the docstring it lacked, and
snapshot_grow, cited under SNP-1, is marked so), are restated with
their proofs left out in formal/Spec/Snapshot.lean over the model, and
are judged by the comparator. SNP-6 to SNP-10 stay design theorems;
the module docstring and formal/README.md say which are which.

check.sh is green: 375 statements judged identical, 105 rows, 381 cited
declarations, 92 law markers, 5,250 declarations audited and 56,231
replayed by the six checkers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a copy of the corpus instance's catalog, 400,274 rows in one chain,
a landing took about 40 ms: the update that writes the closing stamp of
the path's previous row took the primary key, (chain, seq), and walked
the whole chain to find the path's rows, though the statement names
the path's key. The reads already named landings_path for this reason
(dn-temporal-snapshot section 4.1, where the planner's choice cost 49
to 57 ms on the fixture). The closing update and remove's emptying now
name the index too, and a record takes tens of microseconds again.

A test traces every statement the log runs for one path, a record, a
tombstone, a re-key, the two reads and a remove, and asks SQLite's plan
of each to name landings_path; without the named index it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eval/landing_log_bench.py measures stage SN-1 on a copy of a catalog
file, migrated in place under a secret made for the run: the migration
and its genesis, the bytes a row takes in the table and each index, the
chain's verify and the fold of the log against the catalog, a key's
write in a batch of 10,000 with the log and without it, and every read.
It refuses the configured instance's own catalog.

Two runs on copy-on-write clones of the corpus instance's catalog,
400,274 rows: the migration 6.2 to 6.3 s, 429 bytes a row (the table
381, the key index 47), the fold equal to the catalog, verify 3.1 s;
one path at a cut 14 to 15 us; every head at the head 1.6 s, of which
the walk in SQL is 54 to 57 ms; a key's write 42 us more for a new path
and 65 to 69 us more for a new version, 0.1 to 0.2 percent of a lazy
landing. docs/experiments/landing-log-2026-11-11.md reads them; the
first run is what found the closing update walking the chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage SN-1, the landing log, is built, so the note says so where it
matters: the front matter and the header, section 1.4 (SNP-1 to SNP-5
in the ledger, the rest design theorems), section 11 (the measurements
on a copy of the corpus instance's catalog, with the two findings the
first run made: the closing update walking the chain, and every head of
a 400,274-event chain at 1.6 s, the chain section 4.2 keeps heads for),
and section 12 (SN-1 built, its rollback as built).

Section 3.2 marks the three places the build departed from the design:
the key of a path takes half its key from the instance's secret, which
is not in the file, so the file alone cannot test a guess of a purged
path (and section 6.1's purged row says so); a path that changes class
leaves its chain by a sixth kind, leave, since a rename's move must fold
to the catalog's tombstoned row and one kind cannot fold both; and the
genesis writes a renamed path's tombstone as a move, as tombstone does.
The fold is stated as the catalog keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eight pages in the format of the existing articles: the catalog's
missing past, the decision of the design on the two forms of removal,
the five laws as the model states them with their Lean declarations,
the log as built (its tables and kinds, the fold, commitments, holes
that keep their keys and the key's half outside the file, the genesis,
the write in pseudocode, the reads), and the evaluation: what the gate
proves and judges, what the property test checks, and the measurements
on a copy of the corpus instance's catalog, with the query plan the
first run found walking the chain. Limitations and the next stages
close it.

Every reference was looked up on Crossref by its DOI or its title.
scripts/build_papers.sh builds it clean, with no undefined reference
and no overfull box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The genesis of the corpus instance's catalog holds the write lock for
six seconds, and every open of the catalog takes the lock briefly for
its doc_id backfill, so a second process that opened the catalog while
the first wrote the genesis gave up after the connection's five
seconds with "database is locked". Until the file holds the log with a
chain, the migration now waits up to two minutes for the lock; once the
log exists an open waits five seconds as it always did, so a hung
writer still fails a new open quickly. Checked by hand: an open while
another connection held the write lock for 6.5 s waited and then wrote
the genesis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ledger gains family XVI, the temporal snapshot: 105 rows in 16
families, 381 cited declarations and 92 law markers, and 375 statements
judged by the comparator, from the check.sh run of the ledger's commit
(5,250 declarations audited, 56,231 replayed, the attacks and controls
unchanged at 232 and 206). The library has 27 statement files, 25,652
lines of models and proofs and 3,809 of statements. The deterministic
tier is 3,645 tests at 77% coverage, the twelve new ones the landing
log's. formal/README.md's count of the judged theorems follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d write

Review of SN-1 found three places where the landing log did less than
dn-temporal-snapshot says, and tests that would not have noticed.

A purge by digest emptied the rows of the digest and nothing else, so
a note deleted and then purged, purge_raw's usual case, kept its
retire: its path, its identity and the date of its delete stayed in
the file, against D14. remove_digest now also empties a path's other
rows, its retire, move and leave in every chain, once none of its
versions keeps its content; while one does, the hole stays tied to the
path as section 6.1 intends. It finds those rows by the names they
carry and the keys the emptied rows keep, so a purge still needs no
secret.

verify took any row without its salt for a hole, so a row whose salt
was nulled while its content stayed, or was rewritten, verified. It
now fails a row without its salt that keeps any of the content a
purge empties.

Inside a deferred() batch a write whose log row failed after its
catalog row left the catalog row in the batch when the caller caught
the error and went on. Each write in a batch is now a savepoint,
rolled back on its error. The docstrings of history_at say the order
it gives across two chains of a class is a rule of the prefixes, and
the module docstrings say which writes and reads need the secret.

The tests: the property test starts from a random catalog's genesis
and checks, after every write, that no row carries att_head, that a
hole keeps no content, that every name the log carries is carried by
a version that keeps its content, and that a change of identity
follows a move; across a relabel it compares a path's last event chain
by chain. Each of the six writes is killed, and failed, between its two
rows, in a batch too. New cases pin the sync's versions, a re-key's
version, the genesis's closing stamps by the three reads, a relabel
over closed rows and holes, a history over two chains, a purge of
every version of a deleted note (no row, and after a vacuum no byte,
names it), a hole that keeps content, and the secret over every write
and read. Of 58 seeded bugs, the reviewers' 50 (one rewritten for the
new batch code) and 8 for these fixes, every one fails the suite on
hypothesis seed 1 but one that changes nothing (it nulls a column
already null).

The ledger's rows SNP-1, SNP-2 and SNP-5 say what the tests check, the
relabel's exception among it, and cite the renamed and new tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bench's control patched out LandingLog.store and so kept the read
of the path's row before each write and the explicit transaction that
SN-1 added to record: what it measured was what the log's rows add,
not what SN-1 adds to a key's write. A key's write is now timed three
ways on the same file, the order turned each round: record as built;
the same with the log's appending switched off, named for what it
keeps; and the write as record made it before SN-1 (f969904), the
upsert alone. The first against the third is SN-1's cost, the first
against the second the log rows'.

With --fresh, it also lands new one-class catalogs of the given sizes,
paths and titles of the corpus's lengths, and times every head at the
head against the same walk counted in SQL, so the cost a head returned
is read apart from the walk on chains under section 4.2's threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The savepoint each write in a deferred() batch now takes keeps its
journal in a temporary file unless the connection says otherwise, and
on a copy of the corpus instance's catalog that doubled the cost of a
key's write in a batch (a new path 105 us with the log against 49
before the savepoint). The catalog's connection now keeps its
temporary store in memory: on a catalog of 100,000 rows the savepoint
costs 6 us a write there, against 38 to 50 us in a file (two runs,
batches of 10,000, load 3.9 to 4.2). No query of the catalog sorts or
groups more than a few rows in the temporary store, by their plans, so
nothing else of size is held there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te before it

The record first gave the log's cost as the write with the log against
the write with its rows switched off, which left out the read of the
row before the write and the transaction SN-1 added around them, and it
said nothing else in a landing changed, which leaves out the vault's
one more read of its version chain. Two new runs of the harness, on
fresh copy-on-write clones of the corpus instance's catalog at the
code after review, time the write three ways: SN-1 adds 51 to 53 us to
a new path's write and 84 to 86 us to a new version's against the
write before it (4.6 to 4.7 and 34.5 to 34.7 us), 0.16 to 0.28 percent
of a lazy landing; the log's rows are 45 to 47 and 74 of them.

Every head costs what building the answer costs: the walk is 0.14 to
0.15 us an event, each head returned 3.5 to 3.9 us more, on the
corpus's chain and on new chains of 30,000 and 100,000 paths alike, so
a chain of 30,002 events reads its heads in 0.11 s. That meets SNF-6's
first condition, which the record had read as the corpus's chain being
over section 4.2's threshold; kept heads would not lower it. The two
earlier runs that found each savepoint's journal in a temporary file
are kept in the JSON. The migration took 6.7 s, a row 429 bytes, at a
load average of 2.7 to 3.9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What review of the built stage found, stated where the design stands,
each marked as built:

- Section 6.1 and D14: a purge by digest empties a path's tombstones
  with its last version, so no row names a purged note; while a version
  keeps its content the hole stays tied to the path. SQLite keeps the
  bytes it frees until a vacuum, which is SN-3's reach.
- Section 3.2 and 12 (SN-1): which writes and reads need the secret, and
  that every process's first open of a catalog without a log writes the
  genesis, a reader's included. That and "no reader's behaviour
  changes" cannot both hold; which gives way is left to the owner
  before SN-1 is deployed. D12 and SN-3's reason say what SN-1 changes.
- Section 4.2, 11, SN-c and SNF-6: every head costs 3.5 to 3.9 us a head
  returned, so a chain of 30,002 events reads its heads in 0.11 s; SNF-6
  is met, kept heads would not lower that cost, and the threshold or the
  read's shape is open before SN-4. Section 11 gives the runs against the
  write before SN-1 and the savepoint's journal found in a file.
- Sections 3.1, 6.2 and 12: the rollback numbers chain ids and positions
  from 1 again, which SN-3's fresh identity must not rest on; how it is
  kept from repeating is SN-3's to decide.
- Section 6.2: the migration's count sees only what the log recorded
  since its genesis, and not a note landed at a path a rename left; the
  exception for a note that declares its identity is graded as the
  design's reading of the decision, with a falsifier, SNF-17; a life a
  purge closes with a hole is named among what the model leaves out.
- Section 10: SNP-1's test compares a read by class while the class's
  chains are the ones it had, and chain by chain across a relabel;
  SNP-2's attacks include 523; SN-3's test is for notes that declare no
  identity.
- The header, section 6.3, section 11's opening and SN-1's list of
  results no longer speak of a design with nothing built, and name
  leave where a path changes chains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Section 0 said a process that writes the catalog refuses without the
secret and a read needs none once the genesis is written. As built,
the first open of a catalog that has no log writes the genesis
whichever process opens it, a reader included, and holds the write
lock for it; after that, the writes that append to the log and remove
need the secret, while a relabel, a purge by digest, a write that
changes nothing and every read but the log's two reads of one path do
not. The section and the secrets table say so, with every process that
opens the catalog under the wrapper, the daemon first, and the open
question of moving the genesis off the first open. It also says that a
rollback's new genesis numbers chains from 1 again, and that SQLite
keeps the bytes a purge frees until a vacuum. The wrapper's comment
follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The statements' module docstring said each law's controls are among
its statements; only SNP-1's two and SNP-5's one are theorems there,
and the other controls of the five laws are refuted attacks in
PalaceTest/Snapshot.lean. It now says so. Seed 523's second half
attacks landingsAt_mono, which SNP-2's row cites, but its comment
filed the whole attack under SNP-7: the comment names both laws, and
formal/README.md's SNP-2 row lists the seed. No declaration or
statement changed. Checked under the 4 GB cap: the source check, the
Palace and Spec builds, lake test (seed 523 among the attacks that
survive 500), the mk_all checks, the sorry budget, the escape grep and
the ledger cross-reference (105 rows, 381 cited, 92 markers, 375
statements).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The landing log's article said a copy of the file cannot test whether
a hole was a given path and that the holes reveal nothing to whoever
copies it; as built, a purged note's retire kept its path until review
changed the purge, and SQLite keeps the bytes a purge frees until a
vacuum. It now says what a purge empties, what the key a hole keeps
tells without the secret, and where the freed bytes go. It says which
writes and reads need the secret and that the first open writes the
genesis for a reader too, left to the design's owner. Its measurements
are the new runs: the stage adds 51 to 86 us to a key's write against
the write before it, and every head costs 3.5 to 3.9 us a head
returned, which meets the design's falsifier for kept heads; the
savepoint's journal found in a file is among what measuring found. Its
account of the tests follows the suite (a relabel moves a chain to
another class, so a read by class at a past cut follows it), with the
seeded bugs. Nine pages, built clean.

The design's article said the snapshot's theorems are not among the
judged statements; SNP-1 to SNP-5 are, 47 of the 375, since the first
stage. Its resolver resolves the repository sensor's attestation of a
commit and filters a continuous-integration witness's, as the note's
repair of the review's sixth finding has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deterministic tier is 3,654 tests at 77% coverage, the landing
log's now 21 (3,645 before review, with 12). The statements' module
docstring grew by a line, so the statement files are 3,810 lines; the
models and proofs (25,652 lines), the attacks (5,757 lines, 232 attacks
and 206 controls), the 375 judged statements and the ledger's 105 rows
are as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The landing log's module docstring said a chain's id is never reused.
The rollback drops the log's tables and the next genesis numbers its
chains from 1 again, so an id is given once only while the tables
stand, as dn-temporal-snapshot's sections 3.1 and 12 now say; SN-3's
fresh identity must not rest on more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bles stand

The landing log's DDL comments, in the code and in the note's section
3.2, said a chain's id is never reused and a position never given twice,
and the note's table of chains said the same of `seq`. A rollback drops
the two tables, and the genesis after it numbers both from 1 again
(section 12, SN-1), as the module's docstring already says. The comments
now say given once while the tables stand, and the note's DDL and its
table point at section 12's rollback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`empty_digest` read the digest's rows by a walk of the log, emptied them
by a second (`UPDATE ... WHERE digest = ?`) and read the names of their
paths by a third, where the article and the record say a purge walks the
log twice. It now empties the rows it read by their positions, on the
primary key, so its walks are the read of the digest's rows and the read
of the names; every other statement seeks. The rows it empties are the
same.

The plan test counts the purge's walks of `landings`, two, and the test
of a deleted note's purge gives one of its digests to another note's
earlier version, so a purge that emptied only some of a digest's rows
fails it on any seed (the property test alone caught it on seeds 1 and
3, not on 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… each column of a hole

Three gaps the review found by seeding bugs the suite let pass.

- A batch whose failed write rolled back the whole transaction, in place
  of its savepoint, passed: no write of the batch preceded the failing
  one. The batch now records a note before it, and the test asks that
  note's catalog row and log row to commit with the note recorded after.
- The writer's batched key write (`Writer.finish` with producers, under
  `Writer.land_batch`) passing no version passed every test. A new test
  lands two notes, then an edit of one, through a plan of fresh stores
  with `batch=True`, and asks each `store` row of the log to carry the
  version chain's number; SNP-5's row cites it.
- `verify`'s check of a hole and the test's oracle both read
  `Landing.content`, so a `content` that left out a column weakened both
  together. The oracle reads the test's own list of what a purge
  empties, and `verify` is asked to fail a hole that keeps any one
  column of it.

Each of the four seeded bugs now fails the suite on hypothesis seeds 1
and 2, and so do the review's 25 others on seed 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The daemon writes the catalog, and every write that appends a row to its
landing log, the genesis included, needs the landing-log secret, so the
daemon needs it wherever the owner places the genesis. `palace deploy`
installs a committed plist that changed (`launcher.py:1071-1078`), so an
installed plist edited by hand would be overwritten: the committed ones
must carry the secret. Both now run `uv run scripts/palace.py start`
under `scripts/run_with_secrets.sh`, which reads the item from the
Keychain and execs the rest. The daemon twin runs as `ouroboros` and
reads that account's keychain; the plane migration's section 7 copies
the item there with the unseal key, the same value, and the twin's
preconditions name it.

The runbook's section 0 says so, and its wrapper block, which the
landing-log paragraph called the wrapper that carries the item, now
carries it. The note's section 12 says that every writer needs the
secret under either placement of the genesis, which stays the owner's
choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Twenty-one tests beside the property test: the writer's batched landing
carries the version too, and a batch's other writes commit around a
failed one. A writer needs the secret under either placement of the
genesis. The second review seeded 29 bugs, four of which passed; with
the tests it asked for, those 29 and three seeded in the purge's
emptying by position all fail the suite on hypothesis seed 1. Nine
pages, a clean build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deterministic tier is 3,655 tests at 77% coverage, the landing log's
now 22 (3,654 before, with 21). No Lean file changed: the 375 judged
statements, the ledger's 105 rows and the library's lines and attacks
are as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ascalva
ascalva merged commit ab67880 into main Nov 12, 2026
11 checks passed
@ascalva
ascalva deleted the feat/snapshot-landing-log branch November 12, 2026 18:46
ascalva added a commit that referenced this pull request Nov 12, 2026
The landing log (#92) keys every catalog write with the instance's own
secret, and a named instance reads it as `<id>.landing-log-key`. The
suite's fixture sets only the default instance's item, so the launcher
test over the code overlay failed at its first sync once the branch was
rebased onto the log. The test now gives the overlay's instance the
suite's test value, for the in-process sync and the spawned launcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ascalva added a commit that referenced this pull request Nov 12, 2026
The landing log (#92) keys every catalog write with the instance's own
secret, and a named instance reads it as `<id>.landing-log-key`. The
suite's fixture sets only the default instance's item, so the launcher
test over the code overlay failed at its first sync once the branch was
rebased onto the log. The test now gives the overlay's instance the
suite's test value, for the in-process sync and the spawned launcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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