feat(bindings_node): return catch-up counts as number (not BigInt) + completed flag#3882
feat(bindings_node): return catch-up counts as number (not BigInt) + completed flag#3882tylerhawkes wants to merge 1 commit into
Conversation
|
Claude finished @tylerhawkes's task —— View job Code Review - 2026-07-21 22:00 UTCOverall Assessment: ✅ LGTM - The changes are clean, well-justified, and properly implemented. Review SummaryThis PR converts catch-up counts from Detailed FindingsCode Quality: ✅ Excellent
Potential Issues: The
If you wanted to be defensive, you could add saturating casts or a debug assertion, but this is likely overkill: pub messages: u32.saturating_from(summary.messages), // or .min(u32::MAX as u64) as u32Performance: ✅ Neutral-to-positive
Security: ✅ No concerns
Test Coverage:
Recommendations
API Design NoteGood call doing this before release. Forcing JS consumers to use Tasks completed:
|
| Self { | ||
| messages: BigInt::from(summary.messages), | ||
| conversations: BigInt::from(summary.conversations), | ||
| messages: summary.messages as u32, |
There was a problem hiding this comment.
🟡 Medium client/catch_up.rs:20
summary.messages as u32 and summary.conversations as u32 silently truncate when the u64 count exceeds u32::MAX, returning a wrapped (possibly zero) value to JavaScript instead of the true number of newly persisted items. Use a checked conversion that errors on overflow, or keep a 64-bit representation such as BigInt so the full range is preserved.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @bindings/node/src/client/catch_up.rs around line 20:
`summary.messages as u32` and `summary.conversations as u32` silently truncate when the `u64` count exceeds `u32::MAX`, returning a wrapped (possibly zero) value to JavaScript instead of the true number of newly persisted items. Use a checked conversion that errors on overflow, or keep a 64-bit representation such as `BigInt` so the full range is preserved.
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. Unresolved review comment identifies silent truncation when casting u64 to u32, which could return incorrect counts to JavaScript callers. This correctness concern warrants human review. You can customize Macroscope's approvability policy. Learn more. |
Stacked on #3881 (base branch
tyler/lifecycle-catchup-hardening) — review/merge that first.Returns the node
catchUpToLivecounts asnumber(napiu32) instead ofBigInt, and adds thecompletedflag (now that coreCatchUpSummarycarries it, from #3881).BigIntis a permanent tax on every JS/TS consumer — it can't be mixed withnumber, breaksJSON.stringify, and is awkward in TS — while a single catch-up run's counts comfortably fit anumber. Doing this before the release avoids a breaking type change for every agent codebase later.Verification
just node check)🤖 Generated with Claude Code
Note
Return catch-up counts as
numberand addcompletedflag to NodeCatchUpSummaryChanges the
messagesandconversationsfields in the Node-exposedCatchUpSummaryfromBigInttou32(JavaScriptnumber), and adds a newcompleted: boolfield forwarded from the Rust source struct.Risk: any Node consumers reading
messagesorconversationsasBigIntwill break.📊 Macroscope summarized 989e08f. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.