Skip to content

Decompose src/server/handlers/plot-plan-runs.test.ts (640 lines, furthe…#423

Merged
jayminwest merged 2 commits into
mainfrom
warren/run_gwekz26ek6vm
Jun 17, 2026
Merged

Decompose src/server/handlers/plot-plan-runs.test.ts (640 lines, furthe…#423
jayminwest merged 2 commits into
mainfrom
warren/run_gwekz26ek6vm

Conversation

@jayminwest

Copy link
Copy Markdown
Owner

Summary

test: decompose plot-plan-runs.test.ts below 500-line limit (warren-59db)

Run

  • Warren run: run_gwekz26ek6vm
  • Agent: pi
  • Cost: $0.800 (34 in / 15.2k out / 466.2k cache-r)

Seeds

  • warren-59db — Decompose src/server/handlers/plot-plan-runs.test.ts (640 lines, furthest-over grandfathered file not under an open seed) below the 500-line global limit. Extract the file-local helper/fixture group into a new sibling src/server/handlers/plot-plan-runs.test-helpers.ts and export each symbol: silentLogger, stubFetch, jsonRes, poolFor, makeSdSpawn, planShowResult, seedShowResult, makeAttachment, makePlotReader, makePlotResolver, makeSynthesizer, depsFor, tcpUrl, plus their helper-local types (SdCall, SynthesizeCall, BuildDepsInput). Carry the imports those helpers need into the helpers file (Attachment from @os-eco/plot-cli, BurrowClient/BurrowClientPool, openDatabase/WarrenDb, createRepos/Repos, ProjectRow, the plan-run/plot/synthesizer types, SpawnFn/SpawnOptions/SpawnResult, RunEventBroker, NO_AUTH, createBridgeRegistry, startServer, server types). Keep ONE copy of every helper and import it — do NOT duplicate, or jscpd check:dups will flag it. Split the 9 tests in the single describe("POST /plot-plan-runs") block along theme seams into two sibling test files, each importing from ./plot-plan-runs.test-helpers.ts: keep plot-plan-runs.test.ts for the happy-path + filter tests ('happy path: synthesizes plan + persists plan-run + emits Plot dispatch event' and 'filters closed seeds + sd_plan attachments before synthesis'); create plot-plan-runs.validation.test.ts for the 7 validation/error tests (malformed plot_id 400, no .plot/ 400, no .seeds/ 400, plot_id not in project 400, zero dispatchable attachments 400, 404 project missing, synthesizer error 500). Do not alter any test body, assertion, stub, or fixture. Mirror the precedent of src/diagnostics/checks.test-helpers.ts (warren-7a15) and src/server/handlers/projects.test-helpers.ts (warren-a715). Verify: each of wc -l src/server/handlers/plot-plan-runs.test.ts src/server/handlers/plot-plan-runs.validation.test.ts src/server/handlers/plot-plan-runs.test-helpers.ts shows < 500 AND bun test src/server/handlers/plot-plan-runs.test.ts src/server/handlers/plot-plan-runs.validation.test.ts reports 9 pass / 0 fail (same total as before) AND bun run typecheck is clean AND bun run check:dups exits 0.

Commits (2)

  • 14d52ab test: decompose plot-plan-runs.test.ts below 500-line limit (warren-59db)
  • cfa9d18 chore(warren): seeds state

Files changed

.seeds/issues.jsonl                                |   6 +-
 src/server/handlers/plot-plan-runs.test-helpers.ts | 213 ++++++++++
 src/server/handlers/plot-plan-runs.test.ts         | 471 ++-------------------
 .../handlers/plot-plan-runs.validation.test.ts     | 298 +++++++++++++
 4 files changed, 542 insertions(+), 446 deletions(-)

Prompt

Show prompt
work on sd warren-59db

🤖 Opened by warren run run_gwekz26ek6vm

jayminwest and others added 2 commits June 17, 2026 10:53
…9db)

Extract the file-local helper/fixture group into a new sibling
src/server/handlers/plot-plan-runs.test-helpers.ts (one copy of every
stub/fixture, jscpd-scanned). Split the single describe block's 9 tests
into plot-plan-runs.test.ts (happy-path + filter) and a new
plot-plan-runs.validation.test.ts (7 validation/error tests), each
importing from the helpers module. Test bodies, assertions, stubs, and
fixtures are unchanged; 9 pass / 0 fail.

Mirrors checks.test-helpers.ts (warren-7a15) and
projects.test-helpers.ts (warren-a715).
@jayminwest jayminwest enabled auto-merge (squash) June 17, 2026 10:54
@jayminwest jayminwest merged commit 1526bdb into main Jun 17, 2026
2 checks passed
@jayminwest jayminwest deleted the warren/run_gwekz26ek6vm branch June 17, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant