Skip to content

Remove obsolete Git test seams - #14355

Merged
BagToad merged 1 commit into
williammartin-improve-git-testsfrom
williammartin-clean-git-test-seams
Oct 30, 2026
Merged

BagToad merged 1 commit into
williammartin-improve-git-testsfrom
williammartin-clean-git-test-seams

Conversation

@williammartin

@williammartin williammartin commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Description

Follow on from #14351

The client tests no longer need to replace Git with a scripted subprocess, but Client still 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: WithRepoDir now changes only Git's leading directory option. It no longer mistakes a filename such as -C after -- for that option.

Notes for reviewers

Start with Client.Command and the repository-directory handling, then read the command scenarios.

This is the final layer above #14351.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

juanquijandria added a commit to juanquijandria/prisma-harness that referenced this pull request Oct 9, 2026
…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
@williammartin
williammartin force-pushed the williammartin-clean-git-test-seams branch from 7adb254 to 0b08575 Compare October 29, 2026 10:24
Copilot AI balanced review requested due to automatic review settings October 29, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@williammartin
williammartin force-pushed the williammartin-clean-git-test-seams branch from 0a46262 to 8a0ca90 Compare October 29, 2026 11:54
@williammartin williammartin mentioned this pull request Oct 29, 2026
2 of 6 tasks
@williammartin
williammartin force-pushed the williammartin-clean-git-test-seams branch from 8af6d93 to b71a7e2 Compare October 29, 2026 19:28
Comment thread git/client_test.go
assert.Equal(t, in, cmd.Stdin)
assert.Equal(t, out, cmd.Stdout)
assert.Equal(t, errOut, cmd.Stderr)
assert.Same(t, in, cmd.Stdin)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread git/client_test.go
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" {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The Git subprocess-mocking cleanup has no active review issues.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f3f93d09-c411-4f3b-b842-b0d15f9d237a
@williammartin
williammartin force-pushed the williammartin-clean-git-test-seams branch from 4ca14e3 to 934db7e Compare October 29, 2026 20:42
@williammartin
williammartin marked this pull request as ready for review October 29, 2026 20:44
@williammartin
williammartin requested a review from a team as a code owner October 29, 2026 20:44
@BagToad BagToad mentioned this pull request Oct 30, 2026
2 of 6 tasks
@BagToad
BagToad merged commit 443baeb into trunk Oct 30, 2026
18 checks passed
@BagToad
BagToad deleted the williammartin-clean-git-test-seams branch October 30, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants