Skip to content

Fix the doc-drift no-op guard, and fail loudly when the branch's fixes have no PR - #637

Merged
nockawa merged 1 commit into
mainfrom
doc-update
Aug 1, 2026
Merged

nockawa merged 1 commit into
mainfrom
doc-update

Conversation

@nockawa

@nockawa nockawa commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

The nightly doc-accuracy review's open-pr job failed on run 30689709217 — the first night since the 2026-07-31 redesign that the reviewer actually produced a patch, so this path had never executed. Two independent bugs, one masking the other.

The no-op guard could never fire. git status --porcelain is a whole-worktree predicate, and actions/download-artifact drops doc-fix.patch and fixes.txt in the workspace root, so it always reports ?? …. Every quiet night therefore fell through to git add -A doc/ (staging nothing) and git commit, which exits 1 under set -euo pipefail — a red run blaming "nothing added to commit". Staging first and testing the index asks the question the step actually means. The patch step twelve lines up documents this exact trap by name.

A quiet night was treated as unconditionally benign. The patch is idempotent, so once fixes are pushed nothing re-commits them and gh pr create never runs again for work already on the branch. When the PR is missing, those fixes are stranded and no later run recovers them — which is precisely what happened to #632–#635 when createPullRequest was blocked by the repo's Actions policy. The job now fails and names the unmerged files.

Two details in the second guard are deliberate:

  • Diffing doc/ against main, not counting commits. This branch is long-lived and gets squash-merged repeatedly, so it sits permanently ahead of main; only the content question stays correct after the first merge.
  • Naming files instead of ! git diff --quiet. --quiet exits non-zero for errors (128, e.g. an unresolvable origin/main) exactly as for "differs" (1), so the negation would report stranded fixes when the real fault was something else. Capturing the output keeps a genuine git failure fatal with git's own message.

Verified against throwaway repos reproducing the CI workspace:

Case Expected Result
No-op night, artifacts in workspace root commit skipped, exit 0 pass
Real fix applied commits pass
Brand-new doc page (untracked) commits pass
Branch carries fixes, no open PR fails, names files pass
Same, PR open exit 0 pass
Post-merge: 2 commits ahead, no doc delta exit 0 pass
origin/main unresolvable dies on git's fatal: pass

Workflow-only change; no engine code touched. The policy toggle has since been enabled and #636 was opened by hand to rescue the stranded fixes.

…s have no PR

`git status --porcelain` is a whole-worktree predicate and is never empty in the open-pr job — download-artifact drops doc-fix.patch and fixes.txt in the workspace root — so the no-op guard could never fire, and every quiet night fell through to `git commit` and died on "nothing added to commit". Stage first and ask the index instead.

A quiet night is also only benign if the fixes already on the branch are visible somewhere. The patch is idempotent, so nothing re-commits them and the create path never fires again for work already pushed. Fail when doc/ differs from main with no open PR — that is how #632-#635 ended up invisible after run 30689709217 hit the createPullRequest policy block. Diffing doc/ rather than counting commits keeps the merge commits this job creates from reading as stranded work, and naming the files rather than negating `git diff --quiet` keeps an unresolvable ref fatal instead of misreported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019edYt6pHPKFqVcsDpJ7v9x
@nockawa
nockawa merged commit 4573604 into main Aug 1, 2026
13 checks passed
@nockawa
nockawa deleted the doc-update branch August 1, 2026 08:07
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