Skip to content

test(gates): end-to-end tests proving check_append_only rejects broken appends - #69

Merged
imran-siddique merged 1 commit into
agentrust-io:mainfrom
action-state-group:test/prove-fork-validate-runs
Sep 9, 2026
Merged

test(gates): end-to-end tests proving check_append_only rejects broken appends#69
imran-siddique merged 1 commit into
agentrust-io:mainfrom
action-state-group:test/prove-fork-validate-runs

Conversation

@StevenMih

Copy link
Copy Markdown
Collaborator

What this PR does

Extends tests/test_registry_gates.py with a new TestCheckAppendOnlyEndToEnd class. The three tests call check_append_only.main() against a real temporary git repository — the same execution path the CI validate job uses — rather than the extracted comparison logic tested by the existing TestCheckAppendOnly class.

Tampered entry (exits 1). Commits a registry entry, then replaces its merkle_root with a different hash and checks that main() 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 validate job runs python -m unittest discover -s tests -v, which picks up TestCheckAppendOnlyEndToEnd automatically. The tampered-entry and deleted-entry tests will pass (they assert main() returns 1, which it does for those inputs). The pure-append test will also pass (it asserts main() returns 0).

The run will be held for maintainer approval because this is a fork PR — that is the designed behaviour. Once released, the validate check result is the closure evidence for issue #52.

…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
imran-siddique merged commit b73cf3d into agentrust-io:main Sep 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants