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
AgeCommit message (Collapse)Author
2026-02-18fix: use unique commit instead of deterministic Owner variant for ↵DanConwayDev
wrong-commit PR tests PRWrongCommitPushedBeforeEvent and test_push_to_nostr_ref_with_wrong_commit_after_event_received_rejected were calling create_deterministic_commit_with_variant(CommitVariant::Owner) on a clone that already had test.txt with 'Initial commit\n' content from OwnerStateDataPushed. Writing identical content staged nothing so git commit failed silently. Now that ValidRepoServed always depends on OwnerStateDataPushed (git data pushed), the clone is never empty - use create_commit (unique file) instead since the wrong commit only needs to differ from PR_TEST_COMMIT_HASH, not be deterministic.
2026-02-13fix: use ValidRepoServed for events that tag repo eventsDanConwayDev
PR events, issues, and comments need a queryable repo announcement to reference. Changed PREvent and PREventGenerated fixtures and related tests to depend on ValidRepoServed instead of ValidRepoSent. This ensures tests will fail correctly when announcement purgatory is implemented - events tagging a repo should require that repo to be served (not in purgatory).
2026-02-13fix: add trailing newlines to deterministic commit contentDanConwayDev
The CommitVariant::file_content() methods were returning strings without trailing newlines, but the expected hash constants were calculated with trailing newlines. This caused hash mismatches in tests. Updated all hash constants to match the actual commit hashes produced with trailing newlines in the file content.
2026-02-12refactor(grasp-audit): split ValidRepo into Sent/Served, add tolerant purgatoryDanConwayDev
- Rename ValidRepo to ValidRepoSent (announcement sent, may be in purgatory) - Add ValidRepoServed (announcement queryable after git data pushed) - Add send_event_and_note_purgatory() for tolerant purgatory detection - Update fixtures to use tolerant method instead of strict assertion - Update event_acceptance_policy tests to use ValidRepoServed This enables tests to pass regardless of purgatory implementation status while still having explicit purgatory tests that verify the behavior.
2026-02-12refactor(grasp-audit): introduce SpecRef enum for type-safe spec referencesDanConwayDev
Replace string-based spec references with typed SpecRef enum for compile-time validation and better IDE support. TestResult::new() now accepts SpecRef enum plus a requirement description string for test-specific context.
2026-02-12fix: use consistent git identity for PR test commit hashDanConwayDev
The PR_TEST_COMMIT_HASH constant was incorrect because the discovery test used a different git identity (pr-test@example.com) than the actual create_pr_test_commit function (test@grasp-audit.local from fixtures.rs). This caused the same commit content to produce different hashes due to different author/committer info being embedded in the commit object. Fixed by updating the discovery test to use the same git identity as clone_repo() in fixtures.rs, ensuring consistent commit hashes.
2026-01-09test: fix deterministic commit hashDanConwayDev
i suspect this broke when we ensured commits weren't pgp signed
2026-01-08refactor: replace hardcoded Kind constants with rust-nostr variantsDanConwayDev
- Replace KIND_REPOSITORY_ANNOUNCEMENT with Kind::GitRepoAnnouncement - Replace KIND_REPOSITORY_STATE with Kind::RepoState - Replace KIND_PR with Kind::GitPullRequest - Replace KIND_PR_UPDATE with Kind::GitPullRequestUpdate - Replace KIND_USER_GRASP_LIST with Kind::GitUserGraspList - Replace KIND_PATCH with Kind::GitPatch - Replace KIND_ISSUE with Kind::GitIssue - Replace KIND_COMMENT with Kind::Comment - Replace all Kind::Custom(30617|30618|1617|1618|1619|1621|1111|10317) patterns - Remove all hardcoded KIND_* constants from events.rs - Update all match statements to use Kind enum directly - Update all filter builders to use Kind variants - Update all test helpers and assertions Benefits: - Type safety: compiler prevents wrong kind numbers - Readability: Kind::GitRepoAnnouncement is self-documenting - Maintainability: single source of truth (rust-nostr) - IDE support: full autocompletion and refactoring - Standards: aligns with rust-nostr best practices Files modified: 21 Constants removed: 9 Patterns replaced: 100+ Tests passing: 222/222
2026-01-08chore: upgrade nostr-* packages to rev 4767ad13DanConwayDev
- Update nostr-relay-builder, nostr-sdk, nostr-lmdb to latest revision - Update grasp-audit nostr-sdk dependency - Fix clippy warnings: - Replace .clone() with std::slice::from_ref() in src/git/sync.rs - Change &PathBuf to &Path in tests/common/git_server.rs - Replace vec![] with array literal in src/purgatory/sync/functions.rs - Update PR_TEST_COMMIT_HASH in grasp-audit due to event generation changes All 249 tests passing, no breaking changes required.
2025-12-31test: remove local sync on state git data received testDanConwayDev
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.
2025-12-31purgatory: when state data recieved sync across repositoiesDanConwayDev
2025-12-31test: fix ↵DanConwayDev
test_push_to_nostr_ref_with_correct_commit_after_event_received_accepted_and_event_served
2025-12-31test: fix test_head_set_after_git_push_with_required_oidsDanConwayDev
2025-12-24feat(purgatory): add broken purgatory implementationDanConwayDev
2025-12-23test: add purgatory to PR push testDanConwayDev
commented out so it currently passes
2025-12-23test: add stub for purgatory maintainer repo sync testDanConwayDev
2025-12-23test: prepare other state tests for purgatory featureDanConwayDev
2025-12-23test: prepare OwnerStateDataPushed fixture for purgatoryDanConwayDev
This is the model for how to prepare all push tests for purgatory
2025-12-23audit: updated grasp01 line refs to reflect purgatory insertionDanConwayDev
2025-12-22chore: bump rust-nostr to latest masterDanConwayDev
so we can more easily support grasp purgatory feature
2025-12-11fix: resolve all fmt and clippy warningsDanConwayDev
Main lib (src/): - Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration) - Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting) - Replace .or_insert_with(RelaySyncNeeds::default) with .or_default() - Replace manual div_ceil implementations with .div_ceil(100) Test code (tests/): - Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...)) - Remove needless borrows in fetch_metrics() calls - Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module grasp-audit: - Apply cargo fmt to fix formatting
2025-12-02grasp-audit: show tests under GRASP-01 lineDanConwayDev
2025-12-02refactor: fix fmt and clippyDanConwayDev
2025-12-01test: test_head_set_after_git_push_with_required_oidsDanConwayDev
2025-12-01better fixtures: test_head_set_after_state_event_with_existing_commitDanConwayDev
2025-12-01better fixtures: refs/nostr testsDanConwayDev
2025-12-01better fixtures: RecursiveMaintainerStateDataPushed and ↵DanConwayDev
test_non_maintainer_state_rejected
2025-12-01better fixtures: MaintainerStateDataPushedDanConwayDev
2025-12-01better fixtures: MaintainerStateDataPushedDanConwayDev
2025-12-01begin implementing better fixturesDanConwayDev
2025-12-01test placeholder: test_head_set_after_git_push_with_required_oidsDanConwayDev
2025-12-01test: test_head_set_after_state_event_with_existing_commitDanConwayDev
currently failing as branch isn't pushed (we should auto create this branch as we have the ref)
2025-12-01fix cargo clippy and fmt warningsDanConwayDev
2025-12-01reject push when refs/nostr/<event-id> doesnt match known event and delete ↵DanConwayDev
incorrect ref on event receive
2025-11-28test: added checks that refs/nostr/<event-id> match commit in PR / updateDanConwayDev
2025-11-28allow push to ref/nostr/<event-id>DanConwayDev
2025-11-28audit: fix push from maintainer tests when in production modeDanConwayDev
2025-11-28audit: fix rejected push wrong commit testDanConwayDev
2025-11-28audit: stop checking git_data_directoryDanConwayDev
2025-11-28grasp-audit run all tests in audit modeDanConwayDev
2025-11-27remove depricated codeDanConwayDev
2025-11-27Task 4: Refactor recursive maintainer push test to fixture-first patternDanConwayDev
- Deprecated setup_repo_for_recursive_maintainer helper in fixtures.rs - test_push_authorized_by_recursive_maintainer_state now creates own TestContext - Uses FixtureKind chain: RepoState, MaintainerAnnouncement, MaintainerState, RecursiveMaintainerRepoAndState - Uses git helpers from fixtures.rs (clone_repo, create_deterministic_commit_with_variant, try_push) - Updated imports to include RECURSIVE_MAINTAINER_DETERMINISTIC_COMMIT_HASH - All unit tests pass: cargo test --lib
2025-11-27Task 3: Refactor maintainer push authorization test to fixture-first patternDanConwayDev
- Deprecated setup_repo_for_maintainer helper - test_push_authorized_by_maintainer_state_only now creates own TestContext - Uses FixtureKind::RepoState and FixtureKind::MaintainerState - Uses git helpers from fixtures.rs (clone_repo, create_deterministic_commit_with_variant, try_push) - Uses CommitVariant::Maintainer and MAINTAINER_DETERMINISTIC_COMMIT_HASH - Test compiles and passes: cargo test --lib (25 passed, 0 failed)
2025-11-27Task 2: Refactor owner push authorization test to fixture-first patternDanConwayDev
- Refactored test_push_authorized_by_owner_state to use fixture-first pattern - Test now creates its own TestContext and uses FixtureKind::RepoState - Uses git helper functions from fixtures.rs (clone_repo, create_deterministic_commit, try_push) - Follows the 3-step pattern: Generate fixtures → Send to relay → Verify behavior - Deprecated setup_repo_with_deterministic_commit with migration guide - Test passes: cargo test --test push_authorization test_push_authorized_by_owner_state - No API changes required for main project tests
2025-11-27fix(tests): update main project tests for grasp-audit API changesDanConwayDev
2025-11-26test: use fixtures in push testsDanConwayDev
2025-11-26fix: parsing maintainers from announcement eventDanConwayDev
2025-11-26feat: push authorization from state eventDanConwayDev