-
Notifications
You must be signed in to change notification settings - Fork 2
fix(tools): extract_paths misses relative paths without ./ prefix (e.g. foo/bar, .local/...) #2536
Description
Bug
extract_paths in crates/zeph-tools/src/shell/mod.rs only captures paths starting with /, ./, ../, or .. Relative paths without an explicit ./ prefix (e.g. .local/testing/data/file.txt, src/main.rs, Cargo.toml) are silently skipped.
This means affected_paths returns an empty Vec for commands like:
touch .local/testing/data/rollback-test.txt; exit 2When no paths are detected, TransactionSnapshot::capture is never called and transactional rollback cannot restore the affected file even when auto_rollback = true.
Reproduction
Set auto_rollback = true, transactional = true in config. Run:
touch .local/some/file.txt; exit 2Expected: file removed (rollback). Actual: file persists (no snapshot taken).
Workaround: use ./ prefix: touch ./some/file.txt; exit 2 → rollback fires correctly.
Fix
Extend the path detection heuristic in extract_paths to also match tokens containing a / that are not shell builtins or command names (e.g. any token matching [a-zA-Z0-9_.][^=;|& ]*\/[^=;|& ]*).
Discovered
CI-356 (2026-03-31) — transactional rollback testing.