Skip to content

test(agent): pin the scheduled task card contract - ScheduledTaskCard - #2034

Merged
dmitrii-f-t27 merged 2 commits into
queenfrom
zcode/tests-1550-scheduled-task-card
Oct 15, 2026
Merged

dmitrii-f-t27 merged 2 commits into
queenfrom
zcode/tests-1550-scheduled-task-card

Conversation

@dmitrii-f-t27

@dmitrii-f-t27 dmitrii-f-t27 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Hold the one export of trios/agent-server/apps/agent/entrypoints/app/scheduled-tasks/ScheduledTaskCard.tsx β€” ScheduledTaskCard β€” against its contract (#1550), so the next change to that file has something to fail against.

The block is appended to lib/schedules/scheduleStorage.test.ts by the same readdir rule that file documents for the #1634 and #1580 blocks: the card imports the store suite's subject through useScheduledJobRuns, whose module that file already materialized real behind its own stand-ins.

The card is held as a full source contract, no render β€” and the first CI run of this PR is the measured reason: the card's graph also reaches the llm-providers store, whose own suite (lib/llm-providers/storage.test.ts) pins the defineItem interception of its own storage seam, recorded at that module's first materialization. Bun links and runs test files one by one, so whichever order the two files meet in, a card import from this suite materializes that store first (or replaces it) and poisons the llm-providers suite's pins β€” measured both directions (the first run failed Tests / agent with exactly that suite's nine pins). The source-contract block imports nothing: no render, no new global stand-ins, order-proof in both directions.

What is pinned:

  • the switch on the enabled flag with its Disable/Enable label template, the name and quoted query, and the Disabled badge gated on the disabled flag;
  • the provider and last-run rows gated on their loaded values with the relative-time line;
  • the Test and Edit buttons with their handlers, labels and icons, and the delete behind its name label;
  • the schedule lines through the measured set (Daily at, Every hour, Every N hours, Every minute, Every N minutes, Not scheduled) and the durations through the running note and the minute-second split;
  • the run-history counted title, the completed/failed icon branches with the running spinner, and the cancel and retry controls gated behind their statuses and aria-labels with the per-row View action.

Verification

  • bun test lib/schedules/scheduleStorage.test.ts β€” 41 pass, 0 fail (4 new tests).
  • Broken-copy proof: inverting the switch-label ternary plus renaming the daily line turns exactly the first two tests red; the copy restores clean via git checkout.
  • Mixed-order runs, both directions (lib/schedules/ + entrypoints/app/scheduled-tasks/ + lib/llm-providers/): 79 pass, 0 fail each way β€” the llm-providers suite stays green with this block in either link order.
  • biome ci on the suite file: clean, no findings. tsgo --noEmit: 0 mentions of the suite file.

Closes #1550

Dmitrii Fedorov (@dmitrii-f-t27)

Hold the one export of entrypoints/app/scheduled-tasks/ScheduledTaskCard.tsx
against its contract (#1550), appended to the store suite by
the same readdir rule as the blocks above: the card imports this suite's
subject through useScheduledJobRuns, and the hook answers an empty run
list in a static render, so the run history stays away and what is pinned
is the card frame - the switch on and off with its Disable/Enable labels,
the name and query, the daily, every-N-hours, every-minute and unset
schedule lines, the Disabled badge, the Test and Edit buttons with the
delete behind its label, and the last-run line in relative words - plus
the run-history rows, their icon gating, the cancel/retry controls behind
their aria-labels, the View action and the switch label as source checks.

Closes #1550

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

The PR adds contract tests for ScheduledTaskCard by reading its source file and asserting on regex patterns in the code. This avoids rendering the component because importing it would re-materialize the store and break the existing scheduleStorage and llm-providers test pins due to module linking order.

Worth a look

  • trios/agent-server/apps/agent/lib/schedules/scheduleStorage.test.ts (lines 1245–1343): The four it blocks assert on very specific regex patterns (exact spacing, quote style, template-literal structure). Any formatting change β€” Prettier, a added space, switching single/double quotes β€” will fail the tests even though the component behavior is unchanged. The tests verify source shape, not behavior.

  • trios/agent-server/apps/agent/lib/schedules/scheduleStorage.test.ts (line 1233): taskCardCode() strips only whole-line comments (//, *, /*). Inline comments inside a pattern (e.g., checked={job.enabled /* controlled */}) would remain and cause the regex to miss, producing a false negative.

  • trios/agent-server/apps/agent/lib/schedules/scheduleStorage.test.ts (lines 1250, 1253, 1256): The switch assertions (checked={job.enabled}, onCheckedChange={onToggle}, the aria-label template) are coupled to the exact JSX attribute syntax. A refactor to spread props ({...switchProps}) or a wrapper component would break all three tests at once.

  • trios/agent-server/apps/agent/lib/schedules/scheduleStorage.test.ts (lines 1280, 1283): The icon checks (<Play />, <Pencil />, <Trash2 />) only verify the component name appears somewhere in the file. They don't confirm the icons are actually used on the correct buttons, so a swap (e.g., Trash2 on the Test button) would still pass.

  • trios/agent-server/apps/agent/lib/schedules/scheduleStorage.test.ts (lines 1295, 1298, 1301): The schedule-line assertions (Daily at ${job.scheduleTime}, Every ${job.scheduleInterval} hours, etc.) assume the singular/plural branches are written as separate ternary branches in the source. If the component switches to a helper function or a lookup table, the tests fail despite identical output.


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

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

βœ… Tests passed β€” 3886/3956

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

…er lesson

The first draft rendered the card, and the CI order taught the hard
way bun links and runs test files one by one: whichever order the two
files meet in, a card import from this suite materializes the
llm-providers store first (or replaces it) and poisons the
lib/llm-providers suite's defineItem pins - measured both directions.
The card's graph reaches that store, so the contract is now held as
source checks alone, importing nothing: no render, no new global
stand-ins, order-proof in both directions.

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@dmitrii-f-t27
dmitrii-f-t27 merged commit 0b5d0f8 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