✨ [PANA-8797] Allow session replay to clear its string table - #4988
Conversation
|
/to-staging |
|
View all feedbacks in Devflow UI.
Commit 99116a401c will soon be integrated into staging-35.
Commit 99116a401c has been merged into staging-35 in merge commit 173ef8474a. If you need to revert this integration, you can use the following command: |
… into staging-35 Integrated commit sha: 99116a4 Co-authored-by: sethfowler-datadog <seth.fowler@datadoghq.com>
e1b901f to
1619951
Compare
99116a4 to
4323472
Compare
Bundles Sizes Evolution
|
|
Motivation
Session replay recordings extract strings into a string table, and #4983 annotated each entry with the role its string plays on the page so that the backend can mask sensitive content after the fact. Ideally, we could perform that masking based only on the role-annotated string table, but today that would be insufficient, because the string table isn't the only place sensitive strings could appear. The problem is that when the string table reaches its size limit, we stop adding strings to it and start representing them directly inside the replay operations as literal arguments.
To eliminate this problem, we should handle string table overflow in a different way: we should simply clear the string table when it gets too large.
Changes
When the string table reaches its soft maximum size,
ChangeEncodernow clears it. After encoding each change, it compares the table's size against the soft max, and clears the table as soon as the limit is reached. The newClearStringsoperation expresses the fact that the string table was cleared in the recording, so that the recorder's encoder and the player's decoder continue to agree on the meaning of string table references.With this change in place, strings are always transmitted through the string table, and the code that turned them into literals is gone:
changeEncoder.ts: the size check and the clear. Clearing the table ends the current run: the changes buffered so far are encoded ahead of theClearStrings, and the changes that follow start from an empty table.resolvePendingStrings()no longer falls back to a literal.changeEncoder.tsalso gained a new module-privateRunChangeEncoderhelper. This helper owns everything that happens within a run, leavingChangeEncoderto own only cross-run state.RunChangeEncoderis single-use, which made it possible to eliminateChangeEncoder's reset logic.changeDecoder.ts/stringTable.ts: the decoder infrastructure (which is only used in tests) now implementsClearStrings, replacing the throwing placeholder from the schema PR.ChangeDecoderalso now rejects a string literal in change data (though there's an opt-out for testing purposes). This makes the whole unit and e2e suite enforce that the SDK never puts a string anywhere but the string table.Checklist