Repository navigation
fix(reference): Exclude Git pointer files from source identities - #7667
Conversation
Match .git pointer files in the default import policy after the existing directory rules, preserving ordinary-checkout exclusion provenance and Git HEAD discovery. Cover linked-worktree identities, repeated imports, nested metadata, similarly named source files, and configured-secret precedence. Independent review: parent independent review APPROVE for Draft CI on patch 61bddf108952c77858fa71c333b4bb8a05ab33e8b03f5c6bccd879cd19c7c379 and source tree 2d2372a. Review triggers: delegated shipping output, source inventory/file I/O behavior, and more than 50 lines. Validation: npm run check passed with Node 24.22.1/npm 11.16.0 on Windows; tracked Vitest regression 1 passed/3 Windows skips; test discovery passed. Eight offline Linux production imports passed on cached Node 22.19.0 as supporting evidence only. Pinned Linux/macOS Vitest cases await hosted CI. Fixes morluto#7551
[Medium impact] The PR appears safe to merge; the previous fixture-isolation issue is addressed. SummaryAdds
Reviews (2) · Last reviewed commit: "test(reference): Isolate worktree fixtur..." · Reviewed by Greptile |
Route every fixture Git command through one wrapper with a filtered child environment, owned empty global config/template/hook paths, and no system config reads. Keep resource cleanup under the existing temporary owner. These settings are scoped to synthetic child processes; host Git settings and this repository's commit/push checks are unchanged. Targeted independent review: parent review APPROVE on patch 4be9a2af3e40edac3d64f687170e966a87fcf762f1877f2c55016e120bcd90ac and tree a2ba91e. The reviewer confirmed the native proof helper hash, complete fixture command coverage, and owned cleanup. Review triggers: delegated follow-up and fixture file/process boundaries. Validation: npm run check:fast passed; targeted Vitest 1 passed/3 native Windows skips. On pinned Node 24.22.1, the actual helper rejects inherited hooks/templates while commit, worktree creation, HEAD and status checks pass. The unisolated control copies the injected template and its commit fails. Refs morluto#7551
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Hi @morluto, a brief consolidated follow-up to avoid separate pings: #7667, #7673 and #7978 address #7551, #7621 and #7440, which are still open. Their current-head CI runs passed, but this does not establish integration with today's main. #7978's description records the Markdown/redaction validation limits (including an incomplete full local check and no real-provider validation). Would you have time to review, or let me know whether these should be refreshed or superseded by another approach? For the two related test PRs, current main already uses |
Summary
Fixes #7551. Exclude linked-worktree
.gitpointer files from reference-source inventories so checkout-specific administrative paths do not change source identities. Keep Git HEAD discovery and the existing.git/directory exclusion provenance.Problem and expected behavior
Two clean linked worktrees at the same commit produced different
root_sha256,graph_sha256, andmanifest_idvalues because the importer hashed each root's.gitpointer. The source files and HEAD matched, and repeating the same import was stable. Git administration should be excluded in both its file and directory representations.Change and scope
Add
.gitto the owning default exclusion list after the existing directory rules. The matcher records the first positive match, so this order preserves the directory pattern.git/.Add regressions for two linked worktrees, repeat imports, ordinary checkout provenance, nested metadata files/directories, similarly named source files, directory-only defaults, and configured-secret precedence over a caller negation.
Route every synthetic Git command through an isolated child environment and owned empty config, template, and hook paths. A controlled rejecting hook/template check validates this without modifying host Git settings.
This is a focused fix within existing contribution boundaries. Open #2630 and #5472 concern caller-selected exclusions; this change fixes the default policy. The Git locator, reader lifecycle, caller rules, secret rules, and manifest builder are unchanged. No new provider or target execution capability is added.
Contract and boundary impact
DEFAULT_REFERENCE_SOURCE_IGNORE_PATTERNSinReferenceSourceImportTypes.ts, consumed by the existing import-policy matcher before source capture..gitpointers becomedefault-ignoredexclusions with pattern.git; ordinary directories retain pattern.git/; HEAD is retained. Ordinary and linked checkout manifests are not asserted identical because exclusion kinds differ.Expected effects:
The production importer executes no target code. Native Git runs only to create and verify the synthetic test fixtures.
Evidence and regression coverage
Executed synthetic production-boundary checks reproduced the defect on base
40b9c03f996270e944ff07cafb63be15ce903708: both worktrees were clean with equal commit/tree IDs, but all three identities differed and.gitwas inventoried. After the fix, eight imports passed: the three identities match across linked worktrees; retry identity and HEAD remain stable; intended file count is two; ordinary-directory and nested-metadata provenance and secret precedence remain correct. These checks called the production importer, not the public CLI.The tracked regression failed on the baseline at
.gitexclusion. On Windows after the fix, its matcher/provenance case passes and three import-dependent cases are explicitly skipped.Boundary coverage addresses inventory identity, file/directory representation, relocation between linked roots, pruning, and source-policy precedence. No reader lifecycle implementation changed.
Validation performed
95e78b63e5f4fcf1107b635e8f3c7e7344eb6464: source tests, static checks, package build, all eight portable shards, native package checks, and CI required passed.referenceSourceGitMetadataExclusion.test.tson Node 24.22.1.npm run checkpassed on the production-fix revisionf66b147with pinned Windows Node 24.22.1/npm 11.16.0.npm run check:fast, staged-file lint/format checks, and the per-push gate passed for the final test-only isolation follow-up.a2ba91ee9cdb03873ff5fa81030a5f0608172930. Greptile's current-head review reports 5/5 and confirms the fixture-isolation issue is addressed.Remaining limits: the full deterministic suite was not run locally; native Windows source imports remain unsupported; no macOS or real-provider workflow was run. These checks do not establish real Hopper/Ghidra or browser behavior.
The Git fixture-isolation finding is addressed in the published test-only follow-up. Host Git configuration and real repository commit/push checks remain unchanged.
Compatibility, safety, and release
Previously imported Git pointer bytes are now excluded by default, correcting the evidence identity defect. Existing caller policy, configured-secret priority, HEAD provenance, and ordinary-directory exclusion records are preserved. No migration or package metadata change is required. No real Hopper/Ghidra, browser, or other provider workflow was run.
Author readiness
Human owner: @WenyuChiou
Before merge
type(scope): outcome.