Repository navigation
Conversation
Replace the orchestrator's stub resolvePolicyOutcome with the real spec-§9.9 resolver in policy-resolver.ts. Deterministic/capability findings citing an automated-block category block at any severity; model/image findings block only at critical; history findings never produce labels. Warning labels issue at any severity, including alongside blocking labels. assessment-passed issues whenever nothing blocks — including on warned outcomes, which install-eligibility clients gate on. Labels dedupe per category with highest-severity aggregation, ordered blocking → warnings → assessment-passed in first-citation order, and only labels permitting automated release issuance are ever machine-proposed. Adds a supersession regression test pinning that a blocking run negates a prior warned run's assessment-passed.
|
Scope checkThis PR changes 591 lines across 4 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 | 374106e | Jul 13 2026, 07:03 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 374106e | Jul 13 2026, 07:03 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-do | 374106e | Jul 13 2026, 07:05 AM |
There was a problem hiding this comment.
This is the right change at the right place: it implements plan item W8.5 by replacing the orchestrator's stub resolvePolicyOutcome with a real, pure, versioned policy resolver in apps/labeler/src/policy-resolver.ts. Keeping the resolver stateless while the orchestrator continues to own persistence, negation, and staleness matches the labeler's architecture.
What I checked:
- Source/severity blocking bar: deterministic/capability block at any severity; model/image only at critical; history is excluded. This matches the PR description and existing
FindingSourcetypes. - Warning + pass coexistence is correctly implemented: warned outcomes include both the warning label(s) and
assessment-passed. - Blocked outcomes include warnings but not
assessment-passed. - Dedup and severity aggregation are deterministic and first-citation ordered.
- The defensive issuance filter (
permitsAutomatedRelease) only permits labels that allow automated issuance on a release subject. - Supersession regression test correctly asserts that a subsequent blocking run negates the stale
assessment-passedfrom a warned run. - No AGENTS.md violations: this touches only the private
apps/labelerworker (no admin UI, no SQL, no i18n, no published package, no public API change). - Export move from orchestrator to resolver is safe: no other module imports the moved types.
I found no blocking issues. The one pre-existing divergence the author flagged—validateAutomatedProposal still requiring critical for automated-block labels while finalize bypasses it—is correctly left for a follow-up Discussion.
One minor test-gap suggestion: the resolver matrix covers deterministic, model, image, and history sources, but does not exercise the capability source that the description lists as blocking at any severity. Adding that test would pin the behavior explicitly.
| } | ||
|
|
||
| describe("resolvePolicyOutcome: blocking", () => { | ||
| it("blocks on a deterministic finding at any severity", () => { |
There was a problem hiding this comment.
[suggestion] The resolver matrix tests deterministic, model, image, and history sources, and the PR description explicitly calls out capability findings as blocking at any severity. Consider adding a capability analogue to the deterministic test so the spec-correct behavior is pinned, e.g.:
it("blocks on a capability finding at any severity", () => {
const outcome = resolvePolicyOutcome(
[finding({ source: "capability", category: "undeclared-access", severity: "low" })],
MODERATION_POLICY,
);
expect(outcome.toState).toBe("blocked");
expect(outcome.labels).toEqual([
{ val: "undeclared-access", findingCategory: "undeclared-access", severity: "low" },
]);
});e32710a
into
feat/plugin-registry-labelling-service
What does this PR do?
Adds the labeler's versioned policy resolver — plan item W8.5, spec §9.9 steps 4–7. Replaces the orchestrator's stub
resolvePolicyOutcome(marked "W7/W8 replace this with the real policy engine") with the real resolver inpolicy-resolver.ts, consuming validatedNormalizedFinding[](W8.1) under the versionedModerationPolicy.Resolution rules:
deterministic/capabilityfindings citing anautomated-blockcategory block at any severity — deterministic adapters only cite a block category when the condition definitively holds, so the category is the assertion.model/imagefindings block only atcritical(spec step 5's bar for AI judgment).historyfindings never produce labels (plan W8.4: history may recommend review but cannot label).assessment-passedissues whenever nothing blocks — including on warned outcomes. Spec: "An assessment may pass and warn at the same time." This is a behavioral fix over the stub, and it matters: clients gate installability on an activeassessment-passed(feat(registry): enforce moderation labels in clients #1972), so warned-but-passing releases must carry it. A new supersession regression test pins the security-critical inverse — a blocking run negates a prior warned run'sassessment-passed(the negation query has no category filter, so eligibility labels negate like descriptive ones; the test guards against a future "optimization" quietly changing that into an install-eligibility bypass).assessment-passed.severity= highest among citing findings; deterministic ordering (blocking → warnings →assessment-passed, first-citation order within groups).subjectRulespermitautomatedissuance on areleasesubject can be machine-proposed — a defensive layer on top of W8.1 validation.No confidence thresholds are introduced — the spec doesn't define them; that's future policy-version material.
Reviewer note (pre-existing, out of scope):
validateAutomatedProposalinservice.ts(used by the standaloneissueAutomatedAssessmentLabelpath, not byfinalize) requirescriticalseverity for automated-block labels, which now disagrees with the resolver's spec-correct any-severity-deterministic rule. Nothing routes finalize through it today; flagged for a follow-up Discussion rather than changed here.The orchestrator diff is exactly the stub + type deletion and the import swap; lifecycle steps 1–3/8–11 (staleness, retries, negation, persistence) are untouched. No migration, no lexicon change, no public-API change.
Reviewed with an opus adversarial pass that traced the warned→blocked supersession path end-to-end (no hole — and it drove the regression test that now pins it).
Targets
feat/plugin-registry-labelling-service. 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 and changeset are n/a — this touches only
apps/labeler, a private, unpublished Worker app (no admin UI, not on npm).AI-generated code disclosure
Screenshots / test output
pnpm --filter @emdash-cms/labeler test: 274 pass (18 files) — 12 new resolver-matrix tests (source×severity×category blocking bars, history exclusion, pass+warn coexistence, blocked+warn, dedup/severity aggregation, issuance filter, ordering determinism) + 3 orchestrator tests (warned issuesassessment-passed; blocked issues warnings without it; warned→blocked supersession negates the staleassessment-passed)pnpm lint:jsondiagnostics unchanged at 19 (0 inapps/labeler)