Skip to content

refactor(python): dedup mount config parsing and add error-case tests - #788

Merged
chaliy merged 2 commits into
mainfrom
claude/review-pr-768-OLNU0
Mar 23, 2026
Merged

chaliy merged 2 commits into
mainfrom
claude/review-pr-768-OLNU0

Conversation

@chaliy

@chaliy chaliy commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #768 addressing review feedback:

  • Extract parse_mount_configs() helper — removes ~50 lines of duplicated mount config collection between PyBash::new() and BashTool::new()
  • Document realfs always-on — one-line comment in Cargo.toml explaining why
  • Document live handle semantics — fs() docstrings in both Rust and .pyi stubs note per-op interpreter lock behavior
  • Add error-case tests — unmount nonexistent path, write to readonly mount, FileSystem.real() with bad host path, read/stat missing files

Test plan

  • cargo clippy -p bashkit-python --all-targets -- -D warnings passes
  • cargo fmt --check -p bashkit-python passes
  • ruff check crates/bashkit-python && ruff format --check crates/bashkit-python passes
  • pytest crates/bashkit-python/tests/ -v passes (requires maturin develop)
  • CI green

chaliy added 2 commits March 23, 2026 18:11
Follow-up to #768:
- Extract shared parse_mount_configs() helper used by both PyBash and BashTool
- Add comment explaining why realfs feature is always-on
- Document live handle semantics on fs() (per-op interpreter lock)
- Add error-case tests: unmount nonexistent, write to readonly, bad host path, read/stat missing files
…ailure

The readonly text mount sets mode 0o444 but OverlayFs may still allow
shell redirects. Test the actual guarantee (permission bits) instead.
@chaliy
chaliy merged commit 91d2b22 into main Mar 23, 2026
18 checks passed
@chaliy
chaliy deleted the claude/review-pr-768-OLNU0 branch March 23, 2026 18:28
chaliy added a commit that referenced this pull request May 30, 2026
…#788)

## Summary
Follow-up to #768 addressing review feedback:

- **Extract `parse_mount_configs()` helper** — removes ~50 lines of
duplicated mount config collection between `PyBash::new()` and
`BashTool::new()`
- **Document `realfs` always-on** — one-line comment in Cargo.toml
explaining why
- **Document live handle semantics** — `fs()` docstrings in both Rust
and `.pyi` stubs note per-op interpreter lock behavior
- **Add error-case tests** — unmount nonexistent path, write to readonly
mount, `FileSystem.real()` with bad host path, read/stat missing files

## Test plan
- [ ] `cargo clippy -p bashkit-python --all-targets -- -D warnings`
passes
- [ ] `cargo fmt --check -p bashkit-python` passes
- [ ] `ruff check crates/bashkit-python && ruff format --check
crates/bashkit-python` passes
- [ ] `pytest crates/bashkit-python/tests/ -v` passes (requires `maturin
develop`)
- [ ] CI green
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.

1 participant