Skip to content

test(cockpit-chat-debug): aimock e2e suite for the c-debug devtools dock - #1063

Merged
blove merged 2 commits into
mainfrom
blove/chat-debug-e2e
Sep 8, 2026
Merged

test(cockpit-chat-debug): aimock e2e suite for the c-debug devtools dock#1063
blove merged 2 commits into
mainfrom
blove/chat-debug-e2e

Conversation

@blove

@blove blove commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What changed

cockpit/chat/debug was the last chat capability with no aimock-replay e2e. It had none because the demo used to mount <chat-debug> alone — a devtools dock with no composer, so nothing could produce a run and the Timeline tab sat on its empty state forever. e2e/README.md documented that as a permanent gap.

The docs-audit work closed the gap in the demo: it now mounts <chat> beside <chat-debug> (both carrying the main slot attribute, since example-chat-layout only projects [main] and [sidebar]). This PR gives the capability the suite it never had, wired exactly like its siblings.

The suite

cockpit/chat/debug/angular/e2e/playwright.config.ts, global-setup-impl.ts, tsconfig.json, fixtures/c-debug.json, c-debug.spec.ts — plus an e2e target in project.json. That target is also what puts the cap in CI: scripts/cockpit-matrix.mjs derives the cockpit-e2e matrix from targets.e2e, so no workflow edit is needed (scripts/generate-aimock-scaffold.ts was not used — its ci.yml insertion predates that dispatcher).

Four specs:

  1. the Timeline tab shows its empty state before any run;
  2. a run sent through the composer fills it with the pipeline's checkpoint rows;
  3. selecting a checkpoint diffs that step of the run (+ messages, read off the checkpoint the server persisted);
  4. the State tab swaps in the live state inspector.

No assertion reads model prose. The checkpoint labels are structural — toDebugCheckpoint reads state.next[0] — so spec 2 asserts the exact row list (Step 1, generate_title, summarize, process, generate, __start__), newest first. That row set is precisely what this capability exists to demonstrate, so a node added to or dropped from the pipeline should fail here and be re-stated rather than silently pass.

The fixture

Three entries, one per LLM call the graph makes in a turn (generate, summarize, generate_title), discriminated by systemMessage because all three carry the same user message. The hasToolResult ordering rule does not apply here: the c-debug graph binds no tools.

Cross-references

cockpit/render/README.md and scripts/rerecord-all-aimock.sh both named c-debug as a documented no-e2e cap. The re-record script is the load-bearing one: it discovers caps by walking */e2e/fixtures/*.json, so c-debug is picked up automatically now, and an unregistered cap defaults to the prompt "Hello" — a re-record would have quietly replaced the fixture with one whose user message no spec sends. Its real prompt is now registered.

Verification

  • npx nx build cockpit-chat-debug-angular — green.
  • npx nx e2e cockpit-chat-debug-angular — 4 passed, run three times (--skip-nx-cache each time): 32.3s / 13.5s / 15.2s. Deterministic.
  • npx nx smoke cockpit-chat-debug-angular — green.
  • Mutation check: removing <chat> from the demo template makes the three run-driven specs fail on the missing composer while the empty-state spec still passes — exactly the state the deleted README described. Restored after.
  • npx tsc -p cockpit/chat/debug/angular/e2e/tsconfig.json --noEmit — only the pre-existing baseUrl deprecation, identical to the tool-calls sibling.

Notes

  • The fixture was authored, not recorded live. No OPENAI_API_KEY is available in this environment, so AIMOCK_MODE=record could not run. What is real is the run: the fixture drives the actual c-debug graph on a real langgraph dev server through the real adapter, all three of its LLM calls match and return 200, and every assertion is on structure the server produced (checkpoint rows, persisted checkpoint values), never on the fixture's own prose. Re-recording against the live provider with bash scripts/record-aimock-cap.sh c-debug "What is a jet bridge?" would swap the three response bodies for real ones without touching a single assertion.
  • The State tab renders {} on this cap, so spec 4 asserts that the inspector is mounted and bound to the agent rather than asserting content. agent.state() is the LangGraph values bag with messages projected out into the transcript, and c-debug is a plain MessagesState graph, so there is nothing else in it. The tab is not broken; the graph simply carries no state beyond its messages. Giving it one (a steps list the pipeline appends to, say) would make the State half of the dock demonstrate something and is a small change — but it rewrites what the docs page teaches, so it is left as a call for the coordinator. Spec 3 is where "reflects the run" is actually asserted, against the checkpoint diff.
  • apps/website/content/docs/chat/components/chat-debug.mdx needed no correction: it already describes the composer-driven flow and never claimed the demo lacked one or lacked e2e.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 8, 2026 3:27pm UTC

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

blove and others added 2 commits September 8, 2026 08:24
The c-debug demo had no e2e because it used to mount `<chat-debug>` alone —
a devtools dock with no composer, so nothing could produce a run and the
Timeline tab showed its empty state forever. The demo now mounts `<chat>`
beside the dock, so the capability is drivable and gets the same
aimock-replay suite every sibling chat cap has.

Four specs, wired the way the siblings wire theirs (playwright.config.ts +
global-setup-impl.ts + fixtures/, and an `e2e` target in project.json,
which is also what puts the cap in the CI matrix — scripts/cockpit-matrix.mjs
derives that from `targets.e2e`):

- the Timeline tab shows its empty state before any run;
- a run sent through the composer fills it with the pipeline's checkpoint
  rows (asserted as the exact list, newest first, since the row set is
  precisely what this capability exists to demonstrate);
- selecting a checkpoint diffs that step of the run;
- the State tab swaps in the live state inspector.

No assertion reads model prose. Every checkpoint label is structural —
`toDebugCheckpoint` reads `state.next[0]`, so the rows are the graph wiring
read backwards.

The fixture is three entries, one per LLM call the graph makes in a turn
(`generate`, `summarize`, `generate_title`), discriminated by `systemMessage`
because all three carry the same user message. No `hasToolResult` ordering
constraint applies: the graph binds no tools.

Mutation-checked by removing `<chat>` from the demo template: the three
run-driven specs fail on the missing composer and only the empty-state spec
passes, which is exactly the state the deleted e2e/README.md described.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two files pointed at the c-debug README as the marker for a cap that
deliberately ships without an aimock suite. That is no longer true.

`scripts/rerecord-all-aimock.sh` is the load-bearing one: it discovers caps
by walking `*/e2e/fixtures/*.json`, so c-debug is picked up automatically
now that it has a fixture, and an unlisted cap defaults to the prompt
"Hello". Re-recording would have quietly replaced the fixture with one whose
user message no cap spec sends. Register c-debug's actual prompt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@blove
blove force-pushed the blove/chat-debug-e2e branch from 74afef1 to 1ad3e99 Compare September 8, 2026 15:24
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove merged commit 2cba7b4 into main Sep 8, 2026
32 checks passed
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