Skip to content

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

Merged
farhan-syah merged 5 commits into
mainfrom
fix/implicit-root-and-omission-cap
Oct 4, 2026
Merged

farhan-syah merged 5 commits into
mainfrom
fix/implicit-root-and-omission-cap

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

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.

@EnRaiha EnRaiha closed this Oct 3, 2026
@farhan-syah farhan-syah reopened this Oct 4, 2026

@farhan-syah farhan-syah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The accidental home scan and oversized omission envelopes deserve this focused change. The Windows home guard needs correction before merging. Preserve complete reason totals when truncating diagnostic entries.

Checks pass on Linux:

  • cargo test -p code2graph-cli --offline: 253 unit tests and 20 integration tests.
  • cargo fmt --all -- --check.
  • cargo clippy -p code2graph-cli --all-targets --offline -- -D warnings.

The Windows finding follows the documented canonical path representation. I did not run Windows tests locally.

Comment thread cli/src/project/select.rs Outdated
Comment thread cli/src/execution/output.rs

@farhan-syah farhan-syah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both review findings are resolved.

Finding Resolution
Canonical home comparison Home and cwd now use canonical paths. Explicit selection bypasses home discovery.
Full omission reason counts Index and status retain complete reason totals while diagnostic entries remain capped at 256.

Regression coverage checks actual selection paths, Windows prefixes, and mixed reasons outside the entry cap.

Checks:

  • All nine CI jobs pass, including Linux, macOS, and Windows tests.
  • Local CLI tests pass: 255 unit tests and 20 integration tests.
  • Formatting, CLI lint, and documentation checks pass.

@farhan-syah
farhan-syah merged commit 3d5664f into main Oct 4, 2026
9 checks passed
@farhan-syah
farhan-syah deleted the fix/implicit-root-and-omission-cap branch October 4, 2026 07:19
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.

3 participants