Repository navigation
test(agent): pin the agent-outputs hooks - useAgentOutputs, useAgentTurnFiles, useInvalidateAgentOutputs, useRefreshAgentOutputs (Closes #1670) - #1928
Conversation
…urnFiles, useInvalidateAgentOutputs, useRefreshAgentOutputs (Closes #1670)
Summary by t27-beesThis PR adds a contract test file that pins the current behavior of four React Query hooks ( Worth a look
Read: 1 files, +227 -0, the whole diff. Head |
✅ Tests passed — 3544/3614
|
…e - the snapshot was freezing without a port ahead of the helpers suite
|
The first head failed Dmitrii Fedorov (@dmitrii-f-t27) |
|
CI gates on this SHA (head
Dmitrii Fedorov (@dmitrii-f-t27) |
Closes #1670
What changed
One new file:
trios/agent-server/apps/agent/lib/agent-files/useAgentOutputs.test.ts(the path the issue's Success Criteria names). The subjectuseAgentOutputs.tsis untouched.All 4 exported symbols are exercised (4
it(blocks; 0 blocked). Every export is a React Query hook, so the suite runs each one inside a freshQueryClientProviderwithrenderToStaticMarkup; outside the BrowserOS shell there is no base URL, so the queries stay disabled and no fetch ever happens - a disabled query still reads the cache, and that is how the data-path pins drive everything:useAgentOutputs(1 test): no groups without a base URL; the cached groups flow through once the cache holds them under the hook's declared key.useAgentTurnFiles(1 test): no files without a base URL; the cached turn files flow through for the very turn asked about - and a different turn answers nothing, because the turn id is part of the key.useInvalidateAgentOutputs(1 test): captured from the render and driven against the real cache - invalidating one agent marks that agent's outputs and only the turn asked about, leaving every other agent and every other turn untouched (read from each entry'sisInvalidated; the default stale time of zero makesisStalemeaningless here).useRefreshAgentOutputs(1 test): the refresh mutation is answered ready and idle, and it resolves when there is nothing in the cache to refetch.The pins read only what holds no matter which stand-ins other suites of this job register for the URL hook (the base URL is null either way); the loading flag is the one thing that varies, so it is not pinned. Not pinned, and why: the fetch paths themselves (queryFn through agentsFetch) - they need the live agent server. No mocks at all.
How it was verified (FR-004)
4 pass / 0 fail / 16 expect() calls, Ran 4 tests across 1 file.3 pass / 1 fail / 10 expect() calls- the invalidation pin fails on the scoping. The subject was restored byte-identical (git checkout;git diff --name-onlyprints nothing) and the suite passes again.bun run typecheckrunswxt prepare, whose generated.wxt/tsconfig.jsonmakes bun 1.3.6 stop resolving@/aliases for test runs until that generated directory is removed. CI's Tests jobs never runwxt prepare; every run quoted above is from a checkout without.wxt/.Not verified
Tests / agentjob re-runs the suite on this SHA.Dmitrii Fedorov (@dmitrii-f-t27)