Skip to content

test(agent): pin the reasoning block - Reasoning, ReasoningTrigger, ReasoningContent (Closes #1609) - #1935

Merged
dmitrii-f-t27 merged 1 commit into
queenfrom
zcode-mbp/tests-1609-reasoning
Oct 13, 2026
Merged

dmitrii-f-t27 merged 1 commit into
queenfrom
zcode-mbp/tests-1609-reasoning

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator

Closes #1609

What changed

One new file: trios/agent-server/apps/agent/components/ai-elements/reasoning.test.ts (the path the issue's Success Criteria names). The subject reasoning.tsx is untouched.

All 3 exported symbols are exercised (3 it( blocks; 0 blocked). Every export is a memo component reading the subject's own context, so the suite renders each one inside the root that provides it, with renderToStaticMarkup:

  • Reasoning (1 test): the root gates its collapsible - the parts render while open (measured: the open content carries its Streamdown container) and the closed root hides the content (the empty hidden container, nothing inside).
  • ReasoningTrigger (1 test): the thinking message for the state it reads - streaming says Thinking..., an unset duration says Thought for a few seconds, a measured one names its seconds - with the chevron following the open state, and its own label when children are handed in.
  • ReasoningContent (1 test): the reasoning container with its text spacing renders while the root is open, and the closed root renders nothing inside the hidden container.

Not pinned, and why: the streaming duration itself and the auto-close timer - both live in effects that need a live document; the static pins read what each piece renders in either state. No mocks at all; no suite of this job mocks any module in this subject's import graph.

How it was verified (FR-004)

  • Passing run against the unmodified subject: 3 pass / 0 fail / 15 expect() calls, Ran 3 tests across 1 file.
  • Deliberately broken copy (the unset-duration thinking message changed, valid syntax): 2 pass / 1 fail / 9 expect() calls. The subject was restored byte-identical (git checkout; git diff --name-only prints nothing) and the suite passes again.
  • No network, database or container; no existing test modified or weakened. The file is biome-check clean. The local typecheck reports 59 errors - the pre-existing local base of this tree - and 0 mentions of the new file.
  • Local reproducibility note (issue bun test cannot resolve @/ aliases once .wxt/tsconfig.json exists (wxt prepare output breaks the bun 1.3.6 runtime resolver)Β #1909): bun run typecheck runs wxt prepare, whose generated .wxt/tsconfig.json makes bun 1.3.6 stop resolving @/ aliases for test runs until that generated directory is removed. CI's Tests jobs never run wxt prepare; every run quoted above is from a checkout without .wxt/.

Not verified

  • Nothing beyond the quoted local runs; the CI Tests / agent job re-runs the suite on this SHA.

Dmitrii Fedorov (@dmitrii-f-t27)

@tri-claw

tri-claw Bot commented Oct 13, 2026

Copy link
Copy Markdown

Summary by t27-bees

This PR adds a contract test file pinning the current HTML output of three memo components (Reasoning, ReasoningTrigger, ReasoningContent) rendered via renderToStaticMarkup. The tests assert specific Tailwind class names, Radix attributes, and exact text strings for each component state.

Worth a look

  • reasoning.test.ts:45,49,51,58-60,64,69,74,79-80,87-88,93-94 β€” Tests assert exact Tailwind class strings (rotate-180, rotate-0, whitespace-normal, mt-4 text-sm, not-prose), Radix attribute format (data-state="open", hidden=""), and copy (Thought for a few seconds, Thought for 5 seconds, Thinking...). Any styling, wording, or HTML structure change will break these tests without indicating a real regression.
  • reasoning.test.ts:58 β€” The string "Thought for a few seconds" is asserted for the unset-duration case; if the component later uses a different phrase (e.g., "Thought for a moment") or adds i18n, the test fails despite correct behavior.
  • reasoning.test.ts:64 β€” The duration formatting "Thought for 5 seconds" is hard-coded; pluralization changes (e.g., "1 second" vs "1 seconds") or unit changes would break the test.
  • reasoning.test.ts:1-109 β€” The suite only tests static markup with defaultOpen prop; it does not exercise the interactive toggle (clicking the trigger to change open state), the streaming duration effect, or the auto-close timer, so those behaviors remain unpinned.
  • reasoning.test.ts:13 β€” The import ./reasoning assumes the test file lives alongside the source; if the file is moved or the module path changes, the import breaks.

Read: 1 files, +109 -0, the whole diff. Head 73e3b6d. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

@github-actions

Copy link
Copy Markdown

βœ… Tests passed β€” 3558/3628

Suite Passed Failed Skipped
βœ… agent 193/193 0 0
βœ… build 9/9 0 0
βœ… cdp-protocol 5/5 0 0
βœ… eval 93/93 0 0
βœ… server-agent 280/280 0 0
βœ… server-api 2152/2221 0 69
βœ… server-browser 6/6 0 0
βœ… server-integration 10/11 0 1
βœ… server-lib 279/279 0 0
βœ… server-pglive 166/166 0 0
βœ… server-root 68/68 0 0
βœ… server-sim 8/8 0 0
βœ… server-skills 31/31 0 0
βœ… server-tools 244/244 0 0
βœ… shared 14/14 0 0

View workflow run

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator Author

CI gates on this SHA:

  • Tests / agent: pass β€” all three reasoning pins run in the agent group.
  • All other Tests/ matrix jobs pass*, including server-pglive (no flake rerun needed).
  • Typecheck job: 19 errors = the known base count; 0 mentions of reasoning.test.ts in the job log.
  • Biome job: red from base findings; 0 mentions of reasoning.test.ts in the job log.

Dmitrii Fedorov (@dmitrii-f-t27)

@dmitrii-f-t27
dmitrii-f-t27 merged commit b0327d5 into queen Oct 13, 2026
17 of 19 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