Skip to content

fix(risk-paths): skip the workflow sync check when pr-triage.yml is absent - #258

Merged
bketelsen merged 2 commits into
mainfrom
lucilla/risk-paths-vendored-no-workflow
Nov 14, 2026
Merged

bketelsen merged 2 commits into
mainfrom
lucilla/risk-paths-vendored-no-workflow

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

scripts/check-risk-paths.mjs ran the workflow sync check whenever scripts/lib/risk-paths.mjs existed under --root. A repository that vendors the library (as the risk-paths spec allows, with a sha256 pin) usually has no .github/workflows/pr-triage.yml. There checkSync read a missing file, and the gate failed with ENOENT on a valid list.

  • scripts/check-risk-paths.mjs: when the library exists but .github/workflows/pr-triage.yml does not, the gate skips the sync check. Its ok line then ends workflow sync skipped (no .github/workflows/pr-triage.yml) instead of workflow in sync. Only a missing path skips it: the gate calls lstat on the workflow path and skips on ENOENT alone. Any other error (EACCES, ENOTDIR) fails the gate; lstat does 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 no workflow in sync (this case fails with ENOENT without the fix). A pr-triage.yml that exists but holds no embedded block still fails. A pr-triage.yml that is a symlink loop (ELOOP) or a dangling symlink (ENOENT on 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 to test/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 say workflow in sync.

Core stays strict: the existing test check-risk-paths passes on the repository (test/risk-paths.test.mjs) requires workflow in sync on core's run, so a missing or drifted workflow in core still fails make 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: when lstat of .github/workflows/pr-triage.yml under --root gives ENOENT, the check is skipped and the ok line says so; any other lstat error 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

  • Spec changed alongside its implementing code; no new doc, no new link.

Verification

  • make ci green locally before the first push (946 tests, 0 fail) and before the push of f506110 (949 tests, 0 fail; ok risk_paths: 17 entries, 17 at L1 or L2 name a category or boundary, workflow in sync).
  • Revert test at f506110: in a scratch worktree with the scripts/check-risk-paths.mjs of c285eae (the existsSync version) and the new tests, node --test --test-name-pattern="pr-triage.yml is" test/risk-paths.test.mjs fails all 3 cases (symlink loop, dangling symlink, ENOTDIR) on their assertions; with the fix they pass.
  • Without the fix (scripts/check-risk-paths.mjs stashed), node --test --test-name-pattern="vendors the library" test/risk-paths.test.mjs fails: FAIL risk-paths: ENOENT: no such file or directory, open '…/.github/workflows/pr-triage.yml'.
  • No workflow changed.

Cross-review

Reviewer openai/gpt-6.1-sol, coder anthropic/claude-opus-5-5, base 8489cca4b8fda354b5de96c55019e5a96cce84eb.

  • Review at c285eae3e86d35dc1d0122c24f6e5c4ae25d6716: Not ready. 1 blocking finding (medium): existsSync returns false on ELOOP and EACCES too, so the gate skipped the sync check and passed when it could not inspect the workflow. Fixed in f506110 (skip on ENOENT from lstat only, 3 tests, correction record).
  • Re-review 1 at f506110fa9ba565b2664d38b1df6e5de8e5a1334: Ready, Blocking: none, no new findings.

…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
@github-actions github-actions Bot added level:L2 Read the diff risk:high Touches a path in .github/risk-paths.json labels Nov 14, 2026
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.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 14, 2026
@bketelsen
bketelsen merged commit ccee9a0 into main Nov 14, 2026
6 checks passed
@bketelsen
bketelsen deleted the lucilla/risk-paths-vendored-no-workflow branch November 14, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L2 Read the diff ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check-risk-paths: the workflow sync check fails with ENOENT in a repository that vendors the library but has no pr-triage.yml

2 participants