mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
docs: sync implementation spec citations
This commit is contained in:
+2
-2
@@ -738,7 +738,7 @@ pub fn align_repository_with_state(repo_path: &Path, state: &RepositoryState) ->
|
||||
/// - Standard endpoint: `{git_data_path}/{npub}/{identifier}.git` — two
|
||||
/// components after `git_data_path`. The identifier is the last
|
||||
/// component minus the `.git` suffix.
|
||||
/// - GRASP-06 `/prs/` endpoint (06.md line 14): the `/prs/`
|
||||
/// - GRASP-06 `/prs/` endpoint (06.md line 12): the `/prs/`
|
||||
/// contributor-submission subtree at
|
||||
/// `{git_data_path}/prs/{submitter-hex}/{identifier}.git` — three
|
||||
/// components, where the leading `prs` is the namespace marker (see
|
||||
@@ -947,7 +947,7 @@ pub async fn process_newly_available_git_data(
|
||||
// Cross-service mirror (design doc:
|
||||
// docs/explanation/grasp-06-contributor-pr-submission.md, "Cross-service
|
||||
// mirror" section). When the source repo lives under the `/prs/`
|
||||
// subtree (06.md line 14), refs released from purgatory by this push
|
||||
// subtree (06.md line 12), refs released from purgatory by this push
|
||||
// must be copied into any matching announced repo on this relay so the
|
||||
// PR is fetchable at the maintainer's canonical URL. The reverse
|
||||
// direction is NOT supported — a push to `<owner>/<id>.git` must never
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! GRASP-06 `/prs/` fetch handlers.
|
||||
//!
|
||||
//! Spec 06.md line 13:
|
||||
//! Spec 06.md line 11:
|
||||
//!
|
||||
//! > MUST respond to upload-pack requests for any well-formed path as if
|
||||
//! > serving an empty bare repository.
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
//! post-push validation against the database / purgatory.
|
||||
//! - PR / PR-Update event acceptance relaxation for un-announced coords
|
||||
//! whose `clone` tag names this relay's `/prs/<signer-npub>/<d>.git`
|
||||
//! endpoint (06.md lines 21–24).
|
||||
//! endpoint (06.md lines 19–22).
|
||||
//!
|
||||
//! Cross-service mirroring into matching announced repos is not yet
|
||||
//! implemented.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Acceptance helpers for GRASP-06 PR / PR-Update events.
|
||||
//!
|
||||
//! Spec: <https://github.com/DanConwayDev/grasp/blob/main/06.md> (lines 21–24).
|
||||
//! Spec: <https://github.com/DanConwayDev/grasp/blob/main/06.md> (lines 19–22).
|
||||
//!
|
||||
//! Under GRASP-06 a relay MUST accept a kind 1618 (PR) or 1619 (PR Update)
|
||||
//! event for a repository coordinate it has no accepted announcement for,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! GRASP-06 `/prs/` `git-receive-pack` handler.
|
||||
//!
|
||||
//! Spec 06.md line 15:
|
||||
//! Spec 06.md line 13:
|
||||
//!
|
||||
//! > MUST accept pushes to `refs/nostr/<event-id>`. MUST reject pushes to any
|
||||
//! > other ref namespace.
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ use crate::sync::rejected_index::RejectedEventsIndex;
|
||||
|
||||
type HttpBody = GitResponseBody;
|
||||
|
||||
/// CORS headers required by GRASP-01 specification (lines 40-47)
|
||||
/// CORS headers required by GRASP-01 specification (lines 48-51)
|
||||
const CORS_ALLOW_ORIGIN: &str = "*";
|
||||
const CORS_ALLOW_METHODS: &str = "GET, POST";
|
||||
const CORS_ALLOW_HEADERS: &str = "Content-Type";
|
||||
@@ -180,7 +180,7 @@ impl Service<Request<Incoming>> for HttpService {
|
||||
let repo_init_locks = self.repo_init_locks.clone();
|
||||
|
||||
// Handle OPTIONS preflight requests (CORS)
|
||||
// GRASP-01 spec line 47: Respond to OPTIONS with 204 No Content
|
||||
// GRASP-01 spec line 51: Respond to OPTIONS with 204 No Content
|
||||
if method == Method::OPTIONS {
|
||||
return Box::pin(async move {
|
||||
Ok(
|
||||
@@ -320,7 +320,7 @@ impl Service<Request<Incoming>> for HttpService {
|
||||
|
||||
// POST /git-receive-pack — accept pushes to
|
||||
// refs/nostr/<event-id>, reject anything else,
|
||||
// per GRASP-06 06.md line 15.
|
||||
// per GRASP-06 06.md line 13.
|
||||
(m, "git-receive-pack") if m == Method::POST => {
|
||||
// Metrics are recorded inside the `/prs/`
|
||||
// handler and its detached streaming task. For
|
||||
|
||||
+4
-4
@@ -38,17 +38,17 @@ pub struct RelayInformationDocument {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub icon: Option<String>,
|
||||
|
||||
// GRASP-01 Extensions (lines 11-14 of GRASP-01 spec)
|
||||
// GRASP-01 Extensions (lines 24-28 of GRASP-01 spec)
|
||||
/// List of supported GRASPs (e.g., ["GRASP-01"])
|
||||
/// Required by GRASP-01 specification line 12
|
||||
/// Required by GRASP-01 specification line 26
|
||||
pub supported_grasps: Vec<String>,
|
||||
|
||||
/// Repository acceptance criteria description
|
||||
/// Required by GRASP-01 specification line 13
|
||||
/// Required by GRASP-01 specification line 27
|
||||
pub repo_acceptance_criteria: String,
|
||||
|
||||
/// Curation policy (present if curated, absent otherwise)
|
||||
/// Optional per GRASP-01 specification line 14
|
||||
/// Required by GRASP-01 specification line 28 when events are curated
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub curation: Option<String>,
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ impl Nip34WritePolicy {
|
||||
|
||||
// Reject PRs unrelated to stored repositories / events.
|
||||
//
|
||||
// GRASP-06 (06.md lines 21–24) relaxes this: a PR / PR-Update event
|
||||
// GRASP-06 (06.md lines 19–22) relaxes this: a PR / PR-Update event
|
||||
// whose `clone` tag names this relay's
|
||||
// `/prs/<signer-npub>/<d>.git` endpoint (and which carries a
|
||||
// matching `a` tag of the form `30617:<hex>:<d>`) MUST be accepted
|
||||
|
||||
@@ -75,7 +75,7 @@ impl PrEventPolicy {
|
||||
|
||||
if let Some(scope) = prs_scope {
|
||||
// The placeholder was created by a /prs/<submitter>/<id>.git
|
||||
// push (06.md line 14). The arriving event MUST be signed by
|
||||
// push (06.md line 12). The arriving event MUST be signed by
|
||||
// the URL submitter AND carry an `a` tag with d-tag equal to
|
||||
// the URL identifier — otherwise this event was published by
|
||||
// someone else and merely shares an id with a ref the
|
||||
|
||||
@@ -498,7 +498,7 @@ impl Purgatory {
|
||||
}
|
||||
|
||||
/// Add a PR placeholder created by a push to the GRASP-06 `/prs/`
|
||||
/// endpoint (06.md line 14).
|
||||
/// endpoint (06.md line 12).
|
||||
///
|
||||
/// Behaves like [`Self::add_pr_placeholder`] but additionally records
|
||||
/// the URL's submitter and identifier on the entry. When the
|
||||
|
||||
@@ -146,7 +146,7 @@ pub struct PrPurgatoryEntry {
|
||||
pub source: EventSource,
|
||||
|
||||
/// If set, this placeholder was created by a push to the GRASP-06
|
||||
/// `/prs/<submitter>/<identifier>.git` endpoint (06.md line 14). When
|
||||
/// `/prs/<submitter>/<identifier>.git` endpoint (06.md line 12). When
|
||||
/// the corresponding PR event arrives, its signer MUST equal
|
||||
/// `submitter` and it MUST carry an `a` tag with d-tag equal to
|
||||
/// `identifier`. Mismatches cause the pushed ref + placeholder to be
|
||||
|
||||
@@ -126,7 +126,7 @@ isolated_test_with_grasp_06!(
|
||||
// Test 3: Empty-bare-repo fetch for any well-formed /prs/<npub>/<id>.git
|
||||
// =============================================================================
|
||||
//
|
||||
// Spec: GRASP-06 06.md line 13
|
||||
// Spec: GRASP-06 06.md line 11
|
||||
//
|
||||
// Contract: when GRASP-06 is enabled on the relay, a fetch against any
|
||||
// well-formed /prs/<npub>/<id>.git path that has no accepted
|
||||
@@ -149,7 +149,7 @@ isolated_test_with_grasp_06!(
|
||||
// Test 4: /prs/ MUST accept pushes to refs/nostr/<event-id>
|
||||
// =============================================================================
|
||||
//
|
||||
// Spec: GRASP-06 06.md line 15
|
||||
// Spec: GRASP-06 06.md line 13
|
||||
//
|
||||
// Contract: a `git push` of refs/nostr/<event-id> to /prs/<npub>/<id>.git
|
||||
// MUST succeed, even when there is no prior state on the path and no matching
|
||||
@@ -170,7 +170,7 @@ isolated_test_with_grasp_06!(
|
||||
// Test 5: /prs/ MUST reject pushes to anything else
|
||||
// =============================================================================
|
||||
//
|
||||
// Spec: GRASP-06 06.md line 15
|
||||
// Spec: GRASP-06 06.md line 13
|
||||
//
|
||||
// Contract: pushes to ref names that don't match refs/nostr/<64-hex-event-id>
|
||||
// MUST be rejected. Two sub-assertions inside one test:
|
||||
@@ -191,7 +191,7 @@ isolated_test_with_grasp_06!(
|
||||
// Test 6: PR for un-announced coord MUST be accepted when clone tag names /prs/
|
||||
// =============================================================================
|
||||
//
|
||||
// Spec: GRASP-06 06.md lines 21–24
|
||||
// Spec: GRASP-06 06.md lines 19–22
|
||||
//
|
||||
// Contract: a PR event (kind 1618) for a coord this relay has NO accepted
|
||||
// announcement for MUST be accepted (purgatory or served) when the event
|
||||
@@ -215,7 +215,7 @@ isolated_test_with_grasp_06!(
|
||||
// Test 6b: Relaxation-accepted PR MUST stay in purgatory until git data arrives
|
||||
// =============================================================================
|
||||
//
|
||||
// Spec: GRASP-06 06.md lines 21–24, in combination with GRASP-01 line 22
|
||||
// Spec: GRASP-06 06.md lines 19–22, in combination with GRASP-01 line 20
|
||||
// (the purgatory rule).
|
||||
//
|
||||
// Contract: a PR event accepted under the GRASP-06 relaxation (un-announced
|
||||
@@ -242,7 +242,7 @@ isolated_test_with_grasp_06!(
|
||||
// Test 7: Relaxation MUST NOT apply when clone tag does not name this relay
|
||||
// =============================================================================
|
||||
//
|
||||
// Spec: GRASP-06 06.md lines 23–24
|
||||
// Spec: GRASP-06 06.md line 22
|
||||
//
|
||||
// Contract: the same un-announced-coord PR event, but with a `clone` tag
|
||||
// pointing at a foreign host, MUST remain rejected. The relaxation is gated
|
||||
@@ -332,7 +332,7 @@ isolated_test_with_grasp_06!(
|
||||
//
|
||||
// Wired only as `with_grasp_06`. Pre-implementation this can't make its
|
||||
// assertion (the /prs/ endpoint 404s) and reports a setup failure with a
|
||||
// pointer to the 06.md line 13 endpoint-reachability requirement. Once
|
||||
// pointer to the 06.md line 11 endpoint-reachability requirement. Once
|
||||
// /prs/ becomes reachable, the test goes green and stays green as long as
|
||||
// no one adds a reverse-mirror branch.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user