You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
preview-netlify, preview-cloudflare: change detection lists lectures the pull request did not change #215
Found while fact-checking the preview chapters of the user manual (#190, #213).
What happens
The "Changed Lectures" list in a preview comment, and the changed-files output, include lectures that the pull request never touched. Any lecture changed on the base branch after the pull request branched off is listed as modified.
Why
Both actions hand scripts/detect-changed-lectures.sh two commits:
BASE_SHA is github.event.pull_request.base.sha, the tip of the base branch (preview-netlify/action.yml:73, preview-cloudflare/action.yml:85).
HEAD_SHA is the pull request's head.
The script compares them with two dots (scripts/detect-changed-lectures.sh:33 and :56):
A..B compares the two trees. A file that changed on the base branch after the pull request branched off differs between them, so it is listed. To list only what the pull request changed, the comparison must start from the merge base, which is what three dots give: git diff "${BASE_SHA}...${HEAD_SHA}".
Reproduction
A scratch repository where the pull request edits lectures/a.md, and main then edits lectures/d.md:
The fact-check also reproduced it on a depth-1 checkout of a simulated refs/pull/N/merge. There, three dots worked after the script's own git fetch of the two commits.
Proposed fix
Use ... in both git diff calls in scripts/detect-changed-lectures.sh.
Check that the merge base is reachable after the script's fetch in a shallow checkout. The fact-check found it was; if a checkout is ever too shallow, git diff A...B fails, and the script's || echo "" would silently list nothing. Deepening the fetch, or warning when git merge-base fails, would cover that.
Add a unit job to the harness that runs the script against a scratch repository like the one above. It needs no provider secrets, so it covers the one part of the preview actions the harness can run.
The user manual's preview chapters (#213) describe the current behaviour and link here. The fix PR updates them.
From the 2026-10-06 codebase review (finding L4; record: .qe/dev/log/2026-10-06-codebase-review.md, #220).
The base-tip half of the review's finding is this issue. The general half is not filed anywhere: scripts/detect-changed-lectures.sh hides every git failure. Both fetches end in 2>/dev/null || true (:26-27), and the name-status diff in 2>/dev/null || echo "" (:33). So any failure yields an empty list, and the preview comment loses its lecture links without a warning. #164 saw this in the field and fixed one cause (git ownership in containers), but left the swallowing in place.
At :56, a git diff --quiet that errors returns 128, which the ! test reads as "changed": it fails open.
One option avoids the checkout altogether: the pull request files API, which the harness gate already uses (test-actions.yml:163-164). Its caveats: renames come back as renamed with the new path, results stop at 3,000 files, and the list can race a new push.
Activity
docs(manual): correct the preview and restore chapters against the code
docs(manual): chapters for the other seven actions, and delete QUICK-…
mmcky commentedon Nov 4, 2026
From the 2026-10-06 codebase review (finding L4; record:
.qe/dev/log/2026-10-06-codebase-review.md, #220).The base-tip half of the review's finding is this issue. The general half is not filed anywhere:
scripts/detect-changed-lectures.shhides every git failure. Both fetches end in2>/dev/null || true(:26-27), and the name-status diff in2>/dev/null || echo ""(:33). So any failure yields an empty list, and the preview comment loses its lecture links without a warning. #164 saw this in the field and fixed one cause (git ownership in containers), but left the swallowing in place.:56, agit diff --quietthat errors returns 128, which the!test reads as "changed": it fails open.test-actions.yml:163-164). Its caveats: renames come back asrenamedwith the new path, results stop at 3,000 files, and the list can race a new push.fix(preview-*): list only what the pull request changed, with a bound…
fix(preview-*): list only what the pull request changed, with a bound…
fix(preview-*): list only what the pull request changed, with a bound…
fix(preview-*): list only what the pull request changed, with a bound…
docs(changelog): keep the #215 entry under [Unreleased] after v0.13.0
fix(preview-*): list only what the pull request changed, with a bound…
docs(changelog): keep the #215 entry under [Unreleased] after v0.13.0