Skip to content

feat(labeler): verification-state history input via aggregator read (W8.4 slice 3) - #2074

Merged
ascorbic merged 2 commits into
feat/plugin-registry-labelling-servicefrom
feat/labeler-history-aggregator
Jul 16, 2026
Merged

ascorbic merged 2 commits into
feat/plugin-registry-labelling-servicefrom
feat/labeler-history-aggregator

Conversation

@ascorbic

@ascorbic ascorbic commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Implements W8.4 slice 3 of the plugin-registry labelling service: the aggregator-sourced inputs to the labeler's publisher-history stage. Targets the integration branch feat/plugin-registry-labelling-service.

Scope honesty — this delivers one of the two slice-3 inputs:

  • ✅ Verification state (delivered). A new read-only aggregator query com.emdashcms.experimental.aggregator.getPublisherVerification returns the non-tombstoned verification claims indexed for a publisher DID. The labeler consumes it through AggregatorClient.getPublisherVerification and analyzeHistory, emitting an operator-only publisher-verification history finding (specifics in privateDetail only). Like every source: "history" finding it can never become a label — the resolver drops it, and validateFinding holds it to the dedicated history category set.

  • ⏳ Recent handle/profile changes (documented seam, NOT built). This input is genuinely un-ingested, not half-wired: the aggregator's publishers table is upsert-only (current state, no prior-values log), handle isn't stored except snapshotted inside a verification record at issuance, and the Jetstream ingestor does not subscribe to the atproto identity events that carry handle changes (apps/aggregator/src/jetstream-client.ts). Deriving "recent changes" therefore requires new aggregator ingestion work (a W4-era gap) — a follow-up ingestion ticket is needed before this second input can exist. It is left as a documented seam in history-context.ts and the route header; nothing speculative was built against non-existent tables.

Best-effort + fail-safe: history is operator-only context that never gates a run. The aggregator read sits in its own try/catch inside analyzeHistory, so a read failure skips only the verification context and never discards the decision-relevant own-D1 findings.

Per-issuer redaction (review follow-up): each verification claim is authored by its issuer's repo, so getPublisherVerification hydrates labels for the subject DID and every distinct issuer DID in one batched call — a redacted subject 404s the whole view, a redacted issuer drops only its own claim. The internal labeler read sends a blank atproto-accept-labelers header (empty accepted set), so it reads every claim unfiltered and weighs trust itself.

Ratified plan-doc decisions governing this slice live on the integration branch (.opencode/plans/plugin-registry-labelling-service/implementation-plan.md, W8.4, including the 2026-07-16 read-path ratification and the per-issuer-redaction decision recorded in 09e795d9).

Closes #

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes (labeler, aggregator, registry-lexicons)
  • pnpm lint passes (type-aware lint shows the ~40 repo-wide baseline diagnostics only; none in the changed files)
  • pnpm test passes (labeler full 660, aggregator full 305, registry-lexicons 23)
  • pnpm format has been run (oxfmt on touched TS, prettier-clean on the lexicon JSON)
  • I have added/updated tests for my changes
  • User-visible strings in the admin UI are wrapped for translation — n/a: no admin-UI strings (server routes + lexicon defs; server error messages are English-only per repo policy)
  • I have added a changeset — @emdash-cms/registry-lexicons minor (additive getPublisherVerification NSID + views)
  • New features link to an approved Discussion — n/a: governed by the ratified W8.4 implementation-plan decisions on the integration branch, not a standalone Discussion

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.8

Screenshots / test output

Targeted invariant tests (per-issuer redaction, the security-critical part of this PR):

✓ getPublisherVerification > drops a claim whose issuer is redacted for a default-policy caller, keeping the others
✓ getPublisherVerification > keeps a redacted-issuer claim for a blank accept-labelers caller (internal unfiltered read)
✓ history-context > preserves the own-D1 findings when the aggregator verification read fails

Suites: aggregator 305 pass (14 files), labeler 660 pass (33 files), registry-lexicons 23 pass. The workers test pool needs a Cloudflare account selected (CLOUDFLARE_ACCOUNT_ID for EmDash CMS) since two are available.

Query cost: per-issuer redaction adds no round-trip in the realistic case — it widens the existing single label-hydration query's IN (...) list (chunked at 50), so a request stays at 2 queries (verifications SELECT + one hydration) until a publisher has 50+ distinct issuers.


Try 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-history-aggregator. Updated automatically when the playground redeploys.

@changeset-bot

changeset-bot Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae43eaa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@emdash-cms/registry-lexicons Minor
@emdash-cms/admin Patch
@emdash-cms/plugin-cli Patch
@emdash-cms/registry-client Patch
@emdash-cms/registry-verification Patch
@emdash-cms/labeler Patch
emdash Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

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

@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jul 16, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground ae43eaa Jul 16 2026, 01:08 PM

@github-actions

Copy link
Copy Markdown
Contributor

Scope check

This PR changes 891 lines across 18 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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-do ae43eaa Jul 16 2026, 01:08 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache ae43eaa Jul 16 2026, 01:08 PM

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slice delivers the right thing for W8.4: an additive, read-only aggregator query for publisher verification claims, consumed by analyzeHistory as operator-only history context that structurally can never become a label. The approach matches the existing aggregator read patterns (getPackage, label-enforcement, hydrateLabels) and keeps the fail-safe posture: aggregator failures are isolated in their own try/catch so they never discard the own-D1 findings. The second input (handle/profile changes) is honestly left as a documented seam rather than half-built against non-existent ingestion.

