Skip to content

Add mkprobes hash --write to backfill the codebook sidecar - #6

Open
Loyale wants to merge 1 commit into
mainfrom
feat/hash-write
Open

Add mkprobes hash --write to backfill the codebook sidecar#6
Loyale wants to merge 1 commit into
mainfrom
feat/hash-write

Conversation

@Loyale

@Loyale Loyale commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

make-codebook writes <codebook>.hash, but only for codebooks it creates. A codebook made before that landed has no sidecar — and the only ways to get one were a shell redirect, or re-running make-codebook, which reassigns every bit and would orphan probes already designed against the old assignments.

--write drops the sidecar beside the codebook already on disk:

mkprobes hash panel_a/codebook.json --write

Verified against a real 161-target panel: sidecar written, codebook byte-identical, all 161 targets intact.

Details

  • A stale sidecar is updated, and the mismatch is reported. If one exists holding a different value, the codebook was edited after it was written — so anything designed in between matches neither hash. Silently overwriting would hide that.
  • One implementation. hash now uses hash_codebook_file, so the printed value, the sidecar and the provenance stamp cannot drift apart.
  • exists=True on the argument, so a missing path is a usage error rather than a traceback.

Verification

331 tests with external tools, 329 without, at terminal widths 40 and 100. Docs build clean under -W, checked by exit code.

🤖 Generated with Claude Code

make-codebook writes <codebook>.hash, but only for codebooks it creates.
A codebook made before that existed has none, and the only way to get one
was a shell redirect - or re-running make-codebook, which would reassign
every bit and orphan probes already designed against the old assignments.

`--write` drops the sidecar beside the codebook already on disk, leaving
the codebook byte-identical. Verified on a real 161-target panel.

If a sidecar exists holding a different value, it is updated but the
mismatch is reported: it means the codebook was edited after the sidecar
was written, so anything designed in between matches neither hash.

`hash` now uses hash_codebook_file, so the printed value, the sidecar and
the provenance stamp all come from one implementation, and it takes
exists=True rather than failing with a traceback on a missing path.

Co-Authored-By: Claude Fable 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