Skip to content

PANA-8500: Add foundation for pixel-based Session Replay capture - #3697

Draft
jonathanmos wants to merge 5 commits into
feature/sr-new-pipelinefrom
jmoskovich/01-sr-new-pipeline
Draft

PANA-8500: Add foundation for pixel-based Session Replay capture#3697
jonathanmos wants to merge 5 commits into
feature/sr-new-pipelinefrom
jmoskovich/01-sr-new-pipeline

Conversation

@jonathanmos

Copy link
Copy Markdown
Member

What does this PR do?

Introduces the foundational models and pipeline selection for a new pixel-based Session Replay capture pipeline.

Unlike the existing pipeline, which uses semantic mappers for individual Android view types, the new pipeline captures the visual output of the application and represents it as an ordered composition tree.

This PR:

  • Synchronizes the Session Replay wire schemas with composition-tree models.
  • Defines internal contracts for captured layers, visual elements, pixel resources, and mutations.
  • Generates stable, RUM-view-scoped identities for captured elements.
  • Validates captured snapshots and mutations before serialization.
  • Maps valid captured trees to Session Replay wire models.
  • Adds the internal layerTreeRecording feature flag.
  • Selects either the legacy semantic pipeline or the new pixel-capture pipeline at initialization.

Pipeline selection is exclusive: only the selected recorder is constructed, and it handles the complete lifecycle of that recording cycle.

Motivation

The existing Session Replay pipeline reconstructs the UI using semantic, type-specific view mappers. This requires explicit knowledge of Android widget implementations and ongoing mapper support for different UI components.

The new pipeline is based on captured visual output rather than semantic reconstruction. This reduces its dependence on individual widget types and provides a common foundation for capturing content produced by different Android UI technologies.

Before the capture implementation can be connected, the pipeline needs:

  • A stable representation of captured visual content and its layer structure.
  • Deterministic identities across snapshots.
  • Validation of tree structure, resources, and mutations.
  • Conversion into the backend wire format.
  • Flag-gated selection that leaves the existing recorder unchanged.

This PR provides those foundations. The pixel-capture implementation and recording loop will be connected in subsequent work.

Additional Notes

  • The new pipeline is disabled by default.
  • The flag is internal and can be enabled through _SessionReplayInternalProxy.
  • With the flag disabled, the existing SessionReplayRecorder is created and the pixel-capture pipeline is not instantiated.
  • The new recorder is currently a lifecycle shell.
  • This PR does not make the new pipeline production-ready or change the public Session Replay API.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@codecov-commenter

codecov-commenter commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.94702% with 242 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.46%. Comparing base (3ee1901) to head (c0c3b79).
⚠️ Report is 15 commits behind head on feature/sr-new-pipeline.

Files with missing lines Patch % Lines
...lay/internal/composition/CapturedTreeWireMapper.kt 53.70% 82 Missing and 18 partials ⚠️
...sessionreplay/internal/composition/CapturedTree.kt 55.04% 58 Missing ⚠️
...internal/composition/CapturedSnapshotValidation.kt 75.00% 9 Missing and 22 partials ⚠️
...ssionreplay/internal/processor/MutationResolver.kt 5.00% 18 Missing and 1 partial ⚠️
...internal/composition/CapturedMutationValidation.kt 80.46% 6 Missing and 11 partials ⚠️
...internal/composition/CompositionCapturePipeline.kt 40.00% 6 Missing ⚠️
...ionreplay/internal/composition/CapturedIdentity.kt 92.31% 3 Missing and 2 partials ⚠️
...droid/sessionreplay/internal/utils/WireframeExt.kt 0.00% 0 Missing and 3 partials ⚠️
...id/sessionreplay/internal/processor/BoundsUtils.kt 0.00% 1 Missing and 1 partial ⚠️
...play/internal/recorder/mapper/RadioButtonMapper.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           feature/sr-new-pipeline    #3697      +/-   ##
===========================================================
- Coverage                    73.60%   73.46%   -0.14%     
===========================================================
  Files                          999     1007       +8     
  Lines                        36580    37305     +725     
  Branches                      6185     6326     +141     
===========================================================
+ Hits                         26924    27405     +481     
- Misses                        7964     8139     +175     
- Partials                      1692     1761      +69     
Files with missing lines Coverage Δ
...com/datadog/android/sessionreplay/SessionReplay.kt 73.91% <100.00%> (+0.58%) ⬆️
...ndroid/sessionreplay/SessionReplayConfiguration.kt 97.00% <100.00%> (+0.12%) ⬆️
...droid/sessionreplay/_SessionReplayInternalProxy.kt 100.00% <100.00%> (ø)
.../sessionreplay/internal/DefaultRecorderProvider.kt 94.67% <100.00%> (+0.26%) ⬆️
...oid/sessionreplay/internal/SessionReplayFeature.kt 98.30% <100.00%> (+0.02%) ⬆️
...ionreplay/internal/composition/CapturedMutation.kt 100.00% <100.00%> (ø)
...play/internal/composition/CapturedTreeValidator.kt 100.00% <100.00%> (ø)
...onreplay/internal/processor/HeatmapWireframeExt.kt 100.00% <100.00%> (ø)
...ssionreplay/internal/processor/MobileSegmentExt.kt 100.00% <100.00%> (ø)
...replay/internal/processor/RecordedDataProcessor.kt 97.73% <100.00%> (ø)
... and 13 more

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonathanmos
jonathanmos force-pushed the jmoskovich/01-sr-new-pipeline branch from cc8a3e4 to c0c3b79 Compare August 6, 2026 10:20
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.

2 participants