Skip to content

feat(replay): rotate recording session at a configurable size budget#3884

Draft
pauldambra wants to merge 2 commits into
mainfrom
posthog-code/replay-size-rotation
Draft

feat(replay): rotate recording session at a configurable size budget#3884
pauldambra wants to merge 2 commits into
mainfrom
posthog-code/replay-size-rotation

Conversation

@pauldambra

Copy link
Copy Markdown
Member

Problem

Per-session replay size has an extreme tail: web p99.9 is ~338 MiB, ~0.06% of web sessions exceed 500 MiB, and the largest run into the tens of GiB. A small number of unbounded sessions hold a large share of replay storage, strain the player, and push ingestion limits. We want to bound any single recording without losing data or interrupting recording.

Changes

Adds size-based session rotation. When a recording session's flushed bytes reach a configurable budget, the SDK rotates to a new, linked session rather than stopping — so no single recording exceeds the budget, but the recording continues and nothing is dropped.

  • New option session_recording.maxSessionSizeMb — defaults to 300 under the 2026-05-30 defaults bundle (off otherwise), clamped to the 1–500 MiB range. It carries a comment noting it is normally only changed after interaction with the PostHog support team.
  • Rotation is linked, not a reset — a new sessionMaximumSize change reason drives SessionIdManager.rotateSessionForReplaySize(), which mints a fresh session and fires the existing $session_ending / $session_starting linking events (so the player can stitch the timeline back together). Deliberately not resetSessionId(), which reads downstream as a posthog.reset() and would suppress linking.
  • A $session_size_rotation custom event marks the point in the recording where the budget was reached ({ sizeBytes, thresholdBytes }).
  • Built on the session-scoped flushed-size tracker that shipped in fix(replay): scope flushed-size tracker to the session #3868. The budget check runs after the buffer flush + clear, so the rotation events land in the fresh buffer rather than being discarded.

