upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/specs/grasp01/push_authorization.rs
diff options
context:
space:
mode:
Diffstat (limited to 'grasp-audit/src/specs/grasp01/push_authorization.rs')
-rw-r--r--grasp-audit/src/specs/grasp01/push_authorization.rs168
1 files changed, 84 insertions, 84 deletions
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs
index af6247f..c06da0d 100644
--- a/grasp-audit/src/specs/grasp01/push_authorization.rs
+++ b/grasp-audit/src/specs/grasp01/push_authorization.rs
@@ -407,7 +407,7 @@ impl PushAuthorizationTests {
407 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 407 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
408 Ok(r) => r, 408 Ok(r) => r,
409 Err(e) => { 409 Err(e) => {
410 return TestResult::new(test_name, "GRASP-01", "Push rejected without state event") 410 return TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected without state event")
411 .fail(format!("Failed to create repo: {}", e)) 411 .fail(format!("Failed to create repo: {}", e))
412 } 412 }
413 }; 413 };
@@ -427,7 +427,7 @@ impl PushAuthorizationTests {
427 let clone_path = match clone_repo(relay_domain, &npub, &repo_id) { 427 let clone_path = match clone_repo(relay_domain, &npub, &repo_id) {
428 Ok(p) => p, 428 Ok(p) => p,
429 Err(e) => { 429 Err(e) => {
430 return TestResult::new(test_name, "GRASP-01", "Push rejected without state event") 430 return TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected without state event")
431 .fail(&e) 431 .fail(&e)
432 } 432 }
433 }; 433 };
@@ -437,7 +437,7 @@ impl PushAuthorizationTests {
437 437
438 if let Err(e) = create_commit(&clone_path, "Unauthorized commit") { 438 if let Err(e) = create_commit(&clone_path, "Unauthorized commit") {
439 cleanup(); 439 cleanup();
440 return TestResult::new(test_name, "GRASP-01", "Push rejected without state event") 440 return TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected without state event")
441 .fail(&e); 441 .fail(&e);
442 } 442 }
443 443
@@ -447,12 +447,12 @@ impl PushAuthorizationTests {
447 447
448 match push_result { 448 match push_result {
449 Ok(false) => { 449 Ok(false) => {
450 TestResult::new(test_name, "GRASP-01", "Push rejected without state event").pass() 450 TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected without state event").pass()
451 } 451 }
452 Ok(true) => TestResult::new(test_name, "GRASP-01", "Push rejected without state event") 452 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected without state event")
453 .fail("Push accepted but should be rejected"), 453 .fail("Push accepted but should be rejected"),
454 Err(e) => { 454 Err(e) => {
455 TestResult::new(test_name, "GRASP-01", "Push rejected without state event").fail(&e) 455 TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected without state event").fail(&e)
456 } 456 }
457 } 457 }
458 } 458 }
@@ -481,9 +481,9 @@ impl PushAuthorizationTests {
481 // Generate → Send → Verify → DataPush 481 // Generate → Send → Verify → DataPush
482 match ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await { 482 match ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await {
483 Ok(_state_event) => { 483 Ok(_state_event) => {
484 TestResult::new(test_name, "GRASP-01", "Push authorized with matching state").pass() 484 TestResult::new(test_name, "GRASP-01:git-http:30", "Push authorized with matching state").pass()
485 } 485 }
486 Err(e) => TestResult::new(test_name, "GRASP-01", "Push authorized with matching state") 486 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push authorized with matching state")
487 .fail(format!("{}", e)), 487 .fail(format!("{}", e)),
488 } 488 }
489 } 489 }
@@ -523,7 +523,7 @@ impl PushAuthorizationTests {
523 Err(e) => { 523 Err(e) => {
524 return TestResult::new( 524 return TestResult::new(
525 test_name, 525 test_name,
526 "GRASP-01", 526 "GRASP-01:git-http:30",
527 "Push rejected when commit not in state event", 527 "Push rejected when commit not in state event",
528 ) 528 )
529 .fail(format!("Failed to create RepoState fixture: {}", e)); 529 .fail(format!("Failed to create RepoState fixture: {}", e));
@@ -543,7 +543,7 @@ impl PushAuthorizationTests {
543 None => { 543 None => {
544 return TestResult::new( 544 return TestResult::new(
545 test_name, 545 test_name,
546 "GRASP-01", 546 "GRASP-01:git-http:30",
547 "Push rejected when commit not in state event", 547 "Push rejected when commit not in state event",
548 ) 548 )
549 .fail("Missing repo_id in state event"); 549 .fail("Missing repo_id in state event");
@@ -555,7 +555,7 @@ impl PushAuthorizationTests {
555 Err(e) => { 555 Err(e) => {
556 return TestResult::new( 556 return TestResult::new(
557 test_name, 557 test_name,
558 "GRASP-01", 558 "GRASP-01:git-http:30",
559 "Push rejected when commit not in state event", 559 "Push rejected when commit not in state event",
560 ) 560 )
561 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 561 .fail(format!("Failed to convert pubkey to bech32: {}", e));
@@ -571,7 +571,7 @@ impl PushAuthorizationTests {
571 Err(e) => { 571 Err(e) => {
572 return TestResult::new( 572 return TestResult::new(
573 test_name, 573 test_name,
574 "GRASP-01", 574 "GRASP-01:git-http:30",
575 "Push rejected when commit not in state event", 575 "Push rejected when commit not in state event",
576 ) 576 )
577 .fail(format!("Failed to clone repo: {}", e)); 577 .fail(format!("Failed to clone repo: {}", e));
@@ -594,7 +594,7 @@ impl PushAuthorizationTests {
594 cleanup(); 594 cleanup();
595 return TestResult::new( 595 return TestResult::new(
596 test_name, 596 test_name,
597 "GRASP-01", 597 "GRASP-01:git-http:30",
598 "Push rejected when commit not in state event", 598 "Push rejected when commit not in state event",
599 ) 599 )
600 .fail(format!("Failed to create/checkout main branch: {}", e)); 600 .fail(format!("Failed to create/checkout main branch: {}", e));
@@ -603,7 +603,7 @@ impl PushAuthorizationTests {
603 cleanup(); 603 cleanup();
604 return TestResult::new( 604 return TestResult::new(
605 test_name, 605 test_name,
606 "GRASP-01", 606 "GRASP-01:git-http:30",
607 "Push rejected when commit not in state event", 607 "Push rejected when commit not in state event",
608 ) 608 )
609 .fail(format!( 609 .fail(format!(
@@ -620,7 +620,7 @@ impl PushAuthorizationTests {
620 cleanup(); 620 cleanup();
621 return TestResult::new( 621 return TestResult::new(
622 test_name, 622 test_name,
623 "GRASP-01", 623 "GRASP-01:git-http:30",
624 "Push rejected when commit not in state event", 624 "Push rejected when commit not in state event",
625 ) 625 )
626 .fail(format!("Failed to create wrong commit: {}", e)); 626 .fail(format!("Failed to create wrong commit: {}", e));
@@ -634,10 +634,10 @@ impl PushAuthorizationTests {
634 cleanup(); 634 cleanup();
635 635
636 match push_result { 636 match push_result {
637 Ok(false) => TestResult::new(test_name, "GRASP-01", "Push rejected when commit not in state event").pass(), 637 Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event").pass(),
638 Ok(true) => TestResult::new(test_name, "GRASP-01", "Push rejected when commit not in state event") 638 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event")
639 .fail("Push accepted but should be rejected. The pushed commit is not in the state event."), 639 .fail("Push accepted but should be rejected. The pushed commit is not in the state event."),
640 Err(e) => TestResult::new(test_name, "GRASP-01", "Push rejected when commit not in state event").fail(&e), 640 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event").fail(&e),
641 } 641 }
642 } 642 }
643 643
@@ -672,13 +672,13 @@ impl PushAuthorizationTests {
672 { 672 {
673 Ok(_maintainer_state_event) => TestResult::new( 673 Ok(_maintainer_state_event) => TestResult::new(
674 test_name, 674 test_name,
675 "GRASP-01", 675 "GRASP-01:git-http:30",
676 "Push authorized by maintainer state event only (no announcement)", 676 "Push authorized by maintainer state event only (no announcement)",
677 ) 677 )
678 .pass(), 678 .pass(),
679 Err(e) => TestResult::new( 679 Err(e) => TestResult::new(
680 test_name, 680 test_name,
681 "GRASP-01", 681 "GRASP-01:git-http:30",
682 "Push authorized by maintainer state event only (no announcement)", 682 "Push authorized by maintainer state event only (no announcement)",
683 ) 683 )
684 .fail(format!("{}", e)), 684 .fail(format!("{}", e)),
@@ -715,13 +715,13 @@ impl PushAuthorizationTests {
715 { 715 {
716 Ok(_recursive_maintainer_state_event) => TestResult::new( 716 Ok(_recursive_maintainer_state_event) => TestResult::new(
717 test_name, 717 test_name,
718 "GRASP-01", 718 "GRASP-01:git-http:30",
719 "Push authorized by recursive maintainer state event", 719 "Push authorized by recursive maintainer state event",
720 ) 720 )
721 .pass(), 721 .pass(),
722 Err(e) => TestResult::new( 722 Err(e) => TestResult::new(
723 test_name, 723 test_name,
724 "GRASP-01", 724 "GRASP-01:git-http:30",
725 "Push authorized by recursive maintainer state event", 725 "Push authorized by recursive maintainer state event",
726 ) 726 )
727 .fail(format!("{}", e)), 727 .fail(format!("{}", e)),
@@ -765,7 +765,7 @@ impl PushAuthorizationTests {
765 Err(e) => { 765 Err(e) => {
766 return TestResult::new( 766 return TestResult::new(
767 test_name, 767 test_name,
768 "GRASP-01", 768 "GRASP-01:git-http:30",
769 "Non-maintainer state events ignored", 769 "Non-maintainer state events ignored",
770 ) 770 )
771 .fail(format!("Failed to get OwnerStateDataPushed fixture: {}", e)); 771 .fail(format!("Failed to get OwnerStateDataPushed fixture: {}", e));
@@ -783,7 +783,7 @@ impl PushAuthorizationTests {
783 None => { 783 None => {
784 return TestResult::new( 784 return TestResult::new(
785 test_name, 785 test_name,
786 "GRASP-01", 786 "GRASP-01:git-http:30",
787 "Non-maintainer state events ignored", 787 "Non-maintainer state events ignored",
788 ) 788 )
789 .fail("Missing repo_id in state event"); 789 .fail("Missing repo_id in state event");
@@ -795,7 +795,7 @@ impl PushAuthorizationTests {
795 Err(e) => { 795 Err(e) => {
796 return TestResult::new( 796 return TestResult::new(
797 test_name, 797 test_name,
798 "GRASP-01", 798 "GRASP-01:git-http:30",
799 "Non-maintainer state events ignored", 799 "Non-maintainer state events ignored",
800 ) 800 )
801 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 801 .fail(format!("Failed to convert pubkey to bech32: {}", e));
@@ -810,7 +810,7 @@ impl PushAuthorizationTests {
810 Err(e) => { 810 Err(e) => {
811 return TestResult::new( 811 return TestResult::new(
812 test_name, 812 test_name,
813 "GRASP-01", 813 "GRASP-01:git-http:30",
814 "Non-maintainer state events ignored", 814 "Non-maintainer state events ignored",
815 ) 815 )
816 .fail(format!("Failed to clone repo: {}", e)); 816 .fail(format!("Failed to clone repo: {}", e));
@@ -832,7 +832,7 @@ impl PushAuthorizationTests {
832 cleanup(); 832 cleanup();
833 return TestResult::new( 833 return TestResult::new(
834 test_name, 834 test_name,
835 "GRASP-01", 835 "GRASP-01:git-http:30",
836 "Non-maintainer state events ignored", 836 "Non-maintainer state events ignored",
837 ) 837 )
838 .fail(format!("Failed to create commit: {}", e)); 838 .fail(format!("Failed to create commit: {}", e));
@@ -858,7 +858,7 @@ impl PushAuthorizationTests {
858 cleanup(); 858 cleanup();
859 return TestResult::new( 859 return TestResult::new(
860 test_name, 860 test_name,
861 "GRASP-01", 861 "GRASP-01:git-http:30",
862 "Non-maintainer state events ignored", 862 "Non-maintainer state events ignored",
863 ) 863 )
864 .fail(format!("Failed to build rogue state event: {}", e)); 864 .fail(format!("Failed to build rogue state event: {}", e));
@@ -868,7 +868,7 @@ impl PushAuthorizationTests {
868 // Send the rogue state event using the raw client to bypass AuditClient's key check 868 // Send the rogue state event using the raw client to bypass AuditClient's key check
869 if let Err(e) = client.client().send_event(&rogue_state).await { 869 if let Err(e) = client.client().send_event(&rogue_state).await {
870 cleanup(); 870 cleanup();
871 return TestResult::new(test_name, "GRASP-01", "Non-maintainer state events ignored") 871 return TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored")
872 .fail(format!("Failed to send rogue state event: {}", e)); 872 .fail(format!("Failed to send rogue state event: {}", e));
873 } 873 }
874 874
@@ -883,8 +883,8 @@ impl PushAuthorizationTests {
883 cleanup(); 883 cleanup();
884 884
885 match push_result { 885 match push_result {
886 Ok(false) => TestResult::new(test_name, "GRASP-01", "Non-maintainer state events ignored").pass(), 886 Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored").pass(),
887 Ok(true) => TestResult::new(test_name, "GRASP-01", "Non-maintainer state events ignored") 887 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored")
888 .fail(format!( 888 .fail(format!(
889 "Push accepted but should be rejected. A non-maintainer (pubkey: {}) published \ 889 "Push accepted but should be rejected. A non-maintainer (pubkey: {}) published \
890 a state event announcing commit {}, but the push was accepted. The relay should \ 890 a state event announcing commit {}, but the push was accepted. The relay should \
@@ -893,7 +893,7 @@ impl PushAuthorizationTests {
893 new_commit, 893 new_commit,
894 client.public_key() 894 client.public_key()
895 )), 895 )),
896 Err(e) => TestResult::new(test_name, "GRASP-01", "Non-maintainer state events ignored").fail(&e), 896 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored").fail(&e),
897 } 897 }
898 } 898 }
899 899
@@ -924,7 +924,7 @@ impl PushAuthorizationTests {
924 Err(e) => { 924 Err(e) => {
925 return TestResult::new( 925 return TestResult::new(
926 test_name, 926 test_name,
927 "GRASP-01", 927 "GRASP-01:git-http:34",
928 "Push to refs/nostr/<invalid-event-id> rejected", 928 "Push to refs/nostr/<invalid-event-id> rejected",
929 ) 929 )
930 .fail(format!("Failed to create repo: {}", e)); 930 .fail(format!("Failed to create repo: {}", e));
@@ -950,7 +950,7 @@ impl PushAuthorizationTests {
950 Err(e) => { 950 Err(e) => {
951 return TestResult::new( 951 return TestResult::new(
952 test_name, 952 test_name,
953 "GRASP-01", 953 "GRASP-01:git-http:34",
954 "Push to refs/nostr/<invalid-event-id> rejected", 954 "Push to refs/nostr/<invalid-event-id> rejected",
955 ) 955 )
956 .fail(&e); 956 .fail(&e);
@@ -965,7 +965,7 @@ impl PushAuthorizationTests {
965 cleanup(); 965 cleanup();
966 return TestResult::new( 966 return TestResult::new(
967 test_name, 967 test_name,
968 "GRASP-01", 968 "GRASP-01:git-http:34",
969 "Push to refs/nostr/<invalid-event-id> rejected", 969 "Push to refs/nostr/<invalid-event-id> rejected",
970 ) 970 )
971 .fail(&e); 971 .fail(&e);
@@ -984,13 +984,13 @@ impl PushAuthorizationTests {
984 match push_result { 984 match push_result {
985 Ok(false) => TestResult::new( 985 Ok(false) => TestResult::new(
986 test_name, 986 test_name,
987 "GRASP-01", 987 "GRASP-01:git-http:34",
988 "Push to refs/nostr/<invalid-event-id> rejected", 988 "Push to refs/nostr/<invalid-event-id> rejected",
989 ) 989 )
990 .pass(), 990 .pass(),
991 Ok(true) => TestResult::new( 991 Ok(true) => TestResult::new(
992 test_name, 992 test_name,
993 "GRASP-01", 993 "GRASP-01:git-http:34",
994 "Push to refs/nostr/<invalid-event-id> rejected", 994 "Push to refs/nostr/<invalid-event-id> rejected",
995 ) 995 )
996 .fail(format!( 996 .fail(format!(
@@ -1001,7 +1001,7 @@ impl PushAuthorizationTests {
1001 )), 1001 )),
1002 Err(e) => TestResult::new( 1002 Err(e) => TestResult::new(
1003 test_name, 1003 test_name,
1004 "GRASP-01", 1004 "GRASP-01:git-http:34",
1005 "Push to refs/nostr/<invalid-event-id> rejected", 1005 "Push to refs/nostr/<invalid-event-id> rejected",
1006 ) 1006 )
1007 .fail(format!("Push error: {}", e)), 1007 .fail(format!("Push error: {}", e)),
@@ -1035,8 +1035,8 @@ impl PushAuthorizationTests {
1035 .get_fixture(FixtureKind::PRWrongCommitPushedBeforeEvent) 1035 .get_fixture(FixtureKind::PRWrongCommitPushedBeforeEvent)
1036 .await 1036 .await
1037 { 1037 {
1038 Ok(_pr_event) => TestResult::new(test_name, "GRASP-01", desc).pass(), 1038 Ok(_pr_event) => TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass(),
1039 Err(e) => TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)), 1039 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e)),
1040 } 1040 }
1041 } 1041 }
1042 1042
@@ -1062,7 +1062,7 @@ impl PushAuthorizationTests {
1062 { 1062 {
1063 Ok(e) => e, 1063 Ok(e) => e,
1064 Err(e) => { 1064 Err(e) => {
1065 return TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)); 1065 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e));
1066 } 1066 }
1067 }; 1067 };
1068 1068
@@ -1072,7 +1072,7 @@ impl PushAuthorizationTests {
1072 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1072 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1073 Ok(r) => r, 1073 Ok(r) => r,
1074 Err(e) => { 1074 Err(e) => {
1075 return TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)); 1075 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e));
1076 } 1076 }
1077 }; 1077 };
1078 1078
@@ -1087,7 +1087,7 @@ impl PushAuthorizationTests {
1087 let owner_npub = match repo.pubkey.to_bech32() { 1087 let owner_npub = match repo.pubkey.to_bech32() {
1088 Ok(n) => n, 1088 Ok(n) => n,
1089 Err(e) => { 1089 Err(e) => {
1090 return TestResult::new(test_name, "GRASP-01", desc) 1090 return TestResult::new(test_name, "GRASP-01:git-http:34", desc)
1091 .fail(format!("Failed to get owner npub: {}", e)); 1091 .fail(format!("Failed to get owner npub: {}", e));
1092 } 1092 }
1093 }; 1093 };
@@ -1096,7 +1096,7 @@ impl PushAuthorizationTests {
1096 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { 1096 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) {
1097 Ok(p) => p, 1097 Ok(p) => p,
1098 Err(e) => { 1098 Err(e) => {
1099 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1099 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1100 } 1100 }
1101 }; 1101 };
1102 1102
@@ -1106,7 +1106,7 @@ impl PushAuthorizationTests {
1106 Ok(exists) => exists, 1106 Ok(exists) => exists,
1107 Err(e) => { 1107 Err(e) => {
1108 let _ = fs::remove_dir_all(&clone_path); 1108 let _ = fs::remove_dir_all(&clone_path);
1109 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1109 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1110 } 1110 }
1111 }; 1111 };
1112 1112
@@ -1114,13 +1114,13 @@ impl PushAuthorizationTests {
1114 1114
1115 // Ref should be deleted since the pushed commit doesn't match the PR event's `c` tag 1115 // Ref should be deleted since the pushed commit doesn't match the PR event's `c` tag
1116 if refs_exist { 1116 if refs_exist {
1117 TestResult::new(test_name, "GRASP-01", desc).fail(format!( 1117 TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!(
1118 "Expected refs/nostr/{} to be deleted when PR event published with non-matching commit, \ 1118 "Expected refs/nostr/{} to be deleted when PR event published with non-matching commit, \
1119 but the ref still exists. The relay should delete refs that don't match the event's `c` tag.", 1119 but the ref still exists. The relay should delete refs that don't match the event's `c` tag.",
1120 pr_event_id 1120 pr_event_id
1121 )) 1121 ))
1122 } else { 1122 } else {
1123 TestResult::new(test_name, "GRASP-01", desc).pass() 1123 TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass()
1124 } 1124 }
1125 } 1125 }
1126 1126
@@ -1146,7 +1146,7 @@ impl PushAuthorizationTests {
1146 { 1146 {
1147 Ok(e) => e, 1147 Ok(e) => e,
1148 Err(e) => { 1148 Err(e) => {
1149 return TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)); 1149 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e));
1150 } 1150 }
1151 }; 1151 };
1152 1152
@@ -1156,7 +1156,7 @@ impl PushAuthorizationTests {
1156 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1156 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1157 Ok(r) => r, 1157 Ok(r) => r,
1158 Err(e) => { 1158 Err(e) => {
1159 return TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)); 1159 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e));
1160 } 1160 }
1161 }; 1161 };
1162 1162
@@ -1171,7 +1171,7 @@ impl PushAuthorizationTests {
1171 let owner_npub = match repo.pubkey.to_bech32() { 1171 let owner_npub = match repo.pubkey.to_bech32() {
1172 Ok(n) => n, 1172 Ok(n) => n,
1173 Err(e) => { 1173 Err(e) => {
1174 return TestResult::new(test_name, "GRASP-01", desc) 1174 return TestResult::new(test_name, "GRASP-01:git-http:34", desc)
1175 .fail(format!("Failed to get owner npub: {}", e)); 1175 .fail(format!("Failed to get owner npub: {}", e));
1176 } 1176 }
1177 }; 1177 };
@@ -1180,7 +1180,7 @@ impl PushAuthorizationTests {
1180 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { 1180 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) {
1181 Ok(p) => p, 1181 Ok(p) => p,
1182 Err(e) => { 1182 Err(e) => {
1183 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1183 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1184 } 1184 }
1185 }; 1185 };
1186 1186
@@ -1188,7 +1188,7 @@ impl PushAuthorizationTests {
1188 if let Err(e) = create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner) 1188 if let Err(e) = create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner)
1189 { 1189 {
1190 let _ = fs::remove_dir_all(&clone_path); 1190 let _ = fs::remove_dir_all(&clone_path);
1191 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1191 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1192 } 1192 }
1193 1193
1194 // Try to push with wrong commit (should be rejected since PR event exists) 1194 // Try to push with wrong commit (should be rejected since PR event exists)
@@ -1196,7 +1196,7 @@ impl PushAuthorizationTests {
1196 Ok(success) => success, 1196 Ok(success) => success,
1197 Err(e) => { 1197 Err(e) => {
1198 let _ = fs::remove_dir_all(&clone_path); 1198 let _ = fs::remove_dir_all(&clone_path);
1199 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1199 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1200 } 1200 }
1201 }; 1201 };
1202 1202
@@ -1204,11 +1204,11 @@ impl PushAuthorizationTests {
1204 1204
1205 // Should REJECT - PR event exists with different commit hash 1205 // Should REJECT - PR event exists with different commit hash
1206 if push_succeeded { 1206 if push_succeeded {
1207 return TestResult::new(test_name, "GRASP-01", desc) 1207 return TestResult::new(test_name, "GRASP-01:git-http:34", desc)
1208 .fail("Push accepted (expected rejection due to commit hash mismatch)"); 1208 .fail("Push accepted (expected rejection due to commit hash mismatch)");
1209 } 1209 }
1210 1210
1211 TestResult::new(test_name, "GRASP-01", desc).pass() 1211 TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass()
1212 } 1212 }
1213 1213
1214 /// Test 4: Push correct commit to refs/nostr/<pr-event-id> AFTER PR event exists 1214 /// Test 4: Push correct commit to refs/nostr/<pr-event-id> AFTER PR event exists
@@ -1233,7 +1233,7 @@ impl PushAuthorizationTests {
1233 { 1233 {
1234 Ok(e) => e, 1234 Ok(e) => e,
1235 Err(e) => { 1235 Err(e) => {
1236 return TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)); 1236 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e));
1237 } 1237 }
1238 }; 1238 };
1239 1239
@@ -1243,7 +1243,7 @@ impl PushAuthorizationTests {
1243 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1243 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1244 Ok(r) => r, 1244 Ok(r) => r,
1245 Err(e) => { 1245 Err(e) => {
1246 return TestResult::new(test_name, "GRASP-01", desc).fail(format!("{}", e)); 1246 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e));
1247 } 1247 }
1248 }; 1248 };
1249 1249
@@ -1258,7 +1258,7 @@ impl PushAuthorizationTests {
1258 let owner_npub = match repo.pubkey.to_bech32() { 1258 let owner_npub = match repo.pubkey.to_bech32() {
1259 Ok(n) => n, 1259 Ok(n) => n,
1260 Err(e) => { 1260 Err(e) => {
1261 return TestResult::new(test_name, "GRASP-01", desc) 1261 return TestResult::new(test_name, "GRASP-01:git-http:34", desc)
1262 .fail(format!("Failed to get owner npub: {}", e)); 1262 .fail(format!("Failed to get owner npub: {}", e));
1263 } 1263 }
1264 }; 1264 };
@@ -1267,14 +1267,14 @@ impl PushAuthorizationTests {
1267 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { 1267 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) {
1268 Ok(p) => p, 1268 Ok(p) => p,
1269 Err(e) => { 1269 Err(e) => {
1270 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1270 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1271 } 1271 }
1272 }; 1272 };
1273 1273
1274 // Create the CORRECT PR test commit (the one expected by PR event) 1274 // Create the CORRECT PR test commit (the one expected by PR event)
1275 if let Err(e) = reset_to_correct_pr_commit(&clone_path) { 1275 if let Err(e) = reset_to_correct_pr_commit(&clone_path) {
1276 let _ = fs::remove_dir_all(&clone_path); 1276 let _ = fs::remove_dir_all(&clone_path);
1277 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1277 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1278 } 1278 }
1279 1279
1280 // Push correct commit (should succeed) 1280 // Push correct commit (should succeed)
@@ -1282,7 +1282,7 @@ impl PushAuthorizationTests {
1282 Ok(success) => success, 1282 Ok(success) => success,
1283 Err(e) => { 1283 Err(e) => {
1284 let _ = fs::remove_dir_all(&clone_path); 1284 let _ = fs::remove_dir_all(&clone_path);
1285 return TestResult::new(test_name, "GRASP-01", desc).fail(&e); 1285 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e);
1286 } 1286 }
1287 }; 1287 };
1288 1288
@@ -1290,11 +1290,11 @@ impl PushAuthorizationTests {
1290 1290
1291 // Should ACCEPT - commit matches PR event's c tag 1291 // Should ACCEPT - commit matches PR event's c tag
1292 if !push_succeeded { 1292 if !push_succeeded {
1293 return TestResult::new(test_name, "GRASP-01", desc) 1293 return TestResult::new(test_name, "GRASP-01:git-http:34", desc)
1294 .fail("Push rejected (expected acceptance since commit matches PR event)"); 1294 .fail("Push rejected (expected acceptance since commit matches PR event)");
1295 } 1295 }
1296 1296
1297 TestResult::new(test_name, "GRASP-01", desc).pass() 1297 TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass()
1298 } 1298 }
1299 1299
1300 /// Test that HEAD is set after a state event is published with an existing commit 1300 /// Test that HEAD is set after a state event is published with an existing commit
@@ -1331,7 +1331,7 @@ impl PushAuthorizationTests {
1331 { 1331 {
1332 Ok(e) => e, 1332 Ok(e) => e,
1333 Err(e) => { 1333 Err(e) => {
1334 return TestResult::new(test_name, "GRASP-01", desc).fail(format!( 1334 return TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!(
1335 "Failed to create HeadSetToDevelopBranch fixture: {}", 1335 "Failed to create HeadSetToDevelopBranch fixture: {}",
1336 e 1336 e
1337 )); 1337 ));
@@ -1344,7 +1344,7 @@ impl PushAuthorizationTests {
1344 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1344 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1345 Ok(e) => e, 1345 Ok(e) => e,
1346 Err(e) => { 1346 Err(e) => {
1347 return TestResult::new(test_name, "GRASP-01", desc) 1347 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1348 .fail(format!("Failed to get ValidRepo fixture: {}", e)); 1348 .fail(format!("Failed to get ValidRepo fixture: {}", e));
1349 } 1349 }
1350 }; 1350 };
@@ -1357,7 +1357,7 @@ impl PushAuthorizationTests {
1357 { 1357 {
1358 Some(id) => id.to_string(), 1358 Some(id) => id.to_string(),
1359 None => { 1359 None => {
1360 return TestResult::new(test_name, "GRASP-01", desc) 1360 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1361 .fail("Missing repo_id in ValidRepo"); 1361 .fail("Missing repo_id in ValidRepo");
1362 } 1362 }
1363 }; 1363 };
@@ -1365,7 +1365,7 @@ impl PushAuthorizationTests {
1365 let npub = match valid_repo.pubkey.to_bech32() { 1365 let npub = match valid_repo.pubkey.to_bech32() {
1366 Ok(n) => n, 1366 Ok(n) => n,
1367 Err(e) => { 1367 Err(e) => {
1368 return TestResult::new(test_name, "GRASP-01", desc) 1368 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1369 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 1369 .fail(format!("Failed to convert pubkey to bech32: {}", e));
1370 } 1370 }
1371 }; 1371 };
@@ -1377,16 +1377,16 @@ impl PushAuthorizationTests {
1377 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { 1377 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await {
1378 Ok(branch) => branch, 1378 Ok(branch) => branch,
1379 Err(e) => { 1379 Err(e) => {
1380 return TestResult::new(test_name, "GRASP-01", desc) 1380 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1381 .fail(format!("Failed to get default branch: {}", e)); 1381 .fail(format!("Failed to get default branch: {}", e));
1382 } 1382 }
1383 }; 1383 };
1384 1384
1385 // Verify HEAD points to refs/heads/develop 1385 // Verify HEAD points to refs/heads/develop
1386 if default_branch == "refs/heads/develop" { 1386 if default_branch == "refs/heads/develop" {
1387 TestResult::new(test_name, "GRASP-01", desc).pass() 1387 TestResult::new(test_name, "GRASP-01:git-http:32", desc).pass()
1388 } else { 1388 } else {
1389 TestResult::new(test_name, "GRASP-01", desc).fail(format!( 1389 TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!(
1390 "Expected HEAD to point to 'refs/heads/develop' but got '{}'. \ 1390 "Expected HEAD to point to 'refs/heads/develop' but got '{}'. \
1391 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ 1391 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \
1392 as soon as the git data related to that branch has been received.'", 1392 as soon as the git data related to that branch has been received.'",
@@ -1435,7 +1435,7 @@ impl PushAuthorizationTests {
1435 let _develop_state = match ctx.get_fixture(FixtureKind::HeadSetToDevelopBranch).await { 1435 let _develop_state = match ctx.get_fixture(FixtureKind::HeadSetToDevelopBranch).await {
1436 Ok(e) => e, 1436 Ok(e) => e,
1437 Err(e) => { 1437 Err(e) => {
1438 return TestResult::new(test_name, "GRASP-01", desc).fail(format!( 1438 return TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!(
1439 "Failed to create HeadSetToDevelopBranch fixture: {}", 1439 "Failed to create HeadSetToDevelopBranch fixture: {}",
1440 e 1440 e
1441 )); 1441 ));
@@ -1448,7 +1448,7 @@ impl PushAuthorizationTests {
1448 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1448 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1449 Ok(e) => e, 1449 Ok(e) => e,
1450 Err(e) => { 1450 Err(e) => {
1451 return TestResult::new(test_name, "GRASP-01", desc) 1451 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1452 .fail(format!("Failed to get ValidRepo fixture: {}", e)); 1452 .fail(format!("Failed to get ValidRepo fixture: {}", e));
1453 } 1453 }
1454 }; 1454 };
@@ -1461,7 +1461,7 @@ impl PushAuthorizationTests {
1461 { 1461 {
1462 Some(id) => id.to_string(), 1462 Some(id) => id.to_string(),
1463 None => { 1463 None => {
1464 return TestResult::new(test_name, "GRASP-01", desc) 1464 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1465 .fail("Missing repo_id in ValidRepo"); 1465 .fail("Missing repo_id in ValidRepo");
1466 } 1466 }
1467 }; 1467 };
@@ -1469,7 +1469,7 @@ impl PushAuthorizationTests {
1469 let npub = match valid_repo.pubkey.to_bech32() { 1469 let npub = match valid_repo.pubkey.to_bech32() {
1470 Ok(n) => n, 1470 Ok(n) => n,
1471 Err(e) => { 1471 Err(e) => {
1472 return TestResult::new(test_name, "GRASP-01", desc) 1472 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1473 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 1473 .fail(format!("Failed to convert pubkey to bech32: {}", e));
1474 } 1474 }
1475 }; 1475 };
@@ -1480,7 +1480,7 @@ impl PushAuthorizationTests {
1480 let clone_path = match clone_repo(relay_domain, &npub, &repo_id) { 1480 let clone_path = match clone_repo(relay_domain, &npub, &repo_id) {
1481 Ok(path) => path, 1481 Ok(path) => path,
1482 Err(e) => { 1482 Err(e) => {
1483 return TestResult::new(test_name, "GRASP-01", desc) 1483 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1484 .fail(format!("Failed to clone repo: {}", e)); 1484 .fail(format!("Failed to clone repo: {}", e));
1485 } 1485 }
1486 }; 1486 };
@@ -1495,7 +1495,7 @@ impl PushAuthorizationTests {
1495 1495
1496 if let Err(e) = output { 1496 if let Err(e) = output {
1497 let _ = fs::remove_dir_all(&clone_path); 1497 let _ = fs::remove_dir_all(&clone_path);
1498 return TestResult::new(test_name, "GRASP-01", desc) 1498 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1499 .fail(format!("Failed to create develop1 branch: {}", e)); 1499 .fail(format!("Failed to create develop1 branch: {}", e));
1500 } 1500 }
1501 1501
@@ -1504,7 +1504,7 @@ impl PushAuthorizationTests {
1504 Ok(hash) => hash, 1504 Ok(hash) => hash,
1505 Err(e) => { 1505 Err(e) => {
1506 let _ = fs::remove_dir_all(&clone_path); 1506 let _ = fs::remove_dir_all(&clone_path);
1507 return TestResult::new(test_name, "GRASP-01", desc) 1507 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1508 .fail(format!("Failed to create commit: {}", e)); 1508 .fail(format!("Failed to create commit: {}", e));
1509 } 1509 }
1510 }; 1510 };
@@ -1529,7 +1529,7 @@ impl PushAuthorizationTests {
1529 Ok(e) => e, 1529 Ok(e) => e,
1530 Err(e) => { 1530 Err(e) => {
1531 let _ = fs::remove_dir_all(&clone_path); 1531 let _ = fs::remove_dir_all(&clone_path);
1532 return TestResult::new(test_name, "GRASP-01", desc) 1532 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1533 .fail(format!("Failed to build state event: {}", e)); 1533 .fail(format!("Failed to build state event: {}", e));
1534 } 1534 }
1535 }; 1535 };
@@ -1537,7 +1537,7 @@ impl PushAuthorizationTests {
1537 // Send the state event (commit doesn't exist on relay yet) 1537 // Send the state event (commit doesn't exist on relay yet)
1538 if let Err(e) = client.send_event(state_event).await { 1538 if let Err(e) = client.send_event(state_event).await {
1539 let _ = fs::remove_dir_all(&clone_path); 1539 let _ = fs::remove_dir_all(&clone_path);
1540 return TestResult::new(test_name, "GRASP-01", desc) 1540 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1541 .fail(format!("Failed to send state event: {}", e)); 1541 .fail(format!("Failed to send state event: {}", e));
1542 } 1542 }
1543 1543
@@ -1550,11 +1550,11 @@ impl PushAuthorizationTests {
1550 match push_result { 1550 match push_result {
1551 Ok(true) => { /* Push succeeded, continue to verify */ } 1551 Ok(true) => { /* Push succeeded, continue to verify */ }
1552 Ok(false) => { 1552 Ok(false) => {
1553 return TestResult::new(test_name, "GRASP-01", desc) 1553 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1554 .fail("Push to refs/heads/develop1 was rejected"); 1554 .fail("Push to refs/heads/develop1 was rejected");
1555 } 1555 }
1556 Err(e) => { 1556 Err(e) => {
1557 return TestResult::new(test_name, "GRASP-01", desc) 1557 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1558 .fail(format!("Failed to push develop1 branch: {}", e)); 1558 .fail(format!("Failed to push develop1 branch: {}", e));
1559 } 1559 }
1560 } 1560 }
@@ -1567,16 +1567,16 @@ impl PushAuthorizationTests {
1567 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { 1567 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await {
1568 Ok(branch) => branch, 1568 Ok(branch) => branch,
1569 Err(e) => { 1569 Err(e) => {
1570 return TestResult::new(test_name, "GRASP-01", desc) 1570 return TestResult::new(test_name, "GRASP-01:git-http:32", desc)
1571 .fail(format!("Failed to get default branch: {}", e)); 1571 .fail(format!("Failed to get default branch: {}", e));
1572 } 1572 }
1573 }; 1573 };
1574 1574
1575 // Verify HEAD points to refs/heads/develop1 1575 // Verify HEAD points to refs/heads/develop1
1576 if default_branch == "refs/heads/develop1" { 1576 if default_branch == "refs/heads/develop1" {
1577 TestResult::new(test_name, "GRASP-01", desc).pass() 1577 TestResult::new(test_name, "GRASP-01:git-http:32", desc).pass()
1578 } else { 1578 } else {
1579 TestResult::new(test_name, "GRASP-01", desc).fail(format!( 1579 TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!(
1580 "Expected HEAD to point to 'refs/heads/develop1' but got '{}'. \ 1580 "Expected HEAD to point to 'refs/heads/develop1' but got '{}'. \
1581 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ 1581 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \
1582 as soon as the git data related to that branch has been received.'", 1582 as soon as the git data related to that branch has been received.'",