Repository navigation
fix(git): clearer diagnostic when the Git config probe cannot read the config (#4390) - #4442
Merged
Daniel Meppiel (danielmeppiel) merged 4 commits intoNov 21, 2026
Conversation
…remedy (#4390) URL rewrite safety stays fail closed when the effective Git config cannot be read. The refusal now shows Git's first diagnostic line (credentials redacted, printable ASCII, bounded), the config file and line Git reports, and one runnable remedy; a path-length failure names a shorter project path or core.longpaths. Categories without stderr keep their wording and add 'git config --show-origin --list'. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 17:42
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Install errors can expose private config-value suffixes containing apostrophes, and truncated error details can direct users to fix nonexistent paths.
2 open issues
What changed in this PR
This PR improves diagnostics when APM cannot read Git configuration during URL rewrite safety checks, addressing #4390 while preserving fail-closed behavior.
Changes:
- Adds redacted, bounded Git diagnostics and targeted recovery advice, including path-length guidance related to #4397.
- Adds unit and installed-CLI regression coverage for diagnostics, credential masking, and unchanged project state.
- Documents the troubleshooting command and records the fix in the changelog and lifecycle bug ledger.
| File | Description |
|---|---|
tests/unit/utils/test_git_probe_diagnostic.py |
Tests diagnostic formatting, redaction, limits, and remedies. |
tests/unit/cache/test_git_env.py |
Updates probe-failure and timeout assertions. |
tests/integration/test_git_config_probe_diagnostic_lifecycle.py |
Checks CLI refusal, credential masking, and unchanged project state. |
tests/fixtures/lifecycle_bug_ledger.json |
Links issue #4390 to regression coverage. |
src/apm_cli/utils/git_env.py |
Adds diagnostic sanitization and recovery guidance to probe errors. |
docs/src/content/docs/getting-started/authentication.md |
Documents config-read failures and the inspection command. |
CHANGELOG.md |
Records the user-visible diagnostic improvement. |
Review effort: Balanced
…the full line A config value that contains apostrophes is masked through the suffix Git appends, or to the end of the line. The remedy is parsed from the untruncated redacted line, and a path longer than the display cap falls back to the inspection command. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
5 of 10 tasks
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-4390-git-probe-diagnostic
branch
November 21, 2026 05:24
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
Clearer diagnostic when the Git config probe behind URL rewrite safety cannot read the effective configuration. The install still refuses (fail closed). The error now shows:
fix line 3 of '<file>', then check with 'git config --show-origin --list' and retry.'$GIT_DIR' too big, see apm install fails on Windows when the dependency staging path exceeds Git's path limit #4397), the remedy is a shorter project path orcore.longpaths.Categories without stderr (could not start, timed out) keep their wording and add
git config --show-origin --list. The owner isGitUrlRewriteProbeErrorinsrc/apm_cli/utils/git_env.py; callers render its message unchanged.Issue and approved scope
Issue: Fixes #4390
Human scope-approval comment: #4390 (comment)
Does this PR complete the issue, or what remains? It completes the issue.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
tests/integration/test_git_config_probe_diagnostic_lifecycle.py::test_unreadable_git_config_refuses_naming_the_fault_and_a_remedy[unreadable-global-config|credential-in-invalid-key]runs on the installed CLI (APM_BINARY_PATH=.venv/bin/apm): 2 failed before the fix, 2 passed after. It asserts a non-zero exit, the file Git reports, the remedy command, no credential text, and an unchanged apm.yml with no lockfile.tests/unit/utils/test_git_probe_diagnostic.py(new) andtests/unit/cache/test_git_env.py::TestGitSubprocessEnv: 89 passed.tests/quality/test_lifecycle_bug_ledger.py: passed.python -m tests.quality.taxonomy --changed: clean.scripts/check_test_assertions.py: ratchet clean.Lint chain: ruff check and ruff format --check, pylint R0801,
lint-auth-signals.sh, the complexity ratchet (--base-ref origin/main) andlint_architecture_boundaries.py --root .are all clean.Changelog
## [Unreleased]inCHANGELOG.md:user-visible effect first, 25 words or fewer, ending with
(#PR);breaking changes only under upgrade notes; no Highlights; see
.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
Not applicable: no
req-XXXbehavior changes.