Repository navigation
pr-visual: show before, after, and diff in the PR comment - #5572
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
Live demo using real PR #5567 dataThis is the exact Visual Regression section the PR Analysis Report will contain. Demo images live on Cindy’s durable fork asset branch; production evidence will use immutable head/run paths. Visual Regression2 of 20 shot(s) changed.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
pushed a commit
that referenced
this pull request
Aug 26, 2026
pr-visual already generated a static report with before/after/diff PNGs, then hid it in an Actions artifact ZIP. A link to a ZIP is not a visual review: the reviewer has to download, unzip, and match filenames before they can answer the one question the gate asks — is the after correct? The privileged workflow_run deployer now copies the static report beside the PR preview at /pr/<n>/visual/ without executing PR-controlled code. The PR analysis comment links the full wipe report and embeds the first three changed shots as a Before / After / Diff table, directly where the decision is made. The rest stay in the full report so a broad change does not make the comment unreadable. Verified against #5567's real visual-pr-report artifact: its two Collapsible deltas produce six inline image URLs plus the full-report URL.
The first #5572 cut copied PR-generated HTML/JS into a privileged gh-pages publisher and trusted the PR number inside a PR-produced artifact. A fork could redirect that publisher at another PR; an older out-of-order run could also overwrite evidence under the same mutable URL. The workflow now resolves PR identity from the GitHub API and cross-checks the artifact's PR/head/run. Default-branch code validates the verdict schema and safe key grammar, rejects symlinks and oversized files, decodes/re-encodes every PNG, and generates the report wrapper itself. PR-produced HTML/JS is neither executed nor published. Evidence paths are immutable by head SHA + run ID. An existing path with anything but byte-identical content is a hard failure. Inline image URLs point at the immutable raw branch path, independent of Pages deployment health; the full wipe UI uses Pages. Validated against #5567's real artifact plus negative controls for wrong run, path traversal/shell-shaped keys, and invalid PNG bytes.
cixzhang
force-pushed
the
pr-visual-report
branch
from
August 26, 2026 22:16
8c63eb9 to
1a4d1fd
Compare
…sted code Review found three trust-boundary defects in the initial publisher: it trusted a PR number supplied by a PR-controlled artifact, copied PR-generated HTML/JS to the shared Pages origin, and used a mutable per-PR URL that an old run could overwrite. The workflow_run now resolves PR identity through the GitHub API and requires repo/head/run metadata to agree. Default-branch code validates verdict schema, counts and key grammar, rejects symlinks/oversized files, decodes and re-encodes all PNGs, and generates the HTML wrapper itself. Evidence publishes under an immutable head-SHA/run-ID path; different bytes at an existing path are a hard failure. Inline images use the immutable raw branch URL so Pages deployment health cannot break the PR evidence. No pull_request_target or workflow_run step checks out or executes PR code.
cixzhang
force-pushed
the
pr-visual-report
branch
from
August 26, 2026 22:25
36b1aa5 to
c30de63
Compare
This was referenced Aug 27, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.






Problem
pr-visualalready produces the evidence a reviewer needs, then hides it in an Actions artifact ZIP. A link to a ZIP is not a visual review: download, unzip, find three matching filenames, and only then decide whether the after is correct.That is why Cindy has not been seeing the screens even when the gate detects real deltas.
What
deploy-preview.ymldownloadsvisual-pr-reportbest-effort and copies its static report tohttps://facebook.github.io/astryx/pr/<number>/visual/The privileged
workflow_runjob only copies files; it never executes PR-controlled report code.Evidence
Verified against #5567's real
visual-pr-reportartifact (run 33001426427): its two Collapsible deltas generate six inline image URLs and the full-report URL.Testing
pnpm check:repogit diff --checkSecurity hardening after review
The first cut copied PR-generated HTML into a privileged
workflow_runpublisher and used the PR number claimed by a PR-produced artifact. The reviewer correctly rejected that shape.The publisher now:
pr/<number>/visual/<head_sha>/<run_id>/paths and refuses different bytes at an existing pathThe separate demo comment uses a durable
cixzhang/astryxasset branch so it survives preview cleanup. Production evidence remains under the PR's gh-pages lifecycle and is deleted when that PR closes.