feat: replay checksum + input canonicalization (soundness guard) - #36
Open
tishachawla-jg wants to merge 1 commit into
Open
feat: replay checksum + input canonicalization (soundness guard)#36tishachawla-jg wants to merge 1 commit into
tishachawla-jg wants to merge 1 commit into
Conversation
Backs the paper's replay-soundness claim: replay either reproduces the recorded subsequence of stubbed crossings exactly or raises, so a control-flow change cannot silently pair a stub with an envelope recorded for a different crossing. - chronicle/envelope/canonical.py: canonicalize()/digest() drop volatile fields (timestamps, generated ids) and key-sort before hashing, so a faithful replay does not false-fire on an incidental field. - chronicle/replay/checksum.py: crossing_key + order-sensitive trace_checksum, ChecksumMismatch, and ReplayVerifier (build_verifier) that checks stubbed crossings against the recorded stubbed subsequence in request order. - execution_graph: stores the trace checksum in graph.json at save and recomputes it on load, so a committed fixture edited after recording is detected (a volatile edit is not, by canonicalization). - session: verify_checksum flag (default on); _fixture_for verifies each stubbed crossing via the verifier, catching insertion, removal, and reordering. - Export ChecksumMismatch. Tests (tests/test_checksum.py): canonicalization ignores volatile changes and not real ones; a non-volatile fixture edit raises on load while a volatile edit does not; the verifier flags out-of-order and extra stubs; a clean full replay passes. Full suite green; ruff 0.15.22 clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Tisha Chawla <tisha.chawla2020@vitalum.ac.in>
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.
Implements item 4 of the paper plan and backs the paper's replay-soundness claim: replay either reproduces the recorded subsequence of stubbed crossings exactly or raises.
chronicle/envelope/canonical.py: canonicalize/digest drop volatile fields (timestamps, ids) and key-sort before hashing, so a faithful replay does not false-fire.chronicle/replay/checksum.py: order-sensitive trace_checksum, ChecksumMismatch, ReplayVerifier.verify_checksumsession flag (default on); exports ChecksumMismatch.tests/test_checksum.py (9 cases); full suite 124 green; ruff 0.15.22 clean; no em/en dashes. Matches the green Replay-soundness paragraph in chronicle.tex.