mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-06 07:28:23 +00:00
Adds the two mirror tests from the GRASP-06 audit plan (tests 7 and 8): forward (/prs/ -> announced repo MUST mirror) and reverse (announced repo MUST NOT mirror to /prs/). Both are design-doc derived since 06.md does not name the mirror behaviour, and pin the contract where future regressions would otherwise hide. Forward test reuses ValidRepoServed for the destination announcement, materialises a local commit first (decoupling from any deterministic- commit hash), pins the PR event's c tag to that hash, pushes HEAD:refs/nostr/<event-id> to /prs/, waits 2s for the async mirror, then fetches the ref into a verify workspace and runs git cat-file -e to assert commit reachability — the user-chosen verification. Reverse test reuses PREvent2Served (which already pushes a PR ref via the standard endpoint) and asserts git ls-remote on the contributor's /prs/ URL with a refname filter returns empty. A failed ls-remote is treated as a setup failure — per 06.md line 13 the /prs/ endpoint must be reachable as an empty bare repo, so an unreachable endpoint prevents this test from making its assertion meaningfully. Wired into Grasp06Tests::run_all (real assertions when GRASP-06 is advertised, skipped placeholders otherwise), the integration test file (with_grasp_06 macro), and the CLI report under a new 'Cross-Service Mirror' section. Tests fail TDD-red against the current (no GRASP-06) relay with informative error messages and turn green once Phases 4 + 7 of the implementation plan land.