Skip to content

refactor(vfs): share path resolution as vfs::absolute - #317

Open
pgrayy wants to merge 2 commits into
strands-agents:mainfrom
pgrayy:feature/pgrayy/path-helper
Open

pgrayy wants to merge 2 commits into
strands-agents:mainfrom
pgrayy:feature/pgrayy/path-helper

Conversation

@pgrayy

@pgrayy pgrayy commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Description

VfsKernel turns each path into an absolute one with a private helper, abs(). Box's kernel keeps a line-for-line copy of that helper in crates/shell/src/resolve.rs. Two copies can drift, and a change to how a path is read has to land twice.

This PR moves the helper to a public vfs::absolute(cwd, path), next to vfs::normalize, which Box already uses. VfsKernel calls it at the 18 places that called abs(). Box can then drop its copy and call the same function.

There's no behavior change. The body is the same code, and one unit test pins what it returns for a relative path and an absolute path.

Related Issues

Box will switch its kernel to this helper in a follow-up PR once this merges.

Documentation PR

None.

Type of Change

Other (please describe): refactor, adding one public function

Testing

  • cargo test --lib: 86 passed

  • cargo test --test vfs_unit: 98 passed, including the new test

  • cargo test --test custom_kernel: 14 passed

  • cargo test --test shell_integration: 1978 passed

  • cargo test --test differential: 93 passed. command_v_slash_name fails the same way on main, because feat(which): add which, resolved like command -v #272 fixed it and its known-difference marker is now stale. test: remove resolved command lookup difference marker #315 removes the marker.

  • Box's kernel crate (cargo test -p strands-box-shell), built against this branch with Box switched to the helper: 145 passed

  • I ran the relevant test suites for the bindings I touched (cargo test --workspace --all-targets, pytest tests/python, npm test)

  • If I touched Rust, I ran cargo fmt and cargo clippy

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

VfsKernel made each path absolute with a private helper, and Box's kernel
keeps its own copy of the same code. Move it to a public vfs::absolute so
every kernel reads a path the same way. No behavior change.
@github-actions github-actions Bot added chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact rust Pull requests that update rust code labels Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant