Skip to content

Implementation plan / Session plan / Handover RC-1-S28-F9

Handover RC-1-S28-F9 Fix: the UI-ISE-008 registration test stays within Vitest's 5-second timeout on a busy host

Card: RC-1-S28-F9. Issue: cema-care/his#215. Branch: session/RC-1-S28-F9. Slice: RC-1. This is a round 1 fix of the gate session RC-1-S28, for the gate line "Criterion 4 (ACC-001): FR-ISE-KEY-001 (UI-ISE-008)" of the slice gate. The work belongs to RC-1-S22 (web/domains/ise/UI-ISE-008/). No decision record: the fix changes only the screen's tests. It changes no screen behaviour, no contract and no other session's work.

The failure and its cause

In the gate's run, UI-ISE-008/Inventory.test.tsx > FR-ISE-KEY-001 UI-ISE-008 registration and screen states > registers an item with owner, policy and grants; a certificate starts Requested failed after 5102 ms against Vitest's 5000 ms default. The screen did nothing wrong; the test ran out of time.

Measured on this host (4 cores):

Run Registration test First test of the file (with axe)
Before, idle host 2653 ms 2745 ms
Before, 8 CPU-bound processes 5060 to 5086 ms, failed (2 of 2 runs) 3861 ms
After, idle host 760 ms about 1.5 s
After, 8 CPU-bound processes 1964 to 2301 ms, passed (5 of 5 runs) 1656 to 2384 ms

There were two causes:

  • The registration test typed about 100 characters key by key (userEvent.type into five fields). Each key is a keydown, keypress, input and keyup through React Aria's handlers, plus a React render of the dialog. That came to about 25 ms a key on an idle host, and twice that under load. What the test checks is the request the dialog sends, not keystroke handling.
  • The first test of the file paid for loading the screen module. renderScreen calls import("./Inventory"), and the first import (the screen and React Aria through Vite's transform) took about a second on an idle host. That time counted against whichever test came first. With the registration test fixed, that test was the next one close to the limit: 4.2 s under the same load.

What was changed

All of it is in web/domains/ise/UI-ISE-008/:

  • Inventory.test.tsx:
  • A helper enter(field, text) focuses the field with a click and pastes the value (userEvent.paste), which is one input event. The registration test enters its five text values this way. The request body it asserts is unchanged. Keystroke behaviour that a test does check stays on the keyboard: "Enter does not revoke" still presses {Enter}, and the other tests still type their short values.
  • beforeAll(() => registration.component()) loads the screen module once before the first test. A hook has a timeout of its own (10 s), so the one-time load no longer counts against a test.
  • check-under-load.sh (new): this is the card's test that fails before the repair and passes after it. It runs Inventory.test.tsx with Vitest's default timeout while LOAD CPU-bound Node.js processes compete for the host. The default is twice the cores, like the session host when sessions and self-hosted runners work side by side. Any failed test, a timeout included, fails the check.

The 5-second timeout itself is unchanged. A longer timeout would hide the next slow test rather than fix this one, and the workspace's vitest.config.ts is not the screen session's to change (ADR-HIS-042).

Checks and their results

These ran on this host with HIS_SESSION=RC-1-S28-F9. The host's Node.js is v22.22.1 without TypeScript stripping (process.features.typescript is false), so check-against-stubs.sh, which runs contracts/common/src/cli.ts directly, ran in the node:22-bookworm container, as RC-1-S22 did.

Check Command Result
Before the repair, on a busy host web/domains/ise/UI-ISE-008/check-under-load.sh, with the old Inventory.test.tsx Failed: 23 passed, 1 failed (the registration test, 5060 ms, timed out)
After the repair, on a busy host web/domains/ise/UI-ISE-008/check-under-load.sh Passed: 24 of 24, in each of two runs. It also passed 3 of 3 times with 8 processes in the scratch runs behind the table above
RC-1-S22's component and accessibility tests pnpm build and pnpm test in web/domains/ise Type check clean; 54 passed, 5 skipped (the stub tests, as designed)
UI-ISE-008 against the ISE contract stub web/domains/ise/UI-ISE-008/check-against-stubs.sh (in node:22-bookworm, with CI=1) 3 of 3 passed; the stub recorded no violation
The shell with the workspace pnpm build and pnpm test in web/shell Bundle built; 19 passed, 1 skipped; shared-version check 1 passed
Static analysis platform/delivery-pipeline/bin/static-analysis web/domains/ise/UI-ISE-008 No blocking finding
The slice scenario HIS_SESSION=RC-1-S28-F9 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh (from the root) Passed: 12 of 12, outcome passed and the record complete (run 20261129T125011Z-6163, 7.3 min)

What the gate line now shows

Criterion 4 (ACC-001), FR-ISE-KEY-001 (UI-ISE-008): pnpm test in web/domains/ise passes 54 of 54 tests, with the 5 stub tests skipped as designed. The tests also pass on a host loaded with twice as many CPU-bound processes as it has cores. There the registration test takes about 2 s of its 5, where it took over 5 before. TEST-ISE-026's own tests in platform/secrets-keys are not touched. The next gate session (RC-1-S28-G2) reruns the line.

Requirements and test scenarios

Requirement / scenario Test
FR-ISE-KEY-001, registration (owner, policy, grants; a certificate starts Requested) FR-ISE-KEY-001 UI-ISE-008 registration and screen states > registers an item with owner, policy and grants; a certificate starts Requested (sped up, same assertions)
FR-ISE-KEY-001, TEST-ISE-026, UI-ISE-008 as a whole Every test of UI-ISE-008/Inventory.test.tsx, on a busy host: check-under-load.sh

Differences from the specification or contract

None.

Questions for a person

None.

Follow-ups outside the card

  • The shell's workspace kit (FN-S06's web/shell/workspace-kit/) could load a screen's module before its first test, and @his/shell-sdk/testing could offer the enter helper. Then every screen's first test, and every test that fills a form, would get the same margin. Other screens' tests type their values key by key as well. In web/domains/ise, UI-ISE-007's slowest test takes 928 ms idle, so it is not at risk yet.
  • Node.js on the session host cannot run .ts files directly (process.features.typescript is false on v22.22.1 as installed), so the his-contract checks run only in a container here. Running pnpm install in such a container needs CI=1: without it, pnpm stops without a message when it wants to recreate a node_modules that the host made. This touches RC-1-S28-F10 (contracts/common installed for one Node.js).