Repository navigation
fix(app): keep replay chunks from different page loads apart - #3600
SpencerTorres wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 3e5aaf2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor None could be anchored to changed lines; they are listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a well-documented, well-tested bugfix: the chunk assembler now keys pending events by 🟡 P2 -- recommended
🔵 P3 nitpicks (1)
Reviewers (5 returned, 6 did not report in time): maintainability, performance, previous-comments, agent-native, learnings. Supplemented by orchestrator analysis of the full diff and its dependencies ( Residual risks:
Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 463 passed • 1 skipped • 1032s
Tests ran across 4 shards in parallel. |
Summary
Fixes a query that was causing the session player to show a warning/error on replay:
Browser SDKs up to
@clickhouse/clickstack-browser1.2.0 restart replay event numbers at 1 on every page load. When a page closed before all chunks of a large event were sent, the replay player joined the leftover chunk with the next page's event of the same number. The joined JSON failed to parse, and that page's full snapshot was dropped, so its part of the replay rendered blank. This was seen in production asUnexpected non-whitespace character after JSON.Changes
rrwebChunkAssembler.ts): pending chunks are keyed by event number plus full-precision timestamp. All chunks of one event share its timestamp, and different page loads don't. The duplicate-chunk guard is unchanged.sessions.ts): selectsTimestampand orders byTimestampTime, Timestamp, offset, chunk, so rows of two page loads in the same second no longer interleave.TimestampTimestays first to match the table's sort key. If the session table has noTimestampcolumn, the query uses the source's own timestamp instead.package.json,yarn.lock): the app's own browser telemetry moves to@clickhouse/clickstack-browser1.2.1, whose event numbers no longer repeat across page loads (fix: 1.2.1 event sequencing clickstack-browser#18)No data is lost, this is fixed by this query update + the browser SDK patch I published.