Skip to content

test(server): pin the console collector contract - ConsoleCollector (Closes #1663) - #1917

Merged
dmitrii-f-t27 merged 1 commit into
queenfrom
zcode/tests-1663-console-collector
Oct 13, 2026
Merged

dmitrii-f-t27 merged 1 commit into
queenfrom
zcode/tests-1663-console-collector

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator

Closes #1663

What changed

One new file: trios/agent-server/apps/server/tests/api/console-collector.test.ts (the path the issue's Success Criteria names). The subject browser/console-collector.ts is untouched.

The single exported class is exercised (10 it( blocks) through a recording fake CdpBackend whose handlers the suite invokes directly:

  • Event routing (5 tests): console types mapped to levels with args serialized space-joined (measured: a trailing-space fixture would double the join); unknown types fall back to info; exceptions recorded as errors with the description preferred over the text; browser log entries by the log level map (verbose -> debug); a main-frame navigation clears the buffer while a child frame does not.
  • Sessions (3 tests): events from unknown sessions are ignored; re-attach replaces the old session; detach forgets the page.
  • getLogs (2 tests): the severity threshold (measured: the default is 'info', so debug-level entries are hidden unless asked for), the case-insensitive search, combined filters; and the recency limit (60 entries -> the last 50, the honest totalCount of 60) with the optional clear.

The suite registers no mocks. No network, database or container.

How it was verified (FR-004)

  • Passing run against the unmodified subject: 10 pass / 0 fail / 26 expect() calls, Ran 10 tests across 1 file.
  • Deliberately broken copy (the console type map remapped, args joined with '-', the severity comparison inverted, re-attach stops replacing the old session, child frames clear too): 6 fail out of 10, quoted raw above. The subject was restored byte-identical (git checkout) and the suite passes again.
  • All shapes were measured on the live module before writing (two drafts were corrected by measurement: the default 'info' threshold and the double-space join). The file is biome ci-clean (checked with an explicit Found/error grep - the noNonNullAssertion warnings of the first draft led to the fire() helper) and contributes no typecheck error (local monorepo typecheck: base set, 0 mentions of the new file). The one-process run with the four sibling api suites is 41/41; the full tests/api run shows only the 8 pre-existing local vault failures (age is not installed on this machine - CI installs it, see PR ci(test): install age where the vault's tests start it, before the vault shipΒ #1782).

Not verified

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

Dmitrii Fedorov (@dmitrii-f-t27)

The first suite for browser/console-collector.ts: the class exercised
(10 tests) through a recording fake CdpBackend - the three event
kinds with their level maps and arg serialization, the main-frame
navigation clear, session attach/re-attach/detach, and the getLogs
severity threshold (measured: the default hides debug), search,
recency limit, totalCount and clear. No mocks, no network, database
or container; the subject is untouched.

Closes #1663
@github-actions

Copy link
Copy Markdown

βœ… Tests passed β€” 3482/3552

Suite Passed Failed Skipped
βœ… agent 144/144 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 2125/2194 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

Checks note, before merge:

  • runner / Biome and runner / Typecheck are red on the base branch queen with pre-existing failures (reference base run https://github.com/gHashTag/trios/actions/runs/38087839871 on dfb6d97). On this PR's SHA: the Typecheck log has the 19 base error TS lines and 0 mentions of the new console-collector.test.ts; the Biome log has 0 diagnostics for the new file (the first draft's noNonNullAssertion findings were fixed before pushing - the suite invokes the fake's handlers through a fire() helper). The suite itself passed in Tests / server-api on this SHA (10 tests), and all other Tests / * suites including server-pglive are green.

Dmitrii Fedorov (@dmitrii-f-t27)

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