Skip to content

fix(cli): refuse an implicit home root and cap omissions - #3

Open
EnRaiha wants to merge 1 commit into
mainfrom
fix/implicit-root-and-omission-cap
Open

EnRaiha wants to merge 1 commit into
mainfrom
fix/implicit-root-and-omission-cap

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 20, 2026

Copy link
Copy Markdown

Why

An agent session runs with the working directory set to the user's home, so selecting the current directory as the project walked ~2.4M files, ran past any subprocess timeout, and produced no output at all.

A wide root also omits one entry per skipped file: a status envelope for /tmp carried 22,933 entries and 9 MB of JSON, and both the project and cached lists duplicated it.

What

  • Refuse an implicit root that is a home directory or the filesystem root, naming the fix in the error. An explicit --root still selects whatever the caller asks for.
  • Cap each reported omission list at 256 entries, keep the full count in omittedFiles / omitted_files (new on IndexOutput), and mark a capped list with omissionsTruncated.
  • Human output names the truncation and reports the index total from the count instead of the list length.

Tests

  • implicit_cwd_root_refuses_home_and_filesystem_root_only (cli/src/project/select.rs)
  • omission_entry_lists_are_capped_while_the_truncation_is_reported (cli/src/result.rs)
  • cargo test -p code2graph-cli — 20 pass

An agent session runs with the working directory set to the user's home, so
selecting the current directory as the project walked ~2.4M files, ran past any
subprocess timeout, and produced no output at all. Refuse an implicit root that
is a home directory or the filesystem root, naming the fix in the error. An
explicit --root keeps selecting whatever the caller asks for.

A wide root also omits one entry per skipped file: a status envelope for /tmp
carried 22,933 entries and 9 MB of JSON, and both the project and cached lists
duplicated it. Cap each reported omission list at 256 entries, keep the full
count in omittedFiles / omitted_files (new on IndexOutput, so the index report no
longer implies its total by list length), and mark a capped list with
omissionsTruncated. Human output names the truncation and reports the index total
from the count instead of the list.
Copilot AI lite review requested due to automatic review settings September 20, 2026 11:44

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants