Repository navigation
Conversation
|
|
f42c9be to
19d1f5a
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
19d1f5a to
cef7392
Compare
|
@claude review |
|
Claude finished @vibhavgo's task in 20s —— View job Review of #10197The change looks correct overall. I found no blocking bugs. I only read the diff and did not run the tests or build.
Scope and process
|
574ad58 to
23a3576
Compare
|
@claude review always |
|
Claude finished @vibhavgo's task in 26s —— View job Review of #10197 (commit 23a3576)I read the diff and the surrounding code. I did not run the tests or the build. One issue should be fixed before merge. The rest are nits. Should fix:
Correctness checks that passed
Nits
Scope and process
Not covered here: the |
There was a problem hiding this comment.
Still open from earlier reviews (1):
- 🔴
modules/sdk-api/src/bitgoAPI.ts:2595—Accounts whose real changePassword body is just over the server's batching threshold can now be sent as one oversized P…
If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟣
modules/sdk-api/src/bitgoAPI.ts— Pre-existing: a batch upload that fails for good never reaches the caller; heavy accounts get a misleading legacy-POST failure instead of theBatch N failederror. Thecatch (error) {}at bitgoAPI.ts:2250 swallows what processKeychainPasswordUpdatesInBatches rethrows. useBatchingFlow then stays false, and the code falls through to the full-payload POST at 2275. Fix: catch only failures of the checkBatchingPasswordFlow GET, and rethrow errors from the batch upload, so the first-error contract at 2696-2699 holds for callers.Why this was flagged
An account big enough that checkBatchingPasswordFlow returns isBatchingFlowEnabled hits a bin that fails all 3 retries, or whose PUT response lists
failedkeychains (bitgoAPI.ts:2660-2669). The new worker pool stores that error and rethrows it at bitgoAPI.ts:2697-2698, and its comment says this is the 'same fail-loud contract as the sequential loop'. But the call at bitgoAPI.ts:2242 sits inside the try whosecatch (error) { // batching flow check failed }(2250-2252) drops every error. useBatchingFlow stays false, and changePassword sends the fullupdatePasswordParamsbody in the legacy POST at 2275. This change exists to let multi-hundred-MB accounts be sized without a full stringify (2230-2231). For those accounts, superagent's JSON serialization of that body throws the same V8 RangeError, or the server rejects the oversized body. The caller never sees the batch error. The base has the same swallow, so this is pre-existing, but the diff's new rethrow path has no effect in production.Verification: pre-existing. Trigger:
/user/checkBatchingPasswordFlowreturnsisBatchingFlowEnabled, and then one bin fails terminally. Thecatch (error) { // batching flow check failed }at bitgoAPI.ts:2250-2252 throws away every error, including thefirstErrorrethrown at 2696-2698. Control falls through to the full-payload legacy POST at 2275. The base commit has the same try/catch.
Slim envelopeOnly walk with pipelined pages, per-entry payload sizing, 4-way concurrent batch uploads, and an expectedKeychainCount coverage gate on the batching final POST so a partial or TTL-expired staging set fails loudly instead of flipping the password on incomplete keychains. Ticket: WCI-2309
23a3576 to
8d73ef0
Compare
There was a problem hiding this comment.
Code review found no new issues
No new issues were found in this update; 1 finding from earlier reviews is still open above.
Still open from earlier reviews (1):
- 🔴
modules/sdk-api/src/bitgoAPI.ts:2594—Accounts whose real changePassword body is just over the server's batching threshold can now be sent as one oversized P…
If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.
Summary
Speeds up and hardens the changePassword rotation flow for heavy accounts (Rain-scale: ~1,100 keys, ~131 MB payload): slim
envelopeOnlykey walk with pipelined pages, per-entry payload sizing (no full stringify), 4-way concurrent batch uploads, and anexpectedKeychainCountcoverage gate so a partial or TTL-expired staging set can never silently flip the password.Linear: WCI-2309
Changes
sdk-corekeychains:ListKeychainOptions.envelopeOnlyopt-in (envelopeOnly=truequery param); the rotation walk uses the slim list and pipelines the next page fetch while the current page's crypto runs.sdk-apicomputeChangePasswordPayloadSize: per-entry byte sizing replacesJSON.stringifyof the whole payload (RangeError above V8's max string length on heavy accounts).sdk-apiprocessKeychainPasswordUpdatesInBatches: sequential batch PUTs → 4-way cursor-dispatched worker pool. Exactly-once dispatch; per-bin retry and error strings unchanged in isolation; fail-loud on terminal error (workers stop pulling new bins, in-flight siblings abandon their remaining retries, first error rethrown).sdk-apibatching-path final POST gainsexpectedKeychainCount(total V1+V2 keys staged); the server (BitGo/bitgo-microservices#64777) verifies it against the staged set before applying the password change.Test Plan
modules/sdk-core:npx mocha test/unit/bitgo/keychain/keychains.ts— envelopeOnly forwarding, slim-walk rotation, pipelining, old-server fallback.modules/sdk-api:npx mocha test/unit/bitgoAPI.ts— payload sizing; pool: concurrency cap (peak in-flight 4), exactly-once dispatch, per-bin retry, stop-on-terminal-error;expectedKeychainCountpresent on the batching POST (2 / 0) and absent on the legacy POST.505c66bd,047a259e).