Units are MiB (matching the server-side size column and the SDK's $sdk_debug_replay_flushed_size).

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react-native-plugin
  • @posthog/react
  • @posthog/ai
  • @posthog/convex
  • @posthog/next
  • @posthog/nextjs-config
  • @posthog/nuxt
  • @posthog/rollup-plugin
  • @posthog/webpack-plugin
  • @posthog/types

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Paul directed this, sized the cutoff against cross-team replay data (US + EU, via Metabase), and chose the parameters: a 300 MiB default with a 1–500 MiB range, rotation (not hard-stop, so customers keep their data), a session-ended event, and an in-recording custom event marking the rotation point. The threshold and behaviour were chosen because rotation neither saves storage nor meaningfully changes revenue at this scale — its purpose is bounding per-session size, so the value is a guardrail tunable by support rather than a pricing lever.

Decisions made along the way:

  • Rotate via a dedicated sessionMaximumSize change reason rather than reusing resetSessionId(), because the latter suppresses the $session_ending linking the player needs.
  • Run the budget check after _clearBuffer() so the rotation custom events aren't discarded with the flushed buffer.
  • Default gated behind the 2026-05-30 defaults bundle (off for existing integrations until they opt in), matching how split_storage / persistence_save_debounce_ms shipped.
  • Remote-config override deferred to a follow-up (needs a backend change); this PR is local-config + bundle default only.

Verification (run locally, not manual browser testing): 353 tests pass across the recorder, sessionid, config, and flushed-size-tracker suites — including new coverage for the 300 default, the clamp, the rotation method minting a linked (non-reset) session, and the recorder emitting $session_size_rotation + rotating at the budget. Lint clean; @posthog/types typechecks.

Note: the underlying session-scoped flushed-size tracker merged separately in #3868; this PR is the rotation feature on top of it.


Created with PostHog Code

Add session_recording.maxSessionSizeMb (default 300 under the 2026-05-30
defaults, clamped 1-500 MiB) driving size-based session rotation. When a
session's flushed bytes reach the budget the recorder rotates to a new, linked
session via a new sessionMaximumSize change reason, so no single recording
exceeds the budget while recording continues uninterrupted and no data is lost.

- types: maxSessionSizeMb option (with support-team guidance comment) and the
  sessionMaximumSize change reason
- sessionid: rotateSessionForReplaySize() mints a linked session (not a reset)
  so $session_ending/$session_starting fire
- recorder: budget getter, a post-flush check that emits a $session_size_rotation
  custom event marking the rotation point, and shouldLinkSessions extended to the
  new reason
- posthog-core: 300 MiB default wired into the 2026-05-30 bundle

Generated-By: PostHog Code
Task-Id: b9b6f524-7f9d-421a-9b47-8e7131dd8536
@pauldambra pauldambra requested a review from a team as a code owner June 17, 2026 22:38
@pauldambra pauldambra self-assigned this Jun 17, 2026
@pauldambra pauldambra requested review from a team, TueHaulund, arnohillen, fasyy612 and ksvat and removed request for a team June 17, 2026 22:38
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
posthog-example-next-app-router Ready Ready Preview Jun 18, 2026 6:09am
posthog-js Ready Ready Preview Jun 18, 2026 6:09am
posthog-nextjs-config Ready Ready Preview Jun 18, 2026 6:09am

Request Review

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
⚠️ `@posthog/types` is modified but not declared in any changeset

This is informational — the PR is not blocked. Click the triangle above to collapse, or push a fix and this comment will auto-delete.

Modified in this PR but not in any changeset:

  • @posthog/types

If this package should ship the change, add it to the changeset frontmatter:

---
"@posthog/types": patch
---

Changesets in this PR:

  • posthog-js — minor

// the recorder links the old and new sessions instead of treating it as a wipe.
rotateSessionForReplaySize(): void {
const timestamp = new Date().getTime()
const sessionId = this._sessionIdGenerator()

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf2e7ee39e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +204 to +206
session_recording:
defaults && defaults >= '2026-05-30'
? { strictMinimumDuration: true, maxSessionSizeMb: 300 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve size defaults with partial replay config

With defaults: '2026-05-30', this new maxSessionSizeMb default is lost whenever the customer already supplies any partial session_recording config, because _init shallow-merges baseConfig and userConfig and only deep-merges rageclick. For example, { defaults: '2026-05-30', session_recording: { maskAllInputs: true } } replaces this whole object, leaves maxSessionSizeMb undefined, and silently disables the new rotation guardrail for many configured replay installations.

Useful? React with 👍 / 👎.

Comment on lines +1595 to +1598
const flushedBuffer = this._clearBuffer()
// rotate after clearing so the rotation custom events land in the fresh buffer
this._maybeRotateForSessionSize()
return flushedBuffer

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not return a stale buffer after rotating

When _flushBuffer() is invoked from _captureSnapshotBuffered to make room for a large event and the size budget is reached, _maybeRotateForSessionSize() can synchronously emit rotation events that mutate this._buffer and nested-flush the old session, but this method still returns the pre-rotation buffer. The caller at the size-boundary path assigns that stale object back to this._buffer, which can drop the new-session buffer/linking events and continue buffering the triggering event under the old session.

Useful? React with 👍 / 👎.

Comment on lines +1 to +3
---
'posthog-js': minor
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include @posthog/types in the changeset

This changes public types in packages/types/src/posthog-config.ts and packages/types/src/session-recording.ts, but the changeset only bumps posthog-js. Since .changeset/config.json has no linked/fixed packages, @posthog/types will not publish a new version, so consumers importing SessionRecordingOptions or SessionIdChangedCallback from @posthog/types will not get maxSessionSizeMb or sessionMaximumSize after the release.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/browser/src/__tests__/extensions/replay/lazy-sessionrecording.test.ts:4156-4164
**Non-parameterised rotation gate tests**

The three `size-based rotation` tests share the same logical shape — "given this flushed size and this `maxSessionSizeMb`, should `rotateSessionForReplaySize` be called?" — and could be expressed as a single `it.each` table. The team's convention prefers parameterised tests for cases like this, and a table would make it easy to add new boundary scenarios (e.g. exactly at the threshold) without duplicating the `beforeEach` setup.

### Issue 2 of 2
.changeset/replay-size-rotation.md:1-3
**`@posthog/types` not listed in changeset**

The PR description marks `@posthog/types` as an affected library, and two files under `packages/types/src/` are modified (`posthog-config.ts` and `session-recording.ts`). The changeset only lists `posthog-js`, so `@posthog/types` would not receive a version bump in the release. If the types package is published independently, downstream consumers that depend on `@posthog/types` directly (rather than via `posthog-js`) may be stuck on a stale type definition for `SessionIdChangedCallback` and `SessionRecordingOptions.maxSessionSizeMb`.

Reviews (1): Last reviewed commit: "feat(replay): rotate recording session a..." | Re-trigger Greptile

Comment on lines +4156 to +4164
config.session_recording.maxSessionSizeMb = undefined
recorder['_flushedSizeTracker'].trackSize(recorder.sessionId, 10 * oneMb)

recorder['_maybeRotateForSessionSize']()

expect(rotateSpy).not.toHaveBeenCalled()
})
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Non-parameterised rotation gate tests

The three size-based rotation tests share the same logical shape — "given this flushed size and this maxSessionSizeMb, should rotateSessionForReplaySize be called?" — and could be expressed as a single it.each table. The team's convention prefers parameterised tests for cases like this, and a table would make it easy to add new boundary scenarios (e.g. exactly at the threshold) without duplicating the beforeEach setup.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browser/src/__tests__/extensions/replay/lazy-sessionrecording.test.ts
Line: 4156-4164

Comment:
**Non-parameterised rotation gate tests**

The three `size-based rotation` tests share the same logical shape — "given this flushed size and this `maxSessionSizeMb`, should `rotateSessionForReplaySize` be called?" — and could be expressed as a single `it.each` table. The team's convention prefers parameterised tests for cases like this, and a table would make it easy to add new boundary scenarios (e.g. exactly at the threshold) without duplicating the `beforeEach` setup.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +1 to +3
---
'posthog-js': minor
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 @posthog/types not listed in changeset

The PR description marks @posthog/types as an affected library, and two files under packages/types/src/ are modified (posthog-config.ts and session-recording.ts). The changeset only lists posthog-js, so @posthog/types would not receive a version bump in the release. If the types package is published independently, downstream consumers that depend on @posthog/types directly (rather than via posthog-js) may be stuck on a stale type definition for SessionIdChangedCallback and SessionRecordingOptions.maxSessionSizeMb.

Rule Used: In the posthog/posthog-js repository, /packages/br... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: .changeset/replay-size-rotation.md
Line: 1-3

Comment:
**`@posthog/types` not listed in changeset**

The PR description marks `@posthog/types` as an affected library, and two files under `packages/types/src/` are modified (`posthog-config.ts` and `session-recording.ts`). The changeset only lists `posthog-js`, so `@posthog/types` would not receive a version bump in the release. If the types package is published independently, downstream consumers that depend on `@posthog/types` directly (rather than via `posthog-js`) may be stuck on a stale type definition for `SessionIdChangedCallback` and `SessionRecordingOptions.maxSessionSizeMb`.

**Rule Used:** In the posthog/posthog-js repository, /packages/br... ([source](https://app.greptile.com/posthog-org-19734/github/PostHog/posthog-js/-/custom-context?memory=1e5ca16f-9836-4241-953d-21bcf9017456))

How can I resolve this? If you propose a fix, please make it concise.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Size Change: +6.92 kB (+0.04%)

Total Size: 17 MB

Filename Size Change
packages/browser/dist/array.full.es5.js 378 kB +445 B (+0.12%)
packages/browser/dist/array.full.js 457 kB +326 B (+0.07%)
packages/browser/dist/array.full.no-********.js 536 kB +1.01 kB (+0.19%)
packages/browser/dist/array.js 211 kB +326 B (+0.15%)
packages/browser/dist/array.no-********.js 233 kB +416 B (+0.18%)
packages/browser/dist/default-extensions.js 209 kB +326 B (+0.16%)
packages/browser/dist/lazy-********.js 157 kB +463 B (+0.3%)
packages/browser/dist/main.js 215 kB +326 B (+0.15%)
packages/browser/dist/module.full.js 460 kB +326 B (+0.07%)
packages/browser/dist/module.full.no-********.js 539 kB +1.01 kB (+0.19%)
packages/browser/dist/module.js 215 kB +326 B (+0.15%)
packages/browser/dist/module.no-********.js 237 kB +416 B (+0.18%)
packages/browser/dist/module.slim.js 109 kB +326 B (+0.3%)
packages/browser/dist/module.slim.no-********.js 117 kB +416 B (+0.36%)
packages/browser/dist/posthog-********.js 157 kB +464 B (+0.3%)
ℹ️ View Unchanged
Filename Size Change
packages/ai/dist/anthropic/index.cjs 28.1 kB 0 B
packages/ai/dist/anthropic/index.mjs 27.7 kB 0 B
packages/ai/dist/gemini/index.cjs 36.5 kB 0 B
packages/ai/dist/gemini/index.mjs 36.3 kB 0 B
packages/ai/dist/index.cjs 55.2 kB 0 B
packages/ai/dist/index.mjs 55.1 kB 0 B
packages/ai/dist/langchain/index.cjs 34.7 kB 0 B
packages/ai/dist/langchain/index.mjs 34.7 kB 0 B
packages/ai/dist/openai-agents/index.cjs 27.8 kB 0 B
packages/ai/dist/openai-agents/index.mjs 27.7 kB 0 B
packages/ai/dist/openai/index.cjs 77.5 kB 0 B
packages/ai/dist/openai/index.mjs 77.2 kB 0 B
packages/ai/dist/otel/index.cjs 17.2 kB 0 B
packages/ai/dist/otel/index.mjs 17.1 kB 0 B
packages/ai/dist/vercel/index.cjs 47.3 kB 0 B
packages/ai/dist/vercel/index.mjs 47.3 kB 0 B
packages/browser/dist/all-external-dependencies.js 270 kB 0 B
packages/browser/dist/conversations.js 67.6 kB 0 B
packages/browser/dist/crisp-chat-integration.js 1.97 kB 0 B
packages/browser/dist/customizations.full.js 19 kB 0 B
packages/browser/dist/dead-clicks-autocapture.js 14.5 kB 0 B
packages/browser/dist/element-inference.js 5.69 kB 0 B
packages/browser/dist/exception-autocapture.js 11.8 kB 0 B
packages/browser/dist/extension-bundles.js 118 kB 0 B
packages/browser/dist/external-scripts-loader.js 3.11 kB 0 B
packages/browser/dist/intercom-integration.js 2.03 kB 0 B
packages/browser/dist/logs.js 40.6 kB 0 B
packages/browser/dist/product-tours-preview.js 76.4 kB 0 B
packages/browser/dist/product-tours.js 115 kB 0 B
packages/browser/dist/recorder-v2.js 104 kB 0 B
packages/browser/dist/recorder.js 104 kB 0 B
packages/browser/dist/rrweb-plugin-console-record.js 6.67 kB 0 B
packages/browser/dist/rrweb-types.js 2.33 kB 0 B
packages/browser/dist/rrweb.js 285 kB 0 B
packages/browser/dist/surveys-preview.js 77.9 kB 0 B
packages/browser/dist/surveys.js 96.5 kB 0 B
packages/browser/dist/tracing-headers.js 3.36 kB 0 B
packages/browser/dist/web-vitals-with-attribution.js 11.8 kB 0 B
packages/browser/dist/web-vitals.js 6.39 kB 0 B
packages/browser/react/dist/esm/index.js 20.9 kB 0 B
packages/browser/react/dist/esm/slim/index.js 17.3 kB 0 B
packages/browser/react/dist/esm/surveys/index.js 4.68 kB 0 B
packages/browser/react/dist/umd/index.js 24.2 kB 0 B
packages/browser/react/dist/umd/slim/index.js 20.1 kB 0 B
packages/browser/react/dist/umd/surveys/index.js 5.45 kB 0 B
packages/convex/dist/client/feature-flags/crypto.js 461 B 0 B
packages/convex/dist/client/feature-flags/evaluator.js 16.5 kB 0 B
packages/convex/dist/client/feature-flags/index.js 196 B 0 B
packages/convex/dist/client/feature-flags/match-********.js 14.8 kB 0 B
packages/convex/dist/client/feature-flags/types.js 44 B 0 B
packages/convex/dist/client/index.js 14.6 kB 0 B
packages/convex/dist/component/_generated/api.js 712 B 0 B
packages/convex/dist/component/_generated/component.js 212 B 0 B
packages/convex/dist/component/_generated/dataModel.js 230 B 0 B
packages/convex/dist/component/_generated/server.js 3.74 kB 0 B
packages/convex/dist/component/convex.config.js 1.11 kB 0 B
packages/convex/dist/component/crons.js 1.4 kB 0 B
packages/convex/dist/component/lib.js 21.4 kB 0 B
packages/convex/dist/component/schema.js 694 B 0 B
packages/convex/dist/component/version.js 68 B 0 B
packages/core/dist/cookie.js 5.34 kB 0 B
packages/core/dist/cookie.mjs 3.12 kB 0 B
packages/core/dist/error-tracking/chunk-ids.js 2.54 kB 0 B
packages/core/dist/error-tracking/chunk-ids.mjs 1.31 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.js 2.3 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.mjs 993 B 0 B
packages/core/dist/error-tracking/coercers/error-coercer.js 2.02 kB 0 B
packages/core/dist/error-tracking/coercers/error-coercer.mjs 794 B 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.js 1.76 kB 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.mjs 513 B 0 B
packages/core/dist/error-tracking/coercers/event-coercer.js 1.82 kB 0 B
packages/core/dist/error-tracking/coercers/event-coercer.mjs 548 B 0 B
packages/core/dist/error-tracking/coercers/index.js 6.79 kB 0 B
packages/core/dist/error-tracking/coercers/index.mjs 326 B 0 B
packages/core/dist/error-tracking/coercers/object-coercer.js 3.46 kB 0 B
packages/core/dist/error-tracking/coercers/object-coercer.mjs 2.07 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.js 1.67 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.mjs 419 B 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.js 2.59 kB 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.mjs 1.25 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.js 2.01 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.mjs 820 B 0 B
packages/core/dist/error-tracking/coercers/utils.js 2.06 kB 0 B
packages/core/dist/error-tracking/coercers/utils.mjs 716 B 0 B
packages/core/dist/error-tracking/error-properties-builder.js 5.56 kB 0 B
packages/core/dist/error-tracking/error-properties-builder.mjs 4.23 kB 0 B
packages/core/dist/error-tracking/exception-steps.js 6.87 kB 0 B
packages/core/dist/error-tracking/exception-steps.mjs 4.71 kB 0 B
packages/core/dist/error-tracking/index.js 4.74 kB 0 B
packages/core/dist/error-tracking/index.mjs 191 B 0 B
packages/core/dist/error-tracking/parsers/base.js 1.83 kB 0 B
packages/core/dist/error-tracking/parsers/base.mjs 464 B 0 B
packages/core/dist/error-tracking/parsers/chrome.js 2.73 kB 0 B
packages/core/dist/error-tracking/parsers/chrome.mjs 1.32 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.js 2.47 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.mjs 1.13 kB 0 B
packages/core/dist/error-tracking/parsers/index.js 4.75 kB 0 B
packages/core/dist/error-tracking/parsers/index.mjs 2.1 kB 0 B
packages/core/dist/error-tracking/parsers/node.js 3.94 kB 0 B
packages/core/dist/error-tracking/parsers/node.mjs 2.68 kB 0 B
packages/core/dist/error-tracking/parsers/opera.js 2.26 kB 0 B
packages/core/dist/error-tracking/parsers/opera.mjs 746 B 0 B
packages/core/dist/error-tracking/parsers/safari.js 1.88 kB 0 B
packages/core/dist/error-tracking/parsers/safari.mjs 574 B 0 B
packages/core/dist/error-tracking/parsers/winjs.js 1.72 kB 0 B
packages/core/dist/error-tracking/parsers/winjs.mjs 426 B 0 B
packages/core/dist/error-tracking/types.js 1.33 kB 0 B
packages/core/dist/error-tracking/types.mjs 131 B 0 B
packages/core/dist/error-tracking/utils.js 1.8 kB 0 B
packages/core/dist/error-tracking/utils.mjs 604 B 0 B
packages/core/dist/eventemitter.js 1.78 kB 0 B
packages/core/dist/eventemitter.mjs 571 B 0 B
packages/core/dist/featureFlagUtils.js 5.83 kB 0 B
packages/core/dist/featureFlagUtils.mjs 3.54 kB 0 B
packages/core/dist/gzip.js 5.72 kB 0 B
packages/core/dist/gzip.mjs 3.84 kB 0 B
packages/core/dist/index.js 15.1 kB 0 B
packages/core/dist/index.mjs 1.48 kB 0 B
packages/core/dist/logs/index.js 10.8 kB 0 B
packages/core/dist/logs/index.mjs 9.15 kB 0 B
packages/core/dist/logs/logs-utils.js 6.61 kB 0 B
packages/core/dist/logs/logs-utils.mjs 4.5 kB 0 B
packages/core/dist/logs/types.js 603 B 0 B
packages/core/dist/logs/types.mjs 0 B 0 B 🆕
packages/core/dist/posthog-core-stateless.js 34.6 kB 0 B
packages/core/dist/posthog-core-stateless.mjs 31.7 kB 0 B
packages/core/dist/posthog-core.js 46.4 kB 0 B
packages/core/dist/posthog-core.mjs 41.1 kB 0 B
packages/core/dist/surveys/events.js 4.21 kB 0 B
packages/core/dist/surveys/events.mjs 1.99 kB 0 B
packages/core/dist/surveys/index.js 4.57 kB 0 B
packages/core/dist/surveys/index.mjs 894 B 0 B
packages/core/dist/surveys/translations.js 10 kB 0 B
packages/core/dist/surveys/translations.mjs 7.55 kB 0 B
packages/core/dist/surveys/validation.js 3.06 kB 0 B
packages/core/dist/surveys/validation.mjs 1.51 kB 0 B
packages/core/dist/testing/index.js 2.93 kB 0 B
packages/core/dist/testing/index.mjs 79 B 0 B
packages/core/dist/testing/PostHogCoreTestClient.js 3.15 kB 0 B
packages/core/dist/testing/PostHogCoreTestClient.mjs 1.74 kB 0 B
packages/core/dist/testing/test-utils.js 2.83 kB 0 B
packages/core/dist/testing/test-utils.mjs 1.15 kB 0 B
packages/core/dist/tracing-headers.js 3.38 kB 0 B
packages/core/dist/tracing-headers.mjs 2.08 kB 0 B
packages/core/dist/types.js 9.89 kB 0 B
packages/core/dist/types.mjs 7.16 kB 0 B
packages/core/dist/utils/bot-detection.js 3.28 kB 0 B
packages/core/dist/utils/bot-detection.mjs 1.95 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.js 3 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.mjs 1.62 kB 0 B
packages/core/dist/utils/index.js 11.9 kB 0 B
packages/core/dist/utils/index.mjs 1.98 kB 0 B
packages/core/dist/utils/logger.js 2.58 kB 0 B
packages/core/dist/utils/logger.mjs 1.29 kB 0 B
packages/core/dist/utils/number-utils.js 3.32 kB 0 B
packages/core/dist/utils/number-utils.mjs 1.68 kB 0 B
packages/core/dist/utils/promise-queue.js 2 kB 0 B
packages/core/dist/utils/promise-queue.mjs 768 B 0 B
packages/core/dist/utils/string-utils.js 2.73 kB 0 B
packages/core/dist/utils/string-utils.mjs 1.09 kB 0 B
packages/core/dist/utils/type-utils.js 7.43 kB 0 B
packages/core/dist/utils/type-utils.mjs 3.28 kB 0 B
packages/core/dist/utils/user-agent-utils.js 17.7 kB 0 B
packages/core/dist/utils/user-agent-utils.mjs 14.2 kB 0 B
packages/core/dist/vendor/uuidv7.js 8.29 kB 0 B
packages/core/dist/vendor/uuidv7.mjs 6.72 kB 0 B
packages/mcp/dist/extensions/capture.js 3.63 kB 0 B
packages/mcp/dist/extensions/capture.mjs 2.19 kB 0 B
packages/mcp/dist/extensions/compatibility.js 5.63 kB 0 B
packages/mcp/dist/extensions/compatibility.mjs 3.79 kB 0 B
packages/mcp/dist/extensions/constants.js 4.36 kB 0 B
packages/mcp/dist/extensions/constants.mjs 2.25 kB 0 B
packages/mcp/dist/extensions/context-parameters.js 3.9 kB 0 B
packages/mcp/dist/extensions/context-parameters.mjs 2.11 kB 0 B
packages/mcp/dist/extensions/conversation-id.js 7.12 kB 0 B
packages/mcp/dist/extensions/conversation-id.mjs 4.21 kB 0 B
packages/mcp/dist/extensions/event-types.js 1.68 kB 0 B
packages/mcp/dist/extensions/event-types.mjs 459 B 0 B
packages/mcp/dist/extensions/exceptions.js 2.57 kB 0 B
packages/mcp/dist/extensions/exceptions.mjs 1.19 kB 0 B
packages/mcp/dist/extensions/ids.js 2.01 kB 0 B
packages/mcp/dist/extensions/ids.mjs 637 B 0 B
packages/mcp/dist/extensions/instrument-highlevel.js 12.4 kB 0 B
packages/mcp/dist/extensions/instrument-highlevel.mjs 9.74 kB 0 B
packages/mcp/dist/extensions/instrument-********.js 4.11 kB 0 B
packages/mcp/dist/extensions/instrument-********.mjs 2.32 kB 0 B
packages/mcp/dist/extensions/instrumentation.js 14.6 kB 0 B
packages/mcp/dist/extensions/instrumentation.mjs 10.6 kB 0 B
packages/mcp/dist/extensions/intent.js 3.31 kB 0 B
packages/mcp/dist/extensions/intent.mjs 1.68 kB 0 B
packages/mcp/dist/extensions/internal.js 6.39 kB 0 B
packages/mcp/dist/extensions/internal.mjs 4.14 kB 0 B
packages/mcp/dist/extensions/logger.js 1.44 kB 0 B
packages/mcp/dist/extensions/logger.mjs 204 B 0 B
packages/mcp/dist/extensions/mcp-********.js 3.93 kB 0 B
packages/mcp/dist/extensions/mcp-********.mjs 2.56 kB 0 B
packages/mcp/dist/extensions/mcp-sdk-compat.js 4.08 kB 0 B
packages/mcp/dist/extensions/mcp-sdk-compat.mjs 2.22 kB 0 B
packages/mcp/dist/extensions/posthog-events.js 10.1 kB 0 B
packages/mcp/dist/extensions/posthog-events.mjs 6.76 kB 0 B
packages/mcp/dist/extensions/posthog-mcp.js 6.36 kB 0 B
packages/mcp/dist/extensions/posthog-mcp.mjs 4.51 kB 0 B
packages/mcp/dist/extensions/sanitization.js 4.04 kB 0 B
packages/mcp/dist/extensions/sanitization.mjs 2.46 kB 0 B
packages/mcp/dist/extensions/session.js 4.74 kB 0 B
packages/mcp/dist/extensions/session.mjs 2.63 kB 0 B
packages/mcp/dist/extensions/sink.js 4.16 kB 0 B
packages/mcp/dist/extensions/sink.mjs 2.33 kB 0 B
packages/mcp/dist/extensions/tools.js 3.5 kB 0 B
packages/mcp/dist/extensions/tools.mjs 1.61 kB 0 B
packages/mcp/dist/extensions/tracing-helpers.js 2.41 kB 0 B
packages/mcp/dist/extensions/tracing-helpers.mjs 772 B 0 B
packages/mcp/dist/extensions/truncation.js 11.2 kB 0 B
packages/mcp/dist/extensions/truncation.mjs 9.46 kB 0 B
packages/mcp/dist/index.js 7.07 kB 0 B
packages/mcp/dist/index.mjs 4.12 kB 0 B
packages/mcp/dist/types.js 603 B 0 B
packages/mcp/dist/types.mjs 0 B 0 B 🆕
packages/mcp/dist/version.js 1.21 kB 0 B
packages/mcp/dist/version.mjs 45 B 0 B
packages/next/dist/app/PostHogProvider.js 3.33 kB 0 B
packages/next/dist/client/ClientPostHogProvider.js 1.76 kB 0 B
packages/next/dist/client/hooks.js 172 B 0 B
packages/next/dist/client/PostHogPageView.js 1.76 kB 0 B
packages/next/dist/index.client.js 401 B 0 B
packages/next/dist/index.edge.js 447 B 0 B
packages/next/dist/index.js 444 B 0 B
packages/next/dist/index.react-server.js 420 B 0 B
packages/next/dist/middleware/postHogMiddleware.js 3.7 kB 0 B
packages/next/dist/pages.client.js 502 B 0 B
packages/next/dist/pages.edge.js 570 B 0 B
packages/next/dist/pages.js 414 B 0 B
packages/next/dist/pages/getServerSidePostHog.js 1.99 kB 0 B
packages/next/dist/pages/PostHogPageView.js 1.32 kB 0 B
packages/next/dist/pages/PostHogProvider.js 1.61 kB 0 B
packages/next/dist/server/getPostHog.js 2.79 kB 0 B
packages/next/dist/server/nodeClientCache.js 1.31 kB 0 B
packages/next/dist/shared/browser.js 195 B 0 B
packages/next/dist/shared/config.js 2.08 kB 0 B
packages/next/dist/shared/constants.js 201 B 0 B
packages/next/dist/shared/cookie.js 540 B 0 B
packages/next/dist/shared/identity.js 264 B 0 B
packages/next/dist/shared/tracing-headers.js 2.18 kB 0 B
packages/nextjs-config/dist/config.js 6.1 kB 0 B
packages/nextjs-config/dist/config.mjs 4.53 kB 0 B
packages/nextjs-config/dist/index.js 2.24 kB 0 B
packages/nextjs-config/dist/index.mjs 30 B 0 B
packages/nextjs-config/dist/strip-sourcemap-********.js 3.63 kB 0 B
packages/nextjs-config/dist/strip-sourcemap-********.mjs 1.77 kB 0 B
packages/nextjs-config/dist/utils.js 2.94 kB 0 B
packages/nextjs-config/dist/utils.mjs 826 B 0 B
packages/node/dist/client.js 47.8 kB 0 B
packages/node/dist/client.mjs 45.4 kB 0 B
packages/node/dist/entrypoints/index.edge.js 3.85 kB 0 B
packages/node/dist/entrypoints/index.edge.mjs 720 B 0 B
packages/node/dist/entrypoints/index.node.js 5.67 kB 0 B
packages/node/dist/entrypoints/index.node.mjs 1.25 kB 0 B
packages/node/dist/entrypoints/nestjs.js 2.31 kB 0 B
packages/node/dist/entrypoints/nestjs.mjs 42 B 0 B
packages/node/dist/experimental.js 870 B 0 B
packages/node/dist/experimental.mjs 267 B 0 B
packages/node/dist/exports.js 6.75 kB 0 B
packages/node/dist/exports.mjs 582 B 0 B
packages/node/dist/extensions/context/context.js 2.13 kB 0 B
packages/node/dist/extensions/context/context.mjs 863 B 0 B
packages/node/dist/extensions/context/types.js 603 B 0 B
packages/node/dist/extensions/context/types.mjs 0 B 0 B 🆕
packages/node/dist/extensions/error-tracking/autocapture.js 2.66 kB 0 B
packages/node/dist/extensions/error-tracking/autocapture.mjs 1.24 kB 0 B
packages/node/dist/extensions/error-tracking/index.js 4.15 kB 0 B
packages/node/dist/extensions/error-tracking/index.mjs 2.88 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.js 8.81 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs 7.15 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.js 2.78 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.mjs 1.45 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/relative-path.node.js 1.97 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs 624 B 0 B
packages/node/dist/extensions/express.js 4.6 kB 0 B
packages/node/dist/extensions/express.mjs 2.49 kB 0 B
packages/node/dist/extensions/feature-flags/cache.js 603 B 0 B
packages/node/dist/extensions/feature-flags/cache.mjs 0 B 0 B 🆕
packages/node/dist/extensions/feature-flags/crypto.js 1.57 kB 0 B
packages/node/dist/extensions/feature-flags/crypto.mjs 395 B 0 B
packages/node/dist/extensions/feature-flags/feature-flags.js 40.8 kB 0 B
packages/node/dist/extensions/feature-flags/feature-flags.mjs 38.7 kB 0 B
packages/node/dist/extensions/nestjs.js 5 kB 0 B
packages/node/dist/extensions/nestjs.mjs 2.9 kB 0 B
packages/node/dist/extensions/sentry-integration.js 4.66 kB 0 B
packages/node/dist/extensions/sentry-integration.mjs 3.17 kB 0 B
packages/node/dist/extensions/tracing-headers.js 3.31 kB 0 B
packages/node/dist/extensions/tracing-headers.mjs 1.53 kB 0 B
packages/node/dist/feature-flag-evaluations.js 5.97 kB 0 B
packages/node/dist/feature-flag-evaluations.mjs 4.63 kB 0 B
packages/node/dist/storage-memory.js 1.52 kB 0 B
packages/node/dist/storage-memory.mjs 297 B 0 B
packages/node/dist/types.js 1.43 kB 0 B
packages/node/dist/types.mjs 224 B 0 B
packages/node/dist/version.js 1.21 kB 0 B
packages/node/dist/version.mjs 46 B 0 B
packages/nuxt/dist/module.mjs 5.29 kB 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagEnabled.js 566 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagPayload.js 690 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagVariantKey.js 591 B 0 B
packages/nuxt/dist/runtime/composables/usePostHog.js 128 B 0 B
packages/nuxt/dist/runtime/nitro-plugin.js 1.08 kB 0 B
packages/nuxt/dist/runtime/vue-plugin.js 1.14 kB 0 B
packages/plugin-utils/dist/cli.js 3.14 kB 0 B
packages/plugin-utils/dist/cli.mjs 1.64 kB 0 B
packages/plugin-utils/dist/config.js 3.07 kB 0 B
packages/plugin-utils/dist/config.mjs 1.83 kB 0 B
packages/plugin-utils/dist/index.js 4.3 kB 0 B
packages/plugin-utils/dist/index.mjs 217 B 0 B
packages/plugin-utils/dist/spawn-local.js 2.17 kB 0 B
packages/plugin-utils/dist/spawn-local.mjs 918 B 0 B
packages/plugin-utils/dist/utils.js 3.27 kB 0 B
packages/plugin-utils/dist/utils.mjs 1.3 kB 0 B
packages/react-native/dist/autocapture.js 5.05 kB 0 B
packages/react-native/dist/error-tracking/index.js 5.77 kB 0 B
packages/react-native/dist/error-tracking/utils.js 2.58 kB 0 B
packages/react-native/dist/frameworks/wix-navigation.js 1.3 kB 0 B
packages/react-native/dist/hooks/useFeatureFlag.js 1.84 kB 0 B
packages/react-native/dist/hooks/useFeatureFlagResult.js 963 B 0 B
packages/react-native/dist/hooks/useFeatureFlags.js 921 B 0 B
packages/react-native/dist/hooks/useNavigationTracker.js 2.45 kB 0 B
packages/react-native/dist/hooks/usePostHog.js 544 B 0 B
packages/react-native/dist/hooks/utils.js 988 B 0 B
packages/react-native/dist/index.js 4.33 kB 0 B
packages/react-native/dist/logs-********.js 3.66 kB 0 B
packages/react-native/dist/native-deps.js 8.73 kB 0 B
packages/react-native/dist/optional/OptionalAsyncStorage.js 299 B 0 B
packages/react-native/dist/optional/OptionalExpoApplication.js 377 B 0 B
packages/react-native/dist/optional/OptionalExpoDevice.js 347 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystem.js 386 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystemLegacy.js 423 B 0 B
packages/react-native/dist/optional/OptionalExpoLocalization.js 383 B 0 B
packages/react-native/dist/optional/OptionalPlugin.js 569 B 0 B
packages/react-native/dist/optional/OptionalReactNativeDeviceInfo.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeLocalize.js 303 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigation.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigationWix.js 443 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSafeArea.js 644 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSvg.js 872 B 0 B
packages/react-native/dist/posthog-rn.js 55.2 kB 0 B
packages/react-native/dist/PostHogContext.js 329 B 0 B
packages/react-native/dist/PostHogErrorBoundary.js 3.19 kB 0 B
packages/react-native/dist/PostHogMaskView.js 1.68 kB 0 B
packages/react-native/dist/PostHogProvider.js 4.55 kB 0 B
packages/react-native/dist/storage.js 5.76 kB 0 B
packages/react-native/dist/surveys/components/BottomSection.js 1.51 kB 0 B
packages/react-native/dist/surveys/components/Cancel.js 968 B 0 B
packages/react-native/dist/surveys/components/ConfirmationMessage.js 1.71 kB 0 B
packages/react-native/dist/surveys/components/QuestionHeader.js 1.43 kB 0 B
packages/react-native/dist/surveys/components/QuestionTypes.js 13.4 kB 0 B
packages/react-native/dist/surveys/components/SurveyModal.js 6.33 kB 0 B
packages/react-native/dist/surveys/components/Surveys.js 6.58 kB 0 B
packages/react-native/dist/surveys/getActiveMatchingSurveys.js 2.64 kB 0 B
packages/react-native/dist/surveys/icons.js 10 kB 0 B
packages/react-native/dist/surveys/index.js 600 B 0 B
packages/react-native/dist/surveys/PostHogSurveyProvider.js 6.28 kB 0 B
packages/react-native/dist/surveys/safeStyleSheet.js 448 B 0 B
packages/react-native/dist/surveys/survey-translations.js 1.11 kB 0 B
packages/react-native/dist/surveys/surveys-utils.js 14.2 kB 0 B
packages/react-native/dist/surveys/useActivatedSurveys.js 3.67 kB 0 B
packages/react-native/dist/surveys/useSurveyStorage.js 2.16 kB 0 B
packages/react-native/dist/tooling/expoconfig.js 11.9 kB 0 B
packages/react-native/dist/tooling/metroconfig.js 2.32 kB 0 B
packages/react-native/dist/tooling/posthogMetroSerializer.js 4.86 kB 0 B
packages/react-native/dist/tooling/utils.js 4.05 kB 0 B
packages/react-native/dist/tooling/vendor/expo/expoconfig.js 70 B 0 B
packages/react-native/dist/tooling/vendor/metro/countLines.js 237 B 0 B
packages/react-native/dist/tooling/vendor/metro/utils.js 3.35 kB 0 B
packages/react-native/dist/types.js 70 B 0 B
packages/react-native/dist/utils.js 1.3 kB 0 B
packages/react-native/dist/version.js 130 B 0 B
packages/react/dist/esm/index.js 20.9 kB 0 B
packages/react/dist/esm/slim/index.js 17.3 kB 0 B
packages/react/dist/esm/surveys/index.js 4.68 kB 0 B
packages/react/dist/umd/index.js 24.2 kB 0 B
packages/react/dist/umd/slim/index.js 20.1 kB 0 B
packages/react/dist/umd/surveys/index.js 5.45 kB 0 B
packages/rollup-plugin/dist/index.js 2.44 kB 0 B
packages/rrweb/all/dist/rrweb-all.cjs 625 kB 0 B
packages/rrweb/all/dist/rrweb-all.js 624 kB 0 B
packages/rrweb/all/dist/rrweb-all.umd.cjs 628 kB 0 B
packages/rrweb/all/dist/rrweb-all.umd.min.cjs 296 kB 0 B
packages/rrweb/packer/dist/base-********.js 18.2 kB 0 B
packages/rrweb/packer/dist/base-********.cjs 18.3 kB 0 B
packages/rrweb/packer/dist/base-********.umd.cjs 18.7 kB 0 B
packages/rrweb/packer/dist/base-********.umd.min.cjs 9.5 kB 0 B
packages/rrweb/packer/dist/pack.cjs 347 B 0 B
packages/rrweb/packer/dist/pack.js 285 B 0 B
packages/rrweb/packer/dist/pack.umd.cjs 1.63 kB 0 B
packages/rrweb/packer/dist/pack.umd.min.cjs 1.11 kB 0 B
packages/rrweb/packer/dist/packer.cjs 257 B 0 B
packages/rrweb/packer/dist/packer.js 136 B 0 B
packages/rrweb/packer/dist/packer.umd.cjs 662 B 0 B
packages/rrweb/packer/dist/packer.umd.min.cjs 626 B 0 B
packages/rrweb/packer/dist/unpack.cjs 769 B 0 B
packages/rrweb/packer/dist/unpack.js 702 B 0 B
packages/rrweb/packer/dist/unpack.umd.cjs 1.17 kB 0 B
packages/rrweb/packer/dist/unpack.umd.min.cjs 955 B 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.cjs 37.6 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.js 37.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.cjs 38 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.min.cjs 22.2 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.cjs 34.3 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.js 34.2 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.cjs 34.7 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.min.cjs 20.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.cjs 14.9 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.js 14.8 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.cjs 15.4 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.min.cjs 7.33 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.cjs 5.01 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.js 4.9 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.umd.cjs 5.44 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.umd.min.cjs 2.64 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.cjs 681 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.js 548 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.umd.cjs 1.12 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.umd.min.cjs 829 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.cjs 933 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.js 820 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.umd.cjs 1.37 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.umd.min.cjs 968 B 0 B
packages/rrweb/record/dist/rrweb-record.cjs 184 kB 0 B
packages/rrweb/record/dist/rrweb-record.js 184 kB 0 B
packages/rrweb/record/dist/rrweb-record.umd.cjs 184 kB 0 B
packages/rrweb/record/dist/rrweb-record.umd.min.cjs 88.1 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.cjs 443 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.js 443 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.umd.cjs 445 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.umd.min.cjs 211 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.cjs 150 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.js 149 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.umd.cjs 152 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.umd.min.cjs 70.8 kB 0 B
packages/rrweb/rrdom/dist/rrdom.cjs 174 kB 0 B
packages/rrweb/rrdom/dist/rrdom.js 173 kB 0 B
packages/rrweb/rrdom/dist/rrdom.umd.cjs 175 kB 0 B
packages/rrweb/rrdom/dist/rrdom.umd.min.cjs 80.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.cjs 33.9 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.js 32.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.umd.cjs 55.1 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.umd.min.cjs 26.3 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.cjs 138 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.js 137 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.umd.cjs 161 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.umd.min.cjs 74 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.cjs 2.27 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.js 1.42 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.umd.cjs 219 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.umd.min.cjs 92.5 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.cjs 18.3 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.umd.cjs 18.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.umd.min.cjs 9.31 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.js 17.8 kB 0 B
packages/rrweb/rrweb/dist/rrweb.cjs 608 kB 0 B
packages/rrweb/rrweb/dist/rrweb.js 608 kB 0 B
packages/rrweb/rrweb/dist/rrweb.umd.cjs 608 kB 0 B
packages/rrweb/rrweb/dist/rrweb.umd.min.cjs 287 kB 0 B
packages/rrweb/types/dist/rrweb-types.cjs 5.75 kB 0 B
packages/rrweb/types/dist/rrweb-types.js 5.46 kB 0 B
packages/rrweb/types/dist/rrweb-types.umd.cjs 6.16 kB 0 B
packages/rrweb/types/dist/rrweb-types.umd.min.cjs 2.86 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.cjs 6.41 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.js 5.95 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.umd.cjs 6.82 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.umd.min.cjs 3.51 kB 0 B
packages/types/dist/capture-log.js 603 B 0 B
packages/types/dist/capture-log.mjs 0 B 0 B 🆕
packages/types/dist/capture.js 603 B 0 B
packages/types/dist/capture.mjs 0 B 0 B 🆕
packages/types/dist/common.js 603 B 0 B
packages/types/dist/common.mjs 0 B 0 B 🆕
packages/types/dist/feature-flags.js 603 B 0 B
packages/types/dist/feature-flags.mjs 0 B 0 B 🆕
packages/types/dist/index.js 603 B 0 B
packages/types/dist/index.mjs 0 B 0 B 🆕
packages/types/dist/posthog-config.js 603 B 0 B
packages/types/dist/posthog-config.mjs 0 B 0 B 🆕
packages/types/dist/posthog.js 603 B 0 B
packages/types/dist/posthog.mjs 0 B 0 B 🆕
packages/types/dist/request.js 603 B 0 B
packages/types/dist/request.mjs 0 B 0 B 🆕
packages/types/dist/segment.js 603 B 0 B
packages/types/dist/segment.mjs 0 B 0 B 🆕
packages/types/dist/session-recording.js 603 B 0 B
packages/types/dist/session-recording.mjs 0 B 0 B 🆕
packages/types/dist/survey.js 603 B 0 B
packages/types/dist/survey.mjs 0 B 0 B 🆕
packages/types/dist/toolbar.js 603 B 0 B
packages/types/dist/toolbar.mjs 0 B 0 B 🆕
packages/types/dist/tree-shakeable.js 603 B 0 B
packages/types/dist/tree-shakeable.mjs 0 B 0 B 🆕
packages/web/dist/index.cjs 13.9 kB 0 B
packages/web/dist/index.mjs 13.8 kB 0 B
packages/webpack-plugin/dist/config.js 1.47 kB 0 B
packages/webpack-plugin/dist/config.mjs 480 B 0 B
packages/webpack-plugin/dist/index.js 5.38 kB 0 B
packages/webpack-plugin/dist/index.mjs 2.04 kB 0 B
tooling/changelog/dist/index.js 3.31 kB 0 B
tooling/rollup-utils/dist/index.js 1.17 kB 0 B

compressed-size-action

mendral-app[bot]

This comment was marked as outdated.

- guard maxSessionSizeMb against non-finite values explicitly (Number.isFinite)
  rather than relying on the downstream !maxBytes falsy check
- name the 1/500 MiB bounds (MIN/MAX_SESSION_SIZE_MB) and BYTES_PER_MIB instead
  of bare magic numbers
- add overshootBytes to $session_size_rotation so the (multi-tab undercount
  driven) late firing is observable
- document that rotation fires session-change handlers synchronously and they
  must not flush, and that maxSessionSizeMb=0 clamps to 1 rather than disabling

Generated-By: PostHog Code
Task-Id: b9b6f524-7f9d-421a-9b47-8e7131dd8536
@pauldambra

Copy link
Copy Markdown
Member Author

Note

🤖 Automated comment by QA Swarm — not written by a human

Multi-perspective review: qa-team (specialists), paul-reviewer, xp-reviewer. security-audit skipped (no security surface in this diff).

Verdict: 💬 APPROVE WITH NITS

Sound, well-scoped change — reuses the existing $session_ending/$session_starting linking and the change-reason vocabulary rather than inventing new machinery, and minting a linked session (instead of resetSessionId(), which would read as a posthog.reset() and suppress linking) is the correct approach. No correctness blocker for this PR.

Actioned in 55f530cf

  • 🟢 maxSessionSizeMb now guarded with Number.isFinite (an isNumber(NaN) slipped past, working only by the downstream falsy check).
  • 🟡 named the 1/500 MiB bounds + BYTES_PER_MIB (were bare magic numbers).
  • 🟡 added overshootBytes to $session_size_rotation so the late-firing (from the multi-tab undercount) is observable in prod.
  • 🟢 documented that rotation fires session-change handlers synchronously (must not flush, or it re-enters), and that maxSessionSizeMb: 0 clamps to 1 rather than disabling.

Deferred for team-replay's judgement

  • 🟠 OnceAndOnlyOnce (xp): rotateSessionForReplaySize() re-spells the rotation core (generate ids → set → reset idle → fire handlers) that also lives in checkAndGetSessionAndWindowId. A shared _rotateSession(changeReason) would be cleaner — deferred because the existing path interleaves idle / cross-tab / readOnly / activity-timestamp logic, so a clean extraction touches the critical session-read hot path and deserves a maintainer's eye.
  • 🟠 Multi-tab double-rotation (qa-team): two tabs of one session share the localStorage flushed-size counter, so both can cross the budget and each rotate — two $session_starting events, racing writes, and a window where the non-rotating tab emits under a stale id. This is the same shared-counter limitation already accepted as "relatively correct"; a proper fix needs cross-tab coordination (bigger scope). Deferred as a known limitation for a guardrail.
  • 🟡 $session_size_rotation attribution (qa-team): the marker is added old-tagged into a buffer that's then re-tagged to the new session, so it may ingest under the new session. Minor (debug marker); worth confirming against the server-side capture path.
  • 🟢 Remote-config kill switch (qa-team): no server-side override yet, so misbehaviour can only be mitigated by an SDK release. Already noted as a follow-up in the PR description.

Convergence (highest confidence)

  • The synchronous-handler / re-entrancy concern was raised independently by qa-team and paul → addressed with a documenting comment (and it mirrors the existing rotation path, so it's not new risk).
  • The magic-number / bounds-naming point was raised by xp and paul → actioned.

(Note: paul asked for a test that rotation does not suppress linking — already covered by emits session linking events on session maximum size.)

Reviewer summaries

Reviewer Assessment
🔍 qa-team Design sound; single-tab re-entrancy/loop concerns don't hold. Multi-tab double-rotation + marker attribution worth attention; rest is hardening.
👤 paul High trust; worries are coupling + observability, not correctness — wanted the overshoot graphable (done) and the load-bearing ordering explained.
📐 xp Follows the grain; the one real pull is the OnceAndOnlyOnce duplication with the existing rotation core — extract a shared minter.

Automated by QA Swarm — not a human review

@mendral-app mendral-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs attention — 1 issue in 1 file

The logic and design remain solid after the refactor commit. The Number.isFinite guard, named constants, and overshootBytes addition are clean improvements. However, CI is still failing for the same reason I flagged previously: terser-mangled-names.json needs regeneration. This is blocking merge.

What this PR does

Adds size-based session rotation for replay recordings with a configurable maxSessionSizeMb option (default 300 MiB under 2026-05-30 defaults, clamped 1–500). The second commit adds Number.isFinite guard, named constants, overshootBytes in the custom event, and improved documentation.

Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.

<assessment>
The logic and design remain solid after the refactor commit. The `Number.isFinite` guard, named constants, and `overshootBytes` addition are clean improvements. However, CI is still failing for the same reason I flagged previously: `terser-mangled-names.json` needs regeneration. This is blocking merge.
</assessment>

<file name="packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts">
<issue location="packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts:505">
CI still failing: `Write mangled property names` job fails at `git diff --exit-code` because `_maxSessionSizeBytes` and `_maybeRotateForSessionSize` are not in `terser-mangled-names.json`. Run the build (`pnpm build` in `packages/browser`) and commit the regenerated file. This was flagged in the previous review and remains unaddressed.
</issue>
</file>

Tag @mendral-app with feedback or questions. View session

}
const clampedMb = Math.min(MAX_SESSION_SIZE_MB, Math.max(MIN_SESSION_SIZE_MB, configuredMb))
return clampedMb * BYTES_PER_MIB
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug (P2): CI still failing: Write mangled property names job fails at git diff --exit-code because _maxSessionSizeBytes and _maybeRotateForSessionSize are not in terser-mangled-names.json. Run the build (pnpm build in packages/browser) and commit the regenerated file. This was flagged in the previous review and remains unaddressed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts, line 505:

<issue>
CI still failing: `Write mangled property names` job fails at `git diff --exit-code` because `_maxSessionSizeBytes` and `_maybeRotateForSessionSize` are not in `terser-mangled-names.json`. Run the build (`pnpm build` in `packages/browser`) and commit the regenerated file. This was flagged in the previous review and remains unaddressed.
</issue>

@pauldambra pauldambra marked this pull request as draft June 18, 2026 06:44
@pauldambra pauldambra removed the request for review from a team June 18, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants