Skip to content

Use first-parent landing times for risk features - #8

Merged
EhsanAzish80 merged 6 commits into
mainfrom
engine/risk-v2
Dec 4, 2026
Merged

EhsanAzish80 merged 6 commits into
mainfrom
engine/risk-v2

Conversation

@EhsanAzish80

@EhsanAzish80 EhsanAzish80 commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add the leakage-safe point-in-time history features and incremental landing work from P1
  • complete risk v2 with all nine standardized logistic-regression features and inspectable placeholder weights
  • keep calibration global until P3 fits and validates real weights; shipped weights declare "fitted": false
  • index the resolved --base target ref for reviews, never the feature-branch HEAD
  • add point-in-time tree-sitter import graphs for Python, TS/JS, Go, Swift, and Rust behind the optional graph extra
  • store import edges with source landing metadata and compute importer blast radius through depth 2
  • emit schema-version 2 evidence sorted by model contribution with real SHA/path refs and no filler evidence
  • add coverage-derived uncovered added lines and AI provenance context without making provenance a model feature
  • rewrite PR review ranking around risk v2 while retaining every existing CLI flag and configured-warning gate
  • remove legacy depth weighting and history-hotspot review ranking
  • keep index schema 4 and ENGINE_VERSION 5; this review revision does not change the schema

Point-in-time guarantees

  • every history, graph, and PR feature takes an explicit as_of
  • review uses the target tip's indexed landed_at + 1
  • all commit and defect reads use strict landed_at < as_of
  • PR commits are absent from the review index and therefore cannot leak into author history or other features
  • switching between feature branches with the same base reuses the target index without rebuilding
  • import edges select the source file state that had landed at the evaluation boundary
  • cold/incremental imports, SZZ rows, co-change rows, confidence values, truncation replay, and merge-landing leakage tests pass

Evidence contract

  • golden schema-v2 evidence is generated from a scripted repository
  • evidence sentences are emitted only for available numeric features and sorted by absolute contribution
  • defect text uses the complete 12-month fix count while refs remain capped at 10
  • change-size evidence reports raw +A/−D lines while the log transform remains internal
  • owners are plain author names unless a GitHub noreply address provides an actual @login
  • refs contain real abbreviated fix SHAs or repository paths
  • low-risk files carry no filler evidence
  • context reports owners and AI-authored added lines; AI provenance is not passed to the model
  • terminal, Markdown, and HTML reports label the placeholder model as uncalibrated weights

Performance

Warm in-memory SQLite feature computation and scoring for a 500-file PR: 0.035031s (target <2s).

The earlier one-commit Flask incremental index benchmark remains 0.160062s at 2,895 commits and 729 first-parent merges.

Flask acceptance

On a full pallets/flask clone, a local review commit changing src/flask/app.py ranked that file first at risk 0.62, used global calibration, reported unfitted weights, and cited real SZZ fix SHAs.

Verification

  • ruff check src tests
  • strict mypy src
  • Python 3.9 suite: 208 passed, 6 skipped
  • Python 3.12 graph-extra acceptance: 12 passed across all five parsers, point-in-time imports, and cold/incremental parity
  • wheel build includes risk/weights.json, graph extraction, and the runtime model

History

PR #7 was merged at P1 head 189040b. This branch starts from merged main 69d8aa2, carries the signed point-in-time feature layer, completed P2 at b6220ce, and includes the pre-merge review corrections at signed head e9680ee.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Devscope Health Check

Devscope: A · Low risk · Easy onboarding · 0.57 test-file ratio · 0.04s ⚡

Updated: Fri, 04 Dec 2026 15:03:20 GMT

@codecov-commenter

codecov-commenter commented Dec 4, 2026 •

Copy link
Copy Markdown

@EhsanAzish80
EhsanAzish80 merged commit 8625624 into main Dec 4, 2026
5 checks passed
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.

2 participants