Skip to content

fix(repo): repo budget skips a tracked file under an unsearchable directory (#959) - #1028

Merged
napetrov merged 11 commits into
intel:mainfrom
vchamarthi:issue-959-repo-budget-crashes-when-a
Nov 23, 2026
Merged

napetrov merged 11 commits into
intel:mainfrom
vchamarthi:issue-959-repo-budget-crashes-when-a

Conversation

@vchamarthi

@vchamarthi vchamarthi commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #959. repo budget <dir> on a git working tree with a tracked file under a chmod 000 directory ended in PermissionError from Path.is_file in WorkTree.files(). The path is now skipped, named in the budget's warnings, and the table is printed.

Changes

  • WorkTree._is_entry in dokimi/dokimi/repos/source.py checks the path with os.lstat and catches OSError; WorkTree.skipped lists what it dropped.
  • budget() in dokimi/dokimi/repos/budget.py adds skipped to warnings, so --fail-on-warning gates on it.
  • New dokimi/tests/test_repo_budget_unreadable_dir.py and a changelog fragment.
  • The warning reads <path>: Permission denied; the file and anything it leads to are not counted, the wording repo scan takes as an incomplete scan.
  • _loaded_with_default in dokimi/dokimi/commands/repo_scan.py returns tree.skipped as the not-counted warnings for a written manifest too.

Risk

A tracked file under an unreadable directory is left out of the budget and named in warnings; --fail-on-warning now exits 1 for such a tree. The os.walk branch of files() and is_file/is_dir are unchanged. repo scan --fail-on-fail exits 1 for such a tree when the skipped path is one the scan would check (a guidance or also_scan glob, a rule, a guidance name or a Markdown import in the default scan, a directory that could not be listed, a Bazel build input when the Bazel adapter is on); any other skipped path is only a warning.

Testing

python -m pytest -q -p no:cacheprovider tests/test_repo_budget_unreadable_dir.py tests/test_repo_budget.py tests/test_growth_ratchet.py passes. The new test fails on main with PermissionError. python -m ruff check on the changed files passes.

Open questions

None

Revert

Revert the commit. Nothing is stored.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)
Checklist evidence
  • Tests added/updated and pytest passes: 1 test file(s) changed; suite: 23811 passed; 1 failing test(s) fail on the base branch too: tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart; 7 proof(s) fail before the change
  • ruff, mypy, and schema checks pass: passed: ci.yml:static / ruff check, ci.yml:typecheck / mypy, ci.yml:static / schema-check, ci.yml:static / schema_compat vs the PR base
  • Docs updated (or N/A): N/A: No doc describes this: schemas/repo_budget.v1.json already says warnings covers unreadable files, and the code now does what it says.
  • Self-reviewed per "Before opening a PR" in AGENTS.md: second reader: 2 round(s), nothing left open; mutation of changed lines ran
  • Each new raise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue
  • No ad-hoc run artifacts committed: 2 added file(s), none a run's output
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml): every new source file carries the header

Fixes #959.
Fixes #906 (supersedes #953).

