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
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/identity_sharing_fence_test.rsgreps every.rsfile undersrc/fingerprints/,src/handlers/fingerprints/, andsrc/server/routes/fingerprints/and fails the build if any of them importscrate::handlers::discovery::*, importscrate::server::routes::discovery::*, or hardcodes an/api/discovery/URL.fingerprints_module_documents_the_fence) guards that the header insrc/fingerprints/mod.rscontinues to reference the fence test + Privacy Principle.mod.rsfiles now explicitly describe the rule and point at the test.Ships workspace
TODOS.mdTODO-3: Architectural fence — Persona and Identity sharing must never touch discovery endpoints.Why
The Privacy Principle in
docs/designs/fingerprints.mdsays 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.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 warningsclean.cargo test --package fold_db_node --lib— 818 pass.🤖 Generated with Claude Code