Repository navigation
Conversation
Replace npm install with npm ci in backend/Dockerfile (both builder and runner stages), render.yaml, and vercel.json to ensure deterministic, lockfile-pinned dependency installs in production builds. This eliminates the risk of dependency drift between CI-tested and deployed versions. Closes LabsCrypt#1256 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
The setInterval(updateClaimable, 1000) in stream-details-content.tsx was running every second regardless of whether the tab was visible, wasting CPU/battery on backgrounded tabs. This mirrors the approach already used by the useStreamingAmount hook (requestAnimationFrame + document.hidden guard) but keeps the bigint arithmetic intact. - Extract computeClaimable() so the value can be recalculated on demand - Guard the interval callback with document.hidden check - Add visibilitychange listener to resync immediately when tab returns to foreground (matching useStreamingAmount's resync behavior) - Add test verifying no state updates occur while document.hidden is true Closes LabsCrypt#1242 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
The catch block in useStreamEvents.handleEvent was silently ignoring JSON.parse failures with an empty catch and no logging. This made it impossible to diagnose malformed SSE frames in production. Now logs the error, event type, and raw payload via logger.error for debugging. - Import logger from @/lib/logger (consistent with codebase convention) - Log parse failures with type, raw payload, and error details - Add MockEventSource.emitRaw() helper for testing non-JSON payloads - Add test verifying a malformed SSE frame produces a logged error Closes LabsCrypt#1210 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
The backend Dockerfile uses npm ci (from PR LabsCrypt#1256) which requires a package-lock.json. Since this is an npm workspaces monorepo, the lockfile lived only at the root and wasn't available in the backend/ build context. Generated a standalone backend/package-lock.json so npm ci can resolve exact dependency versions in the Docker build. Also added a root .dockerignore for future-proofing. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Restores observability into a currently invisible failure mode by logging malformed SSE payloads instead of silently discarding them.
Problem
useStreamEvents.ts:96-106— thehandleEventcallback swallows anyJSON.parsefailure with an emptycatchblock and no logging:This means a corrupted or unexpected SSE frame vanishes without a trace. In a financial application where real-time stream events drive UI state (claimable amounts, status badges, action buttons), silently dropping events can lead to confusing user-facing behavior with zero diagnostic trail.
Solution
Import
loggerfrom@/lib/logger— consistent with the codebase convention used inuseTokenPrice.tsanduseIncomingStreams.ts.Log the parse failure with structured context in the catch block:
type— which SSE event type failed to parseraw— the raw payload string for debuggingerror— the caught parse errorAdded
emitRaw()toMockEventSource— test helper that fires a named event with a raw (non-JSON) string payload, enabling malformed-payload testing.New test: "logs a parse error when SSE payload is malformed" — verifies that:
console.erroris called (logger.error always surfaces, even in production)Files Changed
frontend/src/hooks/useStreamEvents.tsfrontend/src/__tests__/useStreamEvents.test.tsxemitRaw()to MockEventSource, add malformed-payload testTest Results
All 15 tests pass (14 existing + 1 new):
Closes #1210
🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com