Repository navigation
Remove obsolete Git test seams - #14355
Conversation
…for changes counts from anyone Second half of ticket 4 of the 0.9.1 plan, plan record ready-verdict (notas/planes/plan-0.9.1-b.md). The cause of the Windows case. The probe of cb40d2f showed that jq on Windows ends each line with a carriage return and that the shell drops it only from the last line. A message that names two PRs sent the first number to pr-ready.sh with the carriage return attached, which is a usage error, so the claim went unmeasured and the stop went through. The public CI of the previous commit showed the predicted reds on Windows only, case 5 and 31 of the claim gate, cases 49 and 50 of pr-ready.sh and case 8 of the index gate. Case 9 of the index gate passed there against the prediction, with the cause not verified, and its line is kept. Built here: - Each list a hook reads line by line out of jq drops the carriage return, the claims, the CI runs, the other PRs of the author, and the Read calls and failed calls of the index gate. A carriage return injected at each of the five sites on this Mac turns its case red without the fix and leaves it green with it. - After the fidelity review, a request for changes stops the verdict whoever made it, listed in PRISMA_PR_REVIEWERS or not, and names who asked and when (case 52). A draft with --at is not judged (case 51), and an English ready to merge beside a denied one stays a claim (case 32). CHANGES_REQUESTED is one constant, the denial cases have a function of their own, and the README says that with --at a review is read in the state it has today. Measured on 09/10: on public PRs of today, cli/cli#14355 in draft and cli/cli#13665 blocked went from READY with main to NOT READY with this branch, each with its reason, and cli/cli#13899 now names the reviewer whose request for changes stands. jqlang/jq#3664 and #3663 stay READY with both. Thirteen mutations, each red on its own case on this Mac. Left out on purpose: the draft and blocked state of the past through the timeline, requested reviewers and code owners, the shape of each element inside a list, and jq calls that return one value. The comments check of the push counts the one-line headers of new files and two case patterns of format-gate-tests.sh, as in the previous commits. This commit adds no comment. Claude-Session: https://claude.ai/code/session_01BBBntBuurTTiaaa1rSvZyP
7adb254 to
0b08575
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the cleanup of obsolete Git subprocess mocking infrastructure.
No open issues 🎉
What changed in this PR
Removes obsolete Git subprocess mocking infrastructure, completing the test cleanup built on PR #14351 without intended user-visible behavior changes.
Changes:
- Removes the private command-construction override and its type alias.
- Replaces remaining mocks with real local Git state, command modifiers, and a focused push-revision parser.
- Simplifies the remaining subprocess helper to use explicit arguments instead of environment variables.
| File | Description |
|---|---|
| git/command.go | Removes the obsolete command-context alias and unused import. |
| git/command_test.go | Switches output and error tests to the simplified subprocess helper. |
| git/client.go | Uses command construction directly and extracts push-revision parsing. |
| git/client_test.go | Deletes obsolete mock protocols and updates tests to use focused helpers or real repositories. |
Review effort: Balanced
0a46262 to
8a0ca90
Compare
8af6d93 to
b71a7e2
Compare
| assert.Equal(t, in, cmd.Stdin) | ||
| assert.Equal(t, out, cmd.Stdout) | ||
| assert.Equal(t, errOut, cmd.Stderr) | ||
| assert.Same(t, in, cmd.Stdin) |
There was a problem hiding this comment.
assert.Equal compares the buffers’ contents, not their identity. Here, all three are empty bytes.Buffer values, so accidentally wiring cmd.Stdout = errOut would still pass.
assert.Same checks that each command stream points to the exact buffer supplied by the caller. That’s the contract this test is checking, and it catches swapped streams or replacement buffers.
| func TestCommandMocking(t *testing.T) { | ||
| if os.Getenv("GH_WANT_HELPER_PROCESS_RICH") != "1" { | ||
| func TestGitCommandHelperProcess(t *testing.T) { | ||
| if len(os.Args) != 7 || os.Args[3] != "git-command-helper" { |
There was a problem hiding this comment.
This is a small change, instead of TestMain we call directly into a helper test function. Using -test.run keeps the helper entry point in a single test rather than adding subprocess dispatch to a package-wide TestMain.
Also made a small change to use cmd line args rather than env vars just to keep it a bit cleaner and avoid env var shenanigans e.g. leaving cmd.Env unset, avoiding the need to append its settings to os.Environ().
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f3f93d09-c411-4f3b-b842-b0d15f9d237a
4ca14e3 to
934db7e
Compare
Description
Follow on from #14351
The client tests no longer need to replace Git with a scripted subprocess, but
Clientstill carries the hook that allowed that replacement.This PR removes that hook and the unused subprocess protocols. Command output tests keep one small helper because they need exact control over a process's output and exit status.
How did you test this change?
Not tested manually. The directory-override fix is exercised by automated tests rather than a user-facing command walkthrough.
Key points
There is one behaviour change beyond removing test infrastructure:
WithRepoDirnow changes only Git's leading directory option. It no longer mistakes a filename such as-Cafter--for that option.Notes for reviewers
Start with
Client.Commandand the repository-directory handling, then read the command scenarios.This is the final layer above #14351.
Authorship and follow-up
Who wrote this:
Who answers review comments: