feat(cli): add safe local config discovery - #67
Conversation
limaronaldo
left a comment
There was a problem hiding this comment.
Self-review verdict: semantically ready once CI is green.
- CLI-only boundary preserved;
src/lib.rsexposes no discovery API - default reads are exact registry paths; explicit roots use the same registry/parsers
- Unix opens every root/config component handle-relatively with no-follow flags
- unsupported platforms fail closed without a check-then-open read fallback
- symlink roots/components/configs and special files are not read
- concurrent writes and post-open symlink swaps are covered adversarially
- output uses schema v1, stable ordering/IDs, allowlisted fields, and redacted path refs
- candidate/open/directory/byte/entry limits are deterministic and bounded
- repeated-root limit regression is covered after review found and fixed an unbounded diagnostic path
- no command execution, network access, environment expansion from config, or automatic scan
- default and no-default-feature local gates are green
No unresolved code-review findings. Because the reviewer identity is also the author, this is a COMMENT rather than an approval.
|
Windows CI fix pushed in Root cause: the fail-closed non-Unix implementation compiled correctly, but native CI uses Focused correction:
No check-then-open fallback or Windows file read was added. Full default and no-default-feature local gates remain green. |
limaronaldo
left a comment
There was a problem hiding this comment.
Final re-review at 1bb25b9: READY / no unresolved findings.
The Windows-only warning fix is contract-preserving: it makes the closed v1 status/diagnostic catalogs visible through --explain, reads the injected profile only to decide whether a default-path observation exists, and keeps all non-Unix source reads fail-closed. Native Windows, macOS, Ubuntu, feature-matrix, security, format, clippy, smoke, and Action E2E checks all pass (22/22). The worktree has no staged or tracked drift; only the intentionally local handoff file remains untracked.
Submitted as COMMENT because the author identity cannot approve its own PR.
Summary
Implements D.1 of the accepted local-client discovery ADR:
agentshield discoverwith--no-default-paths, repeated--root,--format console|json, and--explain;scan(), and preserves public Rust API and scan output contracts;unsupported_filesystem_safetywhere that atomic primitive is unavailable;agentshield.discovery/v1with redacted path references and deterministic budgets;rustix1.1.3 was already pinned transitively; this makes it a direct Unix-only dependency without adding a new crate version.Safety
Discovery never executes configured commands, starts subprocesses, performs network access, expands values from configuration, or starts a scan. Missing allowlisted files remain a normal empty result. Explicit roots reject parent components, symlink ancestors, symlink roots, and filesystem roots.
Validation
cargo fmt --all --checkcargo check --workspace --all-targets --lockedcargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test --workspace --all-targets --locked— 399 passedcargo check --workspace --all-targets --no-default-features --lockedcargo clippy --workspace --all-targets --no-default-features --locked -- -D warningscargo test --workspace --all-targets --no-default-features --locked— 365 passedgit diff --checkA local Windows cross-check was blocked because the macOS host lacks the MSVC C headers/toolchain required by existing tree-sitter build scripts; native Windows CI is the authoritative platform check.