feat(foreman): flag a GO that changes no functional production code#1024
Open
Defilan wants to merge 1 commit into
Open
feat(foreman): flag a GO that changes no functional production code#1024Defilan wants to merge 1 commit into
Defilan wants to merge 1 commit into
Conversation
A GO whose committed diff is docs/comments/tests only produces a hollow GATE-PASS: the bite check has no production code to revert, so it is vacuous, and prose (docs or Go comments) can claim behavior that is not implemented. On defilantech#850 a bug-labeled issue produced a docs + comment-only change whose comment claimed "the operator surfaces a clear warning" with no warning code in the diff, and it GATE-PASSed. Add a non-blocking advisory that runs after repo.Commit (same placement as the grounding rail): if the committed diff (base...HEAD) has no functional production change, record noFunctionalChange=true on the terminal result and log it. functionalChangeInDiff treats docs, tests, and comment-only .go edits as non-functional (diffHasCodeLine is a line heuristic, not a Go parser); degrades open on any git error. Records-and-logs only; never changes the verdict, leaving the call to the reviewer/human. Fixes defilantech#1022 Signed-off-by: Christopher Maher <chris@mahercode.io>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What
A non-blocking coder-gate advisory that records
noFunctionalChange: truewhen a GO's committed diff is docs / comments / tests only.Why
A GO that changes no production code produces a hollow GATE-PASS: the bite check has nothing to revert (vacuous), and prose — Go comments or docs — can claim behavior that isn't implemented. Dogfooding #850 exposed this: a
bug-labeled issue ("hostpath PVC blocked on tainted GPU nodes") produced a docs + comment-only change whose comment claimed "the operator surfaces a clear warning when a PVC source is used on a tainted node" — with no warning code in the diff. It GATE-PASSed and looked like a fix.How
Runs after
repo.Commit(same after-commit requirement as the grounding rail, sobase...HEADreflects the committed diff).functionalChangeInDiffwalks the changed files: docs (.md, etc.), tests (_test.go), and comment-only.goedits are non-functional; a.gofile with a real added/removed code line is functional.diffHasCodeLineis a line heuristic (not a Go parser) — a changed line counts as code unless it is blank or a comment. Degrades open (assumes functional) on any git error.Records
noFunctionalChange: trueon the terminal result and logs it. Non-blocking — never changes the verdict; it surfaces a docs/comment-only "fix" for the reviewer/human to judge (a docs-only change to a code bug is a red flag; to a docs issue, it's fine). The semantic half — prose claiming an unimplemented feature — remains a reviewer concern; this removes the misleading clean pass.Testing
TestDiffHasCodeLine: comment-only / blank / block-comment / header lines → not code; real added or removed logic → code.TestFunctionalChangeInDiff(injected runner): docs-only, tests-only, comment-only.go, docs+comment-only → false; real code change → true; git error → true (degrade open).pkg/foreman/agentpackage passes.Checklist
Fixes #1022Assisted-by: Claude Code (identified the gate gap while reviewing Foreman output, wrote the advisory + tests; human-reviewed and DCO-signed by the maintainer).