Problem / context
test/wrapper.test.ts and test/core.test.ts have grown into oversized catch-all files.
That no longer fits the repository's vertical-slice direction. A substantial amount of command-owned behavior is still tested in broad cross-cutting files instead of living with the slice that owns the behavior. That weakens ownership, makes refactors noisier, and makes it harder to see what is truly cross-cutting versus what belongs to a single command slice.
This refactor should move tests toward thinner, more self-sufficient vertical slices while keeping only genuinely shared runtime-boundary behavior in shared test locations.
Desired outcome
Move command-owned tests into the relevant slices where that makes sense, and replace the giant cross-cutting test files with smaller, specifically named files organized by concern so implementation does not have to guess the intended structure.
Scope
In scope
- reduce or eliminate
test/wrapper.test.ts as a large catch-all file
- reduce or eliminate
test/core.test.ts as a large catch-all file
- move command-owned behavior tests into the relevant command slices under
src/commands/...
- treat the following placement rule as required guidance, not an implementation guess:
- put tests with the owning slice when they verify:
- command validation
- command-specific request shaping
- command-specific response shaping
- command-specific success/failure paths
- keep tests outside slices only when they verify:
- wrapper / OpenCode boundary behavior
- caller / context resolution
- config / auth path forwarding
- runtime routing
- shared auth / config loading behavior
- shared error envelopes
- split remaining shared coverage into multiple concern-oriented files under locations such as
test/wrapper/ and test/core/
- use explicit concern-based names for shared test files rather than broad layer-bucket names
- acceptable naming style examples include:
test/wrapper/opencode-context.test.ts
test/wrapper/path-overrides.test.ts
test/wrapper/wrapper-logging.test.ts
test/core/runtime-routing.test.ts
test/core/shared-error-mapping.test.ts
test/core/auth-config-loading.test.ts
- preserve or improve current behavior coverage during the refactor
Out of scope
- redesigning runtime architecture
- changing public command behavior
- reducing meaningful coverage just to make files smaller
- broad test-framework changes unrelated to this refactor
Acceptance criteria
Docs impact
- Docs impact: none
- Details: test organization refactor only unless implementation reveals durable guidance worth documenting
ADR needed?
- ADR needed: no
- Details: this is a refactor to better align tests with the existing vertical-slice direction rather than a new architecture decision
Dependencies / sequencing notes
- keep this as a single issue on purpose to avoid repeated Greg/Klarissa handoff overhead and context loss across one tightly related refactor
- command-specific tests should continue following the existing slice-local pattern already established in
src/commands/...
- small scoped helpers are acceptable when they support a clear concern, but do not replace giant files with one giant shared helper module
Risks / open questions / non-goals
- avoid replacing two giant files with one new giant file or one vague shared test bucket
- avoid moving truly shared behavior into slices where ownership would become misleading
- preserve meaningful behavior coverage while improving structure and ownership clarity
Problem / context
test/wrapper.test.tsandtest/core.test.tshave grown into oversized catch-all files.That no longer fits the repository's vertical-slice direction. A substantial amount of command-owned behavior is still tested in broad cross-cutting files instead of living with the slice that owns the behavior. That weakens ownership, makes refactors noisier, and makes it harder to see what is truly cross-cutting versus what belongs to a single command slice.
This refactor should move tests toward thinner, more self-sufficient vertical slices while keeping only genuinely shared runtime-boundary behavior in shared test locations.
Desired outcome
Move command-owned tests into the relevant slices where that makes sense, and replace the giant cross-cutting test files with smaller, specifically named files organized by concern so implementation does not have to guess the intended structure.
Scope
In scope
test/wrapper.test.tsas a large catch-all filetest/core.test.tsas a large catch-all filesrc/commands/...test/wrapper/andtest/core/test/wrapper/opencode-context.test.tstest/wrapper/path-overrides.test.tstest/wrapper/wrapper-logging.test.tstest/core/runtime-routing.test.tstest/core/shared-error-mapping.test.tstest/core/auth-config-loading.test.tsOut of scope
Acceptance criteria
test/wrapper.test.tsandtest/core.test.tsare moved into the relevant slices where appropriatecore.test.tsorwrapper.test.tsDocs impact
ADR needed?
Dependencies / sequencing notes
src/commands/...Risks / open questions / non-goals