Repository navigation
feat(labeler): publisher contact resolution via aggregator binding (W10.4 slice A) - #2073
Conversation
…10.4 slice A) Resolve a package's takedown/notification email by walking three tiers in spec order -- package security[], package authors[], then the publisher profile contact[] (preferring kind:security within the tier) -- through the aggregator service binding with a fresh single read per tier and no caching. url-only contacts are skipped, not treated as resolved; "no resolvable contact" is an expected terminal outcome, not an error, and only a transport failure throws. Seed the double-opt-in state row on resolution: hash the email via recipientHash and ensureContact, honoring suppression so a victim named in hostile metadata is never re-seeded into a fresh unconfirmed state, and never resetting an already-confirmed contact. Plaintext email is held in memory only -- hashed immediately, never persisted or logged (logs carry the public DID and an 8-char hash prefix). Sending the confirmation mail is W10.5; this seam resolves and seeds only. Tier 3 (the publisher profile contact[]) was already indexed in the aggregator (publishers.contact) but not exposed by any read, so add a minimal getPublisher XRPC query and publisherView definition, mirroring getPackage's label hydration and takedown redaction. Add a getPublisher client method and extend the test AGGREGATOR stub to serve realistic getPackage/getPublisher views so the resolver is exercised end to end through the real binding.
Mirrors the getPackage symmetric test: a !takedown on the publisher profile URI (not just the DID subject) redacts getPublisher to 404, closing the coverage parity gap.
🦋 Changeset detectedLatest commit: 1efcbe5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 1efcbe5 | Jul 16 2026, 12:40 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-do | 1efcbe5 | Jul 16 2026, 12:39 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 1efcbe5 | Jul 16 2026, 12:39 PM |
Scope checkThis PR changes 1,044 lines across 16 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
There was a problem hiding this comment.
This is the right slice-A seam for W10.4: it adds the minimal getPublisher read surface the labeler needs to reach tier-3 contacts and keeps the resolver + seeding self-contained and untriggered for W10.5. The approach is consistent with the existing aggregator read API (same label hydration, redaction, caching, and CID-fallback patterns as getPackage) and the contact hash/seeding conventions already in notification-contacts.ts.
What I checked:
- Diff & changed files — read the full diff and the key new/changed files:
apps/aggregator/src/routes/xrpc/getPublisher.ts,views.ts,router.ts,apps/labeler/src/publisher-contact.ts,aggregator-client.ts,apps/labeler/vitest.config.ts, the lexicon JSON, and the generated registry-lexicons types. - SQL safety —
getPublisherfollows the same safe pattern asgetPackage: column names come from a module-constant list, only?-bound values touch D1, and no user data reaches the SQL text.publishers.didis the primary key, so no extra index is needed. - Label enforcement / redaction — mirrors
getPackage: profile URI + DID subjects are hydrated,!takedownfrom acceptedredact: truesources turns intoNotFound. The labeler binding explicitly sends a blankatproto-accept-labelersheader so its own analysis isn't blinded, which matches the privacy rationale. - Schema alignment —
PublisherRow/publisherColumns()/publisherView()read the samepublisherscolumns the records consumer writes (display_name,description,url,contact,updated_at,signature_metadata,indexed_at).indexed_atwas added topublishersby migration0002_indexed_at.sql. - Contact resolution logic — tier 1 (
security[]) → tier 2 (authors[]email) → tier 3 (publisher.profile.contact[], preferringkind: security), with url-only entries skipped and whitespace-only emails rejected. Tier 3 is still attempted if the package is missing, which is the correct fallback. Transport failures propagate rather than being masked as “no contact”. - Seeding integrity — suppression is checked before
ensureContact(insert-if-absent asunconfirmed), so confirmed/declined rows and suppressed addresses are not reset. Plaintext email is only held in memory; the hash is what touches D1 and logs. - Tests — the PR adds hand-written unit tests for tier walking, suppression, confirmed-state preservation, and an end-to-end binding test via the vitest stub.
- AGENTS.md conventions — no admin UI strings, no content-table locale filtering, no new content-table indexes needed; changeset covers the published
registry-lexiconspackage only; aggregator and labeler are private apps.
No blocking or correctness issues identified. A few things I intentionally did not flag: the cid: "" fallback on malformed signature_metadata is the same existing behavior as getPackage/releaseView; the handle field in publisherView is optional and omitted because the publishers table doesn't store it yet; and seedPublisherContact returns seeded: true for an already-confirmed address, which is consistent with the documented contract that the send path then uses canSendConfirm/getContactState to decide whether a confirmation mail is actually needed.
Static review only — I did not run the test suite, linter, or builds.
6baeb41
into
feat/plugin-registry-labelling-service
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
What does this PR do?
Implements W10.4 slice A — publisher contact resolution for the labeler: given a package subject, resolve the email a takedown/warning notice would be offered to by walking three tiers in spec order and seeding the double-opt-in state row so slice C's confirm flow can proceed. Sending the mail is W10.5; this slice resolves and seeds only.
apps/labeler/src/publisher-contact.ts): walks packagesecurity[]→ packageauthors[]→ publisher profilecontact[](preferringkind: securitywithin the tier), returning the first entry carrying a non-empty email. url-only contacts are skipped, not treated as resolved. Reads go through the aggregator service binding with a fresh single read per tier and no caching. "No resolvable contact" is an expected terminal outcome, not an error; only a transport failure throws.seedPublisherContact: hashes the resolved email viarecipientHash, honors suppression (isSuppressed), thenensureContact(insert-if-absent). Never re-seeds a suppressed address or resets an already-confirmed contact. This is the unit W10.5's send path calls.contact[]was already indexed in the aggregator (publishers.contact) but not exposed by any read, so this adds a minimal read-onlygetPublisher(did)XRPC query +publisherViewdefinition, mirroringgetPackage's label hydration and takedown redaction, plus a client method.No notification trigger is wired yet (W10.5 owns it), so the resolver + seeding ship as a standalone, tested seam.
Part of the ratified plugin-registry labelling-service plan (W10.4). Targets the
feat/plugin-registry-labelling-serviceintegration branch, notmain.Privacy note (informational, not a gate): publisher/package contact emails are now also available as decoded JSON via
getPublisher, a hair easier to scrape than the CBOR the aggregator already serves unredacted viacom.atproto.sync.getRecord. This is no new disclosure — thepublisher.profileis a signed public record already served verbatim by that endpoint, andgetPackageexposes packagesecurity[]emails identically. In factgetPublisheris strictly more redaction-restrictive thansync.getRecord: it applies takedown enforcement (returns NotFound for a redacted publisher DID) where the raw record endpoint does not. The labeler's own reads send a blankatproto-accept-labelersheader, so takedown-contact resolution still works on a redacted subject while public callers get normal redaction.Plaintext email is held in memory only — hashed immediately, never persisted or logged (logs carry the public DID and an 8-char hash prefix).
Type of change
Checklist
pnpm typecheckpasses (labeler, aggregator, registry-lexicons)pnpm lintpasses (0 diagnostics in changed files; ~40 pre-existing baseline unchanged)pnpm testpasses (labeler 667, aggregator 304, registry-lexicons 23)pnpm formathas been run (oxfmt on touched paths)@emdash-cms/registry-lexiconsminor; labeler + aggregator are private)AI-generated code disclosure
Screenshots / test output