Repository navigation
[0.38] test(git-env): exercise the real git_env owner in its seams (#4552 item 6, slice 1) - #4683
Merged
Merged
Conversation
…ild (#4552) The TLS config seam patched the owner's own config reader. It now runs the real chain down to the git config child process: a fake Popen answers with the bytes git config --null --show-scope --list prints, and one test reads real config files through a real git. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…#4552) The git_env seam patched the owner's own config runner, executable resolver and config reader. Config probes now meet a fake git config child at subprocess.Popen, executable lookup resolves stand-in files on a real PATH, and snapshot reuse counts real git config probes. No git_env.py line loses coverage (662 -> 668 lines executed). AQ004 for the git_env owner group shrinks from 38 to 5: test_real_git_tls_config.py 19 -> 0, test_git_env.py 19 -> 5. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 20:05
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests need corrected classification and placement for real Git execution, plus restored snapshot-reuse coverage that verifies config authorization headers are removed.
2 open issues
What changed in this PR
This PR begins #4552 item 6 by rewriting git_env tests to exercise the real owner logic instead of mocking its internal functions. Production behavior is unchanged.
Changes:
- Replace internal probe mocks with fake child processes while preserving TLS precedence, caching, and concurrency checks.
- Exercise executable discovery through stand-in files and configuration parsing through real Git.
- Reduce owner-patching baseline counts from 19 to 0 for TLS tests and from 19 to 5 for cache tests.
| File | Description |
|---|---|
tests/unit/utils/test_real_git_tls_config.py |
Tests TLS configuration through process-boundary fakes and a real Git configuration probe. |
tests/unit/cache/test_git_env.py |
Reworks executable lookup, retry, timeout, and snapshot-reuse tests around real owner logic. |
tests/quality/assertion_quality_baseline.json |
Lowers the owner-patching allowances for both test modules. |
Review effort: Balanced
…ove the real-git TLS probe to a component module Addresses review on #4683: the snapshot reuse test again carries an indexed http.extraheader and asserts no config header survives; the real git config test moves out of the unit module into tests/integration, marked component and windows_compat, with a read-only durable-state oracle. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
deleted the
wip/4552-weak-tests-slice1
branch
November 22, 2026 08:29
This was referenced Nov 22, 2026
Merged
Merged
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.

Description
#4552 item 6, slice 1: the owner-group rewrite of owner-patching tests for
apm_cli.utils.git_env. It was the largest AQ004 group that no open PR touched.The two seams used to patch the owner's own functions (
_read_effective_git_config,_git_config_run,_resolve_trusted_executable). They now run the realgit_envcode and replace only the I/O boundary:tests/unit/utils/test_real_git_tls_config.py:git configchild atsubprocess.Popenanswers with the exact bytesgit config --null --show-scope --listprints.git(a global file plus a command-scope override) moved totests/integration/test_git_tls_config_probe.py. It is markedcomponentandwindows_compat, and checks that the probe writes nothing. The unit module now touches no filesystem and spawns no process.tests/unit/cache/test_git_env.py:PATH.git configprobes. The snapshot still carries an indexedhttp.extraheader, and no config header survives into the child.Assertion-quality baseline, which only shrinks:
tests/unit/utils/test_real_git_tls_config.pytests/unit/cache/test_git_env.pyThe five remaining AQ004 sites in
test_git_env.pyare clone-path tests that patch severalgit_envstages at once. They are left for a later slice so this one stays reviewable (4 files, +345/-318). AQ003 and AQ006 are unchanged.Issue and approved scope
Issue: Refs #4552 (item 6)
Human scope-approval comment: #4552 (comment) (item 6: "start the owner-group rewrites of mock-only, owner-patching and assertion-free tests, shrinking the AQ003, AQ004 and AQ006 entries").
Does this PR complete the issue, or what remains? No. This is the first slice of item 6; more owner groups follow, and the other #4552 items are tracked there.
Type of change
Testing
Local results, run through the host guard with
-n 2. The branch hasorigin/mainmerged in (merge commit 9e4605a).pytest tests/quality/test_quality_baselines.py tests/quality/test_test_taxonomy.py tests/unit/cache/test_git_env.py tests/unit/utils/test_real_git_tls_config.py: 167 passed. After the review fixes, the two rewritten files plustests/integration/test_git_tls_config_probe.py: 124 passed.scripts/check_test_assertions.py: the ratchet is clean.python -m tests.quality.taxonomy --changed: tm006 is clean.scripts/check_exact_test_duplicates.py: clean.git_env.pycoverage goes from 662 to 668 executed lines, with none lost.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)