Skip to content

Stop the capture's own console noise from holding every screenshot PR - #64

Merged
Neaox merged 1 commit into
mainfrom
fix/capture-harness-noise
Sep 20, 2026
Merged

Neaox merged 1 commit into
mainfrom
fix/capture-harness-noise

Conversation

@Neaox

@Neaox Neaox commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

PR #63 was held for review by the screenshot audit for two reasons that have nothing to do with the screenshots.

Inbox: Blocked script execution in 'about:srcdoc'. Playwright's page.clock.install injects its shim into every frame, including the email preview iframe, which is sandbox="allow-same-origin" on purpose. A page with a script-free sandboxed srcdoc iframe logs the message with clock.install and not without it. The console is fine and the sandbox should stay.

Resources: Failed to load resource … 404. The capture opens VersionedBucket, which has no lifecycle rules. The bucket page always calls GetBucketLifecycleConfiguration; the emulator answers 404 NoSuchLifecycleConfiguration like S3 does and the console maps it to "no rules". Chrome logs the 404 before the page handles it.

The audit (#61) is what surfaced these; before it, capture-console.mjs recorded them and dropped them.

Changes

  • isExpectedPageLog in src/lib/screenshot-audit.ts matches exactly those two cases. The 404 rule only applies to a request with ?lifecycle or ?website in its query.
  • capture-console.mjs appends message.location().url to console.error entries, since a "Failed to load resource" message does not name the resource, and drops expected entries from the warnings. They stay in the per-attempt debug log.
  • A 404 for any other URL, a lifecycle request failing with another status, and every other console.error still hold the PR.

Testing

  • npm test (139 pass, six new), npm run copy-lint, node --check scripts/capture-console.mjs.
  • Ran the new listener and filter against a local page with a sandboxed srcdoc iframe, clock.install and a lifecycle 404: two entries logged, none kept. Adding an unrelated 404 keeps exactly that one, with its URL.
  • Not run against a real emulator (Docker is down on my machine). The next refresh-screenshots run is the real confirmation: it should hold only for the map redesign.

The audit added in #61 records every console.error the console logs during a capture and
holds the PR for a human when there is one. Two of those are always there and say nothing
about the screenshot:

- Playwright's clock shim is injected into every frame, including the sandboxed email
  preview iframe, which has no allow-scripts on purpose. Chrome logs "Blocked script
  execution in 'about:srcdoc'". Reproduced with a script-free srcdoc iframe: only
  page.clock.install triggers it.
- Every bucket page asks S3 for the lifecycle and website configuration. A bucket without
  one answers 404 NoSuchLifecycleConfiguration / NoSuchWebsiteConfiguration, as real S3
  does, and the console maps that to "not configured". Chrome logs any 404 before the page
  handles it. The capture's bucket is the example stack's VersionedBucket, which has no
  lifecycle rules.

isExpectedPageLog names both exactly. The 404 rule needs the failing request, so the
capture now appends message.location().url to console.error entries (a "Failed to load
resource" message does not say which resource). A 404 for any other URL, a lifecycle request
that fails with anything but 404, and every other console.error still hold the PR. Filtered
entries stay in the per-attempt debug log.
@Neaox
Neaox merged commit 4f0edbe into main Sep 20, 2026
5 checks passed
@Neaox
Neaox deleted the fix/capture-harness-noise branch September 20, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant