feat(governance): add hash-chained audit logger for predictions#36
Merged
Conversation
1 task
Append-only JSONL audit trail. Each entry records the model version, SHA-256 hash of the input payload, summary statistics for the output, and a prev_hash linking back through the chain. verify_chain() walks the file and detects any tampered entry by recomputing the hash and checking the link to its predecessor.
9aae413 to
8ae630d
Compare
femi23
approved these changes
May 5, 2026
Collaborator
femi23
left a comment
There was a problem hiding this comment.
Hash-chained JSONL is exactly what I need to point auditors at. The verify_chain() walk plus the genesis-hash anchor means we can detect any tampering down to the byte. Process-safe lock is fine for the API; once we deploy with multiple uvicorn workers we'll wrap calls in a filelock or queue, as you note in the docstring.
Approving.
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.
Summary
src/climatevision/governance/audit_logger.py— append-only JSONL audit trail for every model prediction.prev_hashlinking back through the chain.verify_chain()walks the file from genesis and detects any tampered entry by recomputing the hash and checking the link to its predecessor.Why
Sprint deliverable: "Build audit_logger.py — immutable audit trail for every model version and prediction." Required input for the model governance / compliance documentation track.
Test plan
pytest tests/test_audit_logger.py— 6/6 passverify_chain()Notes for reviewers
develop.entry_hashwith a release key.