You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #846 and #847. This closes the callee-side false negatives in the scripts/check-test-remove-tree.mjs lint gate. All of the changes are in isNodeBoundRmCall:
Wrapped callees: the callee now goes through the same unwrapExpression as the options argument (parentheses, as, satisfies, <T>x, !, instantiation expressions). This flags (rm)(…), rm!(…), (rm as typeof rm)(…), (rm satisfies F)(…), (<F>rm)(…), ((rm)!)(…), and (fs.rm)(…).
Wrapped callee objects: the object of X.rm is unwrapped too. This flags fs!.rm(…) and (fs as typeof fs).rm(…).
fs.promises.rm: when the object is Y.promises, Y must be an fs namespace or default import. This flags fs.promises.rm(…) for import fs from 'node:fs' and import * as fs from 'node:fs', plus fs.promises!.rm(…) and (fs.promises as T).rm(…). On a /promises namespace the same shape is an extra flag, for a call that would throw anyway.
import fsp from 'node:fs/promises' with fsp.rm(…) was already flagged and is now covered by a test.
Shadowing still runs on the unwrapped identifier. The new test's controls stay unflagged: a parameter fs with fs.promises.rm, a local rm with (rm)!(…), a parameter fs with (fs as Mock)!.rm, other.promises.rm, and fs.other.rm. The new test failed on main before the fix.
Remaining misses (out of scope)
These were confirmed by probe:
rmSync(dir, { recursive: true }). Three test files use this form today: rsc-runtime/tests/plugin-root.test.ts, agent-bundle/tests/playground-service.test.ts, and agent-bundle/tests/support/shared-pack.ts.
Options through a variable (rm(root, opts)) or a non-literal recursive: deep.
maxRetries: 0 counting as retried.
rmdir(dir, { recursive: true }).
Aliasing through a local (const remove = rm), destructuring (const { rm } = fs.promises), dynamic import() or require, import { default as fs }, fs['rm'], and rm.call(…).
Checks
Run on the merged head 9d1bb93f30, which contains origin/main3b667c8019:
pnpm build: exit 0
pnpm typecheck: exit 0
pnpm lint (includes the gate; no new flags in the real test tree): exit 0
Independent review by change-risk-reviewer (Claude Opus 5.5) found no material findings: no new false negatives, no crash path, and removing ?. is safe. Its one wording nit in the header comment is fixed.
No changeset: only root scripts/ and packages/agent-bundle/tests/** change, and both are exempt per .changeset/README.md.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #846 and #847. This closes the callee-side false negatives in the
scripts/check-test-remove-tree.mjslint gate. All of the changes are inisNodeBoundRmCall:unwrapExpressionas the options argument (parentheses,as,satisfies,<T>x,!, instantiation expressions). This flags(rm)(…),rm!(…),(rm as typeof rm)(…),(rm satisfies F)(…),(<F>rm)(…),((rm)!)(…), and(fs.rm)(…).X.rmis unwrapped too. This flagsfs!.rm(…)and(fs as typeof fs).rm(…).fs.promises.rm: when the object isY.promises,Ymust be an fs namespace or default import. This flagsfs.promises.rm(…)forimport fs from 'node:fs'andimport * as fs from 'node:fs', plusfs.promises!.rm(…)and(fs.promises as T).rm(…). On a/promisesnamespace the same shape is an extra flag, for a call that would throw anyway.!expression.questionDotTokenexclusion from test: canonical removeTree helper and a lint gate on bare recursive rm #823 is removed, sofs?.rm(…)counts. It was a real removal with no documented reason for the exclusion.rm?.(…)was already flagged.import fsp from 'node:fs/promises'withfsp.rm(…)was already flagged and is now covered by a test.Shadowing still runs on the unwrapped identifier. The new test's controls stay unflagged: a parameter
fswithfs.promises.rm, a localrmwith(rm)!(…), a parameterfswith(fs as Mock)!.rm,other.promises.rm, andfs.other.rm. The new test failed on main before the fix.Remaining misses (out of scope)
These were confirmed by probe:
rmSync(dir, { recursive: true }). Three test files use this form today:rsc-runtime/tests/plugin-root.test.ts,agent-bundle/tests/playground-service.test.ts, andagent-bundle/tests/support/shared-pack.ts.rm(root, opts)) or a non-literalrecursive: deep.maxRetries: 0counting as retried.rmdir(dir, { recursive: true }).const remove = rm), destructuring (const { rm } = fs.promises), dynamicimport()orrequire,import { default as fs },fs['rm'], andrm.call(…).Checks
Run on the merged head
9d1bb93f30, which containsorigin/main3b667c8019:pnpm build: exit 0pnpm typecheck: exit 0pnpm lint(includes the gate; no new flags in the real test tree): exit 0pnpm test:unit: 4432 passed, 0 failed, 6 skippedrstest packages/agent-bundle/tests/check-test-remove-tree.test.ts: 19/19Independent review by change-risk-reviewer (Claude Opus 5.5) found no material findings: no new false negatives, no crash path, and removing
?.is safe. Its one wording nit in the header comment is fixed.No changeset: only root
scripts/andpackages/agent-bundle/tests/**change, and both are exempt per.changeset/README.md.