test(web): attachment preview omission tests no longer time out on CI#25514

merged1
main
fix/attachment-preview-flake
opened3d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

The "keeps the body and warns when omitting expanded %s" cases in AttachmentFilePreview.browser.test.tsx hit vitest's 15s timeout on CI for PRs that don't touch this area: run 40332078618 failed comments, styles and style chain, and run 40334346059 failed styles. In the failing run every one of the 12 cases was slow, taking 3.6–15.5s. Other full-UI Word render tests in the same file took about 1.5s.

Cause. The shared fixture body had 500 paragraphs, each with a page break and note references. The expansion budget needs only about 13 copies of the 8,000-unit payload to exceed 100,000 markup units. The style and numbering cases are cut by their own part budgets and don't depend on the body at all. So most of the fixture did nothing for the assertion. It only made every case lay out and mount a 501-page document while the test waited, and on a busy runner that work grew enough to cross the timeout.

Fix. The body now has 20 page-break paragraphs: 160,000 units, still 60% over budget. Every case still asserts the same things: the body is kept, the "Preview limited" notice appears, there's no alert, and the omitted payload isn't rendered. No timeouts, retries or sleeps were added.

Timings. Local, with vitest and Chromium pinned to 2 cores next to 2 busy-loop processes (a rough stand-in for a 2-vCPU runner):

casebeforeafter
footnotes7218ms6002ms
note roots5532ms5375ms
endnotes5670ms4179ms
header5074ms4020ms
footer5263ms4220ms
comments5060ms4163ms
styles5318ms3681ms
style chain6261ms4331ms
style count6415ms4098ms
style visits5087ms5424ms
numbering5805ms4463ms
picture numbering5469ms3888ms
total (12 cases)98.3s83.1s

After the fix, these cases cost about the same as the "retains Word … without a limit warning" render tests under the same load (3.5–6.2s), and those take about 1.5s on CI. What remains is the fixed cost of starting the layout worker (yrs WASM session and fonts), which every Word render test pays. Without load the 12 cases take 1.4–2.9s.

Opus 5.5 via Claude Code.

🤖 Generated with Claude Code

Checks

23 successful · 12 skipped
All checks passed
65172a0

Added 1 commit

  • test(web): attachment preview omission tests no longer time out on CI65172a0
Synced from GitHub

Approvability

Verdict: Approved at 65172a0

Macroscope's review found this PR approvable — This is a five-line change confined to an ignored browser test fixture, intended to reduce CI timeout risk without changing product behavior. Its impact is limited to test execution and does not affect production defaults or static-analysis configuration.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between f05c38f1667fcf36970affd09574a234c85e3bff and 65172a0f05b3d5dd19f6738345c72be534d95770.

External image Files selected for processing: 1
  • apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Walkthrough

The Word expansion test now uses 20 repeated paragraphs instead of 500. Its comments describe the 100,000-unit expansion budget and the layout time added by more pages.

Changes: Word expansion test

Layer / File(s)Summary
Update Word expansion budget test
apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
The test creates 20 repeated paragraphs. Its comments state that 20 references or pages exceed the 100,000-unit expansion budget and add layout time.

Priority: External image Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: maria-rcks

Merge Risk: External image Minimal · up to 65172

The test remains effective with a substantially smaller fixture and introduces no merge-blocking risk.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly states that the change prevents attachment preview omission tests from timing out on CI. It uses a concise conventional commit format.
Description checkPassedThe description clearly explains the CI timeout problem, the fixture-size change, preserved assertions, and verification timings. It does not explicitly document issue or maintainer approval, but the …
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the CI timeout problem, the fixture-size change, preserved assertions, and verification timings. It does not explicitly document issue or maintainer approval, but the remaining content is complete for this focused test-only fix.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.