fix(core): preserve recursive mkdir parent directories
MU
6d ago+92+92+01234567890123456789-1-1-0123456789
PR Checklist
- The commit message follows the contribution guidelines:
fix(core): preserve recursive mkdir parent directories.
Bugs / Features
- Related issue(s) linked — no existing issue found; discovered from the public WorkspaceFilesystem API.
- Tests for the changes have been added.
- Docs have been added / updated — not applicable; restores the existing documented recursive mkdir behavior.
- Changesets have been added.
What is the current behavior?
With the default in-memory backend, await fs.mkdir("/tasks/research/results") succeeds, but fs.exists("/tasks") returns false and fs.stat("/tasks") returns null. Creating a sibling with recursive=false then fails because the parent directory is missing.
What is the new behavior?
Recursive mkdir records each parent directory, so the parents can be queried, used to create siblings, and removed. Parents remain present after their last child is removed. Non-recursive mkdir still rejects missing parents. Recursive mkdir also records directories already inferred from files and rejects ancestor file collisions before changing directory state.
Notes for reviewers
- New regression tests: 2 failed / 3 passed before the fix.
- Review regression tests at the submitted commit: 3 failed / 5 passed; all pass with the follow-up fix.
- Workspace tests with the follow-up fix: 50 passed, with Vitest typechecking enabled.
- Biome on the changed TypeScript files, Core
typecheck, and Internal/Logger/Core builds passed. - Local runtime: Node 26.4.0 and the repository-pinned pnpm 8.10.5. Browser downloads were skipped during dependency installation; no browser tests were run.
- AI assistance: Codex was used to prepare the patch and regression tests.