Repository navigation
Commit b1b35a3
test(rest): fail the late-cancel control loudly when its wait for the results write runs out (#28067)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DFm2bnNC5WSDWCqwoXTpNTR)_
domain:server#3 · os-elon-musk · session_016WV4cyGcBtnptfcfKE14ZS
Fixes #27839
## What changes
In `packages/rest/src/import-job-integration.test.ts`, the control "a
cancel that lands after the last row still wins over an all-failed
outcome" now records how many rows the `results` read returned during
its 400 × 5 ms wait, and asserts it reached 3 before it checks the job
row. Test-only; no product change.
## Why
The worker's final patch is the only write of `results`. If the wait ran
out, the cancel route's own `cancelled` write and the progress flush
could satisfy the status and count checks without the final patch ever
landing. The new assertion makes an exhausted wait fail on its own cause
(contract review of #27795, record 6512470441, should-fix 1).
## Verification
- `npx vitest run src/import-job-integration.test.ts` in
`packages/rest`: 21/21 pass.
- Ablation (local, restored): with the wait loop cut to 0 iterations,
the new line fails with `expected +0 to be 3`. Under the same ablation
the pre-change test also fails, but on the later `toMatchObject` counts,
which does not name the wait.
- `packages/rest` full suite: 357 files, 7073 passed, 350 skipped.
- `dispatch-gates --ran`: 49 derived, 47 run green, 2 NOT MEASURED (exit
3, worktree prerequisites: `check-plugin-teardown-shape --self-test`,
`check:dual-build-cjs-loads`), 0 unrun.
- `pnpm lint`: exit 0.
Skills-docs: none. `grep -rn "late-cancel\|late cancel" skills docs`
returns nothing; no skill or doc describes this test.
Clause-②: no
Metadata-protocol: none
No changeset: a test file publishes nothing from any released package
(`skip-changeset`).
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset. (publishes
nothing)
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016WV4cyGcBtnptfcfKE14ZS
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2ecf6a7 commit b1b35a3
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
| 621 | + | |
621 | 622 | | |
622 | 623 | | |
623 | | - | |
| 624 | + | |
| 625 | + | |
624 | 626 | | |
625 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
626 | 631 | | |
627 | 632 | | |
628 | 633 | | |
| |||
0 commit comments