Skip to content

Reject incomplete or overflowing diff hunks before selecting test-generation targets #45

Closed

Description

@Jacob-Met

Reserved correctness repair — e137a7f86391

TestPilot's current diff parser can silently accept damaged hunk counts and omit changed functions from the actual generation scope. A hash-verified execution of the unchanged parser on four bounded inputs shows: the complete two-file control selects both functions; an oversized first hunk consumes following file headers and drops the second function; a too-small count drops the first function; a truncated final hunk is accepted with empty changed_lines. This can produce a misleading target preview or begin test/model work for a partial selection.

Discovery receipt: 4,421 bytes, SHA-256 3676d00297281bc6a9cddc9defd6b0bae6bbba8b6701a7efc54558a6d3521803, with exact input strings, source and observed outputs. This is a bounded reproduced defect, not a claim that every malformed patch has been enumerated.

Exact source and narrow fence

  • Current inspected main: cec50d8df4499ba509615e179d82ef3861379bd2.
  • Full tree: c0c6f5fe6bf5c4e94e196882a7f28246b42c05bb, 1,297 leaves, no AGENTS.md.
  • Parser testpilot/diff.py: 29dd325ab288ac1d43fd70f33b207281f5375d4b.
  • CLI testpilot/__main__.py: 44f485af279e66f75c6e4ef881b5a75e5d0cdef2.

Proposed four paths: testpilot/diff.py, testpilot/__main__.py, tests/test_diff_hunk_admission.py, and a concise README input-contract note.

Validate recognized two-way unified-hunk body structure and declared line counts; reject incomplete or overflowing bodies through a specific ValueError subclass. Keep diagnostics useful and bounded. The target-preview command should return configuration-error exit2 with empty success stdout. The run command should refuse before baseline tests, model requests or output replacement. Preserve the existing explicit-target error boundary.

Preserve valid Git/diff-u target identities, ordering, added/touched line sets, zero-count insertions/deletions, omitted count=1, no-newline markers, header-like source lines and the existing LF/raw-byte/source-encoding and quoted-path behavior. Preserve the ordinary surrounding Git metadata/empty-diff behavior. This is not a full patch-format validator or proof that a diff applies to the checkout; ambiguous or unsupported formats must not acquire a stronger claim.

Do not change the model/client, loop, sandbox, target-resolution semantics, report writers, saved-run tools, dependencies, CI or existing fixture facts. A genuine pre-existing fixture count defect, if discovered, must be reported with its original bytes rather than silently rewritten.

Receiving and ownership

Production authors the repair. Coordination independently derives and freezes valid/invalid expectations before reading the repair, including real Git-generated controls and actual parser/CLI refusal. Root directly reviewed the current parser, CLI and tests, owns current-source composition, and serializes normal GitHub publication/CI/merge. Native/local work stays in isolated owned namespaces with existing Python/Git. The new independent/native receiving uses no model/provider calls, live accounts, new dependency installation or sandbox execution. The unchanged normal project CI remains the required regression gate and may run its existing scripted-model and sandbox fixture tests; it is not disabled or relabeled as the new independent receiver. No live or paid provider call is part of either gate.

Current issue/PR and central HAMON #140/#142 searches found no hunk-admission claim. Existing #26 saved-run comparison, #35 cancellation and #39 saved-run finding scopes remain owned and excluded. Mac is currently observed Offline; no unavailable registry or timed-out operation is treated as releasing ownership.

The primary Git patch-format contract is https://git-scm.com/docs/diff-format. Receiving will distinguish valid protocol lines from damaged counts without treating header-like source text as a new file while it is still inside a valid hunk.

