Skip to content

test(replay): pin rrweb 2.2.0 annotation (8) / asset (7) event passthrough (#116) - #143

Merged
krassx merged 4 commits into
mainfrom
fix/issue-116
Oct 28, 2026
Merged

krassx merged 4 commits into
mainfrom
fix/issue-116

Conversation

@krassx

@krassx krassx commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Refs #116 (the Electron 46 alpha CI lane item stays open for the owner; do not close).

Verified against main: rrweb/@rrweb/types are already ^2.2.0 and the fork is pinned on 2.2.0 (#117). No unload listeners exist (only a comment in browser/page-lifecycle.ts), no capturePage image-size math, no safeStorage/utilityProcess use, so the Electron 46 alpha items need no change. The only real item was annotation-event tolerance: the iframe guard already passes node-less event types through; this adds the regression test (annotation is EventType 8, asset 7; an earlier draft wrongly used 7 for annotation, caught in review). The test sends both types with real and misleading shapes (including a tainted id and an incremental source) and asserts the same object comes back (the once-per-session report latch is already spent by the snapshot, so a violation count would prove nothing).

Open for owner: add an Electron 46 alpha non-blocking CI lane (CI policy decision).

🤖 Generated with Claude Code

@claude

claude Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Claude finished @krassx's task in 18s —— View job


Review of PR #143

I found no real issues in this PR. I did not run the tests or the mutator loop, because dependencies aren't installed in this checkout.

What the PR changes: It adds one test in packages/replay/src/iframe-guard.test.ts (lines 284–295). The test checks that an rrweb 2.2.0 annotation event (type: 7) passes through guard() unchanged and does not call onViolation.

What I checked:

  • Guard behavior: In packages/replay/src/iframe-guard.ts, process handles FULL_SNAPSHOT (2) and INCREMENTAL_SNAPSHOT (3). It returns any other event type as is (if (raw.type !== INCREMENTAL_SNAPSHOT) return event;). The test therefore matches the real code path, and toBe(annotation) checks that the same object comes back.
  • Test setup: The test seeds the guard with a snapshot first, as the neighbouring tests do. The as unknown as eventWithTime cast is the same one the existing custom-event test uses.
  • Mutation sensitivity: The test would fail if someone later added a malformed(...) branch or a default drop for unknown event types, which is the regression it is meant to catch. The new assertion would not be reached if the guard started rewriting or cloning type-7 events, so the toBe identity check is the one that matters.

Minor notes (P3, no action required):

  • The title says "masked-looking payload", but the payload ({ annotationData: { text: 'marker', id: 1 } }) is simple. It does not look like a masked or iframe-owned node id, so the test does not exercise the case where the guard might match a type-7 payload against tainted. Using an id that belongs to a blocked iframe would pin that case more tightly. Today the guard reads no fields from non-type-2/3 events, so this is not a bug.
  • I could not confirm that 7 is the annotation EventType in the installed @rrweb/types, because node_modules is absent. The PR description says it was verified against 2.2.0.
  • The Electron 46 alpha CI lane is deliberately left as an open owner decision, so I'm not treating it as a gap in this PR.

Overall risk: Low (test-only change).

Merge recommendation: Approve and merge, ideally after CI is green.

Most important issues to fix: None. Optionally, use a tainted node id in the annotation payload to make the passthrough test stricter.

Positives: The change is small and well scoped. The PR description is clear about what was verified and what was left undone.
· branch fix/issue-116

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a731e92c-4b8b-4953-bb44-5b5aae8f3886
Commits

Reviewing files that changed from the base of the PR and between 8d0acb3 and 5d30d84.

Files selected for processing: 1
  • packages/replay/src/iframe-guard.test.ts

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1b32d684-468b-4de1-854c-96ebc8fb6e34
Commits

Reviewing files that changed from the base of the PR and between d5d0c20 and 8d0acb3.

Files selected for processing: 1
  • packages/replay/src/iframe-guard.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Added coverage confirming that replay annotation events pass through iframe validation unchanged, even when their payload resembles masked content.
    • Verified these events do not trigger a violation callback, helping ensure valid annotations are not incorrectly flagged.

Adds a test that verifies the iframe guard returns an rrweb annotation event unchanged, even when its payload resembles masked content. The test also verifies that the guard does not call onViolation.

Possibly related issues

  • #116 — The issue identifies rrweb 2.2.0’s new annotation event and requests compatible event handling. This test checks the iframe guard’s passthrough behavior for that event.

Possibly related PRs

Priority: Low

Change: Other

Merge Risk: Minimal · previous review 8d0ac

The annotation passthrough behavior is covered and the change is safe to merge.

Architecture risk: Low · up to 8d0ac

The change affects 1 system.

Changed systems: packages/replay

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/replay (library) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/replay/src/iframe-guard.test.ts: Adds a test for an annotation event with a masked-looking payload, asserting that the guard returns the same event and does not call onViolation.
Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Directly linked issue #116 has one relevant coding objective: tolerate the new rrweb 2.2.0 annotation event (type 7). The whole-PR diff against the merge base changes one file, packages/replay/src/ifr… Confirm from source that the iframe guard dispatch returns unknown or node-less event types (type 7 in particular) unchanged. Confirm that packages/rrweb and the rrweb type dependencies at the reviewed head resolve to ^2.2.0. Confirm that o…
Passed Passed checks: 4 passed
Check name Status Explanation
Out of Scope Changes check Passed The whole-PR change set is one added test in packages/replay/src/iframe-guard.test.ts. It covers the annotation event tolerance objective from #116. No production code, dependency manifest, CI configu…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Title check Passed The title clearly identifies the regression test for rrweb 2.2.0 annotation and asset event passthrough. The word "pin" may suggest a dependency change, but the title remains directly related to the c…
Description check Passed The pull request description directly explains the rrweb 2.2.0 annotation-event compatibility work and the added iframe-guard regression test. It also identifies Electron 46 CI work as intentionally o…
Full details: Out of Scope Changes check

Explanation

The whole-PR change set is one added test in packages/replay/src/iframe-guard.test.ts. It covers the annotation event tolerance objective from #116. No production code, dependency manifest, CI configuration, or unrelated file changed. The test uses the same helper style as nearby iframe guard tests (make, snapshot, doc, el). The Electron 46 CI lane is not part of this change set, so no out-of-scope change exists for it. The change is a supporting test and fits the linked objective.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Full details: Title check

Explanation

The title clearly identifies the regression test for rrweb 2.2.0 annotation and asset event passthrough. The word "pin" may suggest a dependency change, but the title remains directly related to the changeset.

Full details: Description check

Explanation

The pull request description directly explains the rrweb 2.2.0 annotation-event compatibility work and the added iframe-guard regression test. It also identifies Electron 46 CI work as intentionally out of scope.

Full details: Linked Issues check

Explanation

Directly linked issue #116 has one relevant coding objective: tolerate the new rrweb 2.2.0 annotation event (type 7). The whole-PR diff against the merge base changes one file, packages/replay/src/iframe-guard.test.ts. It adds one test. The test sends an annotation event with type 7 and a payload with annotationData through guard(). It expects the same object back and no call to onViolation. The iframe guard header (iframe-guard.ts) states that events with no node (meta, custom, viewport, log) pass. An annotation event carries no node, so the guard should pass it. The guard's event dispatch code was not readable within the inspection limit, so this pass-through is not confirmed from source. The test was not run. Issue #116 also asks that other event consumers tolerate the annotation type (its follow-up item 2: serializer, uploader, backend player, and any exhaustive switch over rrweb event types). The PR does not change or examine those paths. The PR description says the dependency bump to rrweb/@rrweb/types ^2.2.0 already exists on main. The package.json files were not inspected, so this is not confirmed. The Electron 46 alpha items are checks and a CI policy decision. The PR description says these are not in scope and are open for the owner, and the issue says no action is required yet. They are not treated as coding requirements here.

Resolution

Confirm from source that the iframe guard dispatch returns unknown or node-less event types (type 7 in particular) unchanged. Confirm that packages/rrweb and the rrweb type dependencies at the reviewed head resolve to ^2.2.0. Confirm that other event consumers the issue names (serializer, uploader, backend player) do not reject or fail on event type 7, or state that they are out of scope for this PR. Run the new test to confirm it passes.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@krassx krassx changed the title test(replay): pin rrweb 2.2.0 annotation event passthrough (#116) test(replay): pin rrweb 2.2.0 annotation (8) / asset (7) event passthrough (#116) Oct 28, 2026
@claude

claude Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Claude finished @krassx's task in 20s —— View job


Review of PR #143 (re-review after new commits)

I found no real issues. I did not run the tests or the mutator loop, because dependencies aren't installed in this checkout. The review is from reading the code.

What changed since my last review: The PR still touches only packages/replay/src/iframe-guard.test.ts. Two follow-up commits (9892519f, 1bd62df8) rewrote the test:

  • It now covers both annotation (type 8) and asset (type 7) events.
  • It uses a blocked iframe's inner node id, which was my earlier P3 suggestion. That note looks addressed.

What I checked:

  • Guard behavior: iframe-guard.ts:403 handles FULL_SNAPSHOT (2). iframe-guard.ts:419 returns every type other than INCREMENTAL_SNAPSHOT (3) unchanged. Types 7 and 8 therefore never reach the id, taint or mutation checks, and the test's toBe(e) identity assertion matches that path.
  • Test setup: SOURCE.Mutation and SOURCE.Scroll are defined at lines 39–52. el, doc, snapshot and inner.id are used the same way as in the neighbouring tests, for example at line 178.
  • mockClear() after the seed snapshot: This is correct. The snapshot reports the stripped blocked-iframe content, so clearing the mock keeps not.toHaveBeenCalled() meaningful.
  • Mutation sensitivity: The test would fail if the guard changed in either of these ways:
    • It starts treating types 7 or 8 as incremental events. The { id: inner.id, source: Mutation | Scroll } shapes would then be dropped or reported.
    • It adds a default drop or reject branch for unknown event types.
  • Intentionally non-rrweb shapes: The last two shapes deliberately include id and source fields. The inline comment says so, so no one will mistake them for real rrweb payloads.

Minor note (P3, no action required): I could not confirm from the installed @rrweb/types that 7 is asset and 8 is annotation, because node_modules is absent. The commit history shows you corrected this from an earlier guess, and the test is robust either way because it loops over both values. A one-line check against EventType in @bugsee/rrweb before merge would settle it.

The Electron 46 alpha CI lane: This stays an open owner decision, so I'm not treating it as a gap in this PR.

  1. Overall risk: Low. This is a test-only change.
  2. Merge recommendation: Approve and merge once CI is green.
  3. Most important issues to fix: None.
  4. Positives:
    • The change is small and well scoped.
    • The test pins the exact regression it targets: type 7 or 8 events must not be routed into the taint checks.
    • The PR description is honest about what was verified and what was left undone.
      · branch fix/issue-116

@claude

claude Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Claude finished @krassx's task in 2m 19s —— View job


Review of PR #143 (re-review after push)

I found no new real issues. I read the code but did not run the tests or the mutator loop, because dependencies aren't installed in this checkout.

What changed since my last review: Commit 56a5e940 removed the onViolation not-called assertion from the passthrough test. The PR still touches only packages/replay/src/iframe-guard.test.ts (+22).

What I checked:

  • Guard path: iframe-guard.ts:400-420 handles FULL_SNAPSHOT (2) and returns every type other than INCREMENTAL_SNAPSHOT (3) unchanged. Types 7 and 8 never reach the id, taint or mutation checks, so expect(guard(e)).toBe(e) matches the real path.
  • Dropped assertion: The dropped assertion was vacuous. report (iframe-guard.ts:139-143) latches on reported, so after the seed snapshot's stripped blocked-iframe content has used the latch (the test asserts exactly one call), a later violation would not call onViolation again. Removing it was correct, and the identity assertion is the one that detects a regression. If the guard dropped or rewrote a type-7/8 event, toBe(e) would fail. A returned undefined or a clone fails it too.
  • Mutation sensitivity: The two non-rrweb shapes with id: inner.id and source: Mutation | Scroll would be dropped or rewritten if types 7 and 8 were ever routed into the incremental path. The inline comment says they are intentionally not real rrweb payloads.
  • Test setup: make, el, doc, snapshot and SOURCE are used the same way as in the neighbouring tests. The as unknown as eventWithTime cast matches the existing custom-event test.

Minor note (P3, no action required): I could not confirm from the installed @rrweb/types that 7 is asset and 8 is annotation, because node_modules is absent. The test loops over both values, so it stays valid if the numbering were swapped. Only the test title's wording would be off. A one-line check against EventType in @bugsee/rrweb would settle it.

Earlier notes: My earlier suggestion to use a tainted id from a blocked iframe is addressed (inner.id).

The Electron 46 alpha CI lane: This stays an open owner decision, so I'm not treating it as a gap in this PR.

  1. Overall risk: Low. This is a test-only change.
  2. Merge recommendation: Approve and merge once CI is green.
  3. Most important issues to fix: None.
  4. Positives:
    • The change is small and well scoped.
    • The test pins the exact regression it targets and covers both event types with real and misleading shapes.
    • The review-driven cleanup removed an assertion that could never fail.
      · branch fix/issue-116

krassx and others added 4 commits October 28, 2026 21:22
…rame guard (#116)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…he guard even with a blocked iframe's id (#116)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…a tainted id, catches routing regressions (#116 review)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…gh test (#116 review)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Claude finished @krassx's task in 15s —— View job


Review of PR #143 (re-review after push)

I found no new real issues. I read the code only. I did not run the tests or the mutator loop, because dependencies aren't installed in this checkout.

What changed since the last review: nothing in the diff. The PR still adds one test (+22) to packages/replay/src/iframe-guard.test.ts (commits c5ddfdc1, 878f5367, b515c1d9, 5d30d841). My last review already covered the final test.

What I checked:

  • Guard path: In iframe-guard.ts, process handles FULL_SNAPSHOT (type 2) and returns any type other than INCREMENTAL_SNAPSHOT (3) unchanged (if (raw.type !== INCREMENTAL_SNAPSHOT) return event;). Types 7 and 8 never reach the id, taint or mutation checks, so expect(guard(e)).toBe(e) matches the real path.
  • Mutation sensitivity: The test would fail if the guard dropped, cloned or rewrote a type-7/8 event. It would also fail if the guard started routing those types into the incremental path. The { id: inner.id, source: Mutation | Scroll } shapes exercise that case, and the inline comment says they are not real rrweb payloads.
  • Dropped onViolation assertion: Removing it was correct. The report latch is already spent by the seed snapshot, so a later violation could not call onViolation again.
  • Test setup: make, el, doc, snapshot and SOURCE are used the same way as in the neighbouring tests.

Minor note (P3, no action required): I could not confirm that 8 is annotation and 7 is asset in @rrweb/types, because node_modules is absent. The test loops over both values, so it stays valid if the numbering were swapped, and only the test title would be wrong. A one-line check against EventType before merge would settle it.

Electron 46 alpha CI lane: This stays an open owner decision, as the PR description says, so I'm not treating it as a gap in this PR.

  1. Overall risk: Low. This is a test-only change.
  2. Merge recommendation: Approve and merge once CI is green.
  3. Most important issues to fix: None.
  4. Positives:
    • The change is small and well scoped.
    • The test pins the regression it targets and covers both event types with real and misleading shapes.
    • Review feedback was applied: the tainted id was added and the vacuous assertion was removed.
      · branch fix/issue-116

@krassx
krassx merged commit 5d37625 into main Oct 28, 2026
8 checks passed
@krassx
krassx deleted the fix/issue-116 branch October 28, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant