Skip to content

fix(tools): extract_paths misses relative paths without ./ prefix (e.g. foo/bar, .local/...) #2536

@bug-ops

Description

@bug-ops

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 2

When 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 2

Expected: 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.

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexitybugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions