get_risk
Assess file risk from git churn, bug-fix history, and dependency topology before editing. For PRs, reveals breakage risk, missing co-changes, and tests to run based on coverage.
Instructions
What history says about touching these files — bug fixes, churn, owners.
Fuses git temporal signals (churn percentile, trend, bus factor) with
graph topology (dependents, co-changes, impact surface) and security
findings. Consult before editing a file that is bug-fixed or busy. Pass
changed_files for PR mode: the response leads with a directive block
(will_break, missing_cochanges, missing_tests, tests_to_run) — read it
first. tests_to_run is coverage-backed: the tests the per-test map proves
exercise the changed files, empty when no coverage map is ingested.
To score a live commit or ``base..head`` diff by revspec instead of file
paths, use ``get_change_risk``.
defect_profile appears only on files with counted bug fixes: how many landed
in the trailing 6 months, how long ago the last one was, a bug_magnet flag
for sustained recent fix pressure, and top_symbols. Those per-symbol counts
are approximate, because symbol spans are current-tree while each fix's line
ranges are numbered on its own parent commit, so read them as "mostly here"
rather than exact. Nothing here names the commit that introduced a bug.
global_hotspots ranks the same way: fix history first, churn as fallback.
Args:
targets: file paths to assess.
repo: usually omitted.
changed_files: PR-changed files for blast-radius mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | No | ||
| targets | Yes | ||
| changed_files | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |