← Back to Pull requests

fs: add static `Stats.isStats()` method #67716

Open
LiviaMedeiros opened this pull request with 111 lines diff across 3 files
View on GitHub
LiviaMedeiros LiviaMedeiros commented on Nov 22, 2026 23:31 UTC
Author

fs.Stats class is very problematic because its shape depends on the bigint option passed to the stats functions.

In the documentation, it's defined as single class that has "bigint" version. In the internal implementation, there are separate Stats and BigIntStats classes. As result, stats instanceof fs.Stats in userland returns different results depending on bigint option.

This PR adds static Stats.isStats method that covers both Stats and BigIntStats.

<hr />

This should help us to move forward with making DEP0180 to EOL (https://github.com/nodejs/node/pull/67491) and potentially moving further (e.g. deprecating bigint option in favour of exposing nanosecond precision on Stats, or rewriting internal implementation), providing users documented alternative to instanceof checks for now.

This deliberately doesn't distinguish between Stats and BigIntStats and doesn't provide more specific checks to give us more freedom for internal changes.

I'm open for any actionable suggestions here.

Diff: 111 lines (+111 / -0) across 3 files Reviewer: jasnell Review duration: 4617m
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.34) × (1 − Review Confidence (0.67)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.34 · 111 lines diff across 3 files
0.34
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.56 · 2 substantive comment(s)
0.56
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
67%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.282
Real PR Conversation Timeline
4 items
jasnell jasnell approved these changes on Nov 22, 2026 23:44 UTC
Approved Reviewer

Approved these changes.

codecov[bot] codecov[bot] commented on Nov 23, 2026 01:21 UTC
Bot

Codecov Report


:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.53%. Comparing base (97d5d90) to head (089ff38).
:warning: Report is 4 commits behind head on main.

<details><summary>Additional details and impacted files</summary>

@@            Coverage Diff             @@
##             main   #67716      +/-   ##
==========================================
- Coverage   90.55%   90.53%   -0.02%     
==========================================
  Files         801      801              
  Lines      284111   284128      +17     
  Branches    54879    54885       +6     
==========================================
- Hits       257279   257240      -39     
- Misses      17006    17051      +45     
- Partials     9826     9837      +11     

| Files with missing lines | Coverage Δ | |
|---|---|---|
| lib/internal/fs/utils.js | 96.11% <100.00%> (+0.02%) | :arrow_up: |

... and 42 files with indirect coverage changes
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

  • </details>

    Reviewers
    Assignees
    LiviaMedeiros LiviaMedeiros
    Labels
    risk: low confidence: 67.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 34.2% (LOW) · Higher = larger blast radius
    34.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 67.2% · Lower = rushed or shallow review
    67.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 11.2% · Safe to merge
    11.2%
    Repository