Repository navigation
Conversation
Adds parseAcceptLabelersHeader and serializeContentLabelersHeader to the shared moderation package: RFC 8941 list parsing restricted to the forms the ATProto label spec uses, strict DID validation, first-occurrence ordering, union merging of repeated-DID redact flags, and typed syntax errors. An empty header value means no accepted labelers; resolving a missing header to deployment defaults stays with the caller.
…ndary Parses atproto-accept-labelers once per request: a missing header resolves to the deployment's trusted labelers with redact enabled, an empty header accepts none, malformed syntax returns InvalidRequest, and requested DIDs without a labelers row are omitted. The response reports the sources actually considered via atproto-content-labelers, now correctly CORS- exposed in place of the request header. Also exports the package-scope and release-scope hard-block vocabulary from the shared moderation package so SQL enforcement and the evaluator cannot drift.
Search and latest-release selection exclude subjects carrying hard-block labels from the request's accepted sources, with CID-bound labels applying only to the subject's current CID and package/publisher blocks cascading to releases. Direct package reads and release lists return content with hydrated labels; an accepted source with redact enabled turns an active takedown into a response indistinguishable from absence, including for the parent package of a release list. Redaction decisions always see the full label set; the lexicon's 64-label cap applies only on the wire. Latest-release selection skips the latest_version fast path whenever an accepted policy is in force, since the pointer is not label-aware.
🦋 Changeset detectedLatest commit: 968b719 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 |
Scope checkThis PR changes 1,840 lines across 20 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. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 968b719 | Jul 12 2026, 07:15 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 968b719 | Jul 12 2026, 07:16 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-do | 968b719 | Jul 12 2026, 07:15 AM |
There was a problem hiding this comment.
I reviewed the label-aware aggregator read path introduced by this PR. Overall the approach is sound and matches the labelling-service plan: the request policy is resolved once before dispatch, enforcement SQL is parameterized and fail-closed, hydration is batched and untruncated until the view boundary, and the two pre-merge adversarial fixes (truncation bypass and parent-package existence leak) are correctly implemented. Test coverage looks broad.
I found two minor issues worth cleaning up: a stale/misleading docstring in views.ts that contradicts the deliberate untruncated-hydration design, and a subtle information-leak consideration in listReleases where an all-redacted page can still return a cursor. Neither is blocking, so I’m leaving this as comment.
Findings
-
[suggestion]
apps/aggregator/src/routes/xrpc/views.ts:128-131The docstring says each hydrated subject is “individually capped by
hydrateLabels”, buthydrateLabelsdeliberately returns untruncated sets so redaction decisions see every label. The cap is applied here incapLabels, after redaction has already been decided. Update the comment so future readers don’t assume hydration truncates./** Caps a combined labels array at the lexicon's maxLength. A view's * labels are the union of multiple hydrated subjects (e.g. a release's own * URI plus its parent package and publisher DID). Hydration returns * untruncated per-subject sets so redaction decisions are made first; * this boundary cap trims only the final view array. */ -
[suggestion]
apps/aggregator/src/routes/xrpc/listReleases.ts:149-152The cursor is derived from the last raw row before redaction filtering (
hasMore && last), so a page where every release is redacted returns{ releases: [], cursor: "..." }. That cursor lets a client infer that rows exist beyond the visible set, which somewhat undermines the “indistinguishable from absence” goal for redacted releases. If this is an acceptable trade-off (the alternative is either dropping later pages or doing extra server-side paging work), it should be explicitly documented in the handler comment; otherwise consider only emitting the cursor when at least one release survived.
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. |
|
Both suggestions taken in 968b719: the stale |
6133ac5
into
feat/plugin-registry-labelling-service
What does this PR do?
Implements the aggregator's label-aware read path — W1.6 and W4.4–W4.6 from the labelling-service plan (#1909) — in three commits:
@emdash-cms/registry-moderation):parseAcceptLabelersHeader/serializeContentLabelersHeader, RFC 8941 list grammar restricted to the forms the ATProto label spec uses, strict DID validation, first-occurrence ordering, union merge of repeated-DIDredactflags, typed syntax errors.handleXrpcresolves the policy once per request. Missing header → deployment defaults (everylabelersrow withtrusted = 1,redact: true); explicitly empty → no accepted sources (no enforcement, no hydration); malformed → 400InvalidRequest; requested DIDs without alabelersrow are silently omitted. The response reports the sources actually considered viaatproto-content-labelers, now correctly CORS-exposed (the previousexpose-headersentry echoed the request header, which was meaningless). Also exports the package-scope and release-scope hard-block vocabulary from the shared moderation package, fixing the existing drift where the search SQL was missingpublisher-compromised.redact: trueholding an active!takedownmakes the subject indistinguishable from absence — 404 ongetPackage/resolvePackage, omission inlistReleases, and a 404 for a release list whose parent package is redacted (a 200-empty would leak existence).getLatestReleaseskips thepackages.latest_versionfast path whenever an accepted policy is in force, since the pointer is not label-aware.Adversarial review findings fixed pre-merge: a silent redaction bypass where the 64-label wire cap could truncate away the
!takedownbefore the redaction decision (hydration now returns untruncated sets; the cap applies only at the view boundary, both regression-tested), and thelistReleasesexistence leak above.Decisions needing maintainer ratification (all flagged in review):
redact: true.trustedis provenance, not request authorization (per the W0.3 audit).sync.getRecordintentionally serves records for redacted subjects (raw CAR bytes, publicly cached). Recommendation: keep — it is the sync/verification layer, the record remains available from the publisher's own PDS regardless, and consumers auditing labels need to fetch the subject record. Flagged by adversarial review as needing an explicit decision rather than an implicit passthrough.evaluateReleaseModeration(documented inlabel-enforcement.ts): value/subject pairings the evaluator would reject still exclude, always in the over-hide direction. The evaluator remains the only eligibility engine; no positive-assessment requirement ships in this PR (shadow phase).Implementation PRs target
feat/plugin-registry-labelling-serviceper the umbrella PR. Related to #1909 and RFC #694.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.Admin i18n is n/a — no UI changes. Changesets included for the two published packages that changed (
@emdash-cms/registry-moderation×2,@emdash-cms/registry-lexicons); the aggregator is private.AI-generated code disclosure
Screenshots / test output
pnpm --filter @emdash-cms/aggregator test: 15 files, 296 tests pass (41 header-parser tests, 7 request-policy contract tests, 24 enforcement/hydration/redaction tests incl. the truncation-bypass and existence-leak regressions)pnpm --filter @emdash-cms/registry-moderation test: 114 pass;--filter @emdash-cms/registry-lexicons test: 14 passpnpm lint:quick0 diagnostics; type-awarelint:jsonhas no findings in any touched fileTry this PR
Open a fresh playground →
A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.
Tracks
feat/labeler-aggregator-reads. Updated automatically when the playground redeploys.