Skip to content

fix(plugin-form): the print row-cap test loads the line grid's body before its first render (#36640) - #36656

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-7z9wo3
Nov 23, 2026
Merged

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

Conversation

@os-warren

Copy link
Copy Markdown
Collaborator

Requested by Warren · project thread

Fixes #36640

Also the cause of #36649 (main's 4-hourly full run red at e9fa6b5d06); that card closes when the next full run is green.

What changes

ui/packages/plugin-form/src/__tests__/lineItemsPrintRowCap-11958.test.tsx loads the line grid's body at module scope (await preloadGridField()), before any test renders. No assertion is changed, removed, relaxed or retried; no timeout is touched; the file is not moved into heavyDomTests. Test-only: no product code moves, so no changeset (needs skip-changeset).

Why

Root cause, read from both failure logs and confirmed with a probe:

  • Both reds fail at line 100 (expected +0 to be 2), the single row count read right after waitFor sees the row-ceiling note: the merge-queue run on PR feat(plugin-dashboard): a drill opens a centred dialog over the standard list, and a report's chart marks drill #36461 (reading 7092248222) and main's 4-hourly run 45135779472, job 137562669352 (Test UI (3/16), lineItemsPrintRowCap-11958.test.tsx:100:58). Lines 112 and 118 never failed.
  • The note and the rows commit together (setRowCap and setRows are set in the same load callback in LineItemsPanel.tsx), but the grid's body is split out and loads on first use (objectstack#36102, ui/packages/fields/src/widgets/GridField.ts). LineItemsPanel starts that load at mount with preloadGridField() but does not wait for it, so a grid mounted before the load settles draws its loading face (data-testid="grid-field-loading", no table) while the note is already in the DOM.
  • Probe at line 100 on unmodified main (3cf6a44b): loadingFace=true tbody=false. The count of 0 is the loading face, not a missing or extra row.

This is the case ui/AGENTS.md § 测试纪律 names: an assertion that lands behind a dynamic import() loads that module at module scope, where the cost is outside every test window. Three sibling tests in this package already do exactly this (ModalForm.untypedRepeater.test.tsx, masterDetailSectionMembers-8071.test.tsx, deriveMasterDetail.declaredSpelling.test.tsx).

Product side, considered and not changed: in the browser the note can sit under the grid's loading face only until the chunk that preloadGridField() already requested arrives, and printing is a user-triggered window.print(), so no printed page carries the note without its rows. The row cap and the note are unchanged.

Verification

All counts on objectstack-ai/objectstack, the 6-test file run alone with npx vitest run --maxWorkers=2 packages/plugin-form/src/__tests__/lineItemsPrintRowCap-11958.test.tsx from ui/, 20 runs each, under load (one busy loop per core on a 4-core container, so the file runs against 4 CPU stressors):

Tree Red runs Failing test
before: main 3cf6a44b 20 / 20 draws the cap’s rows…, line 100, expected +0 to be 2
after: this branch 0c621d36 0 / 20 none; every run Tests 6 passed (6)

Run cold, as each fresh vitest run is, the load always loses the race; in CI's full run it loses only when the chunk's transform is slow, which is why the queue and the 4-hourly run saw it intermittently.

Also on 0c621d36: the whole plugin-form package under --maxWorkers=2, 245 files / 2766 tests passed, 1 skipped (pre-existing); eslint on the changed file clean.

Clause-②: no
Metadata-protocol: none

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. (no names added)
  • 3. No formatter ran; pnpm lint passes. (eslint on the changed file)
  • 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. (test-only, 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 by Claude Code

…efore its first render (#36640)

The cut-off case read the row count once, right after the row-ceiling note
appeared. The note and the rows commit together, but the grid's body loads
on first use (objectstack#36102), and the panel's mount-time preload is not
awaited: a grid mounted before that load settles draws its loading face with
no table, so the count read 0. Load the body at module scope, as the other
line-grid tests do; the assertions are unchanged.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbZPB2pvoCNvwHycJan
@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

修好表单打印的一个偶发失败测试。它让主干每 4 小时一次的全量测试变红(#36649),也曾把别的 PR 踢出合并队列。
原因:表格的代码是用到时才加载的,测试在表格还在加载时就去数行。现在测试先把表格加载好,和旁边三个同类测试的写法一样。产品代码没改。
高负载下修复前 20 次全红,修复后 20 次全绿。
要你做的:无。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head 0c621d36 · 2026-11-23T09:51Z

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 09:52
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit a115ac5 Nov 23, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-7z9wo3 branch November 23, 2026 10:12
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui: plugin-form test lineItemsPrintRowCap-11958 failed once in the merge queue with "expected +0 to be 2" on a PR that does not touch plugin-form

2 participants