fs: add static `Stats.isStats()` method #67716
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.56 · 2 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Approved
Approved these changes.
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>
</details>
jasnell
LiviaMedeiros
fs.Statsclass is very problematic because its shape depends on thebigintoption passed to thestatsfunctions.In the documentation, it's defined as single class that has "bigint" version. In the internal implementation, there are separate
StatsandBigIntStatsclasses. As result,stats instanceof fs.Statsin userland returns different results depending onbigintoption.This PR adds static
Stats.isStatsmethod that covers bothStatsandBigIntStats.<hr />
This should help us to move forward with making
DEP0180to EOL (https://github.com/nodejs/node/pull/67491) and potentially moving further (e.g. deprecatingbigintoption in favour of exposing nanosecond precision onStats, or rewriting internal implementation), providing users documented alternative toinstanceofchecks for now.This deliberately doesn't distinguish between
StatsandBigIntStatsand doesn't provide more specific checks to give us more freedom for internal changes.I'm open for any actionable suggestions here.