Repository navigation
Conversation
Decode store assets before reporting validation success. Retain the source metadata checks and identify corrupt assets by label. Add focused truncation and checksum regressions. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Exercise offset byte views, metadata-only files, truncation inside IDAT and damaged IDAT checksums. Recover the lane test improvements without unrelated file-size coverage. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
|
Warning Review limit reachedOnly developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing. Next included review available in 14 minutes. View limit details
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, self-contained fix in host-side screenshot tooling: validation now decodes PNG data and rejects truncated or corrupt assets while preserving valid asset handling. The accompanying regression tests cover the new validation cases without affecting product runtime. You can add or adjust custom eligibility rules. Learn more. |
Problem
--validate-onlycan call a corrupt mobile screenshot "upload-ready". The validator checks dimensions and RGB format using fixed header offsets, but never decodes the image data. A PNG truncated inside IDAT or with a damaged checksum can pass.On main,
--validate-onlyaccepts a PNG truncated to 44 bytes in both the iPhone 6.9-inch and Pixel capture sets. Complete PNGs should pass, and corrupt files should identify the failing asset and exit nonzero.Change
Decode each asset with the existing
PNG.sync.readbefore returning validation success. Report decoder errors with the asset label and preserve the underlying error as the cause. Keep the original dimension, bit-depth, color-type, alpha, file-size, aspect-ratio and screenshot-count checks. Validation does not rewrite the input.The focused tests use generated RGB PNGs. They cover an intact file in an offset byte view, metadata-only files, truncation inside IDAT and a damaged IDAT checksum. They exercise real external-format parsing without timers, mocks or devices.
Scope and approval
This fixes an obvious false validation success in existing screenshot tooling, under the contribution guide's exception for a very small, focused bug fix. No prior issue or discussion approval is claimed. Only the validator and its existing test file change.
Validation-only returns before app, server, Metro, simulator or emulator setup. No product UI or screenshot pixels change. The CLI evidence uses generated RGB files at 1320×2868 and 1080×1920, not app captures. No production app build is needed for this path.
Prior PRs: #4014, by @juliusmarminge, introduced the harness and validator. No earlier PR attempting this integrity fix was found. #14254, by @Bil0000, is separate Pen-export work and is not reused here; its maintainer deferral concerns that feature.
Verification
Linux, Node 24.22.0:
vp test run scripts/mobile-showcase.test.ts --no-cache: against main'smobile-showcase.ts, the three corruption tests fail and the other four pass. All seven pass with this change.node scripts/mobile-showcase.ts --validate-only --device iphone-6.9 --appearance dark --theme t3-code, repeated with--device pixel: base accepts intact, truncated and restored files with exit 0. Candidate accepts intact and restored files, but names the truncated asset and exits 1. Each capture set contains six generated screenshots.tsc-rs --noEmit -p scripts/tsconfig.json: passes.vp lint scripts/mobile-showcase.ts scripts/mobile-showcase.test.ts: passes, including main's current test lint rules.vp fmt --check scripts/mobile-showcase.ts scripts/mobile-showcase.test.ts: passes.git diff --checkand the merge check against green main also pass.The new corruption tests fail on base, then all seven tests pass on the candidate.
Base accepts truncated files. Candidate rejects them for both capture sets and passes again after restoration.
Not checked: native screenshot capture, App Store or Google Play uploads, production app builds, and the full repository suite. This command path neither captures nor uploads screenshots.
Production fix, tests, PR description and images written with GPT-6.1 Sol in T3 Code Nightly.
🤖 Generated with GPT-6.1 Sol in T3 Code Nightly