Skip to content

fix(fs): complete Node 26 parity - #6857

Merged
proggeramlug merged 5 commits into
mainfrom
fix/fs-node26-parity
Jul 30, 2026
Merged

fix(fs): complete Node 26 parity#6857
proggeramlug merged 5 commits into
mainfrom
fix/fs-node26-parity

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 26, 2026

Copy link
Copy Markdown
Member

Summary

Complete Node.js 26.5.0 parity for node:fs.

Changes

  • Preserve the fs.promises.watch creation baseline.
  • Match Node 26 recursive rmdir errors across sync, callback, and promise APIs.
  • Route fs.promises.rmdir through its runtime implementation.

Related issue

Closes #6782

Test plan

  • cargo test -p perry-codegen
  • ./run_parity_tests.sh --suite node-suite --module fs
  • cargo test -p perry-runtime (three existing-suite failures require separate review)

Checklist

  • I have not edited the workspace version, CLAUDE.md, or CHANGELOG.md.
  • The commit follows the conventional commit format.
  • I have read CONTRIBUTING.md and agree to the Code of Conduct.

Summary by CodeRabbit

  • New Features
    • Added support for asynchronous fs.promises.rmdir directory removal.
  • Bug Fixes
    • fs.rmdir/fs.promises.rmdir now validate options up front and reject the unsupported recursive option with a clear ERR_INVALID_ARG_VALUE error.
    • Promise-based rmdir now follows the expected result/error behavior.
    • Improved async directory-watching iteration by removing an unnecessary initial snapshot refresh.
  • Tests
    • Updated rmdir parity tests to assert correct error behavior (including missing-path and empty-options cases) across sync, callback, and promise APIs.

@TheHypnoo TheHypnoo added bug Confirmed defect or regression parity Compatibility gap with Node.js, ECMAScript, or the supported ecosystem rust Pull requests that update rust code labels Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@TheHypnoo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 49dbde8a-5a82-46ad-a882-9c45f6041199

📥 Commits

Reviewing files that changed from the base of the PR and between 323d5d2 and 3530191.

📒 Files selected for processing (1)
  • crates/perry-codegen/src/loop_purity.rs
📝 Walkthrough

Walkthrough

Adds fs.promises.rmdir support, rejects legacy recursive options, updates filesystem parity coverage, roots option values during field lookup, and preserves the creation-time baseline for promise-based filesystem watches.

Changes

rmdir API parity

Layer / File(s) Summary
Promise rmdir lowering and runtime entrypoint
crates/perry-codegen/src/expr/calls/fs.rs, crates/perry-codegen/src/lower_call/namespace_call.rs, crates/perry-codegen/src/runtime_decls/strings.rs, crates/perry-runtime/src/node_submodules/fs_promises.rs
Lowers fs.promises.rmdir arguments, declares its ABI, and forwards calls through the new runtime FFI wrapper.
rmdir runtime behavior and option handling
crates/perry-runtime/src/fs/dirent.rs, crates/perry-runtime/src/fs/mod.rs, crates/perry-runtime/src/fs/callbacks.rs
Roots option values during field lookup, rejects options.recursive, uses non-recursive directory removal, and validates callback options before execution.
Recursive option parity coverage
test-parity/node-suite/fs/rmdir/recursive-options.ts, changelog.d/6857-fs-node26-parity.md
Updates synchronous, callback, and promise cases for recursive-option and missing-path errors, checks empty-options removal, and records the parity fix.

Promise watch initialization

Layer / File(s) Summary
Creation-time watch baseline
crates/perry-runtime/src/fs/dir_glob_watch/watch.rs
Stops refreshing the snapshot on first iteration and documents the creation-time snapshot as the initial baseline.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • PerryTS/perry#7006: Updates fs/promises namespace lowering and dispatch on the same call-routing path.
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR appears to address fs.watch lazy-start, but it doesn't show fixes for the threaded-fd collision or watch event-delivery failures in #6782. Implement fixes for the remaining two failing node-suite fs tests from #6782, or link the separate PRs that cover them.
Out of Scope Changes check ⚠️ Warning The rmdir parity and fs.promises.rmdir runtime/codegen changes are unrelated to the linked #6782 fs-watch/threading failures. Move the rmdir parity work to a separate PR or explain its direct dependency on #6782 in the issue scope.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main theme of the PR: Node 26 fs parity improvements.
Description check ✅ Passed The PR description follows the template with summary, changes, related issue, test plan, and checklist.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fs-node26-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/perry-codegen/src/expr/calls/fs.rs`:
- Around line 72-84: Add an explicit missing-argument error for rmdir in both
crates/perry-codegen/src/expr/calls/fs.rs:72-84 and
crates/perry-codegen/src/lower_call/namespace_call.rs:213-226, before lowering
or constructing the call. Update the rmdir guards so zero arguments produce the
existing runtime argument error, while calls with a path preserve the current
js_fs_promises_rmdir lowering behavior.

In `@crates/perry-runtime/src/fs/mod.rs`:
- Around line 1620-1623: Update validate_rmdir_options so the options object is
rooted before calling options_field_value, or make that property lookup
allocation-free. Ensure any object pointer used after the lookup is reloaded
from the root after potential allocation, preserving the existing
missing-recursive-field behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dbacd9cc-bab4-4bd8-b91a-1e2abf22271d

📥 Commits

Reviewing files that changed from the base of the PR and between 23fbca4 and b3a27a0.

📒 Files selected for processing (8)
  • crates/perry-codegen/src/expr/calls/fs.rs
  • crates/perry-codegen/src/lower_call/namespace_call.rs
  • crates/perry-codegen/src/runtime_decls/strings.rs
  • crates/perry-runtime/src/fs/callbacks.rs
  • crates/perry-runtime/src/fs/dir_glob_watch/watch.rs
  • crates/perry-runtime/src/fs/mod.rs
  • crates/perry-runtime/src/node_submodules/fs_promises.rs
  • test-parity/node-suite/fs/rmdir/recursive-options.ts
💤 Files with no reviewable changes (1)
  • crates/perry-runtime/src/fs/dir_glob_watch/watch.rs

Comment thread crates/perry-codegen/src/expr/calls/fs.rs Outdated
Comment thread crates/perry-runtime/src/fs/mod.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test-parity/node-suite/fs/rmdir/recursive-options.ts`:
- Around line 40-42: Clean up the existing ROOT directory after the preceding
recursive rmdir rejection checks and before calling fs.mkdirSync(ROOT) for the
empty-options case. Preserve the requirement that recursive rmdir calls reject
without deleting ROOT, and ensure the fs.rmdirSync(ROOT, {}) assertion can
execute.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bd5f8e1-3990-416e-9f18-2818fdaf970f

📥 Commits

Reviewing files that changed from the base of the PR and between b3a27a0 and a9b5ccf.

📒 Files selected for processing (4)
  • crates/perry-codegen/src/expr/calls/fs.rs
  • crates/perry-codegen/src/lower_call/namespace_call.rs
  • crates/perry-runtime/src/fs/dirent.rs
  • test-parity/node-suite/fs/rmdir/recursive-options.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/perry-codegen/src/lower_call/namespace_call.rs

Comment thread test-parity/node-suite/fs/rmdir/recursive-options.ts
@proggeramlug
proggeramlug merged commit 7a4a866 into main Jul 30, 2026
27 of 33 checks passed
@proggeramlug
proggeramlug deleted the fix/fs-node26-parity branch July 30, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed defect or regression parity Compatibility gap with Node.js, ECMAScript, or the supported ecosystem rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[parity] node:fs — 3 failing node-suite tests (2026-07-22 baseline)

2 participants