What I checked:

  • The new getPublisherVerification XRPC route, lexicon definitions, router registration, and view mapping.
  • Per-issuer redaction behavior and the blank atproto-accept-labelers internal read path.
  • AggregatorClient.getPublisherVerification wiring and error contract.
  • analyzeHistory integration and the new publisher-verification history category through validateFinding.
  • Tests for redaction, failure isolation, and orchestrator validation.
  • AGENTS.md conventions: SQL uses bound parameters/column constants, no admin UI strings were added, the changeset covers the published registry-lexicons package, and apps are private so no additional changeset is needed.

Headline conclusion: every changed hunk is consistent with the integration-branch conventions, the ratified redaction design, and the existing codebase. No blockers or bugs found. Note: analyzeHistory accepts an aggregator but no production orchestrator path passes one yet; that is consistent with the orchestrator's own documented test-only status, so it is not a merge defect for this slice.

ascorbic and others added 2 commits July 16, 2026 14:02
…W8.4 slice 3)

Adds the publisher verification-state input to analyzeHistory, the first of
W8.4 slice 3's two aggregator-sourced history inputs.

- registry-lexicons: new getPublisherVerification query + publisherVerificationView
  / verificationClaimView defs, returning the non-tombstoned verification claims
  indexed for a publisher DID.
- aggregator: read-only route over publisher_verifications, redaction-gated on the
  publisher DID exactly like getPackage (a blank accept-labelers header opts out,
  so an internal caller reads unfiltered).
- labeler: AggregatorClient.getPublisherVerification; analyzeHistory consumes it
  behind an optional reader and emits a publisher-verification history finding with
  issuer/handle specifics in privateDetail only. The aggregator read has its own
  try/catch so a failure never discards the own-D1 findings.

The second slice-3 input, recent handle/profile changes, is not built: the
aggregator keeps only current profile state (publishers is upserted) and does not
ingest the atproto identity events that carry handle changes, so no change history
exists to expose. Blocked on ingestion, not a read path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…slice 3 review)

Each verification claim is authored by its issuer's repo, so a subject-keyed
lookup could resurface a taken-down issuer's vouch. Hydrate labels for the
subject DID and every distinct issuer DID in one batched call; a redacted
subject 404s the whole view, a redacted issuer drops only its own claim. A
blank accept-labelers header (the internal labeler read) has an empty accepted
set, so nothing is filtered and every claim is seen.

Also correct the shipped docs: the read is NOT indistinguishable from absence
(a non-redacted DID returns 200, possibly with an empty verifications array;
only a redacted subject 404s), and it returns claims regardless of expiry —
expiresAt is present for the consumer to evaluate in-force state, not a
server-side filter.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ascorbic
ascorbic force-pushed the feat/labeler-history-aggregator branch from 759afbe to ae43eaa Compare July 16, 2026 13:06
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/needs-review No maintainer or bot review yet needs-rebase labels Jul 16, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Jul 16, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a re-review of W8.4 slice 3, which adds the read-only aggregator query for publisher verification claims (com.emdashcms.experimental.aggregator.getPublisherVerification) and wires it into analyzeHistory as operator-only history context.

Approach judgment: The change is still the right thing for the integration branch. It delivers exactly the one slice-3 input that is buildable now (verification state) and honestly leaves the other input (recent handle/profile changes) as a documented seam because the aggregator does not ingest a change history. The per-issuer redaction design is correctly implemented, the internal labeler read opts out of default redaction with the blank atproto-accept-labelers header, and the fail-safe posture (aggregator failure is isolated in its own try/catch so it never discards own-D1 findings) is preserved.

What I checked:

  • New aggregator route, lexicon definitions, generated types, and router registration.
  • SQL uses bound parameters and constant column lists; the partial index on publisher_verifications(subject_did) already supports the read query.
  • Per-issuer redaction behavior and the blank-header unfiltered read path.
  • AggregatorClient.getPublisherVerification wiring and error contract.
  • analyzeHistory integration, the new publisher-verification history category, and validateFinding admission.
  • Tests for ordering, tombstone filtering, redaction (subject and issuer), blank-header unfiltered reads, failure isolation, and binding transport.
  • AGENTS.md conventions: no admin UI strings, no ec_* locale filter needed, additive changeset for the published registry-lexicons package, and apps are private so no additional changeset is required.

Headline conclusion: The slice remains clean and consistent with the integration-branch conventions and ratified design. The prior approval still holds. The only issue I found is a contradictory inline comment about whether a redacted subject is distinguishable from an unverified one.

Comment on lines +79 to +80
// A redacted publisher DID hides the whole view — the caller can't tell it
// apart from an empty result, which is the point of redaction.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] The inline comment contradicts the route's documented behavior (and the actual code): this endpoint returns 404 NotFound for a redacted subject DID but 200 with an empty verifications array for a non-redacted, unverified DID, so the two are intentionally distinguishable.

Suggested change
// A redacted publisher DID hides the whole view — the caller can't tell it
// apart from an empty result, which is the point of redaction.
// A redacted publisher DID hides the whole view as NotFound. This is
// distinct from a non-redacted, unverified DID, which returns 200 with an
// empty verifications array — only the subject's claim state is concealed.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Jul 16, 2026
@ascorbic
ascorbic merged commit 9501d61 into feat/plugin-registry-labelling-service Jul 16, 2026
13 checks passed
@ascorbic
ascorbic deleted the feat/labeler-history-aggregator branch July 16, 2026 13:12
@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-rereview New commits since the last review labels Jul 16, 2026
@ascorbic ascorbic mentioned this pull request Jul 16, 2026
60 of 81 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: signed review/approved Approved; no new commits since size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant