Skip to content

feat(registry): add moderation evaluator#1917

Merged
ascorbic merged 1 commit into
feat/plugin-registry-labelling-servicefrom
feat/labeller-08-moderation-core
Jul 10, 2026
Merged

feat(registry): add moderation evaluator#1917
ascorbic merged 1 commit into
feat/plugin-registry-labelling-servicefrom
feat/labeller-08-moderation-core

Conversation

@ascorbic

@ascorbic ascorbic commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds @emdash-cms/registry-moderation, the shared pure evaluator for accepted ATProto registry labels.

  • Reduces current label streams by (src, uri, val) with strict timestamp and collision handling.
  • Evaluates release eligibility across publisher, package, and release scopes.
  • Handles accepted sources, CID applicability, negation/expiry, warnings, overrides, manual blocks, and takedown redaction.
  • Moves the ratified moderation corpus into normal package test fixtures and includes the package in pnpm test:unit.

This is the first W1 implementation slice from #1909. It does not yet integrate aggregator, core, admin, CLI, or the labeller service.

Related to #1909 and #694.

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
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: RFC RFC: Decentralized Plugin Registry #694

Admin i18n is not applicable because this package has no user interface.

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: OpenCode with GPT-5.6-sol and independent review subagents

Screenshots / test output

  • pnpm build passes
  • pnpm --filter @emdash-cms/registry-moderation typecheck passes
  • pnpm --filter @emdash-cms/registry-moderation test: 51 passed
  • pnpm test:unit passes and includes registry-moderation
  • pnpm lint: 0 warnings and 0 errors
  • publint passes
  • pnpm changeset status resolves the initial package release to 0.0.1
  • git diff --check passes

attw --pack still crashes internally after publint succeeds. The identical crash is reproducible in existing @emdash-cms/registry-client; this PR does not add a package-specific workaround.


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/labeller-08-moderation-core. Updated automatically when the playground redeploys.

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b136ab7

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

This PR includes changesets to release 1 package
Name Type
@emdash-cms/registry-moderation 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 review/needs-review No maintainer or bot review yet size/XL labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Scope check

This PR changes 858 lines across 10 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

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 b136ab7 Jul 10 2026, 02:53 PM

@cloudflare-workers-and-pages

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 b136ab7 Jul 10 2026, 02:54 PM

@cloudflare-workers-and-pages

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 b136ab7 Jul 10 2026, 02:54 PM

@ascorbic
ascorbic merged commit 622b42f into feat/plugin-registry-labelling-service Jul 10, 2026
8 checks passed
@ascorbic
ascorbic deleted the feat/labeller-08-moderation-core branch July 10, 2026 14:55

@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 the right change in the right place: a small, shared pure evaluator for accepted ATProto registry labels that can be reused by the aggregator, registry client, and core handlers later. The implementation is well-scoped for a W1 slice and keeps broader integration out, matching the PR description and the labelling-service plan.

What I checked:

  • Source code (packages/registry-moderation/src/index.ts) line-by-line.
  • Unit tests and the ratified fixture corpus.
  • Sibling registry packages (registry-client, registry-lexicons) for workspace conventions.
  • The implementation spec for label vocabulary, subject rules, and consumer policy.

Headline conclusion: the evaluator logic is sound. Label reduction by (src, uri, val), timestamp ordering/collision detection, negation/expiry handling, CID applicability, source-local override suppression, manual-block precedence, and redaction flag handling all line up with the fixture policy and the spec’s v1 consumer rules. No blocking logic bugs, no AGENTS.md violations (this package has no UI, SQL, routes, or content-table queries), and the changeset/workspace wiring looks correct.

Only minor scaffolding nits: the package is missing the vitest.config.ts and README.md that every sibling registry package includes. Tests still run via vitest defaults, so this is non-blocking.

"default": "./dist/index.js"
}
},
"files": [

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] This package omits vitest.config.ts and README.md, which both sibling registry packages (registry-client, registry-lexicons) include.

Tests still execute via vitest defaults, but adding these files keeps the workspace consistent and documents the public API for consumers. Suggested additions:

vitest.config.ts:

import { defineConfig } from "vitest/config";

export default defineConfig({
	test: {
		environment: "node",
		include: ["tests/**/*.test.ts"],
	},
});

README.md: a short description of the package, exported API (evaluateReleaseModeration), and a note that it is the shared pure evaluator for the labelling service.

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-review No maintainer or bot review yet labels Jul 10, 2026
@ascorbic ascorbic mentioned this pull request Jul 10, 2026
81 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: signed review/awaiting-author Reviewed; waiting on the author to respond size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant