What the agent does
The agent clones the repository into its own cloud sandbox and runs it on the Node release that prints the warning. In an embedded database library like louischatriot/nedb at 1.8.0, a single new Datastore().insert({a: 1}) on Node 22 prints (node:7720) [DEP0044] DeprecationWarning: The util.isArray API is deprecated. Please use Array.isArray() instead. and then [DEP0047] DeprecationWarning: The util.isDate API is deprecated. Please use arg instanceof Date instead. A search of lib/ explains why: util.isArray appears in lib/datastore.js at lines 354, 380 and 400, in lib/indexes.js eight times from line 22 to 241, and throughout lib/model.js from line 46 to 773, beside util.isDate in the comparison and equality functions at lines 116, 149, 214, 215, 536, 564 and 565 and util.isRegExp at lines 620, 778, 794 and 815. Node 22 turned all three into runtime deprecations, so every app that depends on this library sees the lines once per process.
Then it gets a baseline from the suite, which takes a detour. package.json runs ./node_modules/.bin/mocha --reporter spec --timeout 10000 with mocha pinned to 1.4.x, and that mocha prints nothing at all on Node 22 and exits 0, which would make any change look green. The agent runs the same test/*.test.js files with a current mocha instead: the suite passes, with DEP0044, DEP0047 and DEP0055 (util.isRegExp) printed from the library during the run, and a DEP0005 Buffer() warning that traces to test_lac/loadAndCrash.test.js line 107, a test helper, not the library.
The replacements are mechanical and the agent keeps them that way: util.isArray(x) becomes Array.isArray(x), util.isDate(x) becomes (x instanceof Date) and util.isRegExp(x) becomes (x instanceof RegExp), 45 lines across lib/datastore.js, lib/indexes.js and lib/model.js, plus one util.isDate in test/model.test.js line 87 and the new Buffer('' + data, ...) in the crash test, which becomes Buffer.from. lib/datastore.js keeps its util.inherits call, which Node has not deprecated at runtime. The util import stays where other helpers still use it.
It proves the result rather than counting lines. The suite runs again with NODE_OPTIONS=--throw-deprecation, which turns any remaining deprecated call into a thrown error: the suite passes with no warning printed. The pull request also says why the pinned mocha was bypassed, and leaves updating the devDependencies as a separate change the maintainer can take or not.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Our app prints \"[DEP0044] DeprecationWarning: The util.isArray API is deprecated\" on Node 22 and the trace points into this library. Read package.json and every file under lib/ first, run a minimal insert on Node 22 and quote every DeprecationWarning it prints. Run the test suite to get a baseline, and if the pinned test runner produces no output on this Node, say so and run the same test files with a current mocha instead. Replace every util.isArray, util.isDate and util.isRegExp call with Array.isArray and instanceof, in library and test code, and leave util.inherits alone. Run the suite again with --throw-deprecation to prove no deprecated call remains. Report any deprecation that comes from a dependency rather than this code. Open a pull request that quotes the before and after.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request touching lib/datastore.js, lib/indexes.js, lib/model.js, test/model.test.js and test_lac/loadAndCrash.test.js, 47 lines changed and no file added, with every util.isArray, util.isDate and util.isRegExp replaced by its builtin. The description quotes the DEP0044 and DEP0047 lines from the minimal insert on Node 22, the baseline run with the warnings interleaved, and the same suite passing under --throw-deprecation with nothing printed.
A reviewer checks that instanceof Date is the right replacement where values may cross realms (not a concern for a Node library that never receives iframe objects), reads the note about the pinned mocha being silent on Node 22, and decides whether to bump the test runner in a follow-up. The run's record holds each test run with its full output, so the warning lines and the clean run can be opened rather than taken on trust.
Run it on every Node release
Add an automation to the Project with this prompt and a schedule trigger, cron set to 0 9 * * 1 in your timezone. Each Monday one run installs the current Node, runs the suite with --throw-deprecation and opens one pull request on its own branch when a new runtime deprecation lands in the library's code; a week where the deprecated call has no drop-in replacement ends needs_review with the warning attached, and a clean week opens nothing.
The same body works from your own code with POST /o/{org}/sessions and an API key when your CI matrix adds a Node version and goes red; the key's webhook_url receives run.completed or run.failed with the session URL and the pull request when the run ends.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
A runtime deprecation is printed once and then forgotten, and the suite that should catch it may be older than the warning: here the pinned mocha produced no output on Node 22 at all. The agent notices the silent runner because it reads the output rather than the exit code, runs the files with a runner that reports, and keeps both runs in the run's record, so the pull request shows the suite passing with warnings and then passing with deprecations turned into errors.
Forty-five near-identical edits are exactly the change a person skims. Running the suite with --throw-deprecation afterwards is what makes the edit count irrelevant: if one util.isDate were left, the run would fail on it, and the pull request says that is the check it passed.
Frequently asked questions
Is util.isArray different from Array.isArray?
No. util.isArray has been an alias of Array.isArray since Node 4, which is why DEP0044 names it as the replacement. util.isDate and util.isRegExp checked the internal class tag, and instanceof is the documented replacement for values created in the same realm.
Why did the pinned mocha print nothing?
mocha 1.4 predates Node 22 by over a decade and exits silently on it, so npm test passes with no tests run. The agent reports that, runs the same test files with a current mocha to get a real run, and leaves the devDependency bump to a separate change so this pull request stays about the deprecations.
Will it fix the Buffer() warning too?
When it is in your code. Here the DEP0005 trace pointed at a test helper in the repository, so the agent changed it to Buffer.from. A warning that traces into node_modules is reported with the package name instead, since the fix belongs upstream.
What about util.inherits?
Node documents util.inherits as discouraged in favour of class extends, but it prints no warning and --throw-deprecation does not trip on it. The agent leaves it, because rewriting the constructor hierarchy is a larger change than a deprecation fix.
More jobs like this: Upgrade dependencies weekly
- Fix "Package subpath './v4' is not defined by exports" When Upgrading uuid (uuid)
- Fix Vulnerable Go Modules in an Echo API (Echo)
- Fix Vulnerable Dependencies in a NestJS App (NestJS)
- Fix Vulnerable Dependencies in a Node.js App (Node.js)
- Fix Vulnerable Dependencies in a React App (React)
- Fix Vulnerable Dependencies in a Rust Project (Rust)