Activity

  1. Jacob-Met commented on Oct 8, 2026

    @Jacob-Met
    OwnerAuthor

    Accepted by convergence with PR48 — independent receiving e137a7f86391

    This issue is satisfied by the implementation authored and merged by the incumbent 6cc6795e89f4 lane in PR48, merge e5b7ac4a00704c0fad0c5d70da0aaafa40a722df. Our independently developed alternate was withdrawn before integration when that merge was discovered. PR49's later timeout admission is preserved.

    Accepted source and results. The independent receiver consumed exact main snapshot 513f17454af378ee042ccd29dc930ef332a48734, tree ffded624f1e44bed9e10872dfb795dae2dda1a46. The pre-candidate frozen corpus passed all 14 valid cases and 12 malformed cases, including complete FileChange/selected-function records, real Git patches and applicability controls. There were 33 actual CLI invocations, plus two long-path controls: a valid 8,192-character path stays exact; the malformed diagnostic is 83 characters and actual targets/run refuse with exit2, empty success stdout and no traceback. The automatic receiver guards precede client construction, model/provider work, baseline tests, sandbox execution and report writing; none of those underlying operations ran.

    Root directly reviewed the accepted parser/CLI and the complete maintained CI log: actual checkout 513f1745, Python3.12, 453 passed, 25 subtests passed in96.33s, success. No settled suite was rerun for publication.

    Durable exact-byte evidence. Immutable evidence commit41e1b1a6 is on receiving/diff-admission-e137a7f86391, with the received snapshot as its sole parent. The complete tree is 475415c10a43f80cdc4b780c445cf2d665a2829d, independently predicted before publication and verified after it. All1,426 original leaves/modes/types are exact; eight evidence leaves are added;1,434 final leaves. There is no runtime, test, configuration or service change and no competing runtime PR.

    Read the custody directory, including the exact ROOT-REVIEW, final-convergence and separate native readback receipts, complete CI log, and both original binary archives:

    Artifact Bytes SHA-256
    receiving-evidence.tar.gz 307,460 cf63ac361e98d61a7bc3b5c043510b73fc120c01dd648338763fa1da0d0223da
    historical-candidate-v2.tar.gz 78,330 8a0c0b4897a4ef76f910a00112d46c0e26bfaaa0b4f3776a0374637e7c5235d6
    final-convergence.json 8,283 998cc7d5b588cbbb2ed2ba969a087b9dbf14dd9618e3719e1214ecce13faa282
    ROOT-REVIEW.json 6,998 8c08ee8a23c023ed9722f411edc5a6928a744fddc486a5b0c79c9842cf5d1d00

    The current receiving archive preserves121 manifested files/673,076 bytes and122 archive members, independently reopened without extraction. Original malformed-hunk failures, the alternate v1 diagnostic overflow, the bounded v2 correction, source drift/supersession and ENOSPC observations remain retained. Neither archive was regenerated; transport base64 is excluded. The final-convergence and receiving-readback files were fetched again from the immutable Git commit and matched their original bytes and blobs.

    Publication reconciliation. A volatile execution-state reset interrupted the publication response. On retry, the existing evidence branch was detected and left intact. Its20:14:11Z commit, exact predicted tree and all source/artifact fences were read directly; no duplicate branch or replacement commit was made. An earlier inference that no mutation had occurred is superseded by that direct readback. The recovered6,998-byte root review reproduces its original hash exactly.

    Later source and Actions boundary. Main subsequently reached 906ce149fba770a62c9f5f2fbc1b7238b949d423 through separate owner work. The parser and targets modules remain exact; direct CLI diff shows the same hunk preflight sequence, with separate regression-command/pytest-selector additions. The qualification above remains pinned to513f and does not claim that those later features were rerun here. Jacob's no-more-Actions relay is now controlling. The complete current workflow inventory contains only ci.yml, triggered by main pushes and PRs; this evidence branch and issue updates match neither event. The head-filtered Actions query returned zero runs for41e1b1a6. No dispatch, rerun, PR or main update is being made.

    Closing completed by incumbent integration and independent receiving. Scope remains two-way hunk/admission behavior, not complete patch applicability, live test generation or deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions