Skip to content

fix(tests): stop replay listing tests leaking materialized columns - #69430

Merged
pauldambra merged 3 commits into
masterfrom
posthog-code/deflake-replay-listing-mat-columns
Jul 9, 2026
Merged

fix(tests): stop replay listing tests leaking materialized columns#69430
pauldambra merged 3 commits into
masterfrom
posthog-code/deflake-replay-listing-mat-columns

Conversation

@pauldambra

Copy link
Copy Markdown
Member

Problem

Saving: deflake — no wall-time claim. Three tests in test_session_recording_list_from_query.py call materialize() directly and never drop the columns, so any second pytest run against the same ClickHouse schema fails 16 snapshot tests (queries suddenly compile against the leaked pmat_email/mat_pp_* columns). CI never sees it (fresh ClickHouse per run); local reuse-db runs always did.

Changes

Register cleanup_materialized_columns as an addCleanup at the three direct-materialize() sites.

How did you test this code?

Repeated suite runs against a reused ClickHouse schema now pass 209/209 with zero leaked columns (previously the second run always failed 16).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

Test infrastructure only.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Split out of #69256 at Paul's request (one change per PR). Authored by Claude Code (PostHog Code cloud task).

Three tests materialize columns directly (not via the
also_test_with_materialized_columns decorator) and never dropped them,
so any later pytest run against the same ClickHouse schema failed 16
snapshot tests: queries suddenly compiled against the leaked
pmat_email/mat_pp_* columns. Register cleanup_materialized_columns as
an addCleanup at each site. CI never saw this (fresh ClickHouse per
run); local reuse-db runs did.

Generated-By: PostHog Code
Task-Id: 45d30bbb-88fc-4b36-ab27-c542ca039af9
@pauldambra pauldambra self-assigned this Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Hey @pauldambra! 👋

It looks like your git author email on this PR isn't your @posthog.com address (paul.dambra@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@pauldambra
pauldambra marked this pull request as ready for review July 8, 2026 18:41
@pauldambra pauldambra added the stamphog Request AI approval (no full review) label Jul 8, 2026
@pauldambra
pauldambra enabled auto-merge (squash) July 8, 2026 18:42
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested review from a team, TueHaulund, arnohillen, fasyy612 and ksvat and removed request for a team July 8, 2026 18:42

@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: a2b2e2d648

ℹ️ 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".

@github-actions github-actions 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.

Trivial, test-only fix adding cleanup calls to prevent materialized-column leakage between test runs; no production code or risky territory touched. The one unresolved comment is a cosmetic em-dash style nit, not a substantive concern.

  • chatgpt-codex-connector[bot] reviewed the current head.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 0L, 0F substantive, 10L/1F incl. docs/generated/snapshots — within ceiling
tier T0 auto-approve: T0-deterministic (10L, 1F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ 65c06e1 · reviewed head a2b2e2d

@trunk-io

trunk-io Bot commented Jul 8, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Playwright — all passed

All tests passed.

View test results →

@pauldambra
pauldambra merged commit 651ed89 into master Jul 9, 2026
233 checks passed
@pauldambra
pauldambra deleted the posthog-code/deflake-replay-listing-mat-columns branch July 9, 2026 14:13
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-09 15:12 UTC Run
prod-us ✅ Deployed 2026-07-09 15:43 UTC Run
prod-eu ✅ Deployed 2026-07-09 15:40 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant