Skip to content

ledger: one shape of catalog records, and the conversion is removed - #130

Closed
krokicki wants to merge 2 commits into
mainfrom
ledger-one-shape
Closed

krokicki wants to merge 2 commits into
mainfrom
ledger-one-shape

Conversation

@krokicki

@krokicki krokicki commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Why

#127 stored each catalog record once by the hash of its text. To keep an installation working until its ledger was converted, it let the ledger read and write both shapes of records, and added a command that converts a ledger file. Every ledger is converted now, so all of that is code nothing runs.

What changes

  • Ledger reads and writes records by body hash only. The branch on the shape of the table is gone from put_records, records and record.
  • The conversion is removed: convert_records, the ledger migrate command, and the runbook in docs/deployment.md.
  • The two record tables are back in the schema text; they were separate constants only for the conversion.
  • put_records hashes each body once instead of twice, and names the columns it writes.

A ledger file in the other shape

A copy of a ledger made before its conversion cannot be used with this code. Reading or writing its catalog records fails with SQLite's "no such column" error and leaves the file as it was; no write lands in the wrong column, because the insert names its columns. The release that has the command (v2026.12.01) converts such a file.

Tests

The tests of the conversion, of the command and of a ledger read unconverted go with the code they covered. The test that a body is stored once however many refs hold it stays. The full suite passes (1,942 tests), with lint and the type check clean.

🤖 Generated with Claude Code

krokicki and others added 2 commits December 1, 2026 15:44
…efused

The ledger reads and writes `records` by body hash only. A ledger file whose
`records` holds a body in every row is refused when it is opened, before
anything is written, with the command that converts it; `ledger migrate`
stays for such a file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every ledger holds one body per distinct record, so nothing is left to
convert: `convert_records`, the `ledger migrate` command, the refusal of
a ledger not converted, their tests and the runbook go. The two record
tables are back in the schema text, and `put_records` hashes each body
once and names the columns it writes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@krokicki krokicki changed the title ledger: one shape of catalog records, and a ledger not converted is refused ledger: one shape of catalog records, and the conversion is removed Dec 4, 2026
@krokicki krokicki closed this Dec 4, 2026
@krokicki
krokicki deleted the ledger-one-shape branch December 4, 2026 19:50
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