Skip to content

test: add regression coverage for error handlers and attachmentLimits - #2856

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/regression-test-coverage-e968
Draft

test: add regression coverage for error handlers and attachmentLimits#2856
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/regression-test-coverage-e968

Conversation

@cursor

@cursor cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Asana Task/Github Issue: Weekly test coverage automation

Description

Adds missing integration tests for recently merged production logic where coverage was weak:

  1. Global error listeners (new-tab + history) — Onboarding already had edge-case tests for the shared ErrorEvent / unhandledrejection handlers (Fall back to ErrorEvent.message in special-pages error handlers #2714), but new-tab and history only covered the happy path. Added parity tests for cross-origin script errors (ErrorEvent.message fallback), empty ErrorEvents, non-Error throws, and primitive/nullish rejection reasons.

  2. NTP attachmentLimits (NTP: Use attachmentLimits config for NTP omnibar attachments #2816) — File cap and oversize rejection were covered, but config-driven image caps and partial/malformed attachmentLimits payloads were not. Added integration tests verifying imageMaxPerTurn config, and that empty { files: {}, images: {} } sections degrade to hook defaults (3) without crashing.

Risky behavior now covered

  • Telemetry from cross-origin script errors and malformed ErrorEvents on new-tab and history pages
  • Non-Error throws and primitive rejection reasons stringified correctly for crash reporting
  • Backend-configured image attachment limits enforced in the omnibar
  • Partial attachmentLimits payloads from native/backend do not throw at optional-chaining sites

Test files added/updated

  • special-pages/pages/new-tab/integration-tests/new-tab.spec.js
  • special-pages/pages/history/integration-tests/history.spec.js
  • special-pages/pages/new-tab/app/omnibar/integration-tests/omnibar-attachments.spec.js
  • special-pages/pages/new-tab/app/omnibar/mocks/omnibar.mock-transport.js (test fixture only)

Why these tests materially reduce regression risk

The error-handler tests protect telemetry quality across three high-traffic special pages that share identical handler logic — a fix or refactor on one page could silently diverge on others. The attachmentLimits tests guard a new config-driven code path (#2816) where incorrect optional chaining or limit wiring would either crash the omnibar or allow oversized/beyond-cap attachments through to Duck.ai.

Testing Steps

  • cd special-pages && npm run test-int -- pages/new-tab/integration-tests/new-tab.spec.js --grep "global error listeners" --reporter list
  • cd special-pages && npm run test-int -- pages/history/integration-tests/history.spec.js --grep "global error listeners" --reporter list
  • cd special-pages && npm run test-int -- pages/new-tab/app/omnibar/integration-tests/omnibar-attachments.spec.js --grep "attachmentLimits|image attachment limits|partial attachmentLimits" --reporter list

Checklist

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged
Open in Web View Automation 

New-tab and history share the same ErrorEvent/unhandledrejection handler
logic as onboarding (#2714) but lacked integration coverage for cross-origin
script errors, empty ErrorEvents, non-Error throws, and primitive rejection
reasons. Add matching tests to prevent regressions in telemetry reporting.
Add integration tests for config-driven image limits (mirroring the existing
file-cap test from #2816) and verify malformed partial attachmentLimits
objects degrade to hook defaults instead of crashing the omnibar.
@github-actions github-actions Bot added the semver-patch Bug fix / internal — no release needed label Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

[Beta] Generated file diff

Time updated: Mon, 13 Jul 2026 08:06:36 GMT

Integration
    - integration/pages/new-tab/dist/index.js

File has changed

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

Labels

semver-patch Bug fix / internal — no release needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant