Skip to content

test(plugin-approvals): seed the past-500-decided stranded-scan cases in batches, not 1200 serial inserts - #38235

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-4xkl1n
Nov 28, 2026
Merged

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #38223

Clause-②: no
Metadata-protocol: none

维护者速读

What changes

packages/plugins/plugin-approvals/src/stranded-request-inspection.test.ts, the #37808 — past 500 decided requests block only:

  • insertAll seeds through the engine's own array insert, engine.insert('sys_approval_request', rows[], …), in batches of SEED_BATCH = 200 rows, instead of one engine.insert per row. Same rows, same insertion order, same isSystem context, same real ObjectQL over SqlDriver (better-sqlite3, in-memory).
  • The batch is 200, not the whole set: one multi-row INSERT of 600 or 1200 rows is refused by SQLite with too many terms in compound SELECT (its default 500-term compound limit; knex emits a multi-row insert as a compound SELECT there). A comment beside insertAll says why the batch exists and why it is 200.
  • The 600-row case also asserts out.scanned === 601: the newest window (ids 102–601) plus the first walk page (ids 1–500) read every seeded row, so a short batch write cannot pass it silently. This only adds an assertion; none is removed or loosened.

No timeout was raised, nothing is skipped, and the scale (600 and 1201 decided requests, 500 per window, 3 + 3 sweeps) is unchanged.

Why

The card's evidence (comment 7236773117): the case took about 1 s locally and 5.8 to 13 s on queue runners, against the 5000 ms default. Measured here, on the case "an older strand outside the newest window is reached by the cursor":

seeding 1201 rows 6 sweeps case total
before (serial inserts) 789 / 1146 ms 53 / 63 ms ~1000 ms
after (batches of 200) 93 / 99 / 103 ms 41 / 54 / 52 ms 149–178 ms

The 600-row case went from about 570 ms to 100–170 ms. The whole file's 39 tests are unchanged and green.

Verification

Ablation (the cases still detect the bug they pin): with inspectStrandedRequests reverted to the pre-#37808 read (no orderBy on the newest window, no id cursor on the walk), the 600-row and 1201-row cases both fail under the new seeding, exactly as they fail under the old one; CONTROL passes in both. Restored, 3/3.

runs

Head 19eeab6.

  • pnpm turbo run build --filter='@objectstack/plugin-approvals^...': exit 0.
  • npx vitest run src/stranded-request-inspection.test.ts (in the package), three times: 39/39 passed each time.
  • npx vitest run (whole package): 131 files, 1979 tests passed.
  • pnpm typecheck (package, includes check:test-typecheck): exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands --changed: 54 derived; 51 exit 0; 3 exit 3 (PREREQUISITE NOT MET), so NOT MEASURED locally and left to CI: node scripts/check-plugin-teardown-shape.mjs --self-test (its fixture commit is out of this shallow clone), pnpm check:dual-build-cjs-loads and pnpm check:i18n (both read every package's dist/; only this package's closure is built here). --ran reconcile: 54 accounted, 0 UNRUN.
  • npx eslint on the changed file: exit 0.

Acceptance notes

  • Found on the way, not fixed here (out of this card's test-only scope): an ObjectQL array insert of more than about 500 rows on SQLite throws too many terms in compound SELECT from SqlDriver.bulkCreate, which does not chunk. Reported to the seat as a follow-up candidate.

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; eslint on the changed file passes (the full pnpm lint was not run locally; CI runs it).
  • 4. One issue, one branch off an up-to-date main, one pull request. (branch claude/project-thread-4xkl1n is the harness-assigned name)
  • 5. A change that publishes carries a changeset: this diff is a test file only and publishes nothing, so no changeset (skip-changeset).
  • 6. packages/spec touched: no.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the 维护者速读 block is the maintainer summary).
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgVv7fqmna3sqqbjzf2

…s, not 1200 serial inserts

The "older strand outside the newest window" case seeded 1201 rows with one
engine insert each; that seeding was ~90% of the case's ~1 s locally and
5.8-13 s on loaded merge-queue runners, past the 5 s test default, so it
ejected unrelated PRs from the queue. The rows now go through the engine's
own array insert, 200 rows per batch (SQLite refuses a multi-row INSERT past
its 500-term compound SELECT). Rows, order and every assertion are
unchanged; the 600-row case additionally asserts all 601 rows are read.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgVv7fqmna3sqqbjzf2
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 28, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-sales November 28, 2026 09:22
@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 bd5407ec74b280f92a281ca4f82e5c8f0f8bdd47 → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head 19eeab6 · card #38223 · area s2-ai · 2026-11-28T09:47Z

L1 checklist (no review face on this file list: this record is the review of record)

Tier: S. Landing: ready and auto-merge in this stroke.

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

Labels

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

Projects

None yet

2 participants