Repository navigation
test: cover policy gates, hash-chain tamper evidence, and bundle status resolution - #3
Open
raofal-msodeh wants to merge 1 commit into
Open
raofal-msodeh wants to merge 1 commit into
raofal-msodeh wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Problem
The
Policy.evaluategates and the hash-chain evidence core are the two highest-risk subsystems in proofsmith, yet the existing suite only exercised a narrow slice of them. Concretely, the following branches were never verified:FILE_COUNT_THRESHOLD) and the churn gate (CHURN_THRESHOLD) insidePolicy.evaluate, including their interactions when multiple gates fire simultaneously (blocked-by-churn vs. blocked-by-file-count precedence).HashChain.verify: appending an out-of-order entry, mutating an intermediate node's digest, and truncating the chain while leaving the stored root intact. The product's core security promise ("deterministic, replayable, tamper-evident evidence bundles") depends on these branches, but they were untested.EvidenceBundlestatus resolution with mixed seal results:SEAL_FAILED/MISSING_EVIDENCEcombinations, the all-SKIPPEDaggregate, and the precedence rules betweenVERIFIED,INVALID, andPENDINGstatuses.Cause
tests/test_policy_hashchain.pywas written around the initial implementation and only covered the security-gate branch, the happy path of the hash chain, and passingEvidenceBundleaggregates. The branch coverage report confirmed large gaps:policy.py(~84%),hashchain.py(~91%), andbundle.py(~86%) before this change.Solution
Add
tests/test_policy_hashchain_evidence_gaps.pywith 20 focused tests that drive exactly the uncovered branches:Tests
All quality gates pass and total coverage rises from 95% to 99% (274 lines, 1 missed), with previously uncovered branches in
policy.py,hashchain.py, andbundle.pynow exercised.Impact