upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-31 12:47:04 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-31 12:47:04 +0000
commit9bd7109991096e610394832a519ff89a0aa095ad (patch)
tree6e14943c7e21301ca0874ae24752135ec0d8cb7b /grasp-audit
parentf5c8d167c3bf175dfe08ea3c8ca96055632364c3 (diff)
test: remove local sync on state git data received test
because the current fixtures don't actually having mutliple owner_repos. they would need 2 announcements that both listed the service and a maintainer relationship. We could do this in grasp-audit but it would require an extra announcement from a different maintainer sent eariler on in the dependancy chain.
Diffstat (limited to 'grasp-audit')
-rw-r--r--grasp-audit/src/specs/grasp01/push_authorization.rs161
1 files changed, 0 insertions, 161 deletions
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs
index 8bcf0f7..549ba6f 100644
--- a/grasp-audit/src/specs/grasp01/push_authorization.rs
+++ b/grasp-audit/src/specs/grasp01/push_authorization.rs
@@ -357,8 +357,6 @@ impl PushAuthorizationTests {
357 results.add( 357 results.add(
358 Self::test_push_authorized_by_recursive_maintainer_state(client, relay_domain).await, 358 Self::test_push_authorized_by_recursive_maintainer_state(client, relay_domain).await,
359 ); 359 );
360 // Note: test_push_of_state_by_maintainer_updates_other_maintainer_repos is not included
361 // in run_tests as it's a stub for the purgatory feature and returns .skip()
362 results.add( 360 results.add(
363 Self::test_push_to_nostr_ref_with_invalid_event_id_rejected(client, relay_domain).await, 361 Self::test_push_to_nostr_ref_with_invalid_event_id_rejected(client, relay_domain).await,
364 ); 362 );
@@ -762,165 +760,6 @@ impl PushAuthorizationTests {
762 } 760 }
763 } 761 }
764 762
765 /// Test that push of state by one maintainer updates git repos of other maintainers
766 ///
767 /// GRASP-01: "respecting the recursive maintainer set"
768 ///
769 /// This test verifies that when a maintainer publishes a state event, the purgatory
770 /// feature correctly copies git commits between repos so all authorized maintainers'
771 /// repositories always reflect the state according to nostr events.
772 ///
773 /// ## Implementation
774 ///
775 /// This test:
776 /// 1. Uses RecursiveMaintainerStateDataPushed fixture which:
777 /// - Creates owner repo + state (ValidRepo, OwnerStateDataPushed)
778 /// - Creates maintainer announcement (separate repo for maintainer)
779 /// - Pushes recursive maintainer's git data to owner's repo
780 /// 2. Clones the maintainer's repository (not the owner's)
781 /// 3. Verifies that the maintainer's repo contains the recursive maintainer's state
782 ///
783 /// This proves purgatory is working: git data was pushed to owner's repo, and purgatory
784 /// synced it to the maintainer's repo based on the state event.
785 pub async fn test_push_of_state_by_maintainer_updates_other_maintainer_repos(
786 client: &AuditClient,
787 relay_domain: &str,
788 ) -> TestResult {
789 let test_name = "test_push_of_state_by_maintainer_updates_other_maintainer_repos";
790 let ctx = TestContext::new(client);
791
792 // Get the RecursiveMaintainerStateDataPushed fixture which:
793 // 1. Creates owner repo + owner state + git data
794 // 2. Creates maintainer announcement (separate repo)
795 // 3. Pushes recursive maintainer's git data to owner's repo
796 // 4. Purgatory should then sync to maintainer's repo
797 let recursive_state = match ctx
798 .get_fixture(FixtureKind::RecursiveMaintainerStateDataPushed)
799 .await
800 {
801 Ok(s) => s,
802 Err(e) => {
803 return TestResult::new(
804 test_name,
805 "GRASP-01:git-http:purgatory",
806 "Maintainer state updates propagate to other maintainer repos",
807 )
808 .fail(format!(
809 "Failed to get RecursiveMaintainerStateDataPushed fixture: {}",
810 e
811 ))
812 }
813 };
814
815 // Small delay to ensure state processing completes
816 tokio::time::sleep(Duration::from_millis(200)).await;
817
818 // Extract repo_id from the recursive maintainer's state event
819 let repo_id = match recursive_state
820 .tags
821 .iter()
822 .find(|t| t.kind() == TagKind::d())
823 .and_then(|t| t.content())
824 {
825 Some(id) => id.to_string(),
826 None => {
827 return TestResult::new(
828 test_name,
829 "GRASP-01:git-http:purgatory",
830 "Maintainer state updates propagate to other maintainer repos",
831 )
832 .fail("No repo identifier in recursive maintainer state event")
833 }
834 };
835
836 // Get the maintainer's npub
837 let maintainer_npub = match client.maintainer_keys().public_key().to_bech32() {
838 Ok(npub) => npub,
839 Err(e) => {
840 return TestResult::new(
841 test_name,
842 "GRASP-01:git-http:purgatory",
843 "Maintainer state updates propagate to other maintainer repos",
844 )
845 .fail(format!(
846 "Failed to convert maintainer pubkey to npub: {}",
847 e
848 ))
849 }
850 };
851
852 // Use the known recursive maintainer deterministic commit hash from the fixture
853 let expected_commit = crate::RECURSIVE_MAINTAINER_DETERMINISTIC_COMMIT_HASH;
854
855 // Clone the maintainer's repository (NOT the owner's)
856 // This is the key test: git data was pushed to owner's repo, does maintainer's repo have it?
857 let clone_path = match clone_repo(relay_domain, &maintainer_npub, &repo_id) {
858 Ok(path) => path,
859 Err(e) => {
860 return TestResult::new(
861 test_name,
862 "GRASP-01:git-http:purgatory",
863 "Maintainer state updates propagate to other maintainer repos",
864 )
865 .fail(format!("Failed to clone maintainer's repo: {}", e))
866 }
867 };
868
869 let cleanup = || {
870 let _ = fs::remove_dir_all(&clone_path);
871 };
872
873 // Verify that the maintainer's repo contains the recursive maintainer's commit
874 // This proves purgatory copied it from owner's repo
875 let commit_exists_output = Command::new("git")
876 .args(["cat-file", "-t", expected_commit])
877 .current_dir(&clone_path)
878 .output();
879
880 let commit_exists = match commit_exists_output {
881 Ok(output) => {
882 if output.status.success() {
883 let obj_type = String::from_utf8_lossy(&output.stdout);
884 obj_type.trim() == "commit"
885 } else {
886 false
887 }
888 }
889 Err(e) => {
890 cleanup();
891 return TestResult::new(
892 test_name,
893 "GRASP-01:git-http:purgatory",
894 "Maintainer state updates propagate to other maintainer repos",
895 )
896 .fail(format!("Failed to check if commit exists: {}", e));
897 }
898 };
899
900 cleanup();
901
902 if commit_exists {
903 TestResult::new(
904 test_name,
905 "GRASP-01:git-http:purgatory",
906 "Maintainer state updates propagate to other maintainer repos",
907 )
908 .pass()
909 } else {
910 TestResult::new(
911 test_name,
912 "GRASP-01:git-http:purgatory",
913 "Maintainer state updates propagate to other maintainer repos",
914 )
915 .fail(format!(
916 "Maintainer's repo does not contain recursive maintainer's commit {}. \
917 Git data was pushed to owner's repo, but purgatory did not copy it to \
918 maintainer's repo. This indicates the purgatory feature is not working correctly.",
919 expected_commit
920 ))
921 }
922 }
923
924 /// Test that non-maintainer state event is ignored 763 /// Test that non-maintainer state event is ignored
925 /// 764 ///
926 /// GRASP-01: "respecting the recursive maintainer set" 765 /// GRASP-01: "respecting the recursive maintainer set"