Repository navigation
Description
Seam verification for prose→tool migrations: registration surface, golden output-shape, and round-trip tests (DE-007)
Related: #659 (token-reduction epic), #758 (DE-005/DE-006 — numbering dependency), #735 (first application of Layer 2), #716 (the migration that surfaced the defect class). Provenance: learnings determinism-20261016T202416 (drift tests only pin what they explicitly assert) and review-dispatch-20261014T165445 (learnings flag defects that persist in merged candidates).
Summary
Since #674, the closed-issue stream is dominated by one defect class: breakage at the seams the prose→tool migration created, found in live use rather than by any verification layer. The migration moved code across the prose/tool boundary; verification stayed behind. Unit tests verify tool interiors (DI'd execute paths), the review council reasons statically about diffs, and the plugin smoke tests assert tool names only — never their schema surfaces (.opencode/test/uf-workflow.test.ts:133, uf-finale.test.ts:80). Nothing executes the seams.
This issue adds three mechanical test layers that verify the seams, and codifies them as determinism rule DE-007 so every future migration increment ships them.
Evidence
| Issue | Defect | Seam | Caught by |
|---|---|---|---|
| #732 | parameters: vs SDK args: — empty schemas exposed to the model; hard break in two consecutive finales |
tool ↔ SDK registration | Layer 1 |
| #735 (open) | triage-issue prose documents findings/proposals/warnings arrays that dispatch_review_runs does not return |
prose ↔ tool output contract | Layer 2 |
| #707/#737 | unleash-summary artifact never written; command-layer invocation unpinned while suite stayed green | writer tool ↔ reader command | Layer 3 |
| #693 | advisor runs with empty profiles resolved no model | dispatch ↔ model resolution | Layer 2, where prose documents the behavior |
| #685 | console.debug surfaced in the OpenCode UI |
plugin ↔ host output channel | adjacent (no-console lint, see Out of scope) |
| #687/#688 | phantom files in review diff from stale local main |
prose git recipe ↔ environment | adjacent (DE-001 completion + staleness guard) |
| #712 | gh api --slurp + --jq flags incompatible; triage ingestion halted |
prose shell incantation ↔ CLI reality | adjacent (DE-001 completion) |
Three layers catch the three highest-impact classes mechanically; the adjacent classes are DE-001 completion work already governed by the existing rule (prose incantations are untested code that belongs in scripts/tools) plus one lint and one staleness guard, deliberately kept out of this issue's scope.
The three test layers
Layer 1 — Registration surface test (catches #732 class)
What: For every registered tool in every plugin (uf-workflow, uf-finale, review-dispatch, invoke-agent), assert through the SDK's actual registration path that:
- The exposed parameter schema is non-empty exactly when the tool declares parameters (empty == empty is correct —
resolve_base_reftakes none) - The exposed schema's keys are in parity with the keys the execute path validates (the zod shape)
- A factory that regresses to a mis-keyed or non-zod declaration (
parameters:plain objects, the uf-workflow and uf-finale tools expose empty parameter schemas to the model (parameters: vs SDK args: mismatch) #732 root cause) fails the suite
Where: extend the plugin smoke tests (uf-workflow.test.ts, uf-finale.test.ts) or add registration-surface.test.ts; run under make plugin-test. Mechanism note for the implementer: @opencode-ai/plugin 1.4.10's tool() helper expects args: z.ZodRawShape and silently ignores anything else — the test must assert on what the SDK actually exposes (or on the structural presence of a valid args shape per tool), not on the factory's self-description. The #732 issue body documents the exact failure mechanism.
Proof bar: the test must fail if any factory reverts to its pre-#732 declaration form.
Layer 2 — Golden output-shape contract tests (catches #735 class)
What: Every output-format example preserved in command prose (the DE-002 arrow-notation examples: Call <tool> with <input> → {consumed fields}) is pinned by a test that executes the tool with DI'd dependencies and asserts the documented fields are present in the returned envelope.
Where: alongside the existing per-tool vitest files in .opencode/test/.
Discovery: enumerate documented examples by scanning command markdown for the arrow-notation pattern; each hit names a tool and its consumed fields. A small script or an in-test fixture list is sufficient — a prose-lint that requires a golden test per example is an optional enhancement, not a gate.
First application forces #735 to resolve: the golden test for dispatch_review_runs fails until either the tool returns the documented arrays or the prose is corrected — test and prose must agree, which is the entire point. File the direction decision (change tool or change prose) under #735.
Layer 3 — Writer↔reader round-trips and command-layer pins (catches #707/#737 class)
What:
- Artifact round-trips: artifact-producing tools tested against their consumers end-to-end —
write_unleash_summary→uf_finale_pr_contextread path (field survival through the sharedsanitizeSlugderivation and JSON round-trip);finalize_review_dispatchartifact →uf_unleash_detect_resumeparse path. - Command-layer invocation pins (the four from learning
determinism-20261016): for each tool invocation a command depends on, pin (a) the invocation's presence within the consuming step's span, (b) the named parameters that define the input contract, (c) absence of superseded tool names, (d) the count of removed ceremony markers. Go tests ininternal/scaffold/following the existingTestUnleashCommand_*precedent; the byte-identical scaffold mirror means one command-text assertion covers canonical and embedded copies.
Known gap to close first: per the learning, the write_unleash_summary invocation in uf.unleash Step 10 is currently unpinned — deleting it or reverting to the superseded persist_unleash_summary 3-argument shape keeps the suite green. That pin is the acceptance proof for this layer.
DE-007 — the increment checklist as a pack rule
Add to .opencode/uf/packs/determinism.md (draft text):
- **DE-007** [MUST] A prose→tool migration increment MUST verify the
seams it creates in the same increment: (1) registration surface —
every new or modified tool exposes a parameter schema through the
plugin SDK's registration path in parity with its execute-path
validation; (2) documented output shape — every output-format
example preserved in instruction text (DE-002) is pinned by a
contract test asserting the tool returns that shape; (3)
round-trips — artifact-producing tools are tested against their
consumers, and command-layer invocations are pinned for presence,
named parameters, superseded-name absence, and ceremony-marker
count. A migration increment whose seam tests are red or absent
is not complete.Pack changes:
- Severity-mapping sentence gains DE-007 in the MUST/CRITICAL list
- Version bump: 1.1.0 → 1.2.0 if Codify intent-level orchestration (Router Pattern) as determinism rules DE-005/DE-006 #758 (DE-005/DE-006) lands first; if this change lands first, take DE-005 and version 1.1.0, and adjust Codify intent-level orchestration (Router Pattern) as determinism rules DE-005/DE-006 #758's numbering — state the final IDs in whichever change lands second
determinism-first/SKILL.md"Related Enforcement" range extends to the final rule count- Authoring-time hook: when writing tasks.md for a migration increment, include a seam-verification task naming the three layers — this is the checklist's tasks-template form
Retroactivity: none required, per the pack's own migration rule (existing prose migrates opportunistically). The in-flight migrations — #757 (Step 6 lifecycle), #664 (post_github_review), and #758's own follow-on migrations — MUST apply DE-007 when they land.
Out of scope (adjacent follow-ups, not this issue)
- review-dispatch plugin console.debug output surfaces in OpenCode UI #685 class:
no-consolelint (or SDK-logger migration) for plugin code - review-council: local review diff includes phantom files when local main is behind upstream #687 class: base-ref staleness guard (fetch + behind-count check) before local review diffs
- fix: correct incompatible gh api flags in uf.triage-issue #712 class: extracting the remaining prose shell incantations to scripts — DE-001 completion, already governed
- The learning-recipe review phase (score learnings naming diff files as findings) — separate governance change if wanted
Acceptance criteria
- Layer 1: registration surface test covering all 4 plugins × all registered tools, with schema-parity and empty-when-no-params semantics; verified to fail on the pre-uf-workflow and uf-finale tools expose empty parameter schemas to the model (parameters: vs SDK args: mismatch) #732 declaration form
- Layer 2: golden output-shape tests for every arrow-notation example in command prose; the
dispatch_review_runscase drives uf.triage-issue: command spec documents dispatch data flows the tools do not return #735 to resolution (tool returns documented shape, or prose corrected and test matches) - Layer 3: round-trip tests for both artifact pairs + the four command-layer pins, including the currently-unpinned
write_unleash_summaryinvocation - DE-007 in
determinism.mdwith severity mapping and version bump; SKILL.md range updated; numbering coordinated with Codify intent-level orchestration (Router Pattern) as determinism rules DE-005/DE-006 #758 -
make plugin-testandmake testgreen; no scaffold-mirror changes (pack and skill are repo-local; tests live in.opencode/test/andinternal/scaffold/) - DE-004 evidence: defect-to-layer matrix (above) reproduced in the change record with before/after test counts
Spec workflow
OpenSpec change (opsx/seam-verification or similar), modeled on determinism-codification: code + tests + one pack rule in a single change, spec delta pinning DE-007's ID/severity the way that change pinned DE-001..DE-004.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
test: pin seam-verification test layers and DE-007 pack rule
test: pin seam-verification test layers and DE-007 pack rule
test: pin seam-verification test layers and DE-007 pack rule