Repository navigation
Reject malformed diffs before test generation - #48
Merged
Merged
Conversation
Validate hunk counts and file headers before target selection and model setup; preserve actual Git/GNU patch and mail-signature behavior. Retain independent negative evidence, installed-console receiving, and private-sentinel proof of test fixture isolation. Native-Head: 156664881ea0536f36cfda1cdad15d181e88a2a3 Native-Tree: 11405f1 Integration-Base: cec50d8 Production-Installed-From: 40860534a8fdc760b105ac9bc7d14ac9087172dd The connector commit has the complete exact native tree; original native and independent-review commit custody is retained in the estate.
Jacob-Met
deleted the
estate/diff-hunk-validation-6cc6795e89f4-1566648
branch
October 17, 2026 03:07
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.
Problem
A truncated unified-diff hunk can be rejected by Git while TestPilot derives a partial target selection, generates tests, and writes a passing report. Automatic runs also constructed the model client before validating this malformed input.
Change
Validate complete file headers and declared old/new hunk counts before returning any target selection. Reject incomplete, overlong, malformed, or unsupported numeric ranges through a dedicated
DiffFormatError. Preflight automatic runs before model setup and return a clean input-error exit.The change preserves physical-line and encoded-path handling, deletion anchors, real Git/GNU unified diffs, and ordinary Git mail signatures. It composes the accepted coverage-option and raw Git acquisition changes from main. Diff structure validation does not assert that a patch applies to the current working tree.
Verification
cec50d8df4499ba509615e179d82ef3861379bd2: 54 tests passed, 1 skipped, and 7 subtests passed across hunk validation, coverage options, and Git acquisition.40860534.Source and receiving
Only
testpilot/diff.pyandtestpilot/__main__.pychange among existing production files. Dedicated regression tests, source-bound negative evidence, independent review, fixture-containment receipts, exact source custody, and installed-console receipts are retained underdocs/receiving/diff-hunks-6cc6795e89f4/anddocs/receiving/git-compat-6cc6795e89f4/.Hosted checks remain the final shared-source integration gate. No external model provider was called during native receiving.
Canonical source:
c7b593ea652dd6b572d0f1076c839d155e0f4599, exact tree11405f150fbfe31602dec709fadc5fdfd4438dc8. This complete tree matches native source/evidence head156664881ea0536f36cfda1cdad15d181e88a2a3byte for byte.