Skip to content

refactor(repos): one link-text helper, and link-walk helpers public - #1402

Merged
napetrov merged 4 commits into
intel:mainfrom
napetrov:arch/r8-3
Nov 30, 2026
Merged

napetrov merged 4 commits into
intel:mainfrom
napetrov:arch/r8-3

Conversation

@napetrov

Copy link
Copy Markdown
Contributor

Summary

Two _link_target helpers with one name and different guards. links strips the \\?\ prefix on Windows only; overlay_paths stripped it on every OS.

 repos/links.py
-def _link_target(path) -> str        # nt-guarded
+def link_text(path) -> str           # nt-guarded, public, one copy
 repos/overlay_paths.py
-def _link_target(link) -> Path       # strips on every OS
+  path_hits / supplies_a_file / overlay_targets   (public)
+  uses links.link_text
 repos/held_guidance.py
-  _link_target, _supplies_a_file (private, imported across modules)
+  link_text, supplies_a_file
 repos/manifest.py
-def _is_within
+def is_within

Cross-module helpers made public in their owning module: links.walk_links, names_dir, require_dir, LinkLoop; overlay_paths.overlay_targets, path_hits, supplies_a_file; manifest.is_within. The # noqa: F401 re-exports of overlay helpers in workspace.py are gone.

Evidence

  • Before: test_a_posix_link_text_that_starts_with_the_long_path_prefix_names_that_file fails on base: a POSIX AGENTS.claude.md -> \\?\x makes path_hits(..., {x}) return True.
    After: the same test passes on head (False; the link names the file \\?\x).
  • tests/test_repo*.py and test_tree_digest.py, test_catalog_path_missing.py: 7763 passed, 7 skipped.
  • make ci-local --offline --jobs static,typecheck: 0 failed.

Merge Danger

Door: two-way. The only behaviour change is a POSIX link whose literal text starts with \\?\: the overlay arm and held_guidance now read it as written (the file an agent in the workspace reaches). Windows is unchanged. Changelog fragment included.

Blast radius: internal. Renames of private helpers in dokimi/repos; no __init__ export, CLI flag, persisted format or ABI changes.

Merge order: open intel/dokimi #1396 edits links._names_dir and monkeypatches links._link_target in test_repo_source_links.py; this PR renames both. Whichever lands second rebases (mechanical).

🤖 Generated with Claude Code

overlay_paths and links each had a _link_target with the same name and
different guards: links strips the \\?\ long-path prefix on Windows only,
overlay_paths on every OS. A POSIX symlink to \\?\x therefore named the
file x for the overlay arm and the held-guidance accounting, and the file
\\?\x for the walk. Keep the links one, now public as link_text() and
guarded by os.name; overlay_paths and held_guidance call it.

Promote the helpers that cross modules to public names in their owning
module: links.walk_links, names_dir, require_dir, LinkLoop;
overlay_paths.overlay_targets, path_hits, supplies_a_file; manifest.is_within.
The workspace re-exports of the overlay helpers go with the rename.

Behaviour changes only for a POSIX link whose text starts with \\?\ (now
read as written, the file an agent in the workspace reaches); see the
changelog fragment.

Test-narrowed: the two overlay tests that read a Windows link text by patching os.readlink (the long-path prefix and the UNC share) are removed; the same helper is now pinned at the links level by test_a_windows_extended_prefix_is_dropped_from_a_link_text and test_an_extended_unc_link_text_is_the_share.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner November 29, 2026 05:02
@exai-bot

exai-bot commented Nov 29, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

CI at f7f2263: 25 passing, 4 skipped.

Review details
  • Commit reviewed: f7f2263 against merge base e2ce271
  • Coverage: 2 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 38k tokens (15k from cache), 4s
  • Tool calls: 4 (4 file_read)
  • small change set: 2 files

@codecov-commenter

codecov-commenter commented Nov 29, 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 95.55556% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.27%. Comparing base (e260503) to head (f7f2263).

Files with missing lines Patch % Lines
dokimi/dokimi/repos/links.py 90.90% 1 Missing ⚠️
dokimi/dokimi/repos/manifest.py 80.00% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1402      +/-   ##
==========================================
- Coverage   96.28%   96.27%   -0.02%     
==========================================
  Files         513      513              
  Lines       68470    68467       -3     
  Branches    11884    11883       -1     
==========================================
- Hits        65924    65914      -10     
- Misses       1566     1569       +3     
- Partials      980      984       +4     
Files with missing lines Coverage Δ
dokimi/dokimi/repos/export_skips.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/guidance_history.py 96.26% <100.00%> (ø)
dokimi/dokimi/repos/held_guidance.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/overlay_paths.py 95.45% <100.00%> (-0.38%) ⬇️
dokimi/dokimi/repos/source.py 97.20% <100.00%> (ø)
dokimi/dokimi/repos/workspace.py 93.66% <100.00%> (ø)
dokimi/dokimi/repos/links.py 97.82% <90.90%> (ø)
dokimi/dokimi/repos/manifest.py 95.11% <80.00%> (ø)

... and 4 files with indirect coverage changes

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

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

71 mutants of the lines this PR changes, at f7f2263: 9 killed, 0 survived, 0 waived, 4 inconclusive, 1 timed out, 0 errors, 57 not run.

The check was incomplete: 0 candidate tests fail without a mutant and were left out, 7 candidate test files were not run, and 1 changed lines were not mutated, 57 mutants were not run before the time budget ended; this is not a clean result.

Warn-only: a survivor does not fail the job yet. Updated on every push; the full report is in the ci run summary.

napetrov and others added 3 commits November 29, 2026 14:39
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

# Conflicts:
#	dokimi/dokimi/repos/links.py
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…thing

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

@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.

🟢 LGTM · checked f7f2263 · nothing required from @napetrov

🔀 Merge: safe now · merges cleanly into current main, 0 commits behind · after it, #1424 needs a rebase (repos/links.py, repos/source.py)

✅ make ci-local --offline: 31,393 passed, 0 failed, mutation step passes · ✅ the new path_hits and held-guidance tests fail on the base · ✅ Windows (Server 2025, Python 3.13): test_repo_overlay.py, test_repo_source_links.py, test_repo_run_guidance.py 126 passed, the same 5 failures as on the base

The rename is complete, and overlay and held-guidance code now read link text like the walk does.

Fixed in this branch, up to f7f2263:

  • The held-guidance half of the fix had no test: b09f05f adds a POSIX test for HeldGuidance.resolved().
  • The changelog said the old code could remove an overlay: f7f2263 says it refused a base link as dangling.

@napetrov
napetrov merged commit 9bbb277 into intel:main Nov 30, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants