upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-12 12:57:44 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-12 12:57:44 +0000
commitdcaaa0c44c46f963929ab0baa91f63759ec702dc (patch)
tree1808621ff43eb01acaabe091033672d347bfbf67 /grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
parent3fd6ce4149d567c67009b0332ca76c0cd6f51055 (diff)
refactor(grasp-audit): split ValidRepo into Sent/Served, add tolerant purgatory
- Rename ValidRepo to ValidRepoSent (announcement sent, may be in purgatory) - Add ValidRepoServed (announcement queryable after git data pushed) - Add send_event_and_note_purgatory() for tolerant purgatory detection - Update fixtures to use tolerant method instead of strict assertion - Update event_acceptance_policy tests to use ValidRepoServed This enables tests to pass regardless of purgatory implementation status while still having explicit purgatory tests that verify the behavior.
Diffstat (limited to 'grasp-audit/src/specs/grasp01/event_acceptance_policy.rs')
-rw-r--r--grasp-audit/src/specs/grasp01/event_acceptance_policy.rs120
1 files changed, 72 insertions, 48 deletions
diff --git a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
index 8259283..3375c4d 100644
--- a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
+++ b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
@@ -157,12 +157,15 @@ impl EventAcceptancePolicyTests {
157 let ctx = TestContext::new(client); 157 let ctx = TestContext::new(client);
158 158
159 // Request repository fixture - behavior depends on mode 159 // Request repository fixture - behavior depends on mode
160 let event = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 160 let event = ctx
161 format!( 161 .get_fixture(FixtureKind::ValidRepoServed)
162 "Test setup failed: could not get valid repository fixture: {}", 162 .await
163 e 163 .map_err(|e| {
164 ) 164 format!(
165 })?; 165 "Test setup failed: could not get valid repository fixture: {}",
166 e
167 )
168 })?;
166 169
167 // Get relay URL for validation 170 // Get relay URL for validation
168 let relay_url = client 171 let relay_url = client
@@ -602,12 +605,15 @@ impl EventAcceptancePolicyTests {
602 let ctx = TestContext::new(client); 605 let ctx = TestContext::new(client);
603 606
604 // NEW: Get repository fixture (mode-aware) 607 // NEW: Get repository fixture (mode-aware)
605 let repo = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 608 let repo = ctx
606 format!( 609 .get_fixture(FixtureKind::ValidRepoServed)
607 "Test setup failed: could not get valid repository fixture: {}", 610 .await
608 e 611 .map_err(|e| {
609 ) 612 format!(
610 })?; 613 "Test setup failed: could not get valid repository fixture: {}",
614 e
615 )
616 })?;
611 617
612 // 2. Create issue that references the repo 618 // 2. Create issue that references the repo
613 let issue = Self::create_issue_for_repo(client, &repo, "Test Issue 1")?; 619 let issue = Self::create_issue_for_repo(client, &repo, "Test Issue 1")?;
@@ -637,12 +643,15 @@ impl EventAcceptancePolicyTests {
637 let ctx = TestContext::new(client); 643 let ctx = TestContext::new(client);
638 644
639 // Get repository fixture (mode-aware) 645 // Get repository fixture (mode-aware)
640 let repo = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 646 let repo = ctx
641 format!( 647 .get_fixture(FixtureKind::ValidRepoServed)
642 "Test setup failed: could not get valid repository fixture: {}", 648 .await
643 e 649 .map_err(|e| {
644 ) 650 format!(
645 })?; 651 "Test setup failed: could not get valid repository fixture: {}",
652 e
653 )
654 })?;
646 655
647 // Extract repo_id and create `A` tag manually 656 // Extract repo_id and create `A` tag manually
648 let repo_id = 657 let repo_id =
@@ -690,12 +699,15 @@ impl EventAcceptancePolicyTests {
690 let ctx = TestContext::new(client); 699 let ctx = TestContext::new(client);
691 700
692 // Get repository fixture (mode-aware) 701 // Get repository fixture (mode-aware)
693 let repo = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 702 let repo = ctx
694 format!( 703 .get_fixture(FixtureKind::ValidRepoServed)
695 "Test setup failed: could not get valid repository fixture: {}", 704 .await
696 e 705 .map_err(|e| {
697 ) 706 format!(
698 })?; 707 "Test setup failed: could not get valid repository fixture: {}",
708 e
709 )
710 })?;
699 711
700 // Extract repo_id and create `q` tag 712 // Extract repo_id and create `q` tag
701 let repo_id = 713 let repo_id =
@@ -825,12 +837,15 @@ impl EventAcceptancePolicyTests {
825 let ctx = TestContext::new(client); 837 let ctx = TestContext::new(client);
826 838
827 // Get repository fixture (mode-aware) 839 // Get repository fixture (mode-aware)
828 let repo = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 840 let repo = ctx
829 format!( 841 .get_fixture(FixtureKind::ValidRepoServed)
830 "Test setup failed: could not get valid repository fixture: {}", 842 .await
831 e 843 .map_err(|e| {
832 ) 844 format!(
833 })?; 845 "Test setup failed: could not get valid repository fixture: {}",
846 e
847 )
848 })?;
834 849
835 // Create Kind 1 A that quotes the repo (makes it accepted) 850 // Create Kind 1 A that quotes the repo (makes it accepted)
836 let repo_id = Self::extract_d_tag(&repo).ok_or("Failed to extract repo_id")?; 851 let repo_id = Self::extract_d_tag(&repo).ok_or("Failed to extract repo_id")?;
@@ -881,12 +896,15 @@ impl EventAcceptancePolicyTests {
881 let ctx = TestContext::new(client); 896 let ctx = TestContext::new(client);
882 897
883 // Get repository fixture (mode-aware) 898 // Get repository fixture (mode-aware)
884 let repo = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 899 let repo = ctx
885 format!( 900 .get_fixture(FixtureKind::ValidRepoServed)
886 "Test setup failed: could not get valid repository fixture: {}", 901 .await
887 e 902 .map_err(|e| {
888 ) 903 format!(
889 })?; 904 "Test setup failed: could not get valid repository fixture: {}",
905 e
906 )
907 })?;
890 908
891 // Verify repo is queryable (ensures it's fully indexed before we reference it) 909 // Verify repo is queryable (ensures it's fully indexed before we reference it)
892 let repo_id = Self::extract_d_tag(&repo).ok_or("Failed to extract repo_id")?; 910 let repo_id = Self::extract_d_tag(&repo).ok_or("Failed to extract repo_id")?;
@@ -1034,12 +1052,15 @@ impl EventAcceptancePolicyTests {
1034 let ctx = TestContext::new(client); 1052 let ctx = TestContext::new(client);
1035 1053
1036 // Get repository fixture (mode-aware) 1054 // Get repository fixture (mode-aware)
1037 let repo = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 1055 let repo = ctx
1038 format!( 1056 .get_fixture(FixtureKind::ValidRepoServed)
1039 "Test setup failed: could not get valid repository fixture: {}", 1057 .await
1040 e 1058 .map_err(|e| {
1041 ) 1059 format!(
1042 })?; 1060 "Test setup failed: could not get valid repository fixture: {}",
1061 e
1062 )
1063 })?;
1043 1064
1044 // Create Kind 1 A locally but DON'T send it yet 1065 // Create Kind 1 A locally but DON'T send it yet
1045 let kind1_a = client 1066 let kind1_a = client
@@ -1148,12 +1169,15 @@ impl EventAcceptancePolicyTests {
1148 let ctx = TestContext::new(client); 1169 let ctx = TestContext::new(client);
1149 1170
1150 // Get accepted repo A fixture (mode-aware) 1171 // Get accepted repo A fixture (mode-aware)
1151 let _repo_a = ctx.get_fixture(FixtureKind::ValidRepo).await.map_err(|e| { 1172 let _repo_a = ctx
1152 format!( 1173 .get_fixture(FixtureKind::ValidRepoServed)
1153 "Test setup failed: could not get valid repository fixture: {}", 1174 .await
1154 e 1175 .map_err(|e| {
1155 ) 1176 format!(
1156 })?; 1177 "Test setup failed: could not get valid repository fixture: {}",
1178 e
1179 )
1180 })?;
1157 1181
1158 // Create Repo B but DON'T send it (unaccepted) 1182 // Create Repo B but DON'T send it (unaccepted)
1159 let repo_b = Self::create_test_repo(client, "unaccepted-repo-b").await?; 1183 let repo_b = Self::create_test_repo(client, "unaccepted-repo-b").await?;