← Back to Pull requests

Add static consumer-graph parser #8199

Closed
unknown closed this pull request without merging on Oct 01, 2026 17:06 UTC
View on GitHub
unknown unknown commented on Sep 14, 2026 19:24 UTC
Author

Motivation

TheRock's committed consumer graph (test_tools/therock_consumer_graph.json) can drift from the CMake it describes. This adds a static generator that parses the super-project CMake — no ENABLE_ALL configure, no submodules — and a unit-test suite that enforces the parser is a conservative may-depend superset of the committed graph (it never omits a real node or edge). It changes no test selection and does not make the generated graph authoritative.

GitHub issue: https://github.com/ROCm/TheRock/issues/7782

[!NOTE]

First of a multi-PR effort for #7782.

This PR is report-only: it adds the parser + subtree_map and checks them, but changes no test selection, the committed graph, or CI gating.

Follow-up PR(s) do the consuming/gating work: make the generated graph authoritative, read subtree_map/the source-dir map (retiring the hand alias + source_paths maps), consolidate STAGE_TO_TEST_LABELS, and drop the old configure-based emit.

## Technical Details

  • build_tools/_therock_utils/cmake_consumer_graph.py — parses Git-tracked CMake and extracts therock_cmake_subproject_declare deps into the reverse-edge schema. Models the dependency-relevant subset (set/list/${var}, if union, foreach, add_subdirectory/include scope) conservatively; unresolved dependency vars fail loud instead of dropping an edge. Also exposes build_subtree_map() (source subtree → graph keys) for follow-up work.

  • build_tools/generate_consumer_graph.py — writes the graph, or --check diffs against the committed graph without writing.

  • build_tools/tests/cmake_consumer_graph_test.py — runs in the existing blocking Test build_tools step (ubuntu + windows); real-tree invariants run where a checkout is present. No unit_tests.yml change.

  • Pins cmake-parser==0.9.2; RFC0013 documents the generator and adds a Revision History.
  • Test Plan

  • cd build_tools && python -m pytest tests/cmake_consumer_graph_test.py

  • python build_tools/generate_consumer_graph.py --check

  • pre-commit run on changed files; Unit Tests workflow on ubuntu + windows.
  • Test Result

  • 17 passed (synthetic cases + 3 real-tree invariants), on Python 3.12 and 3.14.

  • --check: reference_only_* = 0 — the committed 117 nodes / 426 edges are all covered; 4 nodes / 11 edges are conservative-only (by design); no dangling or unreachable declarations.

  • pre-commit clean (black / mdformat); cross-platform CI pending on this push.
  • Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/CONTRIBUTING.md.

  • No change to test selection or the committed graph; the superset invariant is enforced as a blocking unit test.
  • Diff: 347 lines (+260 / -87) across 4 files Reviewer: endurthiabhilash Review duration: 24341m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 347 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.350
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #8199"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.4% (MEDIUM) · Higher = larger blast radius
    42.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%
    Repository