You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: consolidate review-dispatch test helpers and plan plugin module extraction #769
Follow-up from the fix-review-dispatch-recovery review council (iteration 1, architect LOW findings). Two structural refactors deliberately deferred out of the fix loop:
Shared test helpers: .opencode/test/ now has seven files with locally-defined withBun copies (build-review-prompts, plugin-integration, submit-tools, dispatch-status, dispatch-review-runs, scratch-smoke, dispatch-recovery) and scratchProject defined locally in dispatch-recovery.test.ts. CS-004 requires extraction once identical logic exceeds two locations. Extract a shared helpers module under .opencode/test/ and import from all seven suites.
Plugin module extraction: .opencode/plugins/review-dispatch/index.ts reached 5,992 lines after fix-review-dispatch-recovery (schemas, persistence, recovery tools, dispatch, consolidation in one file), dual-maintained byte-identical with internal/scaffold/assets/opencode/plugins/review-dispatch/index.ts. Plan a module extraction (schemas / persistence / recovery / dispatch / consolidation) preserving the byte-identical twin contract — either generating the scaffold twin at build time or extracting modules in both copies in lockstep, with TestEmbeddedAssets_MatchSource drift tests enforcing parity.
The Divisor review panel assessed this issue as VALID — enhancement (objective) by a 5/5 persona majority (adversary, architect, guard, sre, testing).
Verified against current repository state
Item 1 — shared test helpers: the CS-004 violation persists, partially remediated since filing. A shared module now exists (.opencode/test/helpers/bun-runtime.ts:13 exports withBun; helpers/aggregate-dispatch-fixtures.ts exports makeScratchProjectFactory), and two of the seven originally-named suites (dispatch-status, dispatch-review-runs) have migrated to it. Six suites still define withBun locally (build-review-prompts.test.ts:20, plugin-integration.test.ts:38, submit-tools.test.ts:14, scratch-smoke.test.ts:23, dispatch-recovery.test.ts:29, and read-diff-chunk.test.ts:16 — a copy site that accreted after this issue was filed), and scratchProject remains locally defined in several suites. The remaining work is migration onto the existing helpers rather than extraction; a structural guard (for example, a test asserting no function withBun definitions outside helpers/) keeps the duplication from regenerating.
Item 2 — plugin module extraction: the claim has strengthened..opencode/plugins/review-dispatch/index.ts now measures 8,634 lines, up from 5,992 at filing. The byte-identical twin at internal/scaffold/assets/opencode/plugins/review-dispatch/index.ts and the TestEmbeddedAssets_MatchSource drift test (internal/scaffold/scaffold_test.go:96) define the parity constraint. The build-time-generation vs. lockstep-extraction decision is the governing design question and belongs in an OpenSpec design doc, because the build-time option re-points a governance gate.
Recommendation: split
The two refactors touch disjoint file sets and carry materially different risk profiles — item 1 is a mechanical, test-only migration with no twin-sync impact; item 2 is a production decomposition gated on an open design decision. The panel recommends splitting this issue into:
Migrate remaining test suites to shared helpers — move the six remaining local withBun and scratchProject copies onto helpers/bun-runtime.ts and helpers/aggregate-dispatch-fixtures.ts, with a guard against new local copies.
Plan review-dispatch plugin module extraction — a design-doc-first decomposition (schemas / persistence / recovery / dispatch / consolidation) that resolves the twin-contract strategy while keeping the drift test as the parity gate of record.
Similar issues
The duplicate search surfaced related but non-duplicate issues: #741 (decomposes the uf-workflow plugin — different file set, useful precedent for the twin-contract strategy), #771, #873, and #798 (unrelated).
Proposed label:enhancement
This triage was performed by the Divisor review panel.
Activity
jflowers commentedon Nov 2, 2026
Triage Summary
The Divisor review panel assessed this issue as VALID — enhancement (objective) by a 5/5 persona majority (adversary, architect, guard, sre, testing).
Verified against current repository state
Item 1 — shared test helpers: the CS-004 violation persists, partially remediated since filing. A shared module now exists (
.opencode/test/helpers/bun-runtime.ts:13exportswithBun;helpers/aggregate-dispatch-fixtures.tsexportsmakeScratchProjectFactory), and two of the seven originally-named suites (dispatch-status,dispatch-review-runs) have migrated to it. Six suites still definewithBunlocally (build-review-prompts.test.ts:20,plugin-integration.test.ts:38,submit-tools.test.ts:14,scratch-smoke.test.ts:23,dispatch-recovery.test.ts:29, andread-diff-chunk.test.ts:16— a copy site that accreted after this issue was filed), andscratchProjectremains locally defined in several suites. The remaining work is migration onto the existing helpers rather than extraction; a structural guard (for example, a test asserting nofunction withBundefinitions outsidehelpers/) keeps the duplication from regenerating.Item 2 — plugin module extraction: the claim has strengthened.
.opencode/plugins/review-dispatch/index.tsnow measures 8,634 lines, up from 5,992 at filing. The byte-identical twin atinternal/scaffold/assets/opencode/plugins/review-dispatch/index.tsand theTestEmbeddedAssets_MatchSourcedrift test (internal/scaffold/scaffold_test.go:96) define the parity constraint. The build-time-generation vs. lockstep-extraction decision is the governing design question and belongs in an OpenSpec design doc, because the build-time option re-points a governance gate.Recommendation: split
The two refactors touch disjoint file sets and carry materially different risk profiles — item 1 is a mechanical, test-only migration with no twin-sync impact; item 2 is a production decomposition gated on an open design decision. The panel recommends splitting this issue into:
withBunandscratchProjectcopies ontohelpers/bun-runtime.tsandhelpers/aggregate-dispatch-fixtures.ts, with a guard against new local copies.Similar issues
The duplicate search surfaced related but non-duplicate issues: #741 (decomposes the uf-workflow plugin — different file set, useful precedent for the twin-contract strategy), #771, #873, and #798 (unrelated).
Proposed label:
enhancementThis triage was performed by the Divisor review panel.