Appearance
Risk scan
prisk scores the risk of each pull request and gives it one of these verdicts: auto, review, elevated, blocked, split or invalid.
Each changed file gets a Severity, Occurrence and Detection score, and the pull request gets the highest product. Decision 0011 tells why the repository scores each pull request by its risk. Decision 0022 tells why the coverage run includes the product tests. The prisk README lists the parts of the tool.
Run it
sh
node --test --experimental-test-coverage --test-coverage-exclude='**/node_modules/**' --test-reporter=lcov --test-reporter-destination=coverage/lcov.info 'tools/**/*.test.ts' 'products/urn-forge/**/*.test.ts'
node tools/prisk/cli.ts scan --base origin/main --head HEAD --coverage coverage/lcov.info --suite passedThe scan writes prisk-report.json and prints the pull request comment. risk-map.yml at the root of the repository holds all the rules and thresholds.
Rollout
rollout in risk-map.yml sets how strict the scan is:
shadowreports the verdict and blocks nothing.hygieneblocksinvalidandsplit.bandsalso blocksblocked, failselevatedwithout a## Rollbacksection, and clears approvals when the verdict becomes higher.autoalso turns on auto-merge forauto, with the risk trailers in the squash commit.
Branch rulesets read the risk: labels and set the necessary approvals. Before you use bands, set these rulesets in the repository settings.
Rules for special conditions
instructionis a Surface for files that steer agents:AGENTS.md, the Markdown in.agents/and.claude/, and the files thatAGENTS.mdimports. Its Severity is a minimum of 4, its Detection is 3, and onlymodifyandremoveare correct for it.- commitlint bans scopes, so a
chorecommit can declaremodifyorremoveonly when it changes only dependency files. - Only Effect claims on shipped Surfaces (
code,config,deps,schema,contract) must have proof. The scan accepts claims onbuildandinstructionfiles, and scores an unproven claim by its size. - A file that passes the mechanical check counts as
none, whatever its commit declared. Thus, a commit that holds a rename and a fix fails the mixed-effect rule. - The mixed-effect rule skips a file that moves with no change to its content, unless the file is
code,config,deps,schemaorcontract. So a pull request can move instruction, build, test or docs files and update the files that name them, as decision 0015 explains. - Size and complexity increase Occurrence only for
modify,removeand unproven claims. Hotspots and concurrency patterns increase it for each file. - Two to five direct dependency changes give an Occurrence of 4. One change that adds a package or goes to a new major version also gives an Occurrence of 4. More than five changes give an Occurrence of 5.
- A file that no test run reports is 0% covered if it is code, and scores a Detection of 4 if it is not executable. A module of only types has no executable lines, so it counts as 100% covered.
- A data file that covered code imports, such as a JSON schema, gets its Detection from the suite. It scores a Detection of 3 when the suite passes and 5 when it fails.
- A workflow that runs on
pull_requestscores a Detection of 2. Apull_request_targetworkflow runs the base version, so it gets no such credit. - The scan reads the risk map from the merge base, so a pull request cannot loosen its own rules. An edit to it scores a Detection of 2 when the new map validates and the suite passes.
- The scan uses the TypeScript compiler for the structural check, complexity and exports, so the mechanical check covers scripts, JSON and YAML.
- Schema and contract checks are adapters. This repository configures none, so schema files score a Detection of 4 and
additivecontracts fail.
Decision 0012 tells why a file gets Detection credit only from an actual check.