Skip to content

feat: smart risk engine for PR change analysis#14

Merged
kehoej merged 2 commits intomainfrom
feature/smart-risk-engine
Apr 13, 2026
Merged

feat: smart risk engine for PR change analysis#14
kehoej merged 2 commits intomainfrom
feature/smart-risk-engine

Conversation

@kehoej
Copy link
Copy Markdown
Owner

@kehoej kehoej commented Apr 13, 2026

Summary

  • Per-file risk scoring (0–100) with four tiers (SAFE/REVIEW/TEST/CRITICAL) for analyze-change, combining change status, structural factors (importer count, co-change frequency, fragility, mutual deps, cycles), and test coverage adjustments
  • Risk triage output grouping files by tier with human-readable narratives, aggregate risk with percentile ranking against historical baselines, and test suggestions for high-risk untested files
  • Compact output format (--compact) producing token-optimized text summaries (~60–75% fewer tokens than JSON), optimized for LLM consumption
  • CI risk badge and --fail-on critical option for gating PRs on risk triage tiers
  • Slash commands /pr-risk (human-friendly risk review) and /pr-fix (ordered fix plan for every issue found)
  • Setup enhancementscontextception setup now installs MCP server config, PreToolUse hooks, and slash commands with --dry-run and --uninstall support
  • Documentation updates across README, CONTRIBUTING, ARCHITECTURE, features reference, and integrations guide

Test plan

  • make test passes (new tests for risk scoring, compact output, percentile, graph, model, schema, CLI, MCP)
  • contextception analyze-change --json returns risk_score, risk_tier, risk_factors, risk_narrative per file
  • contextception analyze-change --compact produces token-optimized text output
  • contextception analyze-change --ci --fail-on critical exits non-zero only when CRITICAL files present
  • contextception setup --dry-run shows planned changes without writing
  • contextception setup --uninstall cleanly removes configuration

kehoej and others added 2 commits April 12, 2026 21:05
- Updated the risk scoring system to include detailed per-file risk tiers (SAFE, REVIEW, TEST, CRITICAL) and narratives.
- Introduced new slash commands `/pr-risk` and `/pr-fix` for AI-assisted PR reviews, providing actionable insights based on risk assessments.
- Enhanced documentation to reflect changes in risk triage, scoring formulas, and command usage.
- Added tests for risk triage formatting and evidence gating logic to ensure accurate risk reporting.

This update improves the clarity and usability of the risk analysis tools within the project.
@kehoej kehoej merged commit d04e02d into main Apr 13, 2026
2 checks passed
@kehoej kehoej deleted the feature/smart-risk-engine branch April 13, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant