lets design / plan a more sophisticated integration test suite right now it relies on me…
- User
lets design / plan a more sophisticated integration test suite right now it relies on me having a linear cycle free for it to do any testing, but that's a little tricky i'm thinking if we can have a mock server that mocks out Linear API calls and then can execute a set of runs that would be better this will ensure i can design a better suite of tests outside of unit tests that validate certain behaviours across best-case and failure-case scenarios (eg retries/resume, etc) this should also be scoped to include all the session tracking we have around usage/cycle hours used/etc as this is an important piece
let me know if there's a particular set of skills or workflow i should go through to design this project
Assistant· claude-opus-4-7
Quick answer on the workflow before I dive in:
This is a textbook design-doc → task-breakdown job:
shape-design-doc(oragent-skills:spec-driven-development) — Mock-server vs. client-injection vs. record-replay is a one-way-door architectural choice that will shape every future integration test, so it warrants a written design with alternatives before code.shape-planning-and-task-breakdown— once the approach is picked, decompose into verifiable slices.agent-skills:test-driven-developmentduring build, slice by slice.
I'll do the exploration now to ground the design in what actually exists, then come back with questions and a plan.
Assistant· claude-opus-4-7
I have a solid map now. The mock has to intercept two surfaces:
- Parent —
linear.pymakes raw GraphQL POSTs to a hard-codedhttps://api.linear.app/graphql(5 ops:current_cycle,pending_issues,get_issue,set_state,resolve_state). - Spawned children —
claude -pcalls Linear MCP tools (save_issue,save_comment) via the.mcp.jsonthat gets symlinked into the worktree.
Existing tests monkey-patch
linear._postand replaceclaude -pwith marker-touching shell scripts. The session/usage tracking flows from the child'sstream-jsonoutput through_UsageAccumulatorinto the runlog at~/.drain-cycle/runs/<cycle-id>-<ts>.json. No native retry — "resume" means re-running drain against the same cycle, where in-flight issues have been reverted to Todo. Two cycle-halt paths (DependencyCycleError, cycle-cap breach) and four per-issue halt paths.Before I write the plan, three architectural choices will materially shape the design:
- Parent —
Assistant· claude-opus-4-7
All three picks confirmed. I'll write the plan now.
Assistant· claude-opus-4-7
The user asked for
/plan-reviewover the plan. Invoking the skill.- User
/crit:crit ~/.claude/plans/lets-design-plan-snug-tarjan.md
Assistant· claude-opus-4-7
Assistant· claude-opus-4-7
Plan now addresses all eight REVISE conditions:
- Outcome metric — Success criterion section +
test_halt_coverageCI gate - ADR commitment — slice 1 deliverable
docs/adrs/0001-integration-test-architecture.md - Breach determinism — spike at end of slice 3, kill-switch on slice 8
- Per-scenario contract — formalised under IntegrationHarness (runlog snapshot + mock state + call sequence required; lint test)
- Transcript fixture spec — format documented inline + slice-3 README deliverable
- httpx instrumentation — verified in slice 2,
OTEL_SDK_DISABLED=truefallback - Subprocess smoke — promoted into slice 4 MVP
- Schema-drift guard —
test_linear_surface_auditin slice 5
Verdict upgrades to APPROVE with all SUSTAINED conditions addressed in-plan.
- Outcome metric — Success criterion section +
Assistant· claude-opus-4-7
Round 1 resolved. New ask: pass over the plan with
/writing-clearly-and-concisely.Assistant· claude-opus-4-7
Tightening pass against Strunk's rules — active voice, cut hedges, put emphatic words at end. Doing it as targeted edits.
Assistant· claude-opus-4-7
Strunk pass applied. Main changes:
- Active voice — "is started" → "starts", "is enforced by" → "A CI gate enforces", "is recorded" → "records", "Substitutes" → "Swaps"
- Omitted needless words — dropped "Recommended", "small", "actually", "in our context", "explicitly", "already", "the gap is", "This is the only"
- Positive form — "Skipping the POST is how we test X" → "To test X, skip the POST"
- Definite, concrete — "increases meaningfully" → "rises meaningfully"; "a scenario that omits ... fails a lint test" → "A collection-time lint test fails any scenario missing..."
- Emphatic position — moved load-bearing words to the end ("hours (build a real cycle) to minutes (write a 20-line scenario)")
- Cut hedges — "a small Python entrypoint" → "A Python entrypoint"; "a small
IssueUpdatemutation surface" → "anIssueUpdatemutation"
Assistant· claude-opus-4-7
That's a real architectural concern. If the spawned session is fake, what we've built is a sophisticated unit-test rig, not an integration test. Let me get the design right before going further.
If we keep
claude -preal, three things change:- Pillar 2 is no longer
fake_claude. It becomes a Linear-MCP shim — a tiny MCP server we register in a custom.mcp.jsonwritten into each worktree. It exposessave_issueandsave_comment, and translates them to GraphQL againstMockLinear. Same backing store as the parent's HTTP mock. - No transcript fixtures. Instead, each scenario writes an issue body / prompt the real claude session executes (e.g. "create
ABA-1.txtwith hello, then mark Done"; "loop and emit large output"; "exit without calling any tools"). - Determinism + cost. Real claude is non-deterministic on numbers (tokens, turns, cost) but deterministic on outcomes (Done / not Done / breach). Tests use predicate assertions on numbers and exact assertions on outcomes. Breach scenarios get tight / caps. The suite splits: failure-mode scenarios that halt pre-spawn don't need claude at all; happy-path and breach scenarios do. Mark the costly subset and run nightly, not per-commit.
- Pillar 2 is no longer
Assistant· claude-opus-4-7
Rewriting the plan around real
claude -peverywhere. Dropfake_claude, replace with a Linear-MCP shim, drive scenarios via prompts/issue bodies, accept non-determinism on numbers.Assistant· claude-opus-4-7
Pillar 2 swap landed. Summary of the rewrite addressing the comment:
fake_claudeis gone. Realclaude -pruns in every scenario that reaches spawn.- Pillar 2 is now a
linear_mcp_shim— a stdio MCP server that exposessave_issueandsave_comment, translated to GraphQL against the sameMockLinearstore. The harness writes a custom.mcp.jsoninto each worktree pointing claude at the shim instead of the real Linear MCP. - Scenarios steer claude through issue bodies + per-issue limits + claude flags, not transcripts. Prompt library at
tests/integration/prompts/*.md. - Cost / determinism strategy made explicit:
@pytest.mark.real_claudefor spawning scenarios (nightly), pre-spawn halts run per-commit. Tests use exact assertions on outcomes, predicate assertions on numbers. - Slice plan re-shaped — slice 3 now builds the MCP shim and runs the first real-claude drain end-to-end; slices 7/8 split pre-spawn (fast) from real-claude (costly); transcript spec dropped.
- Cost guard added — nightly job alerts on >$5 Anthropic spend.
- User
[Request interrupted by user for tool use]
- User
/compact compact
- User
crit:crit /crit:crit ~/.claude/plans/lets-design-plan-snug-tarjan.md
Assistant· claude-opus-4-7
Crit is open at http://localhost:62322. Leave inline comments, then click Finish Review.
Assistant· claude-opus-4-7
Two comments to address:
- Review-level: Reshape the plan to flow through
/shape-initiative— the plan is the design doc for a Linear initiative; add the six-field initiative skeleton. - Line 18: No CI yet; rewrite success criterion as outcome bullets and remove CI gate language throughout.
- Review-level: Reshape the plan to flow through
Assistant· claude-opus-4-7
Now strip CI references throughout — replace with local-cadence language.
Assistant· claude-opus-4-7
Now reply to both crit comments and re-launch crit for the next round.
Assistant· claude-opus-4-7
Changes applied. Review the diff in your browser and click Finish Review when ready.
Assistant· claude-opus-4-7
Two follow-ups:
- rp_3cc602: Make explicit that this doc is for creating the project and seeding the design doc, not for executing the work.
- c_1e5eba: Unify the Success criteria with the Linear initiative's Key Results — one set, product-centric, friendly language, fewer KRs.
Assistant· claude-opus-4-7
Now collapse the two success criteria into one product-centric set used as KRs in the initiative skeleton.
Assistant· claude-opus-4-7
Now update the Verification section's reference to "Success criterion" (singular) — it now refers to KR 2.
Assistant· claude-opus-4-7
Reply to both follow-ups and re-launch crit.
Assistant· claude-opus-4-7
Changes applied. Review the diff in your browser and click Finish Review when ready.
Assistant· claude-opus-4-7
Review approved — all comments resolved. The plan is at
/Users/anton/.claude/plans/lets-design-plan-snug-tarjan.mdwith:- What this document is section making explicit that this doc creates the Linear project and seeds the design doc — not an execution plan.
- Linear initiative skeleton with three product-centric Key Results (cheap to add failure-mode tests, every present halt path covered, real-claude happy-path + resume + usage tracking pass).
- CI references stripped; halt-coverage runs as a local pytest assertion.
- Real claude for every spawning scenario;
linear_mcp_shim(notfake_claude) is the Linear surface in the child.
Next step is
/shape-initiativeto create the Linear project and copy this content across as its linked design doc.Assistant· claude-opus-4-7
Plan approved. The workflow's first step is
/shape-initiative— which creates the Linear project, promotes this file todocs/integration-test-architecture.md, and links it from the project description.That's a shared-state action (creates a Linear project), so I'd like to confirm before kicking it off. Want me to invoke
/shape-initiativenow with the six-field skeleton from the plan as input?- User
shape-initiative-shape /shape-initiative-shape
Assistant· claude-opus-4-7
I'll work through the shape-initiative workflow. The plan's six-field skeleton is a strong starting point but needs the full rubric pass (commit/stretch tags, bet/brake/foundation roles, Layer 1/2 footers, grader-backed
how we'll know).Let me load the Type 2 playbook and KR templates first.
Assistant· claude-opus-4-7
Assistant· claude-opus-4-7
Approved. Now running the 11-rule rubric check on the draft before creating the project.
Rubric check (Step 6.5):
# Rule Pass 1 All six fields present ✓ 2 Goal names who + outcome, no solution verb ✓ (affected party = drain-cycle operator; outcome = cheap to test + trusted safety net) 3 Initiative name is a goal/problem ✓ (state-framed; constraint named) 4 3 ≤ KRs ≤ 5 ✓ (3 KRs) 5a target ≠ baseline ✓ (all three) 5b Distinct Layer 1 dimensions ✓ (maintenance / discipline / correctness) 5c KRs are not Goal-restatements ✓ (each names a measurable property of the Goal) Assistant· claude-opus-4-7
Project created in Backlog state.
Next step in the workflow is copying the design doc into the repo so the project description's link target exists. The plan body needs to become
docs/integration-test-architecture.mdin drain-cycle (the LL stripped down to: Context / Approach / Pillars / Cost-runtime-determinism / Test-infra correctness / Scenario catalogue / Slices / Critical files / Verification — dropping the duplicated initiative skeleton since that lives in the Linear project now).Want me to write
docs/integration-test-architecture.mdnow, or hand off toshape-planning-and-task-breakdownfor slice → issue conversion first?- User
yes write the design-doc
Assistant· claude-opus-4-7
Design doc written at
docs/integration-test-architecture.md(drain-cycle repo).Differences from the plan file:
- Drops the "What this document is" framing and the duplicated Linear initiative skeleton (those live in the Linear project description now).
- Header links back to the Linear project URL.
- Workflow step 1 marked done (initiative created).
- "Each slice opens a Linear issue under the initiative" (was "the existing project").
Three things to settle next, in order:
- Commit the design doc to drain-cycle (
docs/integration-test-architecture.md) so the Linear project's reference target is durable. - Optionally update the Linear project description's footer line to point at the committed file's URL (currently a generic in-repo path).
- Then hand off to
shape-planning-and-task-breakdownto convert the 12 slices into Linear issues under the new initiative.
Want me to commit + push (this repo pushes to main per
AGENTS.md), or wait for you to review the doc first?- User
/compact compact
- User
in that design, where would it be most helpful to have visuals for communication - say i wanted to present this to my team/tech lead/manager for review and approval?
- Assistant· <synthetic>
API Error: 529 Overloaded. This is a server-side issue, usually temporary — try again in a moment. If it persists, check https://status.claude.com.
- User
in that design, where would it be most helpful to have visuals for communication - say i wanted to present this to my team/tech lead/manager for review and approval?
Assistant· claude-opus-4-7
- User
ok make a plan to include these and to render the whole thing in html using /render-html
- User
[Request interrupted by user]
- User
ok make a plan to include the first 3 and to render the whole thing in html using /render-html - i'm mostly interested in the architecture and how things are being designed rather than the sequencing components, those are all clear
Assistant· claude-opus-4-7
This is a different task from the previous plan, so I'll overwrite the plan file. Let me first check what
/render-htmldoes and where it lives.Assistant· claude-opus-4-7
I have enough to write the plan. The render-html skill has a P14 pattern that handles inline SVG diagrams when the section heading matches
/architecture|sequence|system context/i— that's the seam for diagrams 1 and 2. The coverage matrix is a plain markdown table that the shell styles by default.Assistant· claude-opus-4-7
Plan approved. Executing now.
Edit 1 first — adding the System context diagram between §Context and §Workflow.
Assistant· claude-opus-4-7
Edit 2 — Happy-path sequence diagram at end of §Pillar 2.
Assistant· claude-opus-4-7
Edit 3 — Failure-mode coverage matrix at top of §Scenario catalogue.
Assistant· claude-opus-4-7
Three edits done. Verifying structure before rendering.
Assistant· claude-opus-4-7
Now invoking render-html. The skill is bundled with the user's command at
/Users/anton/.claude/commands/shape/render-html.md— I'll invoke it via Skill so it follows the proper workflow (overwrite check, self-containment, etc.).Assistant· claude-opus-4-7
Step 1 — source check confirmed (H1 + 11 H2s exist). Step 2 — output path doesn't exist, no overwrite prompt needed.
Reading the source, the HTML shell, and the patterns catalogue I haven't yet seen the rest of.
Assistant· claude-opus-4-7
Got everything I need. Inventory:
Headings (11 H2 + 6 H3, slugs generated):
- 01 Context —
context - 02 System context —
system-context(P14 fires) - 03 Workflow —
workflow - 04 Approach —
approach- Cost, runtime, and determinism
- Pillar 1 —
MockLinear - Pillar 2 —
linear_mcp_shim(contains H4Happy-path sequencewith second SVG — applying P14 treatment to it inline since prose-rendering a ```svg block would silently drop a diagram, which is in the skill's Red Flags list) - How scenarios steer claude
- Pillar 3 —
IntegrationHarness
- 05–11: Production code changes / Test-infra checks / Failure-mode coverage (table) / Scenario catalogue / Slices / Critical files / Verification
No other patterns fire (alternatives are bullet-style not H3-side-by-side; failure-mode coverage is a table not severity-tagged so P17 doesn't match cleanly). Failing fast on overzealous pattern matching is the right call per the skill's "false-positive matches degrade trust faster than missing treatments."
Composing the file now.
- 01 Context —
Assistant· claude-opus-4-7
Step 6 — self-containment check, plus file-size verification.
Assistant· claude-opus-4-7
Done. Render report:
- Output:
docs/integration-test-architecture.html· 55.3 KB (well under the 500 KB cap) - Self-containment: ✓ zero
<link rel="stylesheet">,<script src=>, or remote<img>URLs. The only outgoing URL is the Linear project hyperlink in the metadata grid, which is a user click target, not a resource load. - TOC: 11 H2 entries + 5 H3 sub-entries. The H4 "Happy-path sequence" lives inside Pillar 2 with an in-page anchor but is intentionally absent from the TOC per the skill spec (H1 = title, H2/H3 = TOC).
- Pattern treatments:
- P14 applied to §System context (H2 trigger match) and to the H4
Happy-path sequence(heading-rule strictly wants H2 here, but applying P14 was the right call — otherwise the ```svg block falls through to a rendering, which would silently drop the diagram, a red flag in the skill).
- P14 applied to §System context (H2 trigger match) and to the H4
- Output:
- User
open it
Assistant· claude-opus-4-7
Opened in your default browser. Let me know what you see — particularly whether both SVGs render cleanly and the TOC scrollspy tracks as you scroll.
- User
/compact compact
- User
commit and push
Assistant· claude-opus-4-7
Pushed
2e0d4cdtoorigin/main. Theinitiative-multi-agent-collaboration.mddraft is still untracked.