Repository navigation
feat(labeler): code-AI and history stage wiring + dead-stage removal (slice A) - #2090
Conversation
…(slice A) Adapts the built analyzeCode/analyzeHistory analysis modules to the orchestrator's StageAdapter contract, following the createAcquireStage closure idiom. Pure additions this slice: buildStages, the production deploy gate, and executeAssessmentInstance are untouched — the gate stays down until the acquire consumer (release resolution + SSRF-hardened egress + image-metadata extraction) lands and the pipeline can genuinely run end-to-end. - assessment-stages.ts: createCodeAiStage (decoded bundle files + capabilities-only declared surface matching the calibration input shape; ModelTransientError converted to StageTransientError so a flaky model retries and can never finalize a spurious pass) and createHistoryStage (thin over the best-effort analyzeHistory), plus the per-run CoverageAccumulator and serializeCoverage. - assessment-orchestrator.ts: the deterministic and dependency stages are removed (ratified cut: plugins are dependency-free and the sandbox enforces declared access, so those stages have no work); a resolveCoverageJson seam stamps coverage atomically with the finalization CAS; the stale label-leak comment now reflects the requireAssessmentState gate that already closes the window (#2072). - tests: full runAssessment integration over a fake AiBinding/aggregator and real bundle fixtures — block/warn/clean outcomes, transient exhaustion finalizing error not passed, partial coverage propagation, acquire-failure short-circuit, and history best-effort. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | dbe8847 | Jul 17 2026, 12:19 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-do | dbe8847 | Jul 17 2026, 12:20 PM |
Scope checkThis PR changes 660 lines across 6 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-playground | dbe8847 | Jul 17 2026, 12:20 PM |
There was a problem hiding this comment.
This slice is the right change at the right time. It adapts the two analysis modules whose inputs already exist (code-AI and publisher-history) to the orchestrator’s StageAdapter contract, removes the stages ratified as dead, and keeps the production deploy gate closed — all consistent with the umbrella (#1909 / RFC #694) integration plan. The wiring follows the same per-run closure idiom as createAcquireStage, the transient-error mapping preserves the important “flaky model calls can never finalize a spurious pass” invariant, and the coverage seam is stamped atomically via the existing finalization CAS + COALESCE path.
I read the full diff, the changed source files, the related adapter/store/service modules, and searched the labeler tree for leftover references to the removed stages. I did not run the test suite/linter/builds (no shell); the author reports 788/788 with 7 new stage-wiring tests, and the new tests statically cover block, pass, warn, transient-exhaustion, partial coverage, acquire-with-no-bundle, and best-effort history. No SQL-injection vectors, authorization holes, content-table locale bugs, or published-package changesets are introduced. @emdash-cms/plugin-types is newly consumed but not modified, and @emdash-cms/labeler is private, so the author’s “no changeset” rationale holds.
Only one non-blocking item: the module-level docblock in assessment-orchestrator.ts still lists the removed deterministic/dependency stages as future work. It should be updated to match the new OrchestratorStages shape so the next slice’s implementer isn’t misled.
Findings
-
[suggestion]
apps/labeler/src/assessment-orchestrator.ts:10-12The module-level docblock still describes the future stage set as including
deterministic validationanddependency/SBOM, but this PR removes bothdeterministicanddependencyfromOrchestratorStagesandSTAGE_ORDER. That drift is harmless to runtime behavior but will mislead whoever wires the acquire-consumer slice next.* orchestrator per run and calls `runAssessment`. Until W7/W8 supply the real stage adapters * (acquire, code/metadata AI, image AI), that wiring runs `stubStages` — every stage resolves with no findings, so
The module comment still listed the removed deterministic/dependency stages as pending real adapters. Addresses the emdashbot review suggestion on #2090. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Docblock aligned (commit 1e1a118) — the orchestrator's module comment now describes the reduced stage set (acquire, code/metadata AI, image AI, history) and points the stub note at the acquire-consumer slice rather than the removed deterministic/dependency stages. ~ 🤖 Claude Fable 5 |
There was a problem hiding this comment.
Re-review: the prior stale-docblock finding is fixed, and the slice remains the right change at the right time.
This PR adapts the two analysis modules whose inputs already exist — the code-AI adapter and publisher-history context — to the orchestrator’s StageAdapter contract, removes the deterministic and dependency stages ratified as dead, and leaves the production deploy gate down. That matches the umbrella (#1909 / RFC #694) plan and the integration-branch target. The wiring follows the same per-run closure idiom as createAcquireStage, ModelTransientError is correctly promoted to StageTransientError so flaky model calls can never finalize a spurious pass, and the coverage seam is written atomically through the existing finalization CAS + COALESCE path.
What I checked
- Read the full diff and the head versions of the changed files (
assessment-orchestrator.ts,assessment-stages.ts, the migrated orchestrator tests, and the new stage-wiring tests). - Traced the new stage factories through
code-ai-adapter.ts,history-context.ts,artifact-acquisition.ts,assessment-store.ts, andpublic-assessment.ts. - Searched the labeler tree for leftover references to
deterministic/dependencystages. - Verified the prior finding in the
assessment-orchestrator.tsmodule docblock was updated.
The code is otherwise clean: no SQL-injection vectors, no authorization holes, no content-table locale bugs, and no published-package changeset is required (@emdash-cms/labeler is private; the new @emdash-cms/plugin-types dependency is only consumed, not modified).
Only two small pieces of prose drift remain — one in a file this PR intentionally left byte-untouched, and one in a migrated test block. Both are comment/test-label cleanups, not runtime issues.
Findings
-
[suggestion]
apps/labeler/src/assessment-workflow.ts:117-118The
buildStagesdocblock still describes the future real adapters as includingdeterministic/dependency/AI scanning, but this PR removesdeterministicanddependencyfromOrchestratorStagesandSTAGE_ORDER. Since the acquire-consumer slice will wireacquire,codeAi,imageAi, andhistoryhere, the comment should match the new stage set so the next implementer doesn’t resurrect dead stages.* adapters attach here in the acquire-consumer follow-on — acquire (via the aggregator * client), code/metadata AI, image AI, and publisher history; today -
[suggestion]
apps/labeler/test/assessment-orchestrator.test.ts:456This describe block was migrated from the old
deterministicstage tocodeAi, but the label still says "permanent deterministic failure". The stage that now emits the permanentartifact-integrity-failurefinding is the acquire stage; this test injects it throughcodeAipurely as a harness. Renaming the block removes the stale stage name and avoids confusion.describe("AssessmentOrchestrator: permanent blocking finding", () => {
…label Addresses the two prose-drift suggestions in the emdashbot re-review of #2090: the buildStages docblock and a migrated test describe block still named the removed deterministic/dependency stages. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Both prose-drift suggestions applied (commit 90c3d73): the ~ 🤖 Claude Fable 5 |
There was a problem hiding this comment.
Re-review: prior suggestions are fixed; one stale plan-code drift remains
Approach judgment — The slice is still the right change at the right time. Adapting the existing code-AI adapter and publisher-history module to the orchestrator's StageAdapter contract, removing the ratified-dead deterministic and dependency stages, adding the CoverageAccumulator seam, and leaving the production deploy gate down matches the umbrella plan (#1909 / RFC #694) and the integration branch target. The wiring preserves the pure analysis modules, the per-run closure idiom, and the transient-never-passes invariant.
What I checked
- Read the updated diff and the head versions of
assessment-stages.ts,assessment-orchestrator.ts,assessment-workflow.ts, the migrated orchestrator tests, and the new stage-wiring tests. - Verified the two previous
emdashbot[bot]findings are resolved:assessment-workflow.ts:117-118buildStagesdocblock now listsacquire,code/metadata AI,image AI, andpublisher historywith no dead stages.assessment-orchestrator.test.ts:456describe block is renamed toAssessmentOrchestrator: permanent blocking finding.
- Searched the labeler tree for leftover
deterministic/dependencystage references — none found. - Traced the coverage seam through
serializeCoverage,buildFinalizationStatements(COALESCE path), andpublic-assessment.tsto confirmdroppedFilesdoes not leak to the public view and that no coverage is written on the stale/cancel paths. - Confirmed
@emdash-cms/plugin-typesis a workspace dependency on the private labeler app, so no changeset is required.
Headline conclusion
The code is otherwise clean: no logic bugs, no authorization or SQL-injection issues, no content-table locale concerns, and the transient-error classification is correct. One piece of prose drift remains in assessment-workflow.ts: the DEPLOY GATE comment and the production deploy-gate error message still reference the old W7/W8 plan codes, even though the rest of the slice now calls the remaining work the acquire-consumer slice. Since the file is already edited for this re-review, updating those two references would make the guard comment and the runtime error message consistent with the current plan.
Findings
-
[suggestion]
apps/labeler/src/assessment-workflow.ts:12The DEPLOY GATE comment still references the old
W7/W8plan codes. The rest of this PR now scopes the remaining gate-lifting work as the acquire-consumer slice, and thebuildStagesdocblock below has already been updated to that terminology. KeepingW7/W8here makes the guard comment inconsistent and harder to map to the current plan for the next implementer.* stages (acquire-consumer slice) land; shipping it live before then would vouch for everything. -
[suggestion]
apps/labeler/src/assessment-workflow.ts:132The production deploy-gate error message still tells the operator to "Wire the real analysis stages (W7/W8) before deploying."
W7/W8is no longer the active plan name; this slice scopes the remaining work as the acquire-consumer slice. The runtime error should use the current term so it stays actionable when that slice eventually removes the gate."AssessmentWorkflow has only stub stages in a production build — refusing to issue assessment-passed for unscanned subjects. Wire the real stage adapters (acquire-consumer slice) before deploying.",
…-consumer slice Last prose-drift item from the emdashbot re-review of #2090: the DEPLOY GATE comment and the production-gate error message still cited the W7/W8 plan codes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Last prose-drift item applied (commit dbe8847): the DEPLOY GATE docblock and the production-gate error message now name "the acquire-consumer slice" instead of the W7/W8 plan codes, consistent with the rest of the slice. ~ 🤖 Claude Fable 5 |
There was a problem hiding this comment.
Approach judgment — This slice is the right change at the right time. It adapts the existing code-AI adapter and publisher-history analysis modules to the orchestrator's StageAdapter contract, removes the ratified-dead deterministic and dependency stages, adds a bounded CoverageAccumulator seam, and keeps the production deploy gate firmly down. That matches the umbrella plan (#1909 / RFC #694) and the integration branch target.
Re-review status — The two prior emdashbot[bot] findings are resolved:
apps/labeler/src/assessment-workflow.tsno longer mentionsW7/W8; the DEPLOY GATE comment and the production build error message now use the current acquire-consumer slice terminology.apps/labeler/test/assessment-orchestrator.test.tsdescribe block is renamed toAssessmentOrchestrator: permanent blocking finding.
What I checked
- Read the updated diff and the head versions of
assessment-stages.ts,assessment-orchestrator.ts,assessment-workflow.ts,code-ai-adapter.ts,history-context.ts, the migrated orchestrator tests, and the new stage-wiring tests. - Verified the stage set in
assessment-orchestrator.tsis justacquire → codeAi → imageAi → history, with no leftover deterministic/dependency stage references in the orchestrator or workflow. - Traced the coverage seam through
serializeCoverage,buildFinalizationStatements(COALESCE path), andpublic-assessment.ts:droppedFilesis stored in the row but is dropped by the public serializer, so it never reaches the public assessment view. - Confirmed transient model failures become
StageTransientErrorand cannot finalize aspassed; persistent model failures finalize aserror(verified by tests). - Confirmed
@emdash-cms/plugin-typesis a workspace-only dependency on the private labeler app, so no changeset is required for a published package. - Checked AGENTS.md conventions: no admin UI strings (server-only), no new content-table queries, no SQL interpolation, no authorization changes, no index/schema changes.
Headline conclusion
The code is clean. I found no logic bugs, no security or authorization regressions, no SQL-injection risk, no content-table locale concerns, and no remaining AGENTS.md violations. The prior prose drift is fixed, the gate remains intact, and the transient-never-passes invariant is preserved.
5d8f775
into
feat/plugin-registry-labelling-service
What does this PR do?
Slice A of the production-stage wiring for the labeler's assessment pipeline (RFC #694, umbrella #1909). Targets the
feat/plugin-registry-labelling-serviceintegration branch.The orchestrator has run deploy-gated stub stages since #1978. This slice adapts the two built analysis modules whose inputs already exist — the code-AI adapter and the publisher-history context — to the orchestrator's
StageAdaptercontract, and removes the two stages that a ratified scope decision made permanently dead. The production deploy gate does not lift here: scoping found the acquire stage has no production consumer (its release-resolution and SSRF-hardened egress don't exist yet), so a production build still refuses to run — the gate lifts only in the follow-up "acquire consumer" slice when the pipeline can genuinely run end-to-end.buildStages/executeAssessmentInstanceare byte-untouched.assessment-stages.ts(new):createCodeAiStage— reads the acquired bundle's decoded files + a capabilities-only declared surface (matching the calibration input shape; allowedHosts are runtime-enforced, not a moderation signal) and runsanalyzeCode; aModelTransientErrorbecomes aStageTransientErrorso a flaky model call retries and can never finalize a spurious pass.createHistoryStage— thin over the best-effortanalyzeHistory. Plus the per-runCoverageAccumulatorand its serializer.deterministicanddependencycome out of the stage set (ratified 2026-07-17: plugins are dependency-free and the workerd sandbox enforces declared access at runtime, so scanner/capability stages have no work; integrity findings stay in the acquire stage).resolveCoverageJsonthunk stamps analysis coverage intocoverage_jsonatomically with the finalization CAS (existing COALESCE path). Production is unchanged this slice.requireAssessmentStategate from feat(labeler): production Workflow shell over AssessmentOrchestrator (#1978) #2072 already closes it. Comment-only; no behavior change.An adversarial review pass ran before this PR: no HIGH/blocking findings; the gate was verified byte-identical,
droppedFilespaths were verified unable to reach the public assessment view, and the transient-never-passes invariant is locked by a test. Two accepted items are documented for the acquire-consumer slice in the plan (threading the release record's description — the bundle manifest has none, so misleading-metadata/privacy-risk run near-inert until then, flagged as a calibration-input divergence; and the coverage-on-error semantics call).Part of #1909. Related to #694.
Type of change
Checklist
pnpm typecheckpasses (all three labeler projects)pnpm lintpasses (0 new diagnostics; repo baseline unchanged)pnpm testpasses (7 new stage-wiring integration tests over fake AI/aggregator + real bundle fixtures; 22 migrated orchestrator tests; full labeler suite 788/788)pnpm formathas been run@emdash-cms/labelerisprivate: true; the new@emdash-cms/plugin-typesdependency isworkspace:*on an app, no published-package change.AI-generated code disclosure
Screenshots / test output
Key cases: fake-AI malware finding →
blockedwith the label issued and noassessment-passed; clean response →passedwithcoverage.code: "complete"; persistent model failure → transient retries exhaust and finalizeerror, not a spurious pass; over-budget bundle →partialcoverage with the dropped file recorded; checksum-mismatch acquire → AI never invoked,blockedonartifact-integrity-failure; history-stage DB failure → run still finalizes normally.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-stage-wiring. Updated automatically when the playground redeploys.