Repository navigation
fix: harden diff ref parsing in git worktree flow - #46
Closed
bhattaraiprayag wants to merge 2 commits into
Closed
bhattaraiprayag wants to merge 2 commits into
bhattaraiprayag wants to merge 2 commits into
Conversation
- Reject refs that begin with '-' and verify refs with git rev-parse before running structural diff worktree operations. Pass refs to git worktree add after '--' so user-supplied refs cannot be parsed as git command options. - Add regression coverage for dash-prefixed refs, literal $(...) refs, and command argument construction with end-of-options separation.
didier1969
pushed a commit
to didier1969/axon
that referenced
this pull request
Aug 9, 2026
…ers/ist_structural_sccs (REQ-AXO-902279) Feedback LLM harshkedia177#46 (NEX, blocking) : audit de câblage gouverné impossible car les 3 outils émettaient des COMPTES dans content[0].text ("77 dead clusters", "62 SCC", "8 test_only") sans aucun nom — or les LLM lisent le texte, pas data. Les noms étaient déjà dans data. Helper partagé sample_identities() échantillonne les noms dans le résumé avec divulgation de troncature obligatoire ("showing N of M"). Zéro recompute. 3 tests (présence/troncature/vide). REQ-AXO-902279 REFINES REQ-AXO-902192 (CPT-AXO-90056).
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.
Scope
This PR contains one focused bug fix for branch-diff ref handling, plus regression tests for that same behavior.
Why
axon diffpassed user-provided refs directly togit worktree add, so refs starting with-could be parsed as git options.What changed
_validate_ref(repo_path, ref)insrc/axon/core/diff.py:-git rev-parse --verify --quiet --end-of-options <ref>^{commit}diff_branches()now validatesbase_refand optionalcurrent_refbefore graph build/worktree operations._build_graph_for_ref()now calls:git worktree add <path> -- <ref>so user refs are always passed after end-of-options.
tests/core/test_diff.pyfor:main,feature/x,HEAD~1)$(id)refs (treated as plain ref text)diff_branches--separator presence in worktree command argsValidation
uv run pytest -q tests/core/test_diff.py->23 passeduv run pytest -q->591 passeduv run ruff check src/axon/core/diff.py tests/core/test_diff.py-> passuv run ruff format --check src/axon/core/diff.py tests/core/test_diff.py-> passaxon diff -- '--detach'-> rejectedaxon diff -- '$(id)'-> rejected as invalid refaxon diff 'HEAD~1..HEAD'-> succeeds for valid refsCloses #35
Closes #38
Checklist
pytestpasses locallyruff check src/ tests/passes