Repository navigation
feat(review): synthetic defect templates for application languages - #533
Merged
dan-petty merged 1 commit intoSep 24, 2026
Merged
Conversation
The defect generator injected into Python, YAML and Dockerfiles only, so review recall could not be measured on other languages. A template now pairs file suffixes with a finder per language. For TypeScript/ JavaScript, Go, Rust, Java, C# and C/C++: - drop-bounds-check and the new drop-error-check remove guards; - drop-await covers TS/JS and C#; - disable-tls-verify covers rejectUnauthorized, InsecureSkipVerify, danger_accept_invalid_certs and an accept-any certificate callback; - widen-file-mode covers mode arguments and Java permission strings; - the new unbounded-string-copy turns strncpy, strncat, snprintf and vsnprintf into their unbounded forms. A guard is removed only as a whole statement filling its lines. Its body must only exit, with no else and no braceless parent, and literals and comments are blanked before braces are matched. A Go error check is removed only when err is read again, so the file still compiles. On the pinned samples, every mutation was applied and checked: - all 145 cJSON mutations pass gcc; - all 9 express mutations pass node --check; - 76 of 77 fmt mutations compile; the other trips fmt's compile-time format check; - tree-sitter finds no new parse errors in the rest. Closes #503
This was referenced Sep 24, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #503.
Why
The synthetic defect generator (#415) injected defects into Python, YAML and Dockerfiles only, so review recall could not be measured on other languages.
Changes (
src/devops_cli/ai/review/defects.py)Templates span languages.
DefectTemplate.finderspairs file suffixes with a finder per language, so--template drop-bounds-checkcovers every language it knows.Guards in brace languages (TS/JS, Go, Rust, Java, C#, C/C++):
drop-bounds-checkremoves an ordering guard.drop-error-checkremoves a guard that stops on an error or missing value:err != nil,== null,!ptr,is_none(),rc != 0.Removal is conservative, so the file stays well formed:
ifstatement filling its lines.elsemay follow, and it cannot be the body of a bracelessifor loop.errmust be read again later, or Go would not compile.drop-await: TS/JS and C#.for awaitandawait foreach/usingare left alone.disable-tls-verify:rejectUnauthorized, or a newhttps.Agent;InsecureSkipVerify, or a newtls.Config;danger_accept_invalid_certs, orClient::builder();HttpClientHandler.widen-file-mode:MkdirAll,WriteFile,OpenFile,mkdir,open,chmodand the Node*Synccalls;mode:options and Rustmode()/from_mode();PosixFilePermissions.fromString.New
unbounded-string-copy(C/C++):strncpy,strncat,snprintfandvsnprintflose their size argument.Docs:
docs/SELF_IMPROVEMENT.mdlists each template's languages. It also corrects the stale note that review pages lack line numbers (fixed by fix(review): review pages carry no line numbers, so reported line ranges are guesses #499).Verification on the pinned samples (#502)
Every site of every template was applied one at a time and the mutated file checked:
gcc -fsyntax-onlynode --checkg++ -std=c++20 -fsyntax-onlyconstevalformat-string check (well formed, and the defect is caught when compiled)A corpus over the eight application samples injected 91 defects:
drop-bounds-check;drop-error-check;drop-await;unpin-action-refin the samples' workflow files.The samples have no TLS configuration, explicit file modes or bounded C string calls. Those templates are covered by unit tests only.
Found along the way:
tree_sitteris not installed in the project, so the AST engine falls back to its regex parser for every language it claims (TS, Go, Rust, Java, HCL). #505 will record this and #506 will fix it.Test plan
tests/test_review_defects_languages.py(34 tests):ruff --select C901)uv run devops ci --force: all 13 gates pass