Skip to content

fix(repos): leave FIFOs out of a plain directory's file listing - #1321

Open
vchamarthi wants to merge 2 commits into
intel:mainfrom
vchamarthi:issue-1273-repo-reach-misidentifies-and-selects
Open

vchamarthi wants to merge 2 commits into
intel:mainfrom
vchamarthi:issue-1273-repo-reach-misidentifies-and-selects

Conversation

@vchamarthi

Copy link
Copy Markdown
Contributor

Summary

In a plain directory, repo reach --dry-run planned a FIFO sub/AGENTS.md as guidance and refused a lone FIFO AGENTS.md as a link to nothing. Fixes #1273. Related: #1271 (the same listing feeds repo inspect, so it no longer counts FIFOs), #1272 and #1300 (same file, link handling unchanged).

Changes

  • WorkTree.files() in dokimi/repos/source.py keeps only regular files and links, using the _is_entry check the git path uses, and records the others in not_regular.
  • WorkTree.resolve() says is not a regular file when the target exists but is neither a file nor a directory; links to nothing stays for a missing target.
  • check_files in dokimi/repos/reach.py takes an optional tree; with no guidance file left, it names FIFOs and the like that carry a guidance name. Both callers pass the tree.
  • Four tests in tests/test_repo_reach_links.py and a changelog fragment.

Risk

Small. A FIFO, socket or device in a plain directory is no longer listed, so repo inspect stops counting it too. GitTree is unchanged. The existing prefix each is a link that cannot be followed is kept for real links.

Testing

python -m pytest -q -p no:cacheprovider on tests/test_growth_ratchet.py, tests/test_repo_reach_links.py, tests/test_repo_reach.py, tests/test_repo_reach_edges.py, tests/test_repo_reach_shadow.py and tests/test_reach_fixtures_unlistable.py passes (235 tests), and python -m ruff check passes on the changed files. The FIFO tests are skipped where os.mkfifo does not exist.

Open questions

None beyond the choice listed in the decisions.

  • I chose Drop non-regular files from the plain-directory listing and name them in check_files when nothing else matches over Keeping them listed and refusing them in followable: The dry-run plan's files comes from the listing, so only dropping them keeps sub/AGENTS.md out of it, as the git working tree listing does. Is that the behaviour you want?

Revert

A plain revert of 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: 29837 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; 4 of 4 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 how the plain-directory listing treats FIFOs; the change is in the changelog fragment.
  • Self-reviewed per "Before opening a PR" in AGENTS.md: 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: 1 added file(s), none a run's output
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml): no new source file

Fixes #1273.

In a plain directory, FileTree.files() listed a FIFO named like guidance,
so repo reach planned it, and a lone FIFO AGENTS.md was refused as a link
to nothing. The listing now keeps only regular files and links, and
resolve() says "is not a regular file" for an existing non-file target.

Fixes intel#1273

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi requested a review from a team as a code owner November 26, 2026 23:01
Copilot AI balanced review requested due to automatic review settings November 26, 2026 23:01
@exai-bot

exai-bot commented Nov 26, 2026 •

Copy link
Copy Markdown

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

CI at 2fab4a4: 25 passing, 4 skipped.

Review details
  • Commit reviewed: 2fab4a4 against merge base 9bf1ce7
  • Coverage: 5 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 142k tokens (86k from cache), 21s
  • Tool calls: 11 (9 file_read, 1 code_search, 1 local_check_results)
  • Reach FIFO guidance, source handling, and link tests: 5 files

@codecov-commenter

codecov-commenter commented Nov 26, 2026 •

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.14%. Comparing base (9bf1ce7) to head (2fab4a4).
⚠️ Report is 13 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1321   +/-   ##
=======================================
  Coverage   96.14%   96.14%           
=======================================
  Files         498      499    +1     
  Lines       66028    66081   +53     
  Branches    11461    11475   +14     
=======================================
+ Hits        63482    63533   +51     
+ Misses       1574     1573    -1     
- Partials      972      975    +3     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/repo_reach.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/reach.py 98.73% <100.00%> (+<0.01%) ⬆️
dokimi/dokimi/repos/source.py 97.11% <100.00%> (+0.06%) ⬆️

... and 20 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

3 open issues
What changed in this PR

Updates plain-directory repository scanning so non-regular filesystem entries (e.g., FIFOs) are excluded from guidance discovery and are reported with clearer errors when they are the only “guidance-like” matches.

Changes:

  • Filter WorkTree.files() plain-directory results to only regular files and symlinks, tracking excluded paths in not_regular.
  • Improve WorkTree.resolve() and check_files() error messages for non-regular targets (FIFO/socket/device) vs missing link targets.
  • Add FIFO-focused tests and a changelog entry documenting the behavior change.
File Description
dokimi/​tests/​test_repo_reach_links.py Adds regression tests for FIFO handling in dry-run planning, listing, and resolve behavior.
dokimi/​dokimi/​repos/​source.py Excludes non-regular entries from plain-directory listings and improves resolve-time errors for non-regular targets.
dokimi/​dokimi/​repos/​reach.py Enhances check_files() to optionally report “not a regular file” guidance-like paths when nothing matches.
dokimi/​dokimi/​commands/​repo_reach.py Passes tree through to check_files() to enable enhanced reporting in CLI dry-run planning.
dokimi/​changelog.d/​20261126_120000_reach-fifo-guidance.md Documents the FIFO/non-regular handling fix in repo reach.

Review effort: Lite

Comment thread dokimi/dokimi/repos/source.py Resolved
Comment thread dokimi/dokimi/repos/source.py Resolved
Comment thread dokimi/dokimi/repos/reach.py Resolved
…files tree

An unreadable regular file (EACCES) was recorded in WorkTree.not_regular as
well as in skipped, so check_files could call it a FIFO. Only entries that
could be looked at and are not files or links go there now, and the walk
no longer rescans the growing list for each path. check_files documents its
tree argument; tests pin both it and the unreadable case.

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

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-1273-repo-reach-misidentifies-and-selects (2fd144b..2fab4a4).

Changes:

  • A path WorkTree cannot look at is named in skipped only, not in not_regular.

Threads and comments:

  • I answered each one in its thread: 4 fixed.

What I checked on the new commit:

  • 2 threads I marked fixed have no test of their own; the replies there say what changed.
  • The new test fails before the fix and passes after it.
  • The full test suite passes with main merged in (30,032 tests), apart from 1 failure main has too.
What each test shows
  • an unreadable file is not named not regular: fails before, passes after.
  • check_files names a FIFO guidance file only when given the tree: passes.

@xaleryb

xaleryb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Checked on Linux with plain directories holding a FIFO, a socket, a nested FIFO and links to FIFOs inside and outside the tree: a FIFO or socket AGENTS.md is refused as not a regular file, a nested FIFO is left out of the plan, and scan and budget no longer hang.
One regression: repo inspect on a plain directory whose sub/ is mode 0644 and holds sub/AGENTS.md exits 0 and never mentions that file; main exits 5 with a traceback, and with the root itself at 0644 the head reports instructions.missing with exit 0. The walk now puts the path in tree.skipped, which inspect never prints; naming it the way repo scan and repo budget do (Permission denied; ... not counted) would close it.
Also, #1328 changes the same _is_entry return in repos/source.py to keep pipes listed, the opposite of this PR, so whichever lands second undoes the other; keeping this PR's listing (it matches git ls-files) and having #1328 report from tree.not_regular and tree.skipped would let both stand.

This branch has not been deployed

No deployments
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.

repo reach misidentifies and selects non-regular guidance files

5 participants