diff options
| -rw-r--r-- | grasp-audit/README.md | 2 | ||||
| -rw-r--r-- | grasp-audit/src/client.rs | 30 | ||||
| -rw-r--r-- | grasp-audit/src/fixtures.rs | 139 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/cors.rs | 2 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/event_acceptance_policy.rs | 120 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/git_clone.rs | 6 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/git_filter.rs | 6 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/nip01_smoke.rs | 4 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/push_authorization.rs | 16 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/repository_creation.rs | 6 |
10 files changed, 204 insertions, 127 deletions
diff --git a/grasp-audit/README.md b/grasp-audit/README.md index 4d2401f..2cc9247 100644 --- a/grasp-audit/README.md +++ b/grasp-audit/README.md | |||
| @@ -245,7 +245,7 @@ pub async fn test_something(client: &AuditClient) -> TestResult { | |||
| 245 | let ctx = TestContext::new(client); | 245 | let ctx = TestContext::new(client); |
| 246 | 246 | ||
| 247 | // 2. Prerequisites (cached per-TestContext) | 247 | // 2. Prerequisites (cached per-TestContext) |
| 248 | let repo = ctx.get_fixture(FixtureKind::ValidRepo).await?; | 248 | let repo = ctx.get_fixture(FixtureKind::ValidRepoSent).await?; |
| 249 | 249 | ||
| 250 | // 3. Test-specific event | 250 | // 3. Test-specific event |
| 251 | let my_event = client.create_issue(&repo, "Title", "Content", vec![])?; | 251 | let my_event = client.create_issue(&repo, "Title", "Content", vec![])?; |
diff --git a/grasp-audit/src/client.rs b/grasp-audit/src/client.rs index 91a93dc..5c263ad 100644 --- a/grasp-audit/src/client.rs +++ b/grasp-audit/src/client.rs | |||
| @@ -209,6 +209,36 @@ impl AuditClient { | |||
| 209 | Ok(event_id) | 209 | Ok(event_id) |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | /// Send event and note whether it entered purgatory (not served) or was served immediately. | ||
| 213 | /// | ||
| 214 | /// This is a tolerant version of `send_event_expect_purgatory_not_served` that doesn't | ||
| 215 | /// fail if purgatory is not observed. It returns whether purgatory was observed so | ||
| 216 | /// fixtures can proceed regardless of relay implementation status. | ||
| 217 | /// | ||
| 218 | /// Returns (EventId, bool) where bool = true if event was NOT served (purgatory observed). | ||
| 219 | pub async fn send_event_and_note_purgatory(&self, event: Event) -> Result<(EventId, bool)> { | ||
| 220 | if self.config.read_only { | ||
| 221 | return Err(anyhow!("Client is in read-only mode")); | ||
| 222 | } | ||
| 223 | |||
| 224 | let output = self.client.send_event(&event).await?; | ||
| 225 | let event_id = *output.id(); | ||
| 226 | |||
| 227 | // Check if any relay rejected the event and return the error message | ||
| 228 | if !output.failed.is_empty() { | ||
| 229 | let (relay_url, error) = output.failed.iter().next().unwrap(); | ||
| 230 | return Err(anyhow!("Relay {} rejected event: {}", relay_url, error)); | ||
| 231 | } | ||
| 232 | |||
| 233 | // Wait a bit for event to propagate | ||
| 234 | tokio::time::sleep(Duration::from_millis(300)).await; | ||
| 235 | |||
| 236 | // Check if event is served (not in purgatory) or not served (in purgatory) | ||
| 237 | let in_purgatory = !self.is_event_on_relay(event.id).await?; | ||
| 238 | |||
| 239 | Ok((event_id, in_purgatory)) | ||
| 240 | } | ||
| 241 | |||
| 212 | /// check if an event is on the relay | 242 | /// check if an event is on the relay |
| 213 | pub async fn is_event_on_relay(&self, id: EventId) -> Result<bool> { | 243 | pub async fn is_event_on_relay(&self, id: EventId) -> Result<bool> { |
| 214 | Ok(!self | 244 | Ok(!self |
diff --git a/grasp-audit/src/fixtures.rs b/grasp-audit/src/fixtures.rs index e1a5320..2c53bf0 100644 --- a/grasp-audit/src/fixtures.rs +++ b/grasp-audit/src/fixtures.rs | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | //! let ctx = TestContext::new(&client); | 47 | //! let ctx = TestContext::new(&client); |
| 48 | //! | 48 | //! |
| 49 | //! // Request a fixture - behavior depends on mode | 49 | //! // Request a fixture - behavior depends on mode |
| 50 | //! let repo = ctx.get_fixture(FixtureKind::ValidRepo).await?; | 50 | //! let repo = ctx.get_fixture(FixtureKind::ValidRepoSent).await?; |
| 51 | //! # Ok(()) | 51 | //! # Ok(()) |
| 52 | //! # } | 52 | //! # } |
| 53 | //! ``` | 53 | //! ``` |
| @@ -109,11 +109,11 @@ pub const PR_TEST_COMMIT_HASH: &str = "5d40fb1555a0c28bf4d650515a73aaa54d4d9bfb" | |||
| 109 | /// | 109 | /// |
| 110 | /// ## Fixture Dependencies | 110 | /// ## Fixture Dependencies |
| 111 | /// | 111 | /// |
| 112 | /// Several fixtures depend on `ValidRepo` - they all use the SAME repo_id | 112 | /// Several fixtures depend on `ValidRepoSent` - they all use the SAME repo_id |
| 113 | /// within a single TestContext instance to ensure proper fixture relationships: | 113 | /// within a single TestContext instance to ensure proper fixture relationships: |
| 114 | /// - `RepoState` → uses ValidRepo's repo_id | 114 | /// - `RepoState` → uses ValidRepoSent's repo_id |
| 115 | /// - `MaintainerAnnouncement` + `MaintainerState` → uses ValidRepo's repo_id | 115 | /// - `MaintainerAnnouncement` + `MaintainerState` → uses ValidRepoSent's repo_id |
| 116 | /// - `RecursiveMaintainerRepoAndState` → uses ValidRepo's repo_id | 116 | /// - `RecursiveMaintainerRepoAndState` → uses ValidRepoSent's repo_id |
| 117 | /// | 117 | /// |
| 118 | /// This enables testing recursive maintainer authorization chains where multiple | 118 | /// This enables testing recursive maintainer authorization chains where multiple |
| 119 | /// parties publish announcements and state events for the same repository. | 119 | /// parties publish announcements and state events for the same repository. |
| @@ -122,10 +122,16 @@ pub enum FixtureKind { | |||
| 122 | /// Basic repository announcement (kind 30617) | 122 | /// Basic repository announcement (kind 30617) |
| 123 | /// - Signed by owner keys (`client.keys()`) | 123 | /// - Signed by owner keys (`client.keys()`) |
| 124 | /// - Lists `client.maintainer_pubkey_hex()` in maintainers tag | 124 | /// - Lists `client.maintainer_pubkey_hex()` in maintainers tag |
| 125 | ValidRepo, | 125 | ValidRepoSent, |
| 126 | |||
| 127 | /// Repository announcement that is queryable from the relay (served, not in purgatory) | ||
| 128 | /// - Depends on OwnerStateDataPushed (git data pushed, announcement promoted) | ||
| 129 | /// - Returns the same event as ValidRepoSent (now queryable) | ||
| 130 | /// - Use this for tests that need to query the announcement back from the relay | ||
| 131 | ValidRepoServed, | ||
| 126 | 132 | ||
| 127 | /// Repository with one issue (kind 1621) | 133 | /// Repository with one issue (kind 1621) |
| 128 | /// - Requires ValidRepo (reuses same repo_id) | 134 | /// - Requires ValidRepoSent (reuses same repo_id) |
| 129 | RepoWithIssue, | 135 | RepoWithIssue, |
| 130 | 136 | ||
| 131 | /// Repository with issue and comment (kind 1111) | 137 | /// Repository with issue and comment (kind 1111) |
| @@ -133,14 +139,14 @@ pub enum FixtureKind { | |||
| 133 | RepoWithComment, | 139 | RepoWithComment, |
| 134 | 140 | ||
| 135 | /// Repository state announcement (kind 30618) for owner | 141 | /// Repository state announcement (kind 30618) for owner |
| 136 | /// - Requires ValidRepo (uses same repo_id) | 142 | /// - Requires ValidRepoSent (uses same repo_id) |
| 137 | /// - Signed by owner keys (`client.keys()`) | 143 | /// - Signed by owner keys (`client.keys()`) |
| 138 | /// - Points to DETERMINISTIC_COMMIT_HASH | 144 | /// - Points to DETERMINISTIC_COMMIT_HASH |
| 139 | /// - Timestamp: 10 seconds in the past | 145 | /// - Timestamp: 10 seconds in the past |
| 140 | RepoState, | 146 | RepoState, |
| 141 | 147 | ||
| 142 | /// PR (Pull Request) event for the SAME repo_id as ValidRepo | 148 | /// PR (Pull Request) event for the SAME repo_id as ValidRepoSent |
| 143 | /// - Requires ValidRepo (uses same repo_id) | 149 | /// - Requires ValidRepoSent (uses same repo_id) |
| 144 | /// - Signed by `client.pr_author_keys()` | 150 | /// - Signed by `client.pr_author_keys()` |
| 145 | /// - Kind 1618 (NIP-34 PR) | 151 | /// - Kind 1618 (NIP-34 PR) |
| 146 | /// - Includes `a` tag referencing the repo | 152 | /// - Includes `a` tag referencing the repo |
| @@ -153,7 +159,7 @@ pub enum FixtureKind { | |||
| 153 | /// This is a "Generated" stage fixture - the event is created but not published. | 159 | /// This is a "Generated" stage fixture - the event is created but not published. |
| 154 | /// Useful for tests that need the PR event ID before the event exists on the relay. | 160 | /// Useful for tests that need the PR event ID before the event exists on the relay. |
| 155 | /// | 161 | /// |
| 156 | /// - Requires ValidRepo (uses same repo_id) | 162 | /// - Requires ValidRepoSent (uses same repo_id) |
| 157 | /// - Signed by `client.pr_author_keys()` | 163 | /// - Signed by `client.pr_author_keys()` |
| 158 | /// - Kind 1618 (NIP-34 PR) | 164 | /// - Kind 1618 (NIP-34 PR) |
| 159 | /// - Includes `c` tag pointing to PR_TEST_COMMIT_HASH | 165 | /// - Includes `c` tag pointing to PR_TEST_COMMIT_HASH |
| @@ -187,7 +193,7 @@ pub enum FixtureKind { | |||
| 187 | /// (the "wrong" commit), but no PR event exists yet on the relay. | 193 | /// (the "wrong" commit), but no PR event exists yet on the relay. |
| 188 | /// | 194 | /// |
| 189 | /// Server state after this fixture: | 195 | /// Server state after this fixture: |
| 190 | /// - ValidRepo announcement on relay | 196 | /// - ValidRepoSent announcement on relay |
| 191 | /// - refs/nostr/<pr-event-id> exists on git server with wrong commit | 197 | /// - refs/nostr/<pr-event-id> exists on git server with wrong commit |
| 192 | /// - PR event is NOT on relay (but returned for tests to publish later) | 198 | /// - PR event is NOT on relay (but returned for tests to publish later) |
| 193 | /// | 199 | /// |
| @@ -203,7 +209,7 @@ pub enum FixtureKind { | |||
| 203 | /// then the PR event was published (which may trigger cleanup). | 209 | /// then the PR event was published (which may trigger cleanup). |
| 204 | /// | 210 | /// |
| 205 | /// Server state after this fixture: | 211 | /// Server state after this fixture: |
| 206 | /// - ValidRepo announcement on relay | 212 | /// - ValidRepoSent announcement on relay |
| 207 | /// - PR event is on relay | 213 | /// - PR event is on relay |
| 208 | /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify) | 214 | /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify) |
| 209 | /// | 215 | /// |
| @@ -221,7 +227,7 @@ pub enum FixtureKind { | |||
| 221 | /// 4. **DataPushed**: Clones repo, creates deterministic commit, pushes to relay | 227 | /// 4. **DataPushed**: Clones repo, creates deterministic commit, pushes to relay |
| 222 | /// 5. **Verified**: Confirms event is served by relay | 228 | /// 5. **Verified**: Confirms event is served by relay |
| 223 | /// | 229 | /// |
| 224 | /// - Requires ValidRepo (uses same repo_id) | 230 | /// - Requires ValidRepoSent (uses same repo_id) |
| 225 | /// - State event signed by owner keys (`client.keys()`) | 231 | /// - State event signed by owner keys (`client.keys()`) |
| 226 | /// - Points to DETERMINISTIC_COMMIT_HASH | 232 | /// - Points to DETERMINISTIC_COMMIT_HASH |
| 227 | /// - Git push verified to succeed (state matches pushed commit) | 233 | /// - Git push verified to succeed (state matches pushed commit) |
| @@ -252,7 +258,7 @@ pub enum FixtureKind { | |||
| 252 | /// not the owner's announcement, so this tests the recursive maintainer traversal. | 258 | /// not the owner's announcement, so this tests the recursive maintainer traversal. |
| 253 | /// | 259 | /// |
| 254 | /// This fixture represents the complete flow for testing recursive maintainer push authorization: | 260 | /// This fixture represents the complete flow for testing recursive maintainer push authorization: |
| 255 | /// 1. **Generated**: (MaintainerStateDataPushed dependency includes ValidRepo + OwnerStateDataPushed) | 261 | /// 1. **Generated**: (MaintainerStateDataPushed dependency includes ValidRepoSent + OwnerStateDataPushed) |
| 256 | /// Creates MaintainerAnnouncement + RecursiveMaintainerState | 262 | /// Creates MaintainerAnnouncement + RecursiveMaintainerState |
| 257 | /// 2. **Sent**: Sends events to relay (returns OK, accepted but 'purgatory:...' message) | 263 | /// 2. **Sent**: Sends events to relay (returns OK, accepted but 'purgatory:...' message) |
| 258 | /// 3. **Verify Not Served**: Confirms event is not served by relays | 264 | /// 3. **Verify Not Served**: Confirms event is not served by relays |
| @@ -276,16 +282,19 @@ impl FixtureKind { | |||
| 276 | pub fn dependencies(&self) -> Vec<FixtureKind> { | 282 | pub fn dependencies(&self) -> Vec<FixtureKind> { |
| 277 | match self { | 283 | match self { |
| 278 | // Base fixtures - no dependencies | 284 | // Base fixtures - no dependencies |
| 279 | Self::ValidRepo => vec![], | 285 | Self::ValidRepoSent => vec![], |
| 286 | |||
| 287 | // ValidRepoServed depends on OwnerStateDataPushed (announcement promoted after git push) | ||
| 288 | Self::ValidRepoServed => vec![Self::OwnerStateDataPushed], | ||
| 280 | 289 | ||
| 281 | // Fixtures that depend on ValidRepo | 290 | // Fixtures that depend on ValidRepoServed (need queryable announcement) |
| 282 | Self::RepoWithIssue => vec![Self::ValidRepo], | 291 | Self::RepoWithIssue => vec![Self::ValidRepoServed], |
| 283 | Self::RepoState => vec![Self::ValidRepo], | 292 | Self::RepoState => vec![Self::ValidRepoSent], |
| 284 | Self::PREvent => vec![Self::ValidRepo], | 293 | Self::PREvent => vec![Self::ValidRepoSent], |
| 285 | Self::PREventGenerated => vec![Self::ValidRepo], | 294 | Self::PREventGenerated => vec![Self::ValidRepoSent], |
| 286 | Self::PRWrongCommitPushedBeforeEvent => vec![Self::PREventGenerated], | 295 | Self::PRWrongCommitPushedBeforeEvent => vec![Self::PREventGenerated], |
| 287 | Self::PREventSentAfterWrongPush => vec![Self::PRWrongCommitPushedBeforeEvent], | 296 | Self::PREventSentAfterWrongPush => vec![Self::PRWrongCommitPushedBeforeEvent], |
| 288 | Self::OwnerStateDataPushed => vec![Self::ValidRepo], | 297 | Self::OwnerStateDataPushed => vec![Self::ValidRepoSent], |
| 289 | 298 | ||
| 290 | // Fixtures that depend on RepoWithIssue | 299 | // Fixtures that depend on RepoWithIssue |
| 291 | Self::RepoWithComment => vec![Self::RepoWithIssue], | 300 | Self::RepoWithComment => vec![Self::RepoWithIssue], |
| @@ -323,6 +332,8 @@ impl FixtureKind { | |||
| 323 | Self::PREventSentAfterWrongPush => true, | 332 | Self::PREventSentAfterWrongPush => true, |
| 324 | // HeadSetToDevelopBranch sends its state event internally | 333 | // HeadSetToDevelopBranch sends its state event internally |
| 325 | Self::HeadSetToDevelopBranch => true, | 334 | Self::HeadSetToDevelopBranch => true, |
| 335 | // ValidRepoServed doesn't send anything itself, just returns cached event | ||
| 336 | Self::ValidRepoServed => true, | ||
| 326 | // All other fixtures return a single event for the caller to send | 337 | // All other fixtures return a single event for the caller to send |
| 327 | _ => false, | 338 | _ => false, |
| 328 | } | 339 | } |
| @@ -373,7 +384,7 @@ impl From<AuditMode> for ContextMode { | |||
| 373 | /// let ctx = TestContext::new(&client); | 384 | /// let ctx = TestContext::new(&client); |
| 374 | /// | 385 | /// |
| 375 | /// // Get a repository fixture - will be reused by subsequent TestContexts | 386 | /// // Get a repository fixture - will be reused by subsequent TestContexts |
| 376 | /// let repo = ctx.get_fixture(FixtureKind::ValidRepo).await?; | 387 | /// let repo = ctx.get_fixture(FixtureKind::ValidRepoSent).await?; |
| 377 | /// | 388 | /// |
| 378 | /// // For cargo test (isolated fixtures) | 389 | /// // For cargo test (isolated fixtures) |
| 379 | /// let config = AuditConfig::isolated(); | 390 | /// let config = AuditConfig::isolated(); |
| @@ -381,7 +392,7 @@ impl From<AuditMode> for ContextMode { | |||
| 381 | /// let ctx = TestContext::new(&client); | 392 | /// let ctx = TestContext::new(&client); |
| 382 | /// | 393 | /// |
| 383 | /// // Get a repository fixture - fresh for this TestContext only | 394 | /// // Get a repository fixture - fresh for this TestContext only |
| 384 | /// let repo = ctx.get_fixture(FixtureKind::ValidRepo).await?; | 395 | /// let repo = ctx.get_fixture(FixtureKind::ValidRepoSent).await?; |
| 385 | /// # Ok(()) | 396 | /// # Ok(()) |
| 386 | /// # } | 397 | /// # } |
| 387 | /// ``` | 398 | /// ``` |
| @@ -436,7 +447,7 @@ impl<'a> TestContext<'a> { | |||
| 436 | /// ```no_run | 447 | /// ```no_run |
| 437 | /// # use grasp_audit::*; | 448 | /// # use grasp_audit::*; |
| 438 | /// # async fn example(ctx: &TestContext<'_>) -> anyhow::Result<()> { | 449 | /// # async fn example(ctx: &TestContext<'_>) -> anyhow::Result<()> { |
| 439 | /// let repo = ctx.get_fixture(FixtureKind::ValidRepo).await?; | 450 | /// let repo = ctx.get_fixture(FixtureKind::ValidRepoSent).await?; |
| 440 | /// # Ok(()) | 451 | /// # Ok(()) |
| 441 | /// # } | 452 | /// # } |
| 442 | /// ``` | 453 | /// ``` |
| @@ -517,7 +528,7 @@ impl<'a> TestContext<'a> { | |||
| 517 | /// ```no_run | 528 | /// ```no_run |
| 518 | /// # use grasp_audit::*; | 529 | /// # use grasp_audit::*; |
| 519 | /// # async fn example(ctx: &TestContext<'_>) -> anyhow::Result<()> { | 530 | /// # async fn example(ctx: &TestContext<'_>) -> anyhow::Result<()> { |
| 520 | /// // This ensures ValidRepo exists first, then creates RepoState | 531 | /// // This ensures ValidRepoSent exists first, then creates RepoState |
| 521 | /// let state = ctx.ensure_fixture(FixtureKind::RepoState).await?; | 532 | /// let state = ctx.ensure_fixture(FixtureKind::RepoState).await?; |
| 522 | /// # Ok(()) | 533 | /// # Ok(()) |
| 523 | /// # } | 534 | /// # } |
| @@ -625,10 +636,10 @@ impl<'a> TestContext<'a> { | |||
| 625 | /// already-cached dependencies. | 636 | /// already-cached dependencies. |
| 626 | async fn build_fixture_inner(&self, kind: FixtureKind) -> Result<Event> { | 637 | async fn build_fixture_inner(&self, kind: FixtureKind) -> Result<Event> { |
| 627 | match kind { | 638 | match kind { |
| 628 | FixtureKind::ValidRepo => { | 639 | FixtureKind::ValidRepoSent => { |
| 629 | // ValidRepo has no dependencies - create a new repo announcement | 640 | // ValidRepoSent has no dependencies - create a new repo announcement |
| 630 | let test_name = format!( | 641 | let test_name = format!( |
| 631 | "fixture-ValidRepo-{}", | 642 | "fixture-ValidRepoSent-{}", |
| 632 | &uuid::Uuid::new_v4().to_string()[..8] | 643 | &uuid::Uuid::new_v4().to_string()[..8] |
| 633 | ); | 644 | ); |
| 634 | 645 | ||
| @@ -638,9 +649,15 @@ impl<'a> TestContext<'a> { | |||
| 638 | .with_context(|| format!("create_repo_announcement failed for {}", test_name)) | 649 | .with_context(|| format!("create_repo_announcement failed for {}", test_name)) |
| 639 | } | 650 | } |
| 640 | 651 | ||
| 652 | FixtureKind::ValidRepoServed => { | ||
| 653 | // OwnerStateDataPushed is already ensured as a dependency. | ||
| 654 | // The announcement is now promoted (served). Return the cached ValidRepoSent event. | ||
| 655 | self.get_cached_dependency(FixtureKind::ValidRepoSent) | ||
| 656 | } | ||
| 657 | |||
| 641 | FixtureKind::RepoWithIssue => { | 658 | FixtureKind::RepoWithIssue => { |
| 642 | // ValidRepo is ensured by ensure_fixture before this is called | 659 | // ValidRepoServed is ensured by ensure_fixture before this is called |
| 643 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 660 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoServed)?; |
| 644 | 661 | ||
| 645 | // Build issue referencing it - caller will send it | 662 | // Build issue referencing it - caller will send it |
| 646 | self.client | 663 | self.client |
| @@ -658,8 +675,8 @@ impl<'a> TestContext<'a> { | |||
| 658 | FixtureKind::RepoState => { | 675 | FixtureKind::RepoState => { |
| 659 | use nostr_sdk::prelude::*; | 676 | use nostr_sdk::prelude::*; |
| 660 | 677 | ||
| 661 | // ValidRepo is ensured by ensure_fixture before this is called | 678 | // ValidRepoSent is ensured by ensure_fixture before this is called |
| 662 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 679 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 663 | 680 | ||
| 664 | // Extract repo_id from repo announcement | 681 | // Extract repo_id from repo announcement |
| 665 | let repo_id = repo | 682 | let repo_id = repo |
| @@ -695,15 +712,15 @@ impl<'a> TestContext<'a> { | |||
| 695 | FixtureKind::PREvent => { | 712 | FixtureKind::PREvent => { |
| 696 | use nostr_sdk::prelude::*; | 713 | use nostr_sdk::prelude::*; |
| 697 | 714 | ||
| 698 | // ValidRepo is ensured by ensure_fixture before this is called | 715 | // ValidRepoSent is ensured by ensure_fixture before this is called |
| 699 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 716 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 700 | 717 | ||
| 701 | let repo_id = repo | 718 | let repo_id = repo |
| 702 | .tags | 719 | .tags |
| 703 | .iter() | 720 | .iter() |
| 704 | .find(|t| t.kind() == TagKind::d()) | 721 | .find(|t| t.kind() == TagKind::d()) |
| 705 | .and_then(|t| t.content()) | 722 | .and_then(|t| t.content()) |
| 706 | .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepo fixture"))? | 723 | .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepoSent fixture"))? |
| 707 | .to_string(); | 724 | .to_string(); |
| 708 | 725 | ||
| 709 | // Create PR event 1 second in the past | 726 | // Create PR event 1 second in the past |
| @@ -738,15 +755,15 @@ impl<'a> TestContext<'a> { | |||
| 738 | // This fixture is for "Generated" stage only | 755 | // This fixture is for "Generated" stage only |
| 739 | use nostr_sdk::prelude::*; | 756 | use nostr_sdk::prelude::*; |
| 740 | 757 | ||
| 741 | // ValidRepo is ensured by ensure_fixture before this is called | 758 | // ValidRepoSent is ensured by ensure_fixture before this is called |
| 742 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 759 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 743 | 760 | ||
| 744 | let repo_id = repo | 761 | let repo_id = repo |
| 745 | .tags | 762 | .tags |
| 746 | .iter() | 763 | .iter() |
| 747 | .find(|t| t.kind() == TagKind::d()) | 764 | .find(|t| t.kind() == TagKind::d()) |
| 748 | .and_then(|t| t.content()) | 765 | .and_then(|t| t.content()) |
| 749 | .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepo fixture"))? | 766 | .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepoSent fixture"))? |
| 750 | .to_string(); | 767 | .to_string(); |
| 751 | 768 | ||
| 752 | // Create PR event 1 second in the past | 769 | // Create PR event 1 second in the past |
| @@ -873,9 +890,9 @@ impl<'a> TestContext<'a> { | |||
| 873 | use nostr_sdk::prelude::*; | 890 | use nostr_sdk::prelude::*; |
| 874 | 891 | ||
| 875 | // ============================================================ | 892 | // ============================================================ |
| 876 | // Stage 1: ValidRepo is ensured by ensure_fixture before this is called | 893 | // Stage 1: ValidRepoSent is ensured by ensure_fixture before this is called |
| 877 | // ============================================================ | 894 | // ============================================================ |
| 878 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 895 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 879 | let repo_id = self.extract_repo_id(&repo)?; | 896 | let repo_id = self.extract_repo_id(&repo)?; |
| 880 | 897 | ||
| 881 | // Build state event | 898 | // Build state event |
| @@ -901,9 +918,11 @@ impl<'a> TestContext<'a> { | |||
| 901 | // ============================================================ | 918 | // ============================================================ |
| 902 | // Stage 2 & 3: Send to Relay, get Accepted response and Verify its Not Served | 919 | // Stage 2 & 3: Send to Relay, get Accepted response and Verify its Not Served |
| 903 | // ============================================================ | 920 | // ============================================================ |
| 904 | self.client | 921 | let (_, _in_purgatory) = self |
| 905 | .send_event_expect_purgatory_not_served(state_event.clone()) | 922 | .client |
| 923 | .send_event_and_note_purgatory(state_event.clone()) | ||
| 906 | .await?; | 924 | .await?; |
| 925 | // Note: We don't fail if purgatory wasn't observed - the fixture proceeds regardless | ||
| 907 | 926 | ||
| 908 | // ============================================================ | 927 | // ============================================================ |
| 909 | // Stage 4: DataPushed - Clone repo, create commit, push | 928 | // Stage 4: DataPushed - Clone repo, create commit, push |
| @@ -1048,8 +1067,8 @@ impl<'a> TestContext<'a> { | |||
| 1048 | // Extract repo_id from owner's state event (same d-tag structure) | 1067 | // Extract repo_id from owner's state event (same d-tag structure) |
| 1049 | let repo_id = self.extract_repo_id(&owner_state)?; | 1068 | let repo_id = self.extract_repo_id(&owner_state)?; |
| 1050 | 1069 | ||
| 1051 | // Get the repo (ValidRepo, also cached) for the owner's npub | 1070 | // Get the repo (ValidRepoSent, also cached) for the owner's npub |
| 1052 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 1071 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 1053 | 1072 | ||
| 1054 | // Build maintainer's state event (state event ONLY - no announcement) | 1073 | // Build maintainer's state event (state event ONLY - no announcement) |
| 1055 | let base_time = Timestamp::now().as_secs(); | 1074 | let base_time = Timestamp::now().as_secs(); |
| @@ -1074,9 +1093,11 @@ impl<'a> TestContext<'a> { | |||
| 1074 | // ============================================================ | 1093 | // ============================================================ |
| 1075 | // Stage 2 & 3: Send to Relay, get Accepted response and Verify its Not Served | 1094 | // Stage 2 & 3: Send to Relay, get Accepted response and Verify its Not Served |
| 1076 | // ============================================================ | 1095 | // ============================================================ |
| 1077 | self.client | 1096 | let (_, _in_purgatory) = self |
| 1078 | .send_event_expect_purgatory_not_served(maintainer_state_event.clone()) | 1097 | .client |
| 1098 | .send_event_and_note_purgatory(maintainer_state_event.clone()) | ||
| 1079 | .await?; | 1099 | .await?; |
| 1100 | // Note: We don't fail if purgatory wasn't observed - the fixture proceeds regardless | ||
| 1080 | 1101 | ||
| 1081 | // ============================================================ | 1102 | // ============================================================ |
| 1082 | // Stage 4: DataPushed - Clone repo, create maintainer commit, push | 1103 | // Stage 4: DataPushed - Clone repo, create maintainer commit, push |
| @@ -1194,7 +1215,7 @@ impl<'a> TestContext<'a> { | |||
| 1194 | /// recursive maintainer force-pushes their commit on top. | 1215 | /// recursive maintainer force-pushes their commit on top. |
| 1195 | /// | 1216 | /// |
| 1196 | /// This handles all stages of the fixture: | 1217 | /// This handles all stages of the fixture: |
| 1197 | /// 1. **Generated**: (MaintainerStateDataPushed dependency includes ValidRepo + OwnerStateDataPushed) | 1218 | /// 1. **Generated**: (MaintainerStateDataPushed dependency includes ValidRepoSent + OwnerStateDataPushed) |
| 1198 | /// Creates MaintainerAnnouncement + RecursiveMaintainerState | 1219 | /// Creates MaintainerAnnouncement + RecursiveMaintainerState |
| 1199 | /// 2. **Sent**: Sends events to relay (returns OK, accepted but 'purgatory:...' message) | 1220 | /// 2. **Sent**: Sends events to relay (returns OK, accepted but 'purgatory:...' message) |
| 1200 | /// 3. **Verify Not Served**: Confirms event is not served by relays | 1221 | /// 3. **Verify Not Served**: Confirms event is not served by relays |
| @@ -1215,8 +1236,8 @@ impl<'a> TestContext<'a> { | |||
| 1215 | // Extract repo_id from maintainer's state event (same d-tag structure) | 1236 | // Extract repo_id from maintainer's state event (same d-tag structure) |
| 1216 | let repo_id = self.extract_repo_id(&maintainer_state)?; | 1237 | let repo_id = self.extract_repo_id(&maintainer_state)?; |
| 1217 | 1238 | ||
| 1218 | // Get the repo (ValidRepo, also cached) for the owner's npub | 1239 | // Get the repo (ValidRepoSent, also cached) for the owner's npub |
| 1219 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 1240 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 1220 | 1241 | ||
| 1221 | // ============================================================ | 1242 | // ============================================================ |
| 1222 | // Stage 1 (continued): Generate MaintainerAnnouncement and RecursiveMaintainerState | 1243 | // Stage 1 (continued): Generate MaintainerAnnouncement and RecursiveMaintainerState |
| @@ -1249,9 +1270,11 @@ impl<'a> TestContext<'a> { | |||
| 1249 | // ============================================================ | 1270 | // ============================================================ |
| 1250 | // Stage 2 & 3: Send to Relay, get Accepted response and Verify its Not Served | 1271 | // Stage 2 & 3: Send to Relay, get Accepted response and Verify its Not Served |
| 1251 | // ============================================================ | 1272 | // ============================================================ |
| 1252 | self.client | 1273 | let (_, _in_purgatory) = self |
| 1253 | .send_event_expect_purgatory_not_served(recursive_maintainer_state_event.clone()) | 1274 | .client |
| 1275 | .send_event_and_note_purgatory(recursive_maintainer_state_event.clone()) | ||
| 1254 | .await?; | 1276 | .await?; |
| 1277 | // Note: We don't fail if purgatory wasn't observed - the fixture proceeds regardless | ||
| 1255 | 1278 | ||
| 1256 | // ============================================================ | 1279 | // ============================================================ |
| 1257 | // Stage 4: DataPushed - Clone repo, create recursive maintainer commit, push | 1280 | // Stage 4: DataPushed - Clone repo, create recursive maintainer commit, push |
| @@ -1428,7 +1451,7 @@ impl<'a> TestContext<'a> { | |||
| 1428 | /// 3. A wrong commit is pushed to refs/nostr/<pr-event-id> | 1451 | /// 3. A wrong commit is pushed to refs/nostr/<pr-event-id> |
| 1429 | /// | 1452 | /// |
| 1430 | /// Server state after: | 1453 | /// Server state after: |
| 1431 | /// - ValidRepo announcement on relay | 1454 | /// - ValidRepoSent announcement on relay |
| 1432 | /// - refs/nostr/<pr-event-id> on git server pointing to DETERMINISTIC_COMMIT_HASH (wrong) | 1455 | /// - refs/nostr/<pr-event-id> on git server pointing to DETERMINISTIC_COMMIT_HASH (wrong) |
| 1433 | /// - NO PR event on relay | 1456 | /// - NO PR event on relay |
| 1434 | /// | 1457 | /// |
| @@ -1440,8 +1463,8 @@ impl<'a> TestContext<'a> { | |||
| 1440 | let pr_event = self.get_cached_dependency(FixtureKind::PREventGenerated)?; | 1463 | let pr_event = self.get_cached_dependency(FixtureKind::PREventGenerated)?; |
| 1441 | let pr_event_id = pr_event.id.to_hex(); | 1464 | let pr_event_id = pr_event.id.to_hex(); |
| 1442 | 1465 | ||
| 1443 | // Get the ValidRepo to extract repo info | 1466 | // Get the ValidRepoSent to extract repo info |
| 1444 | let repo = self.get_cached_dependency(FixtureKind::ValidRepo)?; | 1467 | let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; |
| 1445 | let repo_id = self.extract_repo_id(&repo)?; | 1468 | let repo_id = self.extract_repo_id(&repo)?; |
| 1446 | 1469 | ||
| 1447 | // Get relay domain for cloning | 1470 | // Get relay domain for cloning |
| @@ -1520,7 +1543,7 @@ impl<'a> TestContext<'a> { | |||
| 1520 | /// | 1543 | /// |
| 1521 | /// This fixture builds on PRWrongCommitPushedBeforeEvent by sending the PR event. | 1544 | /// This fixture builds on PRWrongCommitPushedBeforeEvent by sending the PR event. |
| 1522 | /// After this fixture, the relay has: | 1545 | /// After this fixture, the relay has: |
| 1523 | /// - ValidRepo announcement | 1546 | /// - ValidRepoSent announcement |
| 1524 | /// - PR event | 1547 | /// - PR event |
| 1525 | /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify) | 1548 | /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify) |
| 1526 | /// | 1549 | /// |
| @@ -2040,10 +2063,10 @@ mod tests { | |||
| 2040 | use std::collections::HashSet; | 2063 | use std::collections::HashSet; |
| 2041 | 2064 | ||
| 2042 | let mut set = HashSet::new(); | 2065 | let mut set = HashSet::new(); |
| 2043 | set.insert(FixtureKind::ValidRepo); | 2066 | set.insert(FixtureKind::ValidRepoSent); |
| 2044 | set.insert(FixtureKind::RepoWithIssue); | 2067 | set.insert(FixtureKind::RepoWithIssue); |
| 2045 | 2068 | ||
| 2046 | assert!(set.contains(&FixtureKind::ValidRepo)); | 2069 | assert!(set.contains(&FixtureKind::ValidRepoSent)); |
| 2047 | assert!(!set.contains(&FixtureKind::RepoWithComment)); | 2070 | assert!(!set.contains(&FixtureKind::RepoWithComment)); |
| 2048 | } | 2071 | } |
| 2049 | 2072 | ||
diff --git a/grasp-audit/src/specs/grasp01/cors.rs b/grasp-audit/src/specs/grasp01/cors.rs index eba9e42..e5d9a27 100644 --- a/grasp-audit/src/specs/grasp01/cors.rs +++ b/grasp-audit/src/specs/grasp01/cors.rs | |||
| @@ -246,7 +246,7 @@ impl CorsTests { | |||
| 246 | let ctx = TestContext::new(client); | 246 | let ctx = TestContext::new(client); |
| 247 | 247 | ||
| 248 | // Create repository announcement to get a real repo path | 248 | // Create repository announcement to get a real repo path |
| 249 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 249 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 250 | Ok(r) => r, | 250 | Ok(r) => r, |
| 251 | Err(e) => { | 251 | Err(e) => { |
| 252 | return TestResult::new( | 252 | return TestResult::new( |
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?; |
diff --git a/grasp-audit/src/specs/grasp01/git_clone.rs b/grasp-audit/src/specs/grasp01/git_clone.rs index fda472b..0c223f4 100644 --- a/grasp-audit/src/specs/grasp01/git_clone.rs +++ b/grasp-audit/src/specs/grasp01/git_clone.rs | |||
| @@ -49,7 +49,7 @@ impl GitCloneTests { | |||
| 49 | let ctx = TestContext::new(client); | 49 | let ctx = TestContext::new(client); |
| 50 | 50 | ||
| 51 | // Create repository announcement | 51 | // Create repository announcement |
| 52 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 52 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 53 | Ok(r) => r, | 53 | Ok(r) => r, |
| 54 | Err(e) => { | 54 | Err(e) => { |
| 55 | return TestResult::new( | 55 | return TestResult::new( |
| @@ -171,7 +171,7 @@ impl GitCloneTests { | |||
| 171 | let ctx = TestContext::new(client); | 171 | let ctx = TestContext::new(client); |
| 172 | 172 | ||
| 173 | // Create repository announcement | 173 | // Create repository announcement |
| 174 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 174 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 175 | Ok(r) => r, | 175 | Ok(r) => r, |
| 176 | Err(e) => { | 176 | Err(e) => { |
| 177 | return TestResult::new( | 177 | return TestResult::new( |
| @@ -274,7 +274,7 @@ impl GitCloneTests { | |||
| 274 | let ctx = TestContext::new(client); | 274 | let ctx = TestContext::new(client); |
| 275 | 275 | ||
| 276 | // Create repository announcement | 276 | // Create repository announcement |
| 277 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 277 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 278 | Ok(r) => r, | 278 | Ok(r) => r, |
| 279 | Err(e) => { | 279 | Err(e) => { |
| 280 | return TestResult::new( | 280 | return TestResult::new( |
diff --git a/grasp-audit/src/specs/grasp01/git_filter.rs b/grasp-audit/src/specs/grasp01/git_filter.rs index 7f203a2..31d86aa 100644 --- a/grasp-audit/src/specs/grasp01/git_filter.rs +++ b/grasp-audit/src/specs/grasp01/git_filter.rs | |||
| @@ -62,7 +62,7 @@ impl GitFilterTests { | |||
| 62 | let ctx = TestContext::new(client); | 62 | let ctx = TestContext::new(client); |
| 63 | 63 | ||
| 64 | // Create repository announcement | 64 | // Create repository announcement |
| 65 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 65 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 66 | Ok(r) => r, | 66 | Ok(r) => r, |
| 67 | Err(e) => { | 67 | Err(e) => { |
| 68 | return TestResult::new( | 68 | return TestResult::new( |
| @@ -185,7 +185,7 @@ impl GitFilterTests { | |||
| 185 | let ctx = TestContext::new(client); | 185 | let ctx = TestContext::new(client); |
| 186 | 186 | ||
| 187 | // Create repository announcement | 187 | // Create repository announcement |
| 188 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 188 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 189 | Ok(r) => r, | 189 | Ok(r) => r, |
| 190 | Err(e) => { | 190 | Err(e) => { |
| 191 | return TestResult::new( | 191 | return TestResult::new( |
| @@ -296,7 +296,7 @@ impl GitFilterTests { | |||
| 296 | let ctx = TestContext::new(client); | 296 | let ctx = TestContext::new(client); |
| 297 | 297 | ||
| 298 | // Create repository announcement | 298 | // Create repository announcement |
| 299 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 299 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 300 | Ok(r) => r, | 300 | Ok(r) => r, |
| 301 | Err(e) => { | 301 | Err(e) => { |
| 302 | return TestResult::new( | 302 | return TestResult::new( |
diff --git a/grasp-audit/src/specs/grasp01/nip01_smoke.rs b/grasp-audit/src/specs/grasp01/nip01_smoke.rs index 5976252..8cb4166 100644 --- a/grasp-audit/src/specs/grasp01/nip01_smoke.rs +++ b/grasp-audit/src/specs/grasp01/nip01_smoke.rs | |||
| @@ -69,7 +69,7 @@ impl Nip01SmokeTests { | |||
| 69 | // Step 1: GENERATE - Create TestContext and get ValidRepo fixture | 69 | // Step 1: GENERATE - Create TestContext and get ValidRepo fixture |
| 70 | let ctx = TestContext::new(client); | 70 | let ctx = TestContext::new(client); |
| 71 | let event = ctx | 71 | let event = ctx |
| 72 | .get_fixture(FixtureKind::ValidRepo) | 72 | .get_fixture(FixtureKind::ValidRepoSent) |
| 73 | .await | 73 | .await |
| 74 | .map_err(|e| format!("Failed to create ValidRepo fixture: {}", e))?; | 74 | .map_err(|e| format!("Failed to create ValidRepo fixture: {}", e))?; |
| 75 | 75 | ||
| @@ -135,7 +135,7 @@ impl Nip01SmokeTests { | |||
| 135 | // Step 1: GENERATE - Create TestContext and get ValidRepo fixture | 135 | // Step 1: GENERATE - Create TestContext and get ValidRepo fixture |
| 136 | let ctx = TestContext::new(client); | 136 | let ctx = TestContext::new(client); |
| 137 | let _event = ctx | 137 | let _event = ctx |
| 138 | .get_fixture(FixtureKind::ValidRepo) | 138 | .get_fixture(FixtureKind::ValidRepoSent) |
| 139 | .await | 139 | .await |
| 140 | .map_err(|e| format!("Failed to create ValidRepo fixture: {}", e))?; | 140 | .map_err(|e| format!("Failed to create ValidRepo fixture: {}", e))?; |
| 141 | 141 | ||
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs index be354a0..78ef471 100644 --- a/grasp-audit/src/specs/grasp01/push_authorization.rs +++ b/grasp-audit/src/specs/grasp01/push_authorization.rs | |||
| @@ -208,7 +208,7 @@ async fn setup_pr_test_repo( | |||
| 208 | ) -> Result<(PathBuf, String, String, String), String> { | 208 | ) -> Result<(PathBuf, String, String, String), String> { |
| 209 | // Get fixtures | 209 | // Get fixtures |
| 210 | let repo_event = ctx | 210 | let repo_event = ctx |
| 211 | .get_fixture(FixtureKind::ValidRepo) | 211 | .get_fixture(FixtureKind::ValidRepoSent) |
| 212 | .await | 212 | .await |
| 213 | .map_err(|e| format!("Failed to get repo announcement: {}", e))?; | 213 | .map_err(|e| format!("Failed to get repo announcement: {}", e))?; |
| 214 | 214 | ||
| @@ -407,7 +407,7 @@ impl PushAuthorizationTests { | |||
| 407 | let ctx = TestContext::new(client); | 407 | let ctx = TestContext::new(client); |
| 408 | 408 | ||
| 409 | // Create repository (no state event) | 409 | // Create repository (no state event) |
| 410 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 410 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 411 | Ok(r) => r, | 411 | Ok(r) => r, |
| 412 | Err(e) => { | 412 | Err(e) => { |
| 413 | return TestResult::new( | 413 | return TestResult::new( |
| @@ -956,7 +956,7 @@ impl PushAuthorizationTests { | |||
| 956 | // ============================================================ | 956 | // ============================================================ |
| 957 | let ctx = TestContext::new(client); | 957 | let ctx = TestContext::new(client); |
| 958 | 958 | ||
| 959 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 959 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 960 | Ok(r) => r, | 960 | Ok(r) => r, |
| 961 | Err(e) => { | 961 | Err(e) => { |
| 962 | return TestResult::new( | 962 | return TestResult::new( |
| @@ -1110,7 +1110,7 @@ impl PushAuthorizationTests { | |||
| 1110 | let pr_event_id = pr_event.id.to_hex(); | 1110 | let pr_event_id = pr_event.id.to_hex(); |
| 1111 | 1111 | ||
| 1112 | // Get repo info for cloning (fresh clone for verification) | 1112 | // Get repo info for cloning (fresh clone for verification) |
| 1113 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1113 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 1114 | Ok(r) => r, | 1114 | Ok(r) => r, |
| 1115 | Err(e) => { | 1115 | Err(e) => { |
| 1116 | return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) | 1116 | return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) |
| @@ -1198,7 +1198,7 @@ impl PushAuthorizationTests { | |||
| 1198 | let pr_event_id = pr_event.id.to_hex(); | 1198 | let pr_event_id = pr_event.id.to_hex(); |
| 1199 | 1199 | ||
| 1200 | // Get repo info for cloning (fresh clone for this test) | 1200 | // Get repo info for cloning (fresh clone for this test) |
| 1201 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1201 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 1202 | Ok(r) => r, | 1202 | Ok(r) => r, |
| 1203 | Err(e) => { | 1203 | Err(e) => { |
| 1204 | return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) | 1204 | return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) |
| @@ -1289,7 +1289,7 @@ impl PushAuthorizationTests { | |||
| 1289 | let pr_event_id = pr_event.id.to_hex(); | 1289 | let pr_event_id = pr_event.id.to_hex(); |
| 1290 | 1290 | ||
| 1291 | // Get repo info for cloning (fresh clone for this test) | 1291 | // Get repo info for cloning (fresh clone for this test) |
| 1292 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1292 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 1293 | Ok(r) => r, | 1293 | Ok(r) => r, |
| 1294 | Err(e) => { | 1294 | Err(e) => { |
| 1295 | return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) | 1295 | return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) |
| @@ -1425,7 +1425,7 @@ impl PushAuthorizationTests { | |||
| 1425 | // ============================================================ | 1425 | // ============================================================ |
| 1426 | // Step 2: Extract repo_id and owner npub from ValidRepo (cached by fixture) | 1426 | // Step 2: Extract repo_id and owner npub from ValidRepo (cached by fixture) |
| 1427 | // ============================================================ | 1427 | // ============================================================ |
| 1428 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1428 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 1429 | Ok(e) => e, | 1429 | Ok(e) => e, |
| 1430 | Err(e) => { | 1430 | Err(e) => { |
| 1431 | return TestResult::new(test_name, SpecRef::GitSetHeadOnReceive, desc) | 1431 | return TestResult::new(test_name, SpecRef::GitSetHeadOnReceive, desc) |
| @@ -1528,7 +1528,7 @@ impl PushAuthorizationTests { | |||
| 1528 | // ============================================================ | 1528 | // ============================================================ |
| 1529 | // Step 2: Extract repo_id and owner npub from ValidRepo (cached by fixture) | 1529 | // Step 2: Extract repo_id and owner npub from ValidRepo (cached by fixture) |
| 1530 | // ============================================================ | 1530 | // ============================================================ |
| 1531 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 1531 | let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 1532 | Ok(e) => e, | 1532 | Ok(e) => e, |
| 1533 | Err(e) => { | 1533 | Err(e) => { |
| 1534 | return TestResult::new(test_name, SpecRef::GitSetHeadOnReceive, desc) | 1534 | return TestResult::new(test_name, SpecRef::GitSetHeadOnReceive, desc) |
diff --git a/grasp-audit/src/specs/grasp01/repository_creation.rs b/grasp-audit/src/specs/grasp01/repository_creation.rs index a702afe..5730f1c 100644 --- a/grasp-audit/src/specs/grasp01/repository_creation.rs +++ b/grasp-audit/src/specs/grasp01/repository_creation.rs | |||
| @@ -51,7 +51,7 @@ impl RepositoryCreationTests { | |||
| 51 | let ctx = TestContext::new(client); | 51 | let ctx = TestContext::new(client); |
| 52 | 52 | ||
| 53 | // Use TestContext to create and send repository announcement | 53 | // Use TestContext to create and send repository announcement |
| 54 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 54 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 55 | Ok(r) => r, | 55 | Ok(r) => r, |
| 56 | Err(e) => { | 56 | Err(e) => { |
| 57 | return TestResult::new( | 57 | return TestResult::new( |
| @@ -131,7 +131,7 @@ impl RepositoryCreationTests { | |||
| 131 | let ctx = TestContext::new(client); | 131 | let ctx = TestContext::new(client); |
| 132 | 132 | ||
| 133 | // Create a repository announcement | 133 | // Create a repository announcement |
| 134 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 134 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 135 | Ok(r) => r, | 135 | Ok(r) => r, |
| 136 | Err(e) => { | 136 | Err(e) => { |
| 137 | return TestResult::new( | 137 | return TestResult::new( |
| @@ -210,7 +210,7 @@ impl RepositoryCreationTests { | |||
| 210 | 210 | ||
| 211 | let ctx = TestContext::new(client); | 211 | let ctx = TestContext::new(client); |
| 212 | 212 | ||
| 213 | let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { | 213 | let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { |
| 214 | Ok(r) => r, | 214 | Ok(r) => r, |
| 215 | Err(e) => { | 215 | Err(e) => { |
| 216 | return TestResult::new( | 216 | return TestResult::new( |