Skip to content

test(rest): fail the late-cancel control loudly when its wait for the results write runs out - #28067

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-oqzjri
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-oqzjri

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. (publishes nothing)
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cyGcBtnptfcfKE14ZS

… worker's results write runs out

The all-failed late-cancel control waited up to 400 x 5 ms for the
worker's final patch (the only write of `results`) and then asserted the
job row. If the wait ran out, the cancel route's own `cancelled` write
and the progress flush could pass those checks without the final patch
ever landing. Assert the results read reached 3 rows after the wait.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cyGcBtnptfcfKE14ZS
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 847e4248e9b7059e5b069056bf636c75c1f53b14 → packageMentionDocs.

@github-actions github-actions Bot added the tests label Oct 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia

Seat ACCEPT · PR #28067 · head 857c016592d89e360859435e0e272e87989a5852 · 2026-10-30T11:51Z

维护者速读

  • 改了什么: 只改测试。异步导入「晚取消」那条用例原先等 worker 写回 3 行结果,等不到也照样往下跑;现在等完必须断言确实拿到 3 行(rest: the async import late-cancel pin should assert its wait for the worker's results write actually completed #27839)。
  • 为什么改: 等待耗尽时,取消接口自己的写入和进度刷新就能让后面的断言通过,用例会假绿。
  • 风险与回滚: 无产品代码改动;回滚即删这一行断言。
  • 先看: packages/rest/src/import-job-integration.test.ts 约 621 行。
  • 两分钟验证: 本地把等待次数改成 0,该用例应报 expected +0 to be 3。
  • 需要你做的: 无(Tier S,按本期落地授权由席位落地)。

席位核对

  • Shape: draft → main, Fixes #27839. One file, packages/rest/src/import-job-integration.test.ts (+6/−1), skip-changeset (test only). check-governed-merges --pr 28067: NOT governed.
  • Premise: re-read on main @ 5aee2065: the late-cancel control polled 400 × 5 ms for results.length === 3 and never asserted it.
  • Read of the diff: the loop records the last length it read, and expect(reported).toBe(3) follows the wait, before the status and counter assertions. Ablation shown by the thread: wait cut to 0 → expected +0 to be 3; restored 21/21.
  • Declarations: test only; no published surface, no contract review owed.
  • Gate check-runs on this head: 53 total, 35 success, 18 skipped by the path filter, 0 failed. mergeable_state: clean.
  • Landing: Tier S, under the maintainer's landing grant for this term (2026-10-29 22:05Z, seat thread). Ready + auto-merge through the relay.

ACCEPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rest: the async import late-cancel pin should assert its wait for the worker's results write actually completed

1 participant