From 62a3855cb96616caf704a0f112fb2ade99fb8b45 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 2 Dec 2025 21:33:14 +0000 Subject: audit: fix shared test_reject_repo_announcement_missing_relays_tag test --- .../src/specs/grasp01/event_acceptance_policy.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'grasp-audit/src') diff --git a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs index 89220ea..6474399 100644 --- a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs +++ b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs @@ -424,29 +424,31 @@ impl EventAcceptancePolicyTests { "Accept valid state announcements after repo announcement accepted", ) .run(|| async { - // NEW: Create TestContext for mode-aware fixture management + // Create TestContext for mode-aware fixture management let ctx = TestContext::new(client); - // NEW: Request repository fixture - behavior depends on mode - // CI mode: Creates fresh repo for this test - // Production mode: Returns cached repo if available - let repo_event = ctx.get_fixture(FixtureKind::RepoState).await.map_err(|e| { + // Use OwnerStateDataPushed which handles the complete flow: + // 1. Creates repo announcement + // 2. Pushes git data with the deterministic commit + // 3. Sends the state announcement + // This ensures the state event references a commit that actually exists + let state_event = ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await.map_err(|e| { format!( "Test setup failed: could not get repository state fixture: {}", e ) })?; - // Extract repo_id from the repository announcement - let repo_id = repo_event + // Extract repo_id from the state event + let repo_id = state_event .tags .iter() .find(|t| t.kind() == TagKind::d()) .and_then(|t| t.content()) - .ok_or("Missing d tag in repository announcement")? + .ok_or("Missing d tag in state announcement")? .to_string(); - let event_id = repo_event.id; + let event_id = state_event.id; // Query back to verify it was accepted and stored let filter = Filter::new() -- cgit v1.2.3