Skip to content

test(agent): pin the newtab scheduled results panel contract - ScheduleResults - #2031

Merged
dmitrii-f-t27 merged 1 commit into
queenfrom
zcode/tests-1580-schedule-results
Oct 15, 2026
Merged

dmitrii-f-t27 merged 1 commit into
queenfrom
zcode/tests-1580-schedule-results

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator

Summary

Hold the one export of trios/agent-server/apps/agent/entrypoints/newtab/index/ScheduleResults.tsx — ScheduleResults — against its contract (#1580), so the next change to that file has something to fail against.

The block is appended to lib/schedules/scheduleStorage.test.ts by the readdir rule this file already documents for the #1634 block: the panel imports this suite's subject (the store) through its two hooks, and the hooks answer empty arrays in a static render — they populate through effects a static render never runs — while a store mock registered anywhere cannot replace the module this file already materialized real.

What is pinned:

  • statically reachable: the panel stays entirely away (renders nothing) while the store has loaded no run — the render helper lends the panel a not-collapsed localStorage flag for the duration of one render, this group having no localStorage at all (measured: bun-test globals leave it undefined) and the subject reading the collapsed flag inside its first useState initializer;
  • source checks (the pattern the trios/agent-server/apps/agent/entrypoints/app/scheduled-tasks/ScheduledTaskResults.tsx exports one symbol and no test names any of them #1634 block above uses for behavior no static render can reach): the running runs concatenate before the finished ones, the finished sorted newest first, the display cap of three with a full running set standing alone; the cancel control gated on the running status and the retry control on the failed one, each behind its aria-label; the measured status icon set (completed → CheckCircle2, running → Loader2, failed → XCircle); the header title with its running badge, the view-more anchor to /app.html#/scheduled, the schedule-results-collapsed flag with its default-open read, and the run result dialog wired with the viewed run and both handlers.

Verification

  • bun test lib/schedules/scheduleStorage.test.ts — 37 pass, 0 fail (5 new tests).
  • Broken-copy proof: inverting the empty guard plus dropping the cap to two turns exactly the first two tests red (2 fail, 35 pass); the copy restores clean via git checkout.
  • Mixed-order run with the neighboring groups (lib/schedules/, entrypoints/app/scheduled-tasks/, entrypoints/newtab/): 49 pass, 0 fail across 8 files.
  • biome ci on the suite file: clean. tsgo --noEmit: 0 mentions of the suite file.

Closes #1580

Dmitrii Fedorov (@dmitrii-f-t27)

…leResults

Hold the one export of entrypoints/newtab/index/ScheduleResults.tsx
against its contract (#1580), appended to the store
suite by the readdir rule: the panel imports this suite's subject
through its two hooks, and the hooks answer empty arrays in a
static render, so the block pins what is statically reachable -
the panel stays entirely away while no run has loaded - plus the
ordering (running before finished, newest first), the display cap
of three, the cancel/retry gating behind their aria-labels, the
measured status icon set, the header title with its running badge
and view-more anchor, the default-open collapsed flag and the run
result dialog wiring as source checks. The render helper lends the
panel a not-collapsed localStorage flag for one render, this group
having no localStorage at all.

Closes #1580

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@tri-claw

tri-claw Bot commented Oct 15, 2026

Copy link
Copy Markdown

Summary by t27-bees

This PR adds contract tests for the ScheduleResults panel by appending a new describe block to scheduleStorage.test.ts. It pins the component's static empty-state render and uses source-code regex checks to verify list ordering, display cap, control gating, status icons, header elements, and dialog wiring—behavior that static rendering cannot exercise because the component's hooks populate data via effects.

Worth a look

  • scheduleStorage.test.ts:1127–1132 — The scheduleResultsMarkup helper mutates globalThis.localStorage for a single render. If any test in this file (or a concurrently running file) throws before the finally block restores it, subsequent tests will see a polluted global and may fail spuriously or mask real bugs.
  • scheduleStorage.test.ts:1141–1155 — The "orders the list" test asserts exact source patterns (return [...runningJobs, ...completedOrFailed], a specific date-subtraction sort, MAX_DISPLAY_COUNT = 3). A semantically equivalent rewrite (e.g., concat, localeCompare, a named constant imported from elsewhere) will fail the test despite correct behavior.
  • scheduleStorage.test.ts:1157–1166 — The gating test matches {run.status === 'running' && ( and {run.status === 'failed' && ( literally. Adding parentheses, extracting the condition to a variable, or using a ternary will break the test without changing the rendered output.
  • scheduleStorage.test.ts:1168–1178 — The icon test expects case 'completed':\n\s*return <CheckCircle2 with a specific newline/whitespace pattern. Prettier or a developer reformatting the switch will cause a false failure.
  • scheduleStorage.test.ts:1120–1125 — resultsPanelCode strips comments but not string literals or template expressions, so a comment-like string inside the source could alter the filtered text and make a regex match or miss unexpectedly.

Read: 1 files, +129 -0, the whole diff. Head d49ddd9. 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 — 3876/3946

Suite Passed Failed Skipped
✅ agent 419/419 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 2244/2313 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
dmitrii-f-t27 merged commit 5fa5334 into queen Oct 15, 2026
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