Skip to content

Migrate a 3-file Node.js module from callbacks to async/await + fix a validation bug

Exact prompt

# Task: migrate a small Node.js codebase from callbacks to async/await `lib/store.js`, `lib/inventory.js`, `lib/orders.js` use Node-style callbacks. Convert ALL three to promise-returning `async` functions (same function names and arguments minus the callback; results become resolved values, errors become rejections with the same messages). Keep behaviour identical, including order rollback on failure. While you're there, fix this reported bug: `removeStock` accepts zero/negative/NaN quantities; it must reject with the same message as `addStock` ("qty must be positive") and not change stock. Update `test/` to the new API and add tests. Run `npm test` (node --test). No new dependencies, no network.

Hidden node:test suite checks every API became promise-based, error messages preserved, rollback semantics kept, and the qty bug fixed. Partial migrations or rollback regressions fail. Original benchmark task written for usecaserank.com (not based on a specific public post). Headless, offline run on a reproducible fixture. Each run's notes say how its cost was measured (estimates are marked).

Success criteria: 1. Hidden node:test file is copied into test/ and `node --test test/` must exit 0 (60 s timeout); the agent's own tests in test/ must also pass. 2. Hidden tests check: store/inventory/orders functions return promises with the same results; errors become rejections with the original messages; addStock rejects 0/NaN; removeStock rejects zero/negative quantities with 'qty must be positive' and leaves stock unchanged; insufficient stock rejects without changes; listStock correct; fulfil succeeds and on failure rolls back already-removed lines. 3. No callback usage left in lib/*.js (no `cb(` / `callback(`) and each file uses async or Promise.

Best model for this task so far: DeepSeek V4.1 Flash (Venice) (thinking on) (success, $0.0046, 30s).

Run this on another model

All runs (5)

100% pass rate across 5 eligible runs: 5 pass, 0 partial, 0 fail. Partial and failed runs are listed below with everything else.ⓘ

Runs for this use case
ModelCostTimeStep-insⓘAutonomyOutcomeTrustⓘDateCompare
OGPT-6.1 Soldefault · thinking on$0.082m0Fully autonomouspassTrust 80%2026-10-22
DDeepSeek V4.1 Flash (Venice)thinking on$0.004630s0Fully autonomouspassTrust 80%2026-10-20
AClaude Haiku 5.5default · thinking on$0.008238s0Fully autonomouspassTrust 80%2026-10-16
AClaude Opus 5.5default · thinking on$0.2148s0Fully autonomouspassTrust 80%2026-10-16
AClaude Sonnet 5.5default · thinking on$0.0722s0Fully autonomouspassTrust 80%2026-10-16

Embed this result

A live badge for this use case. It links back here and updates as new runs are published.

UseCaseRank badge for Migrate a 3-file Node.js module from callbacks to async/await + fix a validation bug

Get new runs and ranking changes weekly

Which models got better or cheaper on real tasks like this one.