Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

feat(fingerprints): structural fence for Persona/Identity sharing (TODO-3) - #679

Merged
shiba4life merged 2 commits into
mainfrom
feat/identity-sharing-fence
Apr 25, 2026
Merged

feat(fingerprints): structural fence for Persona/Identity sharing (TODO-3)#679
shiba4life merged 2 commits into
mainfrom
feat/identity-sharing-fence

Conversation

@shiba4life

Copy link
Copy Markdown
Collaborator

Summary

  • New tests/identity_sharing_fence_test.rs greps every .rs file under src/fingerprints/, src/handlers/fingerprints/, and src/server/routes/fingerprints/ and fails the build if any of them imports crate::handlers::discovery::*, imports crate::server::routes::discovery::*, or hardcodes an /api/discovery/ URL.
  • Skips line comments so documenting the fence does not trip it; still scans string literals.
  • A second test (fingerprints_module_documents_the_fence) guards that the header in src/fingerprints/mod.rs continues to reference the fence test + Privacy Principle.
  • Existing doc headers in the three mod.rs files now explicitly describe the rule and point at the test.

Ships workspace TODOS.md TODO-3: Architectural fence — Persona and Identity sharing must never touch discovery endpoints.

Why

The Privacy Principle in docs/designs/fingerprints.md says Personas and Identities never publish to discovery — direct peer sharing and Identity Card exchange go through the existing E2E messaging layer. Without a structural fence, a future refactor could silently reach for a discovery primitive ("it has presigned URLs, let me just use it") and quietly violate the invariant. The grep test makes the wrong thing impossible to add silently; the failure message points future authors at messaging + the design doc rather than at an #[allow] escape hatch.

Test plan

  • cargo test --test identity_sharing_fence_test — 2 tests pass.
  • Verified the test actually detects a violation: temporarily injected const BAD: &str = "/api/discovery/publish"; into a fenced file → test failed with the expected path:line message; reverted.
  • cargo clippy --workspace --all-targets -- -D warnings clean.
  • cargo test --package fold_db_node --lib — 818 pass.

🤖 Generated with Claude Code

…DO-3)

Adds `tests/identity_sharing_fence_test.rs`, which greps every `.rs`
file under `src/fingerprints/`, `src/handlers/fingerprints/`, and
`src/server/routes/fingerprints/` on each `cargo test` run and fails
the build if any of them:

  * imports `crate::handlers::discovery::*`
  * imports `crate::server::routes::discovery::*`
  * hardcodes an `/api/discovery/` URL

Line-comment lines (`//`, `//!`) are skipped so documentation of the
fence does not itself trip the fence.

The goal is the Privacy Principle from
`docs/designs/fingerprints.md`: Personas and Identities never
publish to discovery. Direct peer sharing and Identity Card
exchange go through the existing E2E messaging layer only. The
structural fence makes the wrong thing impossible to add silently
— the failure message points the future author at the messaging
layer and at the design doc, rather than handing them an `#[allow]`
escape hatch.

Also:

  * `src/fingerprints/mod.rs` header strengthened to reference the
    test file + widened the fence scope to include the sibling
    handlers and routes trees.
  * `src/handlers/fingerprints/mod.rs` and
    `src/server/routes/fingerprints/mod.rs` pick up short notes
    pointing at the same structural rule.
  * A second test (`fingerprints_module_documents_the_fence`)
    guards the discoverability of the convention — it fails if the
    doc header drifts away from mentioning either the test file or
    the Privacy Principle.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
github-actions Bot enabled auto-merge April 24, 2026 18:18
@shiba4life
shiba4life added this pull request to the merge queue Apr 25, 2026
Merged via the queue into main with commit d1abb5a Apr 25, 2026
4 checks passed
@shiba4life
shiba4life deleted the feat/identity-sharing-fence branch April 25, 2026 00:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant