Repository navigation
fix(work): read attempt diff paths literally, not as Git pathspecs - #301
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
collect_git_delta builds the committed and working attempt patches with `git diff ... -- <changed files>`. Git interprets those arguments as pathspecs, so glob characters and pathspec magic in a filename changed which files were diffed: - a changed `[id].tsx` also matched `i.tsx` and `d.tsx`, so a pre-existing user edit that the baseline filter had correctly listed under excluded_baseline_paths was still written into the attempt patch and shown in the attempt diff canvas as part of the Work; - a changed file whose name starts with `:` was read as pathspec magic, matched nothing, and its changes were missing from the patch. The paths always come from Git's own status and name-only output, so they are literal repository paths. run_git, which already pins core.quotepath=false for machine consumers, now also passes --literal-pathspecs. None of its callers passes a pattern. Adds a regression test in which an attempt edits `[id].tsx` while a pre-existing dirty `i.tsx` stays untouched; the attempt patch must list only `[id].tsx`. Fixes Code-Amadeus#300
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.
What and why
Fixes #300.
collect_git_deltabuilds the committed and working attempt patches withgit diff ... -- <changed files>, and Git reads those arguments as pathspecs. Glob characters and pathspec magic in a filename therefore changed which files were diffed:[id].tsxalso matchedi.tsxandd.tsx. A pre-existing user edit that the baseline filter had correctly listed underexcluded_baseline_pathswas still written into the attempt patch and shown in the attempt diff canvas as part of the Work;:was read as pathspec magic, matched nothing, and its changes were missing from the patch.These paths always come from Git's own
status --porcelain=v1 -zanddiff --name-only -zoutput, so they are literal repository paths.run_gitalready pinscore.quotepath=falsefor machine consumers; it now also passes--literal-pathspecs. No caller passes a pattern: the other callers arerev-parse,branch --show-current,status, anddiffwith no paths.Linked Issue for product-semantic or public-contract changes: none (routine fix; tracked in #300)
Change class
Owning layer:
server/local_git.py(run_git, the Host's Git boundary for attempt diffs)User-visible effect, or
none: the attempt diff canvas shows only the attempt's attributed files, with no other files whose names happen to match a glob, and it includes changes to files whose names start with:.Compatibility or migration impact, or
none: none. Attempt deltas recorded before this fix are not rewritten.Evidence
Commands and manual journeys run:
pytest tests/test_work_artifact_registry.py -k literal: the newtest_attempt_patch_reads_changed_paths_literally_not_as_globsfails on currentmain(the patch contains the pre-existingi.tsxhunk) and passes with the fix.pytest tests/test_work_artifact_registry.py tests/test_unified_diff_canvas.py: 47 passed.The 81 test files that drive Git or the Work ledger (1304 tests) were run on Linux both with and without the change: the result is identical. The same 31 tests fail on unmodified
mainin that environment because AUIP bundle validation needs a Node runtime, which that machine does not have.ruff check .andgit diff --check: clean.Manual check with plain Git:
git diff --name-only HEAD -- '[id].tsx'lists[id].tsxandi.tsx; with--literal-pathspecsit lists only[id].tsx. A changed:top.txtis listed only with--literal-pathspecs.Relevant Python tests pass
CPU/model-less baseline remains supported
Electron
npm run buildpasses when Electron code changedDependency audit passes when dependencies changed
Before/after screenshots are attached for visible UI changes
Documentation/examples are updated for changed settings or contracts
Final check