…ectory (intel#959)

WorkTree.files() let PermissionError out of Path.is_file for a path git
lists under a directory with mode 000, so repo budget ended in a
traceback. A path that cannot be looked at is now left out of the
listing, with a warning on stderr naming it.

Fixes intel#959

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi marked this pull request as ready for review November 19, 2026 19:25
@vchamarthi
vchamarthi requested a review from a team as a code owner November 19, 2026 19:25
Copilot AI balanced review requested due to automatic review settings November 19, 2026 19:25
@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 90.32258% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.06%. Comparing base (4340e0f) to head (c469cb9).

Files with missing lines Patch % Lines
dokimi/dokimi/commands/repo_scan.py 84.21% 6 Missing and 6 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1028      +/-   ##
==========================================
- Coverage   96.09%   96.06%   -0.03%     
==========================================
  Files         462      463       +1     
  Lines       60884    61000     +116     
  Branches    10525    10541      +16     
==========================================
+ Hits        58505    58600      +95     
- Misses       1474     1485      +11     
- Partials      905      915      +10     
Files with missing lines Coverage Δ
dokimi/dokimi/repos/budget.py 99.52% <100.00%> (+<0.01%) ⬆️
dokimi/dokimi/repos/export_skips.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/l0/__init__.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/shell_search.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/source.py 97.02% <100.00%> (+0.15%) ⬆️
dokimi/dokimi/repos/workspace.py 93.70% <100.00%> (+0.03%) ⬆️
dokimi/dokimi/commands/repo_scan.py 89.37% <84.21%> (-3.11%) ⬇️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

Fixes repo budget <dir> crashing on unreadable (chmod 000) directories in git worktrees by skipping un-stat’able listed paths, surfacing them as warnings, and treating affected scans as incomplete.

Changes:

  • Add WorkTree.skipped tracking and _is_entry() based on os.lstat() to avoid Path.is_file()/is_symlink() permission pitfalls.
  • Propagate skipped-path warnings into repo budget warnings and into repo scan incomplete-scan reporting.
  • Add regression tests and a changelog entry for the unreadable-directory scenario.
File Description
dokimi/​tests/​test_repo_budget_unreadable_dir.py Adds regression coverage for unreadable directory entries and warning/exit-code behavior.
dokimi/​dokimi/​repos/​source.py Implements WorkTree.skipped and safe entry detection via os.lstat() with OSError handling.
dokimi/​dokimi/​repos/​budget.py Includes tree.skipped in budget warnings so --fail-on-warning gates correctly.
dokimi/​dokimi/​commands/​repo_scan.py Treats skipped paths as “not-counted” warnings for written manifests by forcing a listing.
dokimi/​changelog.d/​20261119_100000_budget-unsearchable-dir.md Documents the fixed crash and the new warning/exit behavior.

Review effort: Lite

Comment thread dokimi/dokimi/repos/source.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
…ntel#959)

Every path the listing could not look at made the scan incomplete, so a data
file under an unsearchable directory failed --fail-on-fail. The contract names
only guidance the scan would check.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi marked this pull request as ready for review November 20, 2026 02:02
@exai-bot

exai-bot commented Nov 20, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit c469cb9 was not reviewed. This PR has reached its review limit (6 reviews).

CI at `c469cb9`: 5 still running, 20 passing, 2 skipped
Check Status
Mutation of changed lines still running
Test Linux Python 3.14 still running
Test Linux Wheels Python 3.14 still running
Tests (py3.14) still running
self / repo tasks check fix-degrade-pre still running

To review this commit: re-request review from exai-bot in the Reviewers list.

<details><summary>Last review (7d56c99): 2 medium</summary>

Open threads from the bot: 0

</details>

Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
…intel#959)

- match the skipped path itself, not the text before the first ": ", so
  `team: docs/AGENTS.md` is found
- read `also_scan` entries as globs, as `guidance_files` does
- count a skipped `CLAUDE.local.md` (profile guidance name) and a skipped
  Bazel build input as reasons the scan is incomplete
- name `Permission denied` from the errno, not the locale's `strerror`
- tests restore the directory's own mode

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on issue-959-repo-budget-crashes-when-a (15622f3..ef52f11)

Next: a re-review of the new head.

Changes

  • A tracked team: docs/AGENTS.md under an unsearchable directory makes repo scan --fail-on-fail exit 1.
  • A skipped d/CLAUDE.local.md, a skipped docs/private/b.md under also_scan docs/**/*.md, and a skipped d/macros.bzl make the scan incomplete.

PR description updated

  • repo scan --fail-on-fail exits 1 for such a tree when the skipped path is one the scan would check (a guidance or also_scan glob, a rule, a guidance name in the default scan, a Bazel build input); any other skipped path is only a warning.

Threads and comments

  • 8 fixed; each answered in its thread.

Verified on the new head: ✅ 5/5 tests fail before the fix, pass after · ⚠️ 3 answered as fixed without a test that shows it · ✅ full suite with main merged in: 23949 passed · ✅ second reader: nothing raised

What each test shows
  • test_the_warning_names_the_reason_without_the_locale: fails before, passes after.
  • test_a_skipped_claude_local_md_makes_the_default_scan_incomplete: fails before, passes after.
  • test_a_skipped_path_matching_an_also_scan_glob_makes_the_scan_incomplete: fails before, passes after.
  • test_a_skipped_bazel_build_input_makes_the_scan_incomplete: fails before, passes after.
  • test_a_skipped_path_with_a_colon_and_a_space_is_matched_by_its_whole_name: fails before, passes after.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Comment thread dokimi/dokimi/commands/repo_scan.py Resolved

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at ef52f11. The crash is fixed: repo budget and repo scan no longer raise on a tracked file under an unsearchable directory, and the gate fails on skipped guidance. But the new silent skip now reaches callers that ignore skipped, and a few cases still pass or fail the gate wrongly. Details are in the line comments.

Agreed with @exai-bot on the @ import under an unsearchable directory: repo scan --fail-on-fail still exits 0 there.

What I ran, at ef52f11:

  • make ci-local --offline: 23,732 passed, 0 failed, 72 skipped; every step passed.
  • repo scan --fail-on-fail --json on small git and plain-directory trees with chmod 000 subdirectories: an @ import (exit 0), a vendored BUILD without Bazel (exit 1), nested AGENTS.md in a plain directory (exit 0) and under git (exit 1).
  • workspace._export of a WorkTree with an unsearchable directory: the export misses its files without an error.

Checked, no issues

  • Warning text: Permission denied comes from errno, not the locale; the : in a path is handled by skipped_paths.
  • Earlier threads: the CLAUDE.local.md, also_scan glob and colon-in-path fixes hold, each with a test.
  • Docs and changelog: the contract and the Fixed fragment say what changed; the new test file has the SPDX header.

Comment thread dokimi/dokimi/repos/source.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/repos/source.py Resolved
Comment thread dokimi/dokimi/repos/source.py Resolved
…ntel#959)

Fixes review points on intel#1028:
- an @ import of Markdown under an unsearchable directory makes the default scan incomplete
- a skipped Bazel build input counts only when the Bazel adapter is on
- os.walk records a directory it could not list, as git trees do
- an unmerged path is named once in skipped
- the workspace export raises PrepError instead of copying a partial tree
Fixes review points on intel#1028:
- an @ import of Markdown under an unsearchable directory makes the default scan incomplete
- a skipped Bazel build input counts only when the Bazel adapter is on
- os.walk records a directory it could not list, as git trees do
- an unmerged path is named once in skipped
- the workspace export raises PrepError instead of copying a partial tree

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on issue-959-repo-budget-crashes-when-a (ef52f11..5995be8)

Next: @vlad-perevezentsev: re-review the new head.

Changes

  • Workspace export refuses a tree with skipped paths.
  • Default scan keeps a skipped Markdown file that CLAUDE.md imports.
  • Workspace export refuses a tree whose skipped paths it would copy, not one with an unreadable path outside only or inside exclude.
  • Skipped build input is a reason only with the Bazel adapter.
  • Plain directory walk records an unsearchable directory.
  • Unmerged path is named once.

PR description updated

  • repo scan --fail-on-fail exits 1 for such a tree when the skipped path is one the scan would check (a guidance or also_scan glob, a rule, a guidance name or a Markdown import in the default scan, a directory that could not be listed, a Bazel build input when the Bazel adapter is on); any other skipped path is only a warning.

Threads and comments

  • 5 fixed; each answered in its thread.

Verified on the new head: ✅ 5/5 tests fail before the fix, pass after · ✅ full suite with main merged in: 24333 passed, 1 failure that main has too · ✅ second reader: 1 raised, all fixed

What each test shows
  • the five new tests: fails before, passes after.
  • the five new tests: fails before, passes after.
  • the five new tests: fails before, passes after.
  • the five new tests: fails before, passes after.
  • the five new tests: fails before, passes after.
  • an export of eval or without private is not refused for a skipped path it does not copy: passes.
  • Also changed, outside this PR's files: dokimi/dokimi/repos/l0/__init__.py, dokimi/dokimi/repos/workspace.py.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks (unsupported host: needs installed native gitleaks at the workflow's pinned version), ci.yml:static / Scan commits (unsupported host: needs installed native gitleaks at the workflow's pinned version), ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/repos/l0/__init__.py Resolved
…-crashes-when-a

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
…ts (intel#959)

An @ import through a linked directory to a skipped Markdown file now makes
the default scan incomplete, and a skipped path that is not guidance stays in
the scan report's warnings without becoming an incomplete reason. The tests
and changelog fragment use main's --fail-on warn|fail.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 2 commits on issue-959-repo-budget-crashes-when-a (5995be8..77889ee)

Next: a re-review of the new head.

Threads and comments

  • 2 fixed; each answered in its thread.

Not this PR's

  • Fails on main too: 1 test in tests/test_repo_compare_interval.py – p rounds to -0.0001 instead of 0.0 on main too.

Verified on the new head: ✅ 2/2 tests fail before the fix, pass after · ✅ full suite with main merged in: 24347 passed, 1 failure that main has too · ✅ second reader: nothing raised · ⚠️ 3 tests removed or renamed

What each test shows
  • import through a linked directory makes the scan incomplete: fails before, passes after.
  • skipped data file stays a warning in the scan report: fails before, passes after.
  • Removed or renamed tests: test_a_line_that_breaks_the_version_1_shape_is_refused, test_first_useful_rate_keeps_a_cell_with_steps_past_the_bound_as_a_non_hit, test_scale_of_5000_skills_is_a_few_seconds.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks (unsupported host: needs installed native gitleaks at the workflow's pinned version), ci.yml:static / Scan commits (unsupported host: needs installed native gitleaks at the workflow's pinned version), ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: CONTRACT (head 77889ee)

  • Contract: candidate. errors dokimi/dokimi/commands/repo_scan.py:109; errors dokimi/dokimi/repos/workspace.py:323
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

Two existing blocking findings remain open. The budget now names skipped entries. The default scan can still call itself complete when imported Markdown is hidden behind either a direct file symlink to an inaccessible target or a directory symlink to the repository root. _link_routes drops errors while resolving the former and builds the wrong prefix for the latter. Both of the failing CI jobs report a runner shutdown. T16, T17

Focused tests on 77889eefc: 26 passed in 2.04s. CI on head 77889ee: 2 failing Actions jobs; merge base 6ebda00 is behind base tip 36075a0.

)

A skipped Markdown file imported through a file link, a chain of file
links, an absolute link inside the repository, a file link over a
directory link, a directory named ..docs, or a link to the root
(self -> .) was not matched to the skipped path, so the default scan
passed the gate. Follow unresolvable links component by component and
map the root link's paths.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review, @napetrov: 1 commit on issue-959-repo-budget-crashes-when-a (77889ee..0600eed) answers your comment.

Changes:

  • _link_routes keeps routes for a file link to a skipped file and for a link to the root.
  • _link_target follows chained links and accepts absolute targets inside the repository.
  • _link_target follows links component by component, through directory links, and no longer treats a name starting with .. as a parent step.

Threads and comments:

  • 3 fixed; each answered in its thread.

Checked on the new head: 6 of 6 tests fail before the fix and pass after; full suite with main merged in: 24550 passed, 1 failure that main has too.

What each test shows
  • file link to a skipped import makes the scan incomplete: fails before, passes after.
  • root link to a skipped import makes the scan incomplete: fails before, passes after.
  • absolute file link to a skipped import makes the scan incomplete: fails before, passes after.
  • chain of file links to a skipped import makes the scan incomplete: fails before, passes after.
  • link into a ..docs directory to a skipped import makes the scan incomplete: fails before, passes after.
  • file link over a directory link to a skipped import makes the scan incomplete: fails before, passes after.

Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
…tors (intel#959)

A Markdown import through a link whose absolute target has '.' or '//'
components, or whose target uses backslashes or a \\?\ prefix, was not
routed to the skipped file, so the scan was not marked incomplete.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review: 1 commit on issue-959-repo-budget-crashes-when-a (0600eed..7d56c99).

Threads and comments:

  • 2 fixed; each answered in its thread.

Checked on the new head:

  • Not passed: 3 of 4 tests fail before the fix and pass after
  • Not passed: 1 answered as fixed without a test that shows it
  • Full suite with main merged in: 24555 passed, 1 failure that main has too
What each test shows
  • dot components: fails before, passes after.
  • windows separators: fails before, passes after.
  • extended-length Windows prefix: fails before, passes after.
  • relative target under a directory named C: off Windows: passes before the fix too.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review: 1 commit on issue-959-repo-budget-crashes-when-a (7d56c99..9e5f356).

Not the PR's:

  • Fails on main too: 1 test in tests/test_growth_ratchet.py; dokimi/commands/novelty.py is 801 lines on main, over the 800 cap.
  • Outside the PR: dokimi/dokimi/commands/benchmark.py:154; _keyless_route returns [] for a vertex_ai route before reading the configured key, so benchmark preflight --provider anthropic --model vertex_ai/gemini-2.5-pro --judge-provider openai --judge-model gpt-4o with ANTHROPIC_API_KEY=file:/nonexistent/key prints Preflight OK and exits 0, while LLM.complete calls resolve_api_key for the configured provider and raises.
  • Outside the PR: dokimi/changelog.d/20261119_120000_vlad-perevezentsev_pipeline-retrieval-doctreatment.md:8; The fragment names --max-tokens for answers generate and benchmark run, but benchmark.py:583 registers --retrieval-tokens, so benchmark run --target onetbb --max-tokens 4000 exits 2.

Checked on the new head:

  • Not passed: 2 tests removed or renamed
  • Tests of the fix: 1 passed
  • Full suite with main merged in: 25587 passed, 9 failures that main has too
What each test shows
  • Removed or renamed tests: test_growth_of_quadratic_work_stays_near_16_after_all_attempts, test_repo_validate_out_writes_the_report.

Comment thread dokimi/dokimi/repos/workspace.py Resolved
Comment thread dokimi/dokimi/repos/workspace.py Resolved
Comment thread dokimi/dokimi/repos/workspace.py Resolved

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: CONTRACT (head 9e5f356)

  • Contract: candidate. errors dokimi/dokimi/commands/repo_scan.py:113; errors dokimi/dokimi/commands/repo_scan.py:158
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

The earlier approval at 7d56c99 missed this case. An absolute Markdown import through a directory symlink followed by .. can still pass --fail-on fail with incomplete: false. The direct-file and repository-root link cases from the previous review now pass. I also reproduced the growth failure against the current main tip: merging takes workspace.py from 797 to 804 lines, above the 800-line limit. The standalone head has 796 lines in workspace.py; its local growth test instead flags the unchanged novelty.py. T16 T17 T20

Coverage on 9e5f356c0 included budget warnings and exit codes, scan completeness, workspace export and the earlier symlink cases. Focused tests on Python 3.13 returned 1 failed, 162 passed, 1 skipped in 7.37s. The Windows cases used simulated native paths.

Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
…ace.py

Moves the skipped-path refusal of `_export` into `repos/export_skips.py`, so
`workspace.py` is back under the 800-line cap (growth ratchet).

An absolute link `<repo>/jump/../d/context.md` was cut with `posixpath.relpath`,
which folds `jump/..` before `jump` is followed. The root prefix is now cut as
text, so the components are resolved in filesystem order and a skipped
Markdown import behind them makes the scan incomplete.

`git grep <pattern> <revision> -- <file>` shows lines of an older blob, so
`searched_files` no longer returns the workspace file for it.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review, @napetrov: 2 commits on issue-959-repo-budget-crashes-when-a (9e5f356..c469cb9) answers your thread.

Changes:

  • workspace.py is back under the 800-line cap.
  • An absolute link containing .. after a directory link resolves in filesystem order.
  • git grep of a revision no longer counts the workspace file as searched.

Threads and comments:

  • 4 fixed; each answered in its thread.

Not the PR's:

  • Outside the PR: dokimi/dokimi/repos/shell_search.py:167; git grep old-token HEAD~1 -- AGENTS.md returns ['HEAD~1', 'AGENTS.md'] from searched_files, so the workspace AGENTS.md counts as searched although the agent read an older blob.

Checked on the new head: 3 of 3 tests fail before the fix and pass after; full suite with main merged in: 32873 passed, 1 failure that main has too.

What each test shows
  • the skipped-path refusal lives in repos/export_skips.py: fails before, passes after.
  • the file-length ratchet passes: passes.
  • a skipped import behind jump/.. in an absolute link makes the scan incomplete: fails before, passes after.
  • the export still refuses a tree with an unsearchable directory: passes.
  • a git grep of a revision searches no workspace file: fails before, passes after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants