Skip to content

test(agent): pin the new-tab suggestions - useSuggestions, getSuggestionLabel (Closes #1633) - #1931

Merged
dmitrii-f-t27 merged 1 commit into
queenfrom
zcode-mbp/tests-1633-use-suggestions
Oct 13, 2026
Merged

dmitrii-f-t27 merged 1 commit into
queenfrom
zcode-mbp/tests-1633-use-suggestions

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator

Closes #1633

What changed

One new file: trios/agent-server/apps/agent/entrypoints/newtab/index/lib/suggestions/useSuggestions.test.ts (the path the issue's Success Criteria names). The subject useSuggestions.ts is untouched.

The 2 exported symbols are exercised (2 it( blocks; 0 blocked):

  • useSuggestions (1 test): the three suggestion sources are stubbed with full stand-ins steered by module-level fixtures, and the hook renders under renderToStaticMarkup inside a probe that serialises the sections it builds - the composition itself is what the pins read: nothing without a query; the search section behind the real provider name with the raw query trimmed, the case-duplicate dropped and the blank entries gone (Google Search:hello world/second, two flat items); the AI actions section ahead of search when tabs are selected; and the BrowserOS answer first when it has something to say.
  • getSuggestionLabel (1 test): the text each kind of suggestion shows - the search query, the AI action name, the BrowserOS message.

No other suite of this job imports the stubbed modules (checked), and the subject is imported dynamically after the stand-ins register, so the file order cannot break the load. The provider lookup stays real - the pins read the section title it names.

How it was verified (FR-004)

  • Passing run against the unmodified subject: 2 pass / 0 fail / 10 expect() calls, Ran 2 tests across 1 file.
  • Deliberately broken copy (the AI Actions section title changed, valid syntax): 1 pass / 1 fail / 7 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 behavior of useSuggestions and getSuggestionLabel from the new-tab suggestions module. The test stubs three suggestion sources and a storage seam with module-level fixtures, then renders the hook via renderToStaticMarkup to assert on the composed section structure and labels.

Worth a look

  • trios/agent-server/apps/agent/entrypoints/newtab/index/lib/suggestions/useSuggestions.test.ts:13–21 β€” Mutable module-level fixtures (searchApiData, aiTabData, browserOSData) are reassigned between assertions inside a single it block. If the test runner ever parallelizes or reorders tests (or if another it is added later), this shared state will cause cross-test pollution and flaky failures.
  • trios/agent-server/apps/agent/entrypoints/newtab/index/lib/suggestions/useSuggestions.test.ts:72–95 β€” The entire useSuggestions contract is verified in one it with sequential mutations. A failure at any expect stops the block, leaving fixtures mutated for any subsequent tests; splitting into independent it blocks with fresh fixtures per case would isolate failures.
  • trios/agent-server/apps/agent/entrypoints/newtab/index/lib/suggestions/useSuggestions.test.ts:64–65 β€” The probe serializes sections by joining section.id, section.title, and mapped labels with : and / delimiters, then asserts with toContain. If a label or title ever contains those characters, the string matching can produce false positives/negatives.
  • trios/agent-server/apps/agent/entrypoints/newtab/index/lib/suggestions/useSuggestions.test.ts:33–34 β€” The searchProviderStorage mock returns null for getValue but the real provider lookup stays active (useSearchProvider returns providerFixture = 'google'). If the subject later falls back to storage when the provider is missing, this test won't exercise that path.

Read: 1 files, +153 -0, the whole diff. Head d410f2d. 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 β€” 3546/3616

Suite Passed Failed Skipped
βœ… agent 188/188 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 2145/2214 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 β€” both suggestion 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 useSuggestions.test.ts in the job log.
  • Biome job: red from base findings; 0 mentions of useSuggestions.test.ts in the job log.

Dmitrii Fedorov (@dmitrii-f-t27)

@dmitrii-f-t27
dmitrii-f-t27 merged commit 8b00dbf 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