fix(tests): stop replay listing tests leaking materialized columns - #69430
Conversation
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
|
Hey @pauldambra! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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 |
🤖 CI report |
Problem
Saving: deflake — no wall-time claim. Three tests in
test_session_recording_list_from_query.pycallmaterialize()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 leakedpmat_email/mat_pp_*columns). CI never sees it (fresh ClickHouse per run); local reuse-db runs always did.Changes
Register
cleanup_materialized_columnsas anaddCleanupat 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
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).