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 25738d1..4f21e70 100644
--- a/grasp-audit/src/specs/grasp01/push_authorization.rs
+++ b/grasp-audit/src/specs/grasp01/push_authorization.rs
@@ -409,7 +409,7 @@ impl PushAuthorizationTests {
409 Err(e) => { 409 Err(e) => {
410 return TestResult::new( 410 return TestResult::new(
411 test_name, 411 test_name,
412 "GRASP-01:git-http:30", 412 "GRASP-01:git-http:36",
413 "Push rejected without state event", 413 "Push rejected without state event",
414 ) 414 )
415 .fail(format!("Failed to create repo: {}", e)) 415 .fail(format!("Failed to create repo: {}", e))
@@ -433,7 +433,7 @@ impl PushAuthorizationTests {
433 Err(e) => { 433 Err(e) => {
434 return TestResult::new( 434 return TestResult::new(
435 test_name, 435 test_name,
436 "GRASP-01:git-http:30", 436 "GRASP-01:git-http:36",
437 "Push rejected without state event", 437 "Push rejected without state event",
438 ) 438 )
439 .fail(&e) 439 .fail(&e)
@@ -447,7 +447,7 @@ impl PushAuthorizationTests {
447 cleanup(); 447 cleanup();
448 return TestResult::new( 448 return TestResult::new(
449 test_name, 449 test_name,
450 "GRASP-01:git-http:30", 450 "GRASP-01:git-http:36",
451 "Push rejected without state event", 451 "Push rejected without state event",
452 ) 452 )
453 .fail(&e); 453 .fail(&e);
@@ -460,19 +460,19 @@ impl PushAuthorizationTests {
460 match push_result { 460 match push_result {
461 Ok(false) => TestResult::new( 461 Ok(false) => TestResult::new(
462 test_name, 462 test_name,
463 "GRASP-01:git-http:30", 463 "GRASP-01:git-http:36",
464 "Push rejected without state event", 464 "Push rejected without state event",
465 ) 465 )
466 .pass(), 466 .pass(),
467 Ok(true) => TestResult::new( 467 Ok(true) => TestResult::new(
468 test_name, 468 test_name,
469 "GRASP-01:git-http:30", 469 "GRASP-01:git-http:36",
470 "Push rejected without state event", 470 "Push rejected without state event",
471 ) 471 )
472 .fail("Push accepted but should be rejected"), 472 .fail("Push accepted but should be rejected"),
473 Err(e) => TestResult::new( 473 Err(e) => TestResult::new(
474 test_name, 474 test_name,
475 "GRASP-01:git-http:30", 475 "GRASP-01:git-http:36",
476 "Push rejected without state event", 476 "Push rejected without state event",
477 ) 477 )
478 .fail(&e), 478 .fail(&e),
@@ -504,13 +504,13 @@ impl PushAuthorizationTests {
504 match ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await { 504 match ctx.get_fixture(FixtureKind::OwnerStateDataPushed).await {
505 Ok(_state_event) => TestResult::new( 505 Ok(_state_event) => TestResult::new(
506 test_name, 506 test_name,
507 "GRASP-01:git-http:30", 507 "GRASP-01:git-http:36",
508 "Push authorized with matching state", 508 "Push authorized with matching state",
509 ) 509 )
510 .pass(), 510 .pass(),
511 Err(e) => TestResult::new( 511 Err(e) => TestResult::new(
512 test_name, 512 test_name,
513 "GRASP-01:git-http:30", 513 "GRASP-01:git-http:36",
514 "Push authorized with matching state", 514 "Push authorized with matching state",
515 ) 515 )
516 .fail(format!("{}", e)), 516 .fail(format!("{}", e)),
@@ -552,7 +552,7 @@ impl PushAuthorizationTests {
552 Err(e) => { 552 Err(e) => {
553 return TestResult::new( 553 return TestResult::new(
554 test_name, 554 test_name,
555 "GRASP-01:git-http:30", 555 "GRASP-01:git-http:36",
556 "Push rejected when commit not in state event", 556 "Push rejected when commit not in state event",
557 ) 557 )
558 .fail(format!("Failed to create RepoState fixture: {}", e)); 558 .fail(format!("Failed to create RepoState fixture: {}", e));
@@ -572,7 +572,7 @@ impl PushAuthorizationTests {
572 None => { 572 None => {
573 return TestResult::new( 573 return TestResult::new(
574 test_name, 574 test_name,
575 "GRASP-01:git-http:30", 575 "GRASP-01:git-http:36",
576 "Push rejected when commit not in state event", 576 "Push rejected when commit not in state event",
577 ) 577 )
578 .fail("Missing repo_id in state event"); 578 .fail("Missing repo_id in state event");
@@ -584,7 +584,7 @@ impl PushAuthorizationTests {
584 Err(e) => { 584 Err(e) => {
585 return TestResult::new( 585 return TestResult::new(
586 test_name, 586 test_name,
587 "GRASP-01:git-http:30", 587 "GRASP-01:git-http:36",
588 "Push rejected when commit not in state event", 588 "Push rejected when commit not in state event",
589 ) 589 )
590 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 590 .fail(format!("Failed to convert pubkey to bech32: {}", e));
@@ -600,7 +600,7 @@ impl PushAuthorizationTests {
600 Err(e) => { 600 Err(e) => {
601 return TestResult::new( 601 return TestResult::new(
602 test_name, 602 test_name,
603 "GRASP-01:git-http:30", 603 "GRASP-01:git-http:36",
604 "Push rejected when commit not in state event", 604 "Push rejected when commit not in state event",
605 ) 605 )
606 .fail(format!("Failed to clone repo: {}", e)); 606 .fail(format!("Failed to clone repo: {}", e));
@@ -623,7 +623,7 @@ impl PushAuthorizationTests {
623 cleanup(); 623 cleanup();
624 return TestResult::new( 624 return TestResult::new(
625 test_name, 625 test_name,
626 "GRASP-01:git-http:30", 626 "GRASP-01:git-http:36",
627 "Push rejected when commit not in state event", 627 "Push rejected when commit not in state event",
628 ) 628 )
629 .fail(format!("Failed to create/checkout main branch: {}", e)); 629 .fail(format!("Failed to create/checkout main branch: {}", e));
@@ -632,7 +632,7 @@ impl PushAuthorizationTests {
632 cleanup(); 632 cleanup();
633 return TestResult::new( 633 return TestResult::new(
634 test_name, 634 test_name,
635 "GRASP-01:git-http:30", 635 "GRASP-01:git-http:36",
636 "Push rejected when commit not in state event", 636 "Push rejected when commit not in state event",
637 ) 637 )
638 .fail(format!( 638 .fail(format!(
@@ -649,7 +649,7 @@ impl PushAuthorizationTests {
649 cleanup(); 649 cleanup();
650 return TestResult::new( 650 return TestResult::new(
651 test_name, 651 test_name,
652 "GRASP-01:git-http:30", 652 "GRASP-01:git-http:36",
653 "Push rejected when commit not in state event", 653 "Push rejected when commit not in state event",
654 ) 654 )
655 .fail(format!("Failed to create wrong commit: {}", e)); 655 .fail(format!("Failed to create wrong commit: {}", e));
@@ -663,10 +663,10 @@ impl PushAuthorizationTests {
663 cleanup(); 663 cleanup();
664 664
665 match push_result { 665 match push_result {
666 Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event").pass(), 666 Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:36", "Push rejected when commit not in state event").pass(),
667 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event") 667 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:36", "Push rejected when commit not in state event")
668 .fail("Push accepted but should be rejected. The pushed commit is not in the state event."), 668 .fail("Push accepted but should be rejected. The pushed commit is not in the state event."),
669 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Push rejected when commit not in state event").fail(&e), 669 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:36", "Push rejected when commit not in state event").fail(&e),
670 } 670 }
671 } 671 }
672 672
@@ -701,13 +701,13 @@ impl PushAuthorizationTests {
701 { 701 {
702 Ok(_maintainer_state_event) => TestResult::new( 702 Ok(_maintainer_state_event) => TestResult::new(
703 test_name, 703 test_name,
704 "GRASP-01:git-http:30", 704 "GRASP-01:git-http:36",
705 "Push authorized by maintainer state event only (no announcement)", 705 "Push authorized by maintainer state event only (no announcement)",
706 ) 706 )
707 .pass(), 707 .pass(),
708 Err(e) => TestResult::new( 708 Err(e) => TestResult::new(
709 test_name, 709 test_name,
710 "GRASP-01:git-http:30", 710 "GRASP-01:git-http:36",
711 "Push authorized by maintainer state event only (no announcement)", 711 "Push authorized by maintainer state event only (no announcement)",
712 ) 712 )
713 .fail(format!("{}", e)), 713 .fail(format!("{}", e)),
@@ -744,13 +744,13 @@ impl PushAuthorizationTests {
744 { 744 {
745 Ok(_recursive_maintainer_state_event) => TestResult::new( 745 Ok(_recursive_maintainer_state_event) => TestResult::new(
746 test_name, 746 test_name,
747 "GRASP-01:git-http:30", 747 "GRASP-01:git-http:36",
748 "Push authorized by recursive maintainer state event", 748 "Push authorized by recursive maintainer state event",
749 ) 749 )
750 .pass(), 750 .pass(),
751 Err(e) => TestResult::new( 751 Err(e) => TestResult::new(
752 test_name, 752 test_name,
753 "GRASP-01:git-http:30", 753 "GRASP-01:git-http:36",
754 "Push authorized by recursive maintainer state event", 754 "Push authorized by recursive maintainer state event",
755 ) 755 )
756 .fail(format!("{}", e)), 756 .fail(format!("{}", e)),
@@ -794,7 +794,7 @@ impl PushAuthorizationTests {
794 Err(e) => { 794 Err(e) => {
795 return TestResult::new( 795 return TestResult::new(
796 test_name, 796 test_name,
797 "GRASP-01:git-http:30", 797 "GRASP-01:git-http:36",
798 "Non-maintainer state events ignored", 798 "Non-maintainer state events ignored",
799 ) 799 )
800 .fail(format!("Failed to get OwnerStateDataPushed fixture: {}", e)); 800 .fail(format!("Failed to get OwnerStateDataPushed fixture: {}", e));
@@ -812,7 +812,7 @@ impl PushAuthorizationTests {
812 None => { 812 None => {
813 return TestResult::new( 813 return TestResult::new(
814 test_name, 814 test_name,
815 "GRASP-01:git-http:30", 815 "GRASP-01:git-http:36",
816 "Non-maintainer state events ignored", 816 "Non-maintainer state events ignored",
817 ) 817 )
818 .fail("Missing repo_id in state event"); 818 .fail("Missing repo_id in state event");
@@ -824,7 +824,7 @@ impl PushAuthorizationTests {
824 Err(e) => { 824 Err(e) => {
825 return TestResult::new( 825 return TestResult::new(
826 test_name, 826 test_name,
827 "GRASP-01:git-http:30", 827 "GRASP-01:git-http:36",
828 "Non-maintainer state events ignored", 828 "Non-maintainer state events ignored",
829 ) 829 )
830 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 830 .fail(format!("Failed to convert pubkey to bech32: {}", e));
@@ -839,7 +839,7 @@ impl PushAuthorizationTests {
839 Err(e) => { 839 Err(e) => {
840 return TestResult::new( 840 return TestResult::new(
841 test_name, 841 test_name,
842 "GRASP-01:git-http:30", 842 "GRASP-01:git-http:36",
843 "Non-maintainer state events ignored", 843 "Non-maintainer state events ignored",
844 ) 844 )
845 .fail(format!("Failed to clone repo: {}", e)); 845 .fail(format!("Failed to clone repo: {}", e));
@@ -861,7 +861,7 @@ impl PushAuthorizationTests {
861 cleanup(); 861 cleanup();
862 return TestResult::new( 862 return TestResult::new(
863 test_name, 863 test_name,
864 "GRASP-01:git-http:30", 864 "GRASP-01:git-http:36",
865 "Non-maintainer state events ignored", 865 "Non-maintainer state events ignored",
866 ) 866 )
867 .fail(format!("Failed to create commit: {}", e)); 867 .fail(format!("Failed to create commit: {}", e));
@@ -887,7 +887,7 @@ impl PushAuthorizationTests {
887 cleanup(); 887 cleanup();
888 return TestResult::new( 888 return TestResult::new(
889 test_name, 889 test_name,
890 "GRASP-01:git-http:30", 890 "GRASP-01:git-http:36",
891 "Non-maintainer state events ignored", 891 "Non-maintainer state events ignored",
892 ) 892 )
893 .fail(format!("Failed to build rogue state event: {}", e)); 893 .fail(format!("Failed to build rogue state event: {}", e));
@@ -899,7 +899,7 @@ impl PushAuthorizationTests {
899 cleanup(); 899 cleanup();
900 return TestResult::new( 900 return TestResult::new(
901 test_name, 901 test_name,
902 "GRASP-01:git-http:30", 902 "GRASP-01:git-http:36",
903 "Non-maintainer state events ignored", 903 "Non-maintainer state events ignored",
904 ) 904 )
905 .fail(format!("Failed to send rogue state event: {}", e)); 905 .fail(format!("Failed to send rogue state event: {}", e));
@@ -916,8 +916,8 @@ impl PushAuthorizationTests {
916 cleanup(); 916 cleanup();
917 917
918 match push_result { 918 match push_result {
919 Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored").pass(), 919 Ok(false) => TestResult::new(test_name, "GRASP-01:git-http:36", "Non-maintainer state events ignored").pass(),
920 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored") 920 Ok(true) => TestResult::new(test_name, "GRASP-01:git-http:36", "Non-maintainer state events ignored")
921 .fail(format!( 921 .fail(format!(
922 "Push accepted but should be rejected. A non-maintainer (pubkey: {}) published \ 922 "Push accepted but should be rejected. A non-maintainer (pubkey: {}) published \
923 a state event announcing commit {}, but the push was accepted. The relay should \ 923 a state event announcing commit {}, but the push was accepted. The relay should \
@@ -926,7 +926,7 @@ impl PushAuthorizationTests {
926 new_commit, 926 new_commit,
927 client.public_key() 927 client.public_key()
928 )), 928 )),
929 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:30", "Non-maintainer state events ignored").fail(&e), 929 Err(e) => TestResult::new(test_name, "GRASP-01:git-http:36", "Non-maintainer state events ignored").fail(&e),
930 } 930 }
931 } 931 }
932 932
@@ -957,7 +957,7 @@ impl PushAuthorizationTests {
957 Err(e) => { 957 Err(e) => {
958 return TestResult::new( 958 return TestResult::new(
959 test_name, 959 test_name,
960 "GRASP-01:git-http:34", 960 "GRASP-01:git-http:40",
961 "Push to refs/nostr/<invalid-event-id> rejected", 961 "Push to refs/nostr/<invalid-event-id> rejected",
962 ) 962 )
963 .fail(format!("Failed to create repo: {}", e)); 963 .fail(format!("Failed to create repo: {}", e));
@@ -983,7 +983,7 @@ impl PushAuthorizationTests {
983 Err(e) => { 983 Err(e) => {
984 return TestResult::new( 984 return TestResult::new(
985 test_name, 985 test_name,
986 "GRASP-01:git-http:34", 986 "GRASP-01:git-http:40",
987 "Push to refs/nostr/<invalid-event-id> rejected", 987 "Push to refs/nostr/<invalid-event-id> rejected",
988 ) 988 )
989 .fail(&e); 989 .fail(&e);
@@ -998,7 +998,7 @@ impl PushAuthorizationTests {
998 cleanup(); 998 cleanup();
999 return TestResult::new( 999 return TestResult::new(
1000 test_name, 1000 test_name,
1001 "GRASP-01:git-http:34", 1001 "GRASP-01:git-http:40",
1002 "Push to refs/nostr/<invalid-event-id> rejected", 1002 "Push to refs/nostr/<invalid-event-id> rejected",
1003 ) 1003 )
1004 .fail(&e); 1004 .fail(&e);
@@ -1017,13 +1017,13 @@ impl PushAuthorizationTests {
1017 match push_result { 1017 match push_result {
1018 Ok(false) => TestResult::new( 1018 Ok(false) => TestResult::new(
1019 test_name, 1019 test_name,
1020 "GRASP-01:git-http:34", 1020 "GRASP-01:git-http:40",
1021 "Push to refs/nostr/<invalid-event-id> rejected", 1021 "Push to refs/nostr/<invalid-event-id> rejected",
1022 ) 1022 )
1023 .pass(), 1023 .pass(),
1024 Ok(true) => TestResult::new( 1024 Ok(true) => TestResult::new(
1025 test_name, 1025 test_name,
1026 "GRASP-01:git-http:34", 1026 "GRASP-01:git-http:40",
1027 "Push to refs/nostr/<invalid-event-id> rejected", 1027 "Push to refs/nostr/<invalid-event-id> rejected",
1028 ) 1028 )
1029 .fail(format!( 1029 .fail(format!(
@@ -1034,7 +1034,7 @@ impl PushAuthorizationTests {
1034 )), 1034 )),
1035 Err(e) => TestResult::new( 1035 Err(e) => TestResult::new(
1036 test_name, 1036 test_name,
1037 "GRASP-01:git-http:34", 1037 "GRASP-01:git-http:40",
1038 "Push to refs/nostr/<invalid-event-id> rejected", 1038 "Push to refs/nostr/<invalid-event-id> rejected",
1039 ) 1039 )
1040 .fail(format!("Push error: {}", e)), 1040 .fail(format!("Push error: {}", e)),
@@ -1068,9 +1068,9 @@ impl PushAuthorizationTests {
1068 .get_fixture(FixtureKind::PRWrongCommitPushedBeforeEvent) 1068 .get_fixture(FixtureKind::PRWrongCommitPushedBeforeEvent)
1069 .await 1069 .await
1070 { 1070 {
1071 Ok(_pr_event) => TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass(), 1071 Ok(_pr_event) => TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass(),
1072 Err(e) => { 1072 Err(e) => {
1073 TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!("{}", e)) 1073 TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(format!("{}", e))
1074 } 1074 }
1075 } 1075 }
1076 } 1076 }
@@ -1097,7 +1097,7 @@ impl PushAuthorizationTests {
1097 { 1097 {
1098 Ok(e) => e, 1098 Ok(e) => e,
1099 Err(e) => { 1099 Err(e) => {
1100 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1100 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1101 .fail(format!("{}", e)); 1101 .fail(format!("{}", e));
1102 } 1102 }
1103 }; 1103 };
@@ -1108,7 +1108,7 @@ impl PushAuthorizationTests {
1108 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1108 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1109 Ok(r) => r, 1109 Ok(r) => r,
1110 Err(e) => { 1110 Err(e) => {
1111 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1111 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1112 .fail(format!("{}", e)); 1112 .fail(format!("{}", e));
1113 } 1113 }
1114 }; 1114 };
@@ -1124,7 +1124,7 @@ impl PushAuthorizationTests {
1124 let owner_npub = match repo.pubkey.to_bech32() { 1124 let owner_npub = match repo.pubkey.to_bech32() {
1125 Ok(n) => n, 1125 Ok(n) => n,
1126 Err(e) => { 1126 Err(e) => {
1127 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1127 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1128 .fail(format!("Failed to get owner npub: {}", e)); 1128 .fail(format!("Failed to get owner npub: {}", e));
1129 } 1129 }
1130 }; 1130 };
@@ -1133,7 +1133,7 @@ impl PushAuthorizationTests {
1133 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { 1133 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) {
1134 Ok(p) => p, 1134 Ok(p) => p,
1135 Err(e) => { 1135 Err(e) => {
1136 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1136 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1137 } 1137 }
1138 }; 1138 };
1139 1139
@@ -1143,7 +1143,7 @@ impl PushAuthorizationTests {
1143 Ok(exists) => exists, 1143 Ok(exists) => exists,
1144 Err(e) => { 1144 Err(e) => {
1145 let _ = fs::remove_dir_all(&clone_path); 1145 let _ = fs::remove_dir_all(&clone_path);
1146 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1146 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1147 } 1147 }
1148 }; 1148 };
1149 1149
@@ -1151,13 +1151,13 @@ impl PushAuthorizationTests {
1151 1151
1152 // Ref should be deleted since the pushed commit doesn't match the PR event's `c` tag 1152 // Ref should be deleted since the pushed commit doesn't match the PR event's `c` tag
1153 if refs_exist { 1153 if refs_exist {
1154 TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(format!( 1154 TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(format!(
1155 "Expected refs/nostr/{} to be deleted when PR event published with non-matching commit, \ 1155 "Expected refs/nostr/{} to be deleted when PR event published with non-matching commit, \
1156 but the ref still exists. The relay should delete refs that don't match the event's `c` tag.", 1156 but the ref still exists. The relay should delete refs that don't match the event's `c` tag.",
1157 pr_event_id 1157 pr_event_id
1158 )) 1158 ))
1159 } else { 1159 } else {
1160 TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass() 1160 TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass()
1161 } 1161 }
1162 } 1162 }
1163 1163
@@ -1183,7 +1183,7 @@ impl PushAuthorizationTests {
1183 { 1183 {
1184 Ok(e) => e, 1184 Ok(e) => e,
1185 Err(e) => { 1185 Err(e) => {
1186 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1186 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1187 .fail(format!("{}", e)); 1187 .fail(format!("{}", e));
1188 } 1188 }
1189 }; 1189 };
@@ -1194,7 +1194,7 @@ impl PushAuthorizationTests {
1194 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1194 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1195 Ok(r) => r, 1195 Ok(r) => r,
1196 Err(e) => { 1196 Err(e) => {
1197 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1197 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1198 .fail(format!("{}", e)); 1198 .fail(format!("{}", e));
1199 } 1199 }
1200 }; 1200 };
@@ -1210,7 +1210,7 @@ impl PushAuthorizationTests {
1210 let owner_npub = match repo.pubkey.to_bech32() { 1210 let owner_npub = match repo.pubkey.to_bech32() {
1211 Ok(n) => n, 1211 Ok(n) => n,
1212 Err(e) => { 1212 Err(e) => {
1213 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1213 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1214 .fail(format!("Failed to get owner npub: {}", e)); 1214 .fail(format!("Failed to get owner npub: {}", e));
1215 } 1215 }
1216 }; 1216 };
@@ -1219,7 +1219,7 @@ impl PushAuthorizationTests {
1219 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { 1219 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) {
1220 Ok(p) => p, 1220 Ok(p) => p,
1221 Err(e) => { 1221 Err(e) => {
1222 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1222 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1223 } 1223 }
1224 }; 1224 };
1225 1225
@@ -1227,7 +1227,7 @@ impl PushAuthorizationTests {
1227 if let Err(e) = create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner) 1227 if let Err(e) = create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner)
1228 { 1228 {
1229 let _ = fs::remove_dir_all(&clone_path); 1229 let _ = fs::remove_dir_all(&clone_path);
1230 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1230 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1231 } 1231 }
1232 1232
1233 // Try to push with wrong commit (should be rejected since PR event exists) 1233 // Try to push with wrong commit (should be rejected since PR event exists)
@@ -1235,7 +1235,7 @@ impl PushAuthorizationTests {
1235 Ok(success) => success, 1235 Ok(success) => success,
1236 Err(e) => { 1236 Err(e) => {
1237 let _ = fs::remove_dir_all(&clone_path); 1237 let _ = fs::remove_dir_all(&clone_path);
1238 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1238 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1239 } 1239 }
1240 }; 1240 };
1241 1241
@@ -1243,11 +1243,11 @@ impl PushAuthorizationTests {
1243 1243
1244 // Should REJECT - PR event exists with different commit hash 1244 // Should REJECT - PR event exists with different commit hash
1245 if push_succeeded { 1245 if push_succeeded {
1246 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1246 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1247 .fail("Push accepted (expected rejection due to commit hash mismatch)"); 1247 .fail("Push accepted (expected rejection due to commit hash mismatch)");
1248 } 1248 }
1249 1249
1250 TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass() 1250 TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass()
1251 } 1251 }
1252 1252
1253 /// Test 4: Push correct commit to refs/nostr/<pr-event-id> AFTER PR event exists 1253 /// Test 4: Push correct commit to refs/nostr/<pr-event-id> AFTER PR event exists
@@ -1272,7 +1272,7 @@ impl PushAuthorizationTests {
1272 { 1272 {
1273 Ok(e) => e, 1273 Ok(e) => e,
1274 Err(e) => { 1274 Err(e) => {
1275 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1275 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1276 .fail(format!("{}", e)); 1276 .fail(format!("{}", e));
1277 } 1277 }
1278 }; 1278 };
@@ -1283,7 +1283,7 @@ impl PushAuthorizationTests {
1283 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1283 let repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1284 Ok(r) => r, 1284 Ok(r) => r,
1285 Err(e) => { 1285 Err(e) => {
1286 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1286 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1287 .fail(format!("{}", e)); 1287 .fail(format!("{}", e));
1288 } 1288 }
1289 }; 1289 };
@@ -1299,7 +1299,7 @@ impl PushAuthorizationTests {
1299 let owner_npub = match repo.pubkey.to_bech32() { 1299 let owner_npub = match repo.pubkey.to_bech32() {
1300 Ok(n) => n, 1300 Ok(n) => n,
1301 Err(e) => { 1301 Err(e) => {
1302 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1302 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1303 .fail(format!("Failed to get owner npub: {}", e)); 1303 .fail(format!("Failed to get owner npub: {}", e));
1304 } 1304 }
1305 }; 1305 };
@@ -1308,14 +1308,14 @@ impl PushAuthorizationTests {
1308 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) { 1308 let clone_path = match clone_repo(relay_domain, &owner_npub, &repo_id) {
1309 Ok(p) => p, 1309 Ok(p) => p,
1310 Err(e) => { 1310 Err(e) => {
1311 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1311 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1312 } 1312 }
1313 }; 1313 };
1314 1314
1315 // Create the CORRECT PR test commit (the one expected by PR event) 1315 // Create the CORRECT PR test commit (the one expected by PR event)
1316 if let Err(e) = reset_to_correct_pr_commit(&clone_path) { 1316 if let Err(e) = reset_to_correct_pr_commit(&clone_path) {
1317 let _ = fs::remove_dir_all(&clone_path); 1317 let _ = fs::remove_dir_all(&clone_path);
1318 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1318 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1319 } 1319 }
1320 1320
1321 // Push correct commit (should succeed) 1321 // Push correct commit (should succeed)
@@ -1323,7 +1323,7 @@ impl PushAuthorizationTests {
1323 Ok(success) => success, 1323 Ok(success) => success,
1324 Err(e) => { 1324 Err(e) => {
1325 let _ = fs::remove_dir_all(&clone_path); 1325 let _ = fs::remove_dir_all(&clone_path);
1326 return TestResult::new(test_name, "GRASP-01:git-http:34", desc).fail(&e); 1326 return TestResult::new(test_name, "GRASP-01:git-http:40", desc).fail(&e);
1327 } 1327 }
1328 }; 1328 };
1329 1329
@@ -1331,11 +1331,11 @@ impl PushAuthorizationTests {
1331 1331
1332 // Should ACCEPT - commit matches PR event's c tag 1332 // Should ACCEPT - commit matches PR event's c tag
1333 if !push_succeeded { 1333 if !push_succeeded {
1334 return TestResult::new(test_name, "GRASP-01:git-http:34", desc) 1334 return TestResult::new(test_name, "GRASP-01:git-http:40", desc)
1335 .fail("Push rejected (expected acceptance since commit matches PR event)"); 1335 .fail("Push rejected (expected acceptance since commit matches PR event)");
1336 } 1336 }
1337 1337
1338 TestResult::new(test_name, "GRASP-01:git-http:34", desc).pass() 1338 TestResult::new(test_name, "GRASP-01:git-http:40", desc).pass()
1339 } 1339 }
1340 1340
1341 /// Test that HEAD is set after a state event is published with an existing commit 1341 /// Test that HEAD is set after a state event is published with an existing commit
@@ -1372,7 +1372,7 @@ impl PushAuthorizationTests {
1372 { 1372 {
1373 Ok(e) => e, 1373 Ok(e) => e,
1374 Err(e) => { 1374 Err(e) => {
1375 return TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( 1375 return TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!(
1376 "Failed to create HeadSetToDevelopBranch fixture: {}", 1376 "Failed to create HeadSetToDevelopBranch fixture: {}",
1377 e 1377 e
1378 )); 1378 ));
@@ -1385,7 +1385,7 @@ impl PushAuthorizationTests {
1385 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1385 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1386 Ok(e) => e, 1386 Ok(e) => e,
1387 Err(e) => { 1387 Err(e) => {
1388 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1388 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1389 .fail(format!("Failed to get ValidRepo fixture: {}", e)); 1389 .fail(format!("Failed to get ValidRepo fixture: {}", e));
1390 } 1390 }
1391 }; 1391 };
@@ -1398,7 +1398,7 @@ impl PushAuthorizationTests {
1398 { 1398 {
1399 Some(id) => id.to_string(), 1399 Some(id) => id.to_string(),
1400 None => { 1400 None => {
1401 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1401 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1402 .fail("Missing repo_id in ValidRepo"); 1402 .fail("Missing repo_id in ValidRepo");
1403 } 1403 }
1404 }; 1404 };
@@ -1406,7 +1406,7 @@ impl PushAuthorizationTests {
1406 let npub = match valid_repo.pubkey.to_bech32() { 1406 let npub = match valid_repo.pubkey.to_bech32() {
1407 Ok(n) => n, 1407 Ok(n) => n,
1408 Err(e) => { 1408 Err(e) => {
1409 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1409 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1410 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 1410 .fail(format!("Failed to convert pubkey to bech32: {}", e));
1411 } 1411 }
1412 }; 1412 };
@@ -1418,16 +1418,16 @@ impl PushAuthorizationTests {
1418 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { 1418 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await {
1419 Ok(branch) => branch, 1419 Ok(branch) => branch,
1420 Err(e) => { 1420 Err(e) => {
1421 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1421 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1422 .fail(format!("Failed to get default branch: {}", e)); 1422 .fail(format!("Failed to get default branch: {}", e));
1423 } 1423 }
1424 }; 1424 };
1425 1425
1426 // Verify HEAD points to refs/heads/develop 1426 // Verify HEAD points to refs/heads/develop
1427 if default_branch == "refs/heads/develop" { 1427 if default_branch == "refs/heads/develop" {
1428 TestResult::new(test_name, "GRASP-01:git-http:32", desc).pass() 1428 TestResult::new(test_name, "GRASP-01:git-http:38", desc).pass()
1429 } else { 1429 } else {
1430 TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( 1430 TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!(
1431 "Expected HEAD to point to 'refs/heads/develop' but got '{}'. \ 1431 "Expected HEAD to point to 'refs/heads/develop' but got '{}'. \
1432 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ 1432 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \
1433 as soon as the git data related to that branch has been received.'", 1433 as soon as the git data related to that branch has been received.'",
@@ -1476,7 +1476,7 @@ impl PushAuthorizationTests {
1476 let _develop_state = match ctx.get_fixture(FixtureKind::HeadSetToDevelopBranch).await { 1476 let _develop_state = match ctx.get_fixture(FixtureKind::HeadSetToDevelopBranch).await {
1477 Ok(e) => e, 1477 Ok(e) => e,
1478 Err(e) => { 1478 Err(e) => {
1479 return TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( 1479 return TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!(
1480 "Failed to create HeadSetToDevelopBranch fixture: {}", 1480 "Failed to create HeadSetToDevelopBranch fixture: {}",
1481 e 1481 e
1482 )); 1482 ));
@@ -1489,7 +1489,7 @@ impl PushAuthorizationTests {
1489 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await { 1489 let valid_repo = match ctx.get_fixture(FixtureKind::ValidRepo).await {
1490 Ok(e) => e, 1490 Ok(e) => e,
1491 Err(e) => { 1491 Err(e) => {
1492 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1492 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1493 .fail(format!("Failed to get ValidRepo fixture: {}", e)); 1493 .fail(format!("Failed to get ValidRepo fixture: {}", e));
1494 } 1494 }
1495 }; 1495 };
@@ -1502,7 +1502,7 @@ impl PushAuthorizationTests {
1502 { 1502 {
1503 Some(id) => id.to_string(), 1503 Some(id) => id.to_string(),
1504 None => { 1504 None => {
1505 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1505 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1506 .fail("Missing repo_id in ValidRepo"); 1506 .fail("Missing repo_id in ValidRepo");
1507 } 1507 }
1508 }; 1508 };
@@ -1510,7 +1510,7 @@ impl PushAuthorizationTests {
1510 let npub = match valid_repo.pubkey.to_bech32() { 1510 let npub = match valid_repo.pubkey.to_bech32() {
1511 Ok(n) => n, 1511 Ok(n) => n,
1512 Err(e) => { 1512 Err(e) => {
1513 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1513 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1514 .fail(format!("Failed to convert pubkey to bech32: {}", e)); 1514 .fail(format!("Failed to convert pubkey to bech32: {}", e));
1515 } 1515 }
1516 }; 1516 };
@@ -1521,7 +1521,7 @@ impl PushAuthorizationTests {
1521 let clone_path = match clone_repo(relay_domain, &npub, &repo_id) { 1521 let clone_path = match clone_repo(relay_domain, &npub, &repo_id) {
1522 Ok(path) => path, 1522 Ok(path) => path,
1523 Err(e) => { 1523 Err(e) => {
1524 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1524 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1525 .fail(format!("Failed to clone repo: {}", e)); 1525 .fail(format!("Failed to clone repo: {}", e));
1526 } 1526 }
1527 }; 1527 };
@@ -1536,7 +1536,7 @@ impl PushAuthorizationTests {
1536 1536
1537 if let Err(e) = output { 1537 if let Err(e) = output {
1538 let _ = fs::remove_dir_all(&clone_path); 1538 let _ = fs::remove_dir_all(&clone_path);
1539 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1539 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1540 .fail(format!("Failed to create develop1 branch: {}", e)); 1540 .fail(format!("Failed to create develop1 branch: {}", e));
1541 } 1541 }
1542 1542
@@ -1545,7 +1545,7 @@ impl PushAuthorizationTests {
1545 Ok(hash) => hash, 1545 Ok(hash) => hash,
1546 Err(e) => { 1546 Err(e) => {
1547 let _ = fs::remove_dir_all(&clone_path); 1547 let _ = fs::remove_dir_all(&clone_path);
1548 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1548 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1549 .fail(format!("Failed to create commit: {}", e)); 1549 .fail(format!("Failed to create commit: {}", e));
1550 } 1550 }
1551 }; 1551 };
@@ -1570,7 +1570,7 @@ impl PushAuthorizationTests {
1570 Ok(e) => e, 1570 Ok(e) => e,
1571 Err(e) => { 1571 Err(e) => {
1572 let _ = fs::remove_dir_all(&clone_path); 1572 let _ = fs::remove_dir_all(&clone_path);
1573 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1573 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1574 .fail(format!("Failed to build state event: {}", e)); 1574 .fail(format!("Failed to build state event: {}", e));
1575 } 1575 }
1576 }; 1576 };
@@ -1578,7 +1578,7 @@ impl PushAuthorizationTests {
1578 // Send the state event (commit doesn't exist on relay yet) 1578 // Send the state event (commit doesn't exist on relay yet)
1579 if let Err(e) = client.send_event(state_event).await { 1579 if let Err(e) = client.send_event(state_event).await {
1580 let _ = fs::remove_dir_all(&clone_path); 1580 let _ = fs::remove_dir_all(&clone_path);
1581 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1581 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1582 .fail(format!("Failed to send state event: {}", e)); 1582 .fail(format!("Failed to send state event: {}", e));
1583 } 1583 }
1584 1584
@@ -1591,11 +1591,11 @@ impl PushAuthorizationTests {
1591 match push_result { 1591 match push_result {
1592 Ok(true) => { /* Push succeeded, continue to verify */ } 1592 Ok(true) => { /* Push succeeded, continue to verify */ }
1593 Ok(false) => { 1593 Ok(false) => {
1594 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1594 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1595 .fail("Push to refs/heads/develop1 was rejected"); 1595 .fail("Push to refs/heads/develop1 was rejected");
1596 } 1596 }
1597 Err(e) => { 1597 Err(e) => {
1598 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1598 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1599 .fail(format!("Failed to push develop1 branch: {}", e)); 1599 .fail(format!("Failed to push develop1 branch: {}", e));
1600 } 1600 }
1601 } 1601 }
@@ -1608,16 +1608,16 @@ impl PushAuthorizationTests {
1608 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await { 1608 match get_default_branch_from_info_refs(relay_domain, &npub, &repo_id).await {
1609 Ok(branch) => branch, 1609 Ok(branch) => branch,
1610 Err(e) => { 1610 Err(e) => {
1611 return TestResult::new(test_name, "GRASP-01:git-http:32", desc) 1611 return TestResult::new(test_name, "GRASP-01:git-http:38", desc)
1612 .fail(format!("Failed to get default branch: {}", e)); 1612 .fail(format!("Failed to get default branch: {}", e));
1613 } 1613 }
1614 }; 1614 };
1615 1615
1616 // Verify HEAD points to refs/heads/develop1 1616 // Verify HEAD points to refs/heads/develop1
1617 if default_branch == "refs/heads/develop1" { 1617 if default_branch == "refs/heads/develop1" {
1618 TestResult::new(test_name, "GRASP-01:git-http:32", desc).pass() 1618 TestResult::new(test_name, "GRASP-01:git-http:38", desc).pass()
1619 } else { 1619 } else {
1620 TestResult::new(test_name, "GRASP-01:git-http:32", desc).fail(format!( 1620 TestResult::new(test_name, "GRASP-01:git-http:38", desc).fail(format!(
1621 "Expected HEAD to point to 'refs/heads/develop1' but got '{}'. \ 1621 "Expected HEAD to point to 'refs/heads/develop1' but got '{}'. \
1622 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \ 1622 GRASP-01 requires: 'MUST set repository HEAD per repository state announcement \
1623 as soon as the git data related to that branch has been received.'", 1623 as soon as the git data related to that branch has been received.'",