test(gates): end-to-end tests proving check_append_only rejects broken appends - #69
Merged
imran-siddique merged 1 commit intoSep 9, 2026
Conversation
…s broken appends Adds TestCheckAppendOnlyEndToEnd to test_registry_gates.py. The three cases call check_append_only.main() against a real temporary git repository (the same execution path CI uses), not just the extracted comparison logic: - test_tampered_entry_is_rejected: commits a registry entry, then replaces its merkle_root with a different hash (broken hash-chain link / wrong prev pointer) and asserts main() exits 1. - test_deleted_entry_is_rejected: commits two entries, then removes the first (omission attack) and asserts main() exits 1. - test_pure_append_passes: appends a new entry to an existing file and asserts main() exits 0, confirming the check is not over-broad. All three pass locally. The import of check_append_only at the top of the module is also new; the two existing test classes are unchanged.
imran-siddique
approved these changes
Sep 9, 2026
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.
What this PR does
Extends
tests/test_registry_gates.pywith a newTestCheckAppendOnlyEndToEndclass. The three tests callcheck_append_only.main()against a real temporary git repository — the same execution path the CIvalidatejob uses — rather than the extracted comparison logic tested by the existingTestCheckAppendOnlyclass.Tampered entry (exits 1). Commits a registry entry, then replaces its
merkle_rootwith a different hash and checks thatmain()exits non-zero. This is the broken hash-chain link / wrong previous value case: a post-hoc substitution of a committed anchor field is caught.Deleted entry (exits 1). Commits two entries, then removes the first one and checks that
main()exits non-zero. This is the omission case: dropping a line from the registry file is caught.Pure append (exits 0). Appends a new entry to an existing file and checks that
main()exits zero. This confirms the check is not over-broad — a legitimate new entry is accepted.All three pass locally against the current
tools/check_append_only.py.How to read the CI run
The
validatejob runspython -m unittest discover -s tests -v, which picks upTestCheckAppendOnlyEndToEndautomatically. The tampered-entry and deleted-entry tests will pass (they assertmain()returns 1, which it does for those inputs). The pure-append test will also pass (it assertsmain()returns 0).The run will be held for maintainer approval because this is a fork PR — that is the designed behaviour. Once released, the
validatecheck result is the closure evidence for issue #52.