← Back to Pull requests

[ENH] Mine issues and cross-repository references into SQLite #6

Closed
unknown closed this pull request without merging on Nov 17, 2026 13:56 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 13:54 UTC
Author

Summary

Adds the data collection code for CrossTrace.

  • GitHubClient.graphql() sends GraphQL requests and caches the raw answers on disk.

  • mine.py reads the newest issues of a repository, 50 per request, together with their cross-reference events.

  • db.py stores issues and cross-repository links in SQLite.

  • scripts/mine.py mines all projects in projects.toml. It reads the newest 1,000 issues of each project.

  • scripts/count_links.py counts the links between projects.
  • Only links between different repositories are saved. Same-repository links are dropped.

    Related issue


    Fixes #4, #5 used for testing the cross reference

    How I tested it

  • uv run pytest passes (8 tests, including a mining test with a fake GraphQL answer)

  • uv run ruff check . passes

  • Real run on 12 projects, 1,000 newest issues each
  • Result of scripts/count_links.py:

  • 349 links between projects in the list

  • 3,314 links from repositories outside the list

  • Largest pairs: scipy -> numpy (41), numpy -> astropy (24), dask -> xarray (23), numpy -> scipy (22)
  • I checked one saved pair by hand on GitHub.

    Notes for the reviewer

  • Token type. A fine-grained token returned no cross-reference events. A request with no token returned them. A classic token with no scopes works. The first full run found 0 links because of this. .env.example now says so. This cause is likely, but I did not find a statement from GitHub that confirms it.

  • Old issues first gave 0 links. The first query read the oldest issues first. The newest issues are the useful ones, so the query now reads newest first.

  • A link is a mention, not a cause. Sources include pull requests. The label audit in the next step measures how many links are real causes.

  • Limits. Only the newest 1,000 issues of each project are read. An issue with more than 100 cross-reference events is truncated, and the script prints a warning. Pull requests are not stored as rows yet.

  • Next step. Read 300 random links and label each as cause, related, or noise.
  • Diff: 257 lines (+192 / -65) across 3 files Reviewer: aashoday Review duration: 2m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.39) × (1 − Review Confidence (0.40)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 257 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 34% · Reviewer familiarity: 35%
    39%
    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.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 39.7% 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: 39.1% (MEDIUM) · Higher = larger blast radius
    39.1%
    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: 39.7% · Lower = rushed or shallow review
    39.7%
    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: 23.6% · Safe to merge
    23.6%