Repository navigation
Ledger: restore records the migration invalidated for missing evidence (#39) - #53
Draft
Deep-Sixed wants to merge 1 commit into
Draft
Deep-Sixed wants to merge 1 commit into
Deep-Sixed wants to merge 1 commit into
Conversation
#39) The migration invalidates a committed record whose bundle is neither on disk nor in the archive, and invalidating is permanent. But evidence that was never archived (a pre-#16 ledger) may still exist on disk. - The migration's error now says why: "evidence missing" (neither on disk nor archived) or "evidence mismatched" (anything else). - stele.ledger.reverify (reverify_record, and python -m stele.ledger.reverify <db> <archive> <record_id> --artifact-dir DIR) seals such a record again from files that hash as recorded. It is an explicit operator step, never part of migration, and refuses unless the record was invalidated by the migration for missing evidence (its error says so and its only event is the migration's import), has no deliveries, and the files match the manifest. Mismatched evidence, operator or replay invalidations, and earlier migrations' unlabelled errors stay invalidated. - A chained record.reverified event is written in the same transaction; verify_ledger replays it as sealed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013p3FU6gUJ1MGinnmEgvHsm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #39.
Problem
The migration invalidates a committed record whose bundle is neither on disk nor in the archive, and invalidating is permanent. But that evidence may simply never have been archived (a ledger from before the archive existed), and the files can still be on disk.
Changes
evidence missing(neither on disk nor archived) orevidence mismatched(anything else: changed, unsafe, unreadable).python -m stele.ledger.reverify <db> <archive> <record_id> --artifact-dir DIR(reverify_record()instele/ledger/reverify.py) seals such a record again. It is an explicit operator step, never part of migration.record.invalidatedevent, so it stays invalidated even if its note copies the migration's wording;record.reverifiedevent is written in the same transaction.verify_ledgerreplays it as sealed, so the ledger still verifies.Records migrated before this change carry the old, unlabelled error. They are never restored automatically: the reason isn't recorded, so the restore refuses them. This is deliberate and covered by a test; an operator can still invalidate-and-record fresh evidence under a new run.
Tests
tests/test_reverify.py, 16 tests:Full suite: 895 passed, 97 skipped.
ruffis clean. Docs:docs/ledger.md.🤖 Generated with Claude Code
https://claude.ai/code/session_013p3FU6gUJ1MGinnmEgvHsm
Generated by Claude Code