Repository navigation
feat(risk-paths): validator, matcher, reusable workflow and core's own list (T801 t4) - #194
Merged
Merged
Conversation
…n list (T801 t4) Adds scripts/lib/risk-paths.mjs (strict JSON, validation, glob matcher, API client, labeling job), its tests, the reusable workflow .github/workflows/risk-paths.yml (on: workflow_call) that embeds the library verbatim with no checkout, core's caller on pull_request_target, core's .github/risk-paths.json, the gate npm run check:risk-paths, and the risk-paths surface in repository-surfaces v1 (ADR-0068).
…e limit; test the cap Cross-review round 1: the summary shows 500 matches and the count of the rest, and the job log lists every match; the spec now says so, and a test with 503 matches pins it. Section A names the 256-expansion brace limit.
frostyard-machines
force-pushed
the
lucilla/t4-risk-paths
branch
from
November 4, 2026 14:54
cc39d10 to
4651509
Compare
bketelsen
approved these changes
Nov 4, 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
Plan T801 task t4 (ADR-0068,
docs/specs/risk-paths.md). Adds:scripts/lib/risk-paths.mjs: strict JSON parser (fails on a duplicate key), validator (spec field table, deny by default), glob matcher (**,*,?,{a,b}), a minimalfetchGitHub client, and the labeling jobrunRiskPathsJob..github/workflows/risk-paths.yml(on: workflow_call): top-levelpermissions: {}, jobcontents: read+pull-requests: writeonly. It checks out nothing. It embeds the library verbatim in a heredoc and runs it withnode --input-type=module. GitHub has no context value for a reusable workflow's own SHA, so a checkout of core at "the pinned commit" is not possible without a duplicate SHA input; embedding keeps all code at the caller's pinned core commit.scripts/sync-risk-paths-workflow.mjs(npm run sync:risk-paths-workflow) andscripts/check-risk-paths.mjs(npm run check:risk-paths, now inverify): validates a list, rule C (the list and the caller are listed), and fails when the embedded copy drifts from the library..github/workflows/risk-paths-caller.ymlonpull_request_target(opened,synchronize,reopened,edited), nomerge_group, not a required check. It uses the local path./.github/workflows/risk-paths.yml: underpull_request_targetthat resolves to the base-branch commit, and a PR cannot pin to a SHA that does not exist yet. The spec now names this as the 1 exception to the SHA pin..github/risk-paths.json(12 entries; eachwhystarts with aprotected_boundaries[].id).risk-pathssurface inrepository-surfacesv1 (contract, schema, invariant, fixtures, enrollment spec table). Snowcat is retired (ADR-0064), so no importer requires the 5th surface today.AGENTS.mdlive-convention bullet; PR template line (arisk:highmatch is the highest tier).Job behaviour:
pull_request_targetonly; reads.github/risk-paths.jsonatpull_request.base.shathrough the contents API (404 → "no list on base", pass); strict-parses and validates (invalid → fail, no label); checksGET labels/risk:highon every run with a valid list (missing → fail with a message naming the label, the repository and thegh label createstep; never creates it); lists PR files over all pages; ≥ 3000 files → label (fail safe) and a "truncated" note; on a match addsrisk:highand writes path, glob and why to the job summary; never removes a label. Untrusted file names are printed only as JSON after a fixed prefix (no::command::injection) and escaped in the summary; the token goes only to the API host (a pagination link to another host fails).Risk tier
Risk tier: high — a new
pull_request_targetworkflow with apull-requests: writetoken, new governance paths, and a change to the organization surface contract. This PR touches paths in its own new list (.github/workflows/**,.github/risk-paths.json,organization/contracts/**,organization/schemas/**,scripts/lib/risk-paths.mjs,scripts/check-risk-paths.mjs). Why it is safe: no PR head code runs (no checkout, list at the base SHA, files from the API), permissions are the 2 the spec allows, and the caller is not a required check. The caller does not run on this PR (no caller and no list on base).Verification
make ci: 164 tests pass, 0 fail;ok risk_paths: 12 entries, workflow in sync; docs, organization, bash and corrections gates green.actionlint1.7.12 (with shellcheck) on all workflow files: no findings.ci.ymlunchanged; no ADR changed.frostyard/corePR 190 withaddLabelsstubbed: contents, pagination and label reads worked;risk:highexists in core.34a28ce, removed afterwards):matchGlobmade to returnfalse:node --test test/risk-paths.test.mjs→ 66 tests, 16 fail (spec table rows, braces/**, dotfile, case, matchFiles, job match, sync check, check-risk-paths).pull_request.head.shainstead of the base: 9 fail, including "job reads the list at the base SHA, never at the head SHA".actions/setup-node@49933ea… # v4.4.0),permissions: {}, no checkout (ADR-0021).Docs housekeeping
AGENTS.mdedited at the canonical path).After merge
risk:highalready exists in core.frostyard/core/.github/workflows/risk-paths.yml@<merge SHA>.Cross-review
github-copilot/claude-opus-5.5. Reviewer:openai/gpt-6.1-sol(read-only), base20fd8a3.34a28ce: Not ready, 2 blocking spec mismatches: (1) the summary showed 500 matches while section E said "each"; (2) the 256 brace-expansion limit was not in section A. Fixed incc39d10: the spec states both; the summary names the count it omits and points to the job log, which lists every match; a new test with 503 matches pins it.cc39d10: Ready, Blocking: none.cc39d10:make ci165 pass, 0 fail;actionlintclean; CI green (docs-gate, fleet-conventions, scaffold-e2e). The revert tests above were at34a28ce;cc39d10changes only the summary text, the spec and 1 added test.Rebase after #193 and #191
182a399(main after t8 feat(scripts): weekly corrections report (T801 t8) #193 and t9 feat(scripts): instruction lint and the blind-review prompt (T801 t9) #191). Head:4651509. The only conflict was thepackage.jsonscripts block: keptcheck:instructionsandreport:correctionsfrom main, and addedcheck:risk-pathsandsync:risk-paths-workflow.git range-diffshows no other change. The fix has no logic change, so the re-review atcc39d10(Ready) stays valid per the cross-review policy.4651509:make ci200 pass, 0 fail;ok risk_paths: 12 entries, workflow in sync;actionlintclean; CI green (docs-gate, fleet-conventions, scaffold-e2e).