Repository navigation
fix(repo): scan leaves the manifest a pinned commit holds out of the identifier check (#1530) - #1614
Conversation
…identifier check (intel#1530) With `repo scan <dir>@<rev> --manifest-file <dir>/<path>` the manifest's own text was read as code: `_manifest_file_in_tree` returned nothing for a tree without a file system root, so the manifest path was not excluded from the words of the identifier check, and a name only the manifest holds (`repo_manifest` from `schema: repo_manifest.v1`) turned an `AGENTS.md` claim `ok`. The same scan of the work tree reports `unresolved_identifier`. Without `--manifest-file`, `--manifest <path>` already excluded the path of a pinned tree. For a pinned tree the file named by `--manifest-file` is now mapped through the checkout the commit was named by and the commit's own listing: the path the commit lists, and the target of a link there, are left out; a file the commit does not list leaves nothing out. The manifest's file system path is not read. The contract doc and a changelog fragment say so, and the test that pinned the old behaviour now pins the new one. Test-narrowed: test_a_pinned_commit_skips_its_manifest_without_manifest_file_and_reads_it_as_code_with_the_flag pinned the bug (a pinned manifest named by --manifest-file read as code); it is renamed and now asserts the fix. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
Manifest paths containing .. are checked before resolution, leaving manifest-only claims incorrectly marked ok instead of unresolved_identifier.
1 open issue
What changed in this PR
1 new finding.
This PR aligns local pinned-commit scans with work-tree scans by excluding manifests named through --manifest-file from identifier checks.
Changes:
- Maps manifest paths and symlink targets through the pinned commit.
- Adds regression coverage for nested paths and symlinks.
- Updates the contract and changelog.
| File | Description |
|---|---|
dokimi/tests/test_repo_scan_own_files.py |
Tests pinned-manifest exclusions. |
dokimi/dokimi/commands/repo.py |
Adds commit-aware manifest path mapping. |
dokimi/docs/repo-evaluation-contract.md |
Documents the revised exclusion behavior. |
dokimi/changelog.d/20261204_120000_pinned-manifest-file-own-file.md |
Records the identifier-check fix. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). CI at Test notes (2)
Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1614 +/- ##
==========================================
- Coverage 96.46% 96.45% -0.02%
==========================================
Files 561 566 +5
Lines 74345 75010 +665
Branches 12840 12953 +113
==========================================
+ Hits 71716 72349 +633
- Misses 1609 1632 +23
- Partials 1020 1029 +9
🚀 New features to boost your workflow:
|
…the identifier check Review point on intel#1614: `repo scan ROOT@SHA --manifest-file ROOT/config/../config/eval.yaml` left a manifest-only claim as `ok`, because the typed path kept its `..` and failed the listing check before the commit's own link walk could resolve it. The path under the checkout is now also resolved with the commit's walk (`tree.resolve`), which follows links and `..` as a checkout does, and the resolved path joins the listed ones. The separate pass over link targets is folded into it, and the unreachable `git_dir is None` guard is removed. Tests cover a plain `..`, a `..` after a link in the commit, and a link that leaves the commit. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…out is left out of the identifier check Settles the review thread on _pinned_manifest_file: with the commit named by its real path (ROOT@SHA) and --manifest-file typed through a link to the checkout (ALIAS/config/nested/eval.yaml), the typed path was not under either spelling of git_dir, so nothing was left out and the manifest was read as code. The directories of the typed path's prefix that are the same directory as the checkout on disk now count as bases too; the suffix is still looked up in the commit's own listing. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 49c299e)
- Contract: candidate. errors dokimi/dokimi/commands/repo.py:374
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
No new blocking findings on 49c299e0.
Reviewed the diff, edge cases and prior threads. Focused tests: 24 passed on head and 16 passed on merge base. The full local suite was outside coverage.
napetrov
left a comment
There was a problem hiding this comment.
Checked manifest exclusion for both worktrees and pinned commits, focused tests, and required CI. Coverage includes the two repository forms in the reviewed fixtures.
vchamarthi
left a comment
There was a problem hiding this comment.
Approving 49c299e.
Still open: when I changed the code on purpose, the tests still passed for 4 of 12 changes, and no test pins these down yet (non-blocking): dokimi/dokimi/commands/repo.py:374 (the handled error is raised again), dokimi/dokimi/commands/repo.py:380 (the handled error is raised again), dokimi/dokimi/commands/repo.py:391 (the handled error is raised again) and 1 more.
What I checked: the 24 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (36,528 tests), apart from failures main has too; it merges cleanly onto main.

Summary
repo scan <dir>@<rev> --manifest-file <dir>/<path>read the manifest's own text as code in the identifier check. A work tree skips it, a pinned commit did not:_manifest_file_in_treereturned()for a tree with no file system root, so the manifest's tree path was not left out ofScan.words(). A name only the manifest holds (repo_manifest, fromschema: repo_manifest.v1) then resolved a claim inAGENTS.md.Run on
mainover a repository whose only manifest is at the named path and whoseAGENTS.mdnamesrepo_manifest, the status of theAGENTS.mdidentifier claim:<dir><dir>@<sha>onmain--manifest .github/dokimi/repo.yamlunresolved_identifierunresolved_identifier(already correct:scan_repoexcludesmanifest.path)--manifest config/eval.yaml --manifest-file <dir>/config/eval.yamlunresolved_identifierok(wrong)--manifest config/eval.yaml(no--manifest-file)unresolved_identifierSo only the
--manifest-fileform fails; the issue's first form already works at this head. The fix is the issue's: exclude the tree path of the manifest the commit holds, mapped through the tree's own listing.Closes #1530
Changes
_manifest_file_in_tree(dokimi/dokimi/commands/repo.py) hands a tree withoutrootto a new_pinned_manifest_file. It takes the typed--manifest-filepath relative to the checkout the commit was named by (git_dir, as typed, withgit_dirresolved, and relative to any directory of the typed path's prefix that is the same directory asgit_diron disk, so a link to the checkout works whichever side names it), keeps it only when the commit's owntree.files()lists it, and adds the targettree.resolvegives for a link in the commit, as the work-tree code does for a link on disk. The path is also resolved with the commit's own link walk, so a..in the typed path (<dir>/config/../config/eval.yaml), also after a link in the commit, names the file as a checkout would. The manifest's file system path is not read. A--manifest-fileoutside the checkout or one the commit does not list stays(). The work-tree branch is unchanged.dokimi/docs/repo-evaluation-contract.md(identifier check): the sentence that said a pinned<dir>@<rev>reads its manifest as code when--manifest-filenames it now says what the code does.dokimi/tests/test_repo_scan_own_files.py: the test that pinned the old behaviour (test_a_pinned_commit_skips_its_manifest_without_manifest_file_and_reads_it_as_code_with_the_flag) is renamed and assertsunresolved_identifierfor the flag too. New tests: a nested manifest path (and AGENTS.md's own claim still counts, with the work tree as the same result), no--manifest, a link in the commit, a checkout named through a link, a manifest typed through a link to a checkout named by its real path, a..in the path, a..after a link in the commit, and a link that leaves the commit (the file is then not skipped).Risk
repo scan <dir>@<rev> --manifest-file <dir>/<path>now reportsunresolved_identifierwhere it reportedokfor a name only the manifest holds, which is what the work tree reports. A name the manifest shares with real code still resolves from that code. Exit codes and error messages are unchanged.Open PR #1328 changes
dokimi/dokimi/commands/repo.pytoo (incmd_repo_inspectand a new_inspectedhelper) and merges cleanly with this branch; the open PRs that touchdokimi/docs/repo-evaluation-contract.mdmerge cleanly as well.Limit of this fix: a remote pinned source has a cache clone as its
git_dir, so a--manifest-filethere excludes nothing and the manifest is still read as code. The work-tree behaviour is unchanged: a manifest file inside the tree is left out as before, one outside the tree excludes nothing, and a pinned local checkout now matches it.Testing
On a Linux review host, at
49c299e0(onmain01ff2d6):make ci-local: 37 passed, 1 failed, 16 skipped (steps with a job condition, matrix, tool or network not available locally). Test run: 35411 passed, 1 failed, 28 skipped. The failure istests/test_import_architecture.py::test_package_uses_the_new_modules(dokimi.runs.resolveimportsdokimi.utils), which fails on this branch's base (01ff2d6) and is fixed on currentmainby the merged fix(runs): import InputError from dokimi.files, not dokimi.utils #1609; this PR does not touch it.--manifest-file <alias>/config/nested/eval.yamlwith<alias>a link to the checkout and the commit named by its real path (<dir>@<sha>) givesunresolved_identifier; at2a52834ait gaveok. The new test fails on2a52834a's code (1 failed, 23 passed) and, as a mutant, with the link-prefix bases removed (1 failed, 23 passed).main's code:--manifest config/eval.yaml --manifest-file <dir>/config/eval.yamlon<dir>@<sha>givesok; on this branchunresolved_identifier, as the work tree does.main's codetests/test_repo_scan_own_files.pygives5 failed, 15 passed, first onassert 'ok' == 'unresolved_identifier'; here 23 passed...spelling: resolving the path withposixpath.normpathinstead of the commit's walk fails 3 tests (the..after a link, the link that leaves the commit, the link in the commit); not resolving it at all fails 3 (the plain.., the..after a link, the link in the commit).(), work-tree branch returns()) each fail at least one of the new or changed tests.fix/manifest-glob-bracesonmain0eeae5f:pytest -n auto35684 passed, 28 skipped,mypyclean,ruff checkclean.Open questions
None.
Revert
A plain revert restores the old behaviour (a pinned manifest named by
--manifest-fileread as code). Nothing is stored.Checklist
pytestpasses (tests added; the full run has one failure,test_package_uses_the_new_modules, which fails on the base and is fixed on currentmainby the merged fix(runs): import InputError from dokimi.files, not dokimi.utils #1609)ruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)