arXiv:2611.06950cs.SENov 2026

Manuscript Offprint

arXiv:2611.06950

KG-AST for Cheaper CI/CD: Budgeted Test Selection and AI Bug Review

Henry Yeung

Abstract

Continuous integration and AI-assisted review spend the same budget on every commit, although few commits introduce bugs. We study KG-AST, which scores each commit's risk from git history and code-graph features before heavy tests or AI review run, so the budget goes to the riskiest commits first, and which hands the AI reviewer only a graph slice around the change. On 155 open-source projects in 11 languages, a single cross-language model trained on other projects ranks commits so that heavy testing of the riskiest 20% covers 49–64% of bug-introducing commits depending on the language, against 20% for random selection and 40–55% for testing the biggest change first. Every language beats the biggest-change baseline, by 3.8 to 13.2 points. In 20 Java projects the gain at a 20% budget is 15.1 points (64.6% vs 49.5%, 95% interval +11.6 to +18.4), and the model wins in 19 of the 20 projects. About twelve training projects suffice; richer features, tuning and cleaner labels did not help. An AI reviewer that sees only a commit's diff finds 26% of later-fixed defects exactly (32% with graph context), and about half of its findings that did not match a later fix were judged real by independent AI judges. A static call-graph selector runs about 8% of a test suite while including a test written for the fix in 85% of 67 fix commits. The Poincaré embedding used in our retrieval work adds nothing measurable here: commit-risk AUC, bug review and severity ranking are unchanged or worse. The labels are noisy and the budget metric assumes a heavy test catches the bug it covers; no CI minutes were measured.

Keywords: continuous integration, test selection, just-in-time defect prediction, code knowledge graph, AI code review, software maintenance

1. Introduction

Testing and review are the most labour- and compute-intensive steps after code is written. Most pipelines treat every commit alike: the same suite runs, and the same reviewer or AI model reads the diff. Yet only a minority of commits introduce a bug (4% to 35% of commits per project in our data), so a budget spread evenly is largely spent on safe changes.

We ask a practical question: given a fixed budget of heavy tests or AI reviews, which commits should receive it? KG-AST answers with a risk score computed at commit time from the diff and from what git knew before the commit, and then limits the work done on a chosen commit to a slice of the code graph around the change. The companion paper (Yeung [12], in preparation) uses the same graph and a Poincaré embedding to cut the cost of sending code to an LLM; this paper concerns the CI/CD side.

Our question is cost, not completeness. A selector is useful if, at a small fraction of the budget, it covers most commits that will later be found to have introduced a bug. We therefore report coverage at a fixed budget, compared with sensible baselines that practitioners already use, rather than classification accuracy alone.