Repository navigation
fix(risk-paths): skip the workflow sync check when pr-triage.yml is absent - #258
Merged
Merged
Conversation
…bsent check-risk-paths ran the sync check whenever scripts/lib/risk-paths.mjs existed under --root. A repository that vendors the library usually has no .github/workflows/pr-triage.yml, so the gate failed with ENOENT on a valid list. The gate now skips the sync check there and says so in its ok line. Core stays strict: its own run must say "workflow in sync", which test/risk-paths.test.mjs checks. Fixes #257
existsSync also returns false on EACCES, ENOTDIR and a symlink loop, so the gate passed when it could not inspect the workflow. lstat now decides: only ENOENT skips the check, and any other error fails the gate. Tests cover a symlink loop, a dangling symlink and a file in place of .github/workflows; a correction record holds the lesson.
bketelsen
approved these changes
Nov 14, 2026
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.
Summary
scripts/check-risk-paths.mjsran the workflow sync check wheneverscripts/lib/risk-paths.mjsexisted under--root. A repository that vendors the library (as the risk-paths spec allows, with asha256pin) usually has no.github/workflows/pr-triage.yml. TherecheckSyncread a missing file, and the gate failed withENOENTon a valid list.scripts/check-risk-paths.mjs: when the library exists but.github/workflows/pr-triage.ymldoes not, the gate skips the sync check. Its ok line then endsworkflow sync skipped (no .github/workflows/pr-triage.yml)instead ofworkflow in sync. Only a missing path skips it: the gate callslstaton the workflow path and skips onENOENTalone. Any other error (EACCES,ENOTDIR) fails the gate;lstatdoes not follow a symlink, so a symlink loop or a dangling symlink reaches the sync check and its read error fails the gate. When the workflow exists, the check runs as before, and every read or parse error (for example a workflow with no embedded block) still fails.test/risk-paths.test.mjs: 5 new cases. A vendored library with no workflow passes on a valid list, with the skip note and noworkflow in sync(this case fails withENOENTwithout the fix). Apr-triage.ymlthat exists but holds no embedded block still fails. Apr-triage.ymlthat is a symlink loop (ELOOP) or a dangling symlink (ENOENTon read), and a file in place of.github/workflows(ENOTDIR), each fail the gate with no skip note..memory/corrections/2026-11-14-pr-258-skip-only-enoent.json: the review finding below, as a correction record (ADR-0081), promoted totest/risk-paths.test.mjs.docs/specs/risk-paths.md: the reusable-workflow section says when the gate skips the sync check, and that core's own run must sayworkflow in sync.Core stays strict: the existing test
check-risk-paths passes on the repository(test/risk-paths.test.mjs) requiresworkflow in syncon core's run, so a missing or drifted workflow in core still failsmake ci.Fixes #257
Risk tier
Risk tier: 3 —
risk:high: the PR touches 1 risk path at L2 (.github/risk-paths.json):scripts/check-risk-paths.mjs(quality-gates: the gate that validates the risk-path list). The change adds 1 branch before the sync check: whenlstatof.github/workflows/pr-triage.ymlunder--rootgivesENOENT, the check is skipped and the ok line says so; any otherlstaterror is a gate failure. The list validation, rule B, rule C and the drift check when the workflow exists are unchanged. In core the workflow exists, and the test above makes its absence a failure, so the gate does not get weaker for core. No library, workflow, permission or label behavior changes.Docs housekeeping
Verification
make cigreen locally before the first push (946 tests, 0 fail) and before the push off506110(949 tests, 0 fail;ok risk_paths: 17 entries, 17 at L1 or L2 name a category or boundary, workflow in sync).f506110: in a scratch worktree with thescripts/check-risk-paths.mjsofc285eae(theexistsSyncversion) and the new tests,node --test --test-name-pattern="pr-triage.yml is" test/risk-paths.test.mjsfails all 3 cases (symlink loop, dangling symlink,ENOTDIR) on their assertions; with the fix they pass.scripts/check-risk-paths.mjsstashed),node --test --test-name-pattern="vendors the library" test/risk-paths.test.mjsfails:FAIL risk-paths: ENOENT: no such file or directory, open '…/.github/workflows/pr-triage.yml'.Cross-review
Reviewer
openai/gpt-6.1-sol, coderanthropic/claude-opus-5-5, base8489cca4b8fda354b5de96c55019e5a96cce84eb.c285eae3e86d35dc1d0122c24f6e5c4ae25d6716: Not ready. 1 blocking finding (medium):existsSyncreturnsfalseonELOOPandEACCEStoo, so the gate skipped the sync check and passed when it could not inspect the workflow. Fixed inf506110(skip onENOENTfromlstatonly, 3 tests, correction record).f506110fa9ba565b2664d38b1df6e5de8e5a1334: Ready, Blocking: none, no new findings.