Repository navigation
fix(work): read attempt diff paths literally, not as Git pathspecs - #301
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
|
Thanks for the focused fix and regression coverage, and for your continued work on the diff pipeline. Treating repository paths literally at the shared Git boundary addresses the attribution problem at its source. The fix is consistent with the independent before/after checks from issue review, and all 15 hosted checks are green. Ready to merge. |
Lucas1479
left a comment
There was a problem hiding this comment.
Reviewed 33df7f1. The shared Git helper's existing callers supply literal repository paths rather than intentional patterns, so --literal-pathspecs fixes the owning boundary without adding another filtering layer. Independent issue validation covered working-tree and committed attempts, persisted patch contents, and leading-colon paths via Git tree objects. The head is unchanged from review and all 15 hosted checks pass. No blocking findings.
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