Review changed code
Send per-file diff hunks instead of an entire repository.
The tradeoffRequests are focused, but surrounding application context may be missing and unsupported files are skipped.
Inspect the decisionCodeGuard
An AI-assisted review tool that narrows attention to changed code and translates model responses into structured findings a developer can inspect.
Independent project · Recorded offline provider fixturesThe 60-second overview399a13aRefresh Career Atlas after public repository changesA unified-diff parser identifies changed files and hunks before review.
The reviewer assembles prompts, calls a selectable provider, and validates returned findings.
A local review passed 181 tests. The demonstration uses fixed public response fixtures, with no model or paid service called.
Model feedback becomes difficult to use when it is detached from a file, severity, or proposed correction. The tool creates a narrow interface between a code change, a provider response, and the review workflow.
Choose a stage to explore its purpose and supporting source.
The parser extracts files, language, line ranges, and hunks. The reviewer skips deleted files and binary or unknown languages.
Parser tests include multiple files, deleted files, binary content, and an empty diff.
Read the implementationInspect inputs and outputs captured from the repository. Switching scenarios replays saved results; it does not run cloud services or a model.
{
"diff": "tests/fixtures/diffs/sql_injection.diff",
"provider": "fixed response; no model called",
"simulateFailure": false,
"response": "{\n \"findings\": [\n {\n \"title\": \"SQL Injection Vulnerability\",\n \"severity\": \"CRITICAL\",\n \"category\": \"security\",\n \"description\": \"User input is concatenated directly into SQL query string without sanitization.\",\n \"suggestion\": \"Use parameterized queries with placeholders instead of string concatenation.\",\n \"line_number\": 13,\n \"cwe_id\": \"CWE-89\",\n \"owasp_ref\": \"A03:2021\"\n },\n {\n \"title\": \"Hardcoded Database Path\",\n \"severity\": \"LOW\",\n \"category\": \"style\",\n \"description\": \"Database path is hardcoded. Consider using configuration.\",\n \"suggestion\": \"Move database path to environment variable or config file.\",\n \"line_number\": 12,\n \"cwe_id\": null,\n \"owasp_ref\": null\n }\n ]\n}\n"
}[
{
"title": "SQL Injection Vulnerability",
"severity": "CRITICAL",
"category": "security",
"description": "User input is concatenated directly into SQL query string without sanitization.",
"suggestion": "Use parameterized queries with placeholders instead of string concatenation.",
"file_path": "app/db.py",
"line_number": 13,
"cwe_id": "CWE-89",
"owasp_ref": "A03:2021",
"code_snippet": null
},
{
"title": "Hardcoded Database Path",
"severity": "LOW",
"category": "style",
"description": "Database path is hardcoded. Consider using configuration.",
"suggestion": "Move database path to environment variable or config file.",
"file_path": "app/db.py",
"line_number": 12,
"cwe_id": null,
"owasp_ref": null,
"code_snippet": null
}
]A fixed public fixture returned two findings, which the actual reviewer associated with app/db.py. This verifies data handling, not the quality of an AI model.
Send per-file diff hunks instead of an entire repository.
The tradeoffRequests are focused, but surrounding application context may be missing and unsupported files are skipped.
Inspect the decisionTranslate model text into a shared finding model.
The tradeoffA well-formed finding can still be wrong. Invalid output may be dropped, so validation does not equal detection accuracy.
Inspect the decisionWarn and continue when a file review raises an exception.
The tradeoffPartial work remains available, but zero findings can hide incomplete coverage. A future improvement is an explicit incomplete-review state.
Inspect the decisionParser, provider adapters, prompts, response handling, orchestration, and report tests passed locally on 5 September 2026.
Supporting sourceThe offline replay records two findings from a valid fixture, zero from malformed content, and zero plus a warning from a failed provider. These are integration results, not model accuracy measurements.
Supporting sourceThe most important AI engineering boundary is between “the model returned nothing” and “the work was checked.” The project makes that boundary available for inspection and points to a concrete reliability improvement.
Reviewed 5 September 2026. These links point to the source revision used for this case study.
Changed-file and hunk extraction.
src/codeguard/diff_parser/parser.pyProvider calls, file association, and failure handling.
src/codeguard/review/reviewer.pyJSON parsing and finding validation.
src/codeguard/llm/structured.pyHuman-readable and SARIF outputs.
src/codeguard/common/reporter.pyControlled provider behavior and skipped files.
tests/test_review/test_reviewer.pyHosted and local provider adapters.
src/codeguard/llm/providers.pySource revision 6c31058 · View current workflow history ↗