Skip to content

[process] gate PR-body images: every url must resolve, designs/ images must be sha-pinned - #108

Merged
miachen0401 merged 4 commits into
mainfrom
process/pr-body-image-gate
Jul 30, 2026
Merged

[process] gate PR-body images: every url must resolve, designs/ images must be sha-pinned#108
miachen0401 merged 4 commits into
mainfrom
process/pr-body-image-gate

Conversation

@BenchCAD

@BenchCAD BenchCAD commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Nothing checks that the images in a PR body actually load. This adds that check, plus a fix to the bot that writes such links itself.

1. New: the image gate

Added to the existing check job. It fails a PR when:

  • an image URL in the body does not load
  • an image under designs/ is pinned to a branch name instead of a commit sha

It reads both ![alt](url) and <img src="url">. The second form is what you must write to set a width, and a markdown-only reader sees nothing — that exact hole let two family PRs ship broken previews in the sibling repo with CI green.

docs/assets/refs images on a branch only warn. 10 open PRs do this and stay green.

Why the branch rule

An image URL holds a ref plus a path.

Your fork branch is deleted when this PR merges. Every preview pinned to it dies at that moment, and the merged family can no longer be reviewed. A commit sha never moves.

So: copy the sha off your branch and use blob/<sha>/<path>?raw=true.

2. The dossier bot wrote links that rot

When a family merges, the bot comments on its issue with the renders. It linked blob/main/... — even though it already computed the merge sha for the text "landed in 3713fea". main moves, so a later rename would kill a merged family's permanent record. It also hard-coded preview.png.

Now it pins to the merge commit and links only files that exist.

Tested

Ran the script straight out of this YAML against real PR bodies, against the live API.

PR result
#52 FAIL — 3 previews on issue-31-metric-plastic-cable-gland
#50 FAIL — 2 previews on add-vertical-latch-toggle-clamp
#34 FAIL — 3 previews on add-minifix-cam-housing
#48 PASS + 2 warnings (docs/assets/refs on main)
#70, #82 PASS (images are user-attachments uploads)

Replayed the dossier bot on #38 and #36. Every link opens at the merge sha.

Those three PRs are already fixed

#52, #50 and #34 have been re-pinned to their branch head shas. Image URLs only — no code, and the previews show exactly what they showed before. All 8 rewritten URLs were checked before the edit, and all three now pass. Each author got a one-line note explaining it.

So this can merge without turning any open PR red.

Docs

CONTRIBUTING.md, the require-issue-link.yml row: states the rule and the fork-branch reason.

Both repos now have 0 broken images.

BenchCAD and others added 4 commits July 30, 2026 02:31
…s must be sha-pinned

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LPzpANKKH7rouBXBtyY6jf
Signed-off-by: BenchCAD <benchcad@users.noreply.github.com>
…y links renders that exist; CONTRIBUTING states the pin rule

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LPzpANKKH7rouBXBtyY6jf
Signed-off-by: BenchCAD <benchcad@users.noreply.github.com>
Repo rule: no Chinese outside *.zh.md — drops the Chinese halves of the
four new gate messages.

Signed-off-by: BenchCAD <benchcad@users.noreply.github.com>
@miachen0401
miachen0401 merged commit 9809a89 into main Jul 30, 2026
6 checks passed
@miachen0401
miachen0401 deleted the process/pr-body-image-gate branch July 30, 2026 09:56
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.

3 participants