Skip to content

fix(data-warehouse): pin mark_primed streak-reset test to its run generation - #69839

Merged
EDsCODE merged 2 commits into
masterfrom
fix/duckgres-mark-primed-run-generation-test
Jul 9, 2026
Merged

fix(data-warehouse): pin mark_primed streak-reset test to its run generation#69839
EDsCODE merged 2 commits into
masterfrom
fix/duckgres-mark-primed-run-generation-test

Conversation

@EDsCODE

@EDsCODE EDsCODE commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

Master is red. test_backfill.py::TestFailureStreak::test_mark_primed_resets_streak fails with:

TypeError: mark_primed() missing 1 required keyword-only argument: 'run_uuid'

Two PRs landed back to back and collided semantically, which no merge conflict caught:

#69101's CI ran against a master that predated #68785, so nothing ever exercised the two together. Both are green in isolation and broken in combination.

Every open PR branched off master inherits the failure, so this blocks the rest of the duckgres sink stack.

Changes

Pin the test to a run generation, matching how mark_primed is now called in production. The state row gets a backfill_run_uuid, and the call passes the matching run_uuid so the CAS actually matches.

 DuckgresSinkSchemaState.objects.filter(id=candidate.id).update(
-    consecutive_failures=5, first_failed_at=timezone.now(), last_error="boom"
+    backfill_run_uuid="run-1",
+    consecutive_failures=5,
+    first_failed_at=timezone.now(),
+    last_error="boom",
 )

-backfill_module.mark_primed(str(candidate.schema_id))
+backfill_module.mark_primed(str(candidate.schema_id), run_uuid="run-1")

Test-only. No production code changes.

Note

The test's intent is unchanged: promotion to PRIMED resets the failure streak. It now just supplies the generation that mark_primed requires, rather than relying on the old unpinned signature.

How did you test this code?

I (Claude) ran these automated tests. I did not do any manual testing.

  • Reproduced the failure on a clean origin/master worktree with no local changes, confirming this is a master breakage and not a branch artifact.
  • test_backfill.py on this branch: 29 passed (was 1 failed on master).
  • Full pipeline_v3/duckgres/ suite: 115 passed. On master the same run gave 114 passed, 1 failed, 1 error. The error was a teardown cascade from the failure, not a second defect. It passes in isolation on master.
  • Mutation check, to confirm the test still earns its place rather than just satisfying the new signature: removing **_STREAK_RESET_UPDATES from mark_primed makes the test fail on the assertion, as it should.

No new test is added here. This restores an existing test that catches a real regression: a promotion that silently leaves consecutive_failures and first_failed_at set, which would keep a healed schema classified as failing.

Automatic notifications

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

Docs update

Not applicable. Test-only change with no user-facing or documented behavior.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude (Claude Code, Opus 4.8) found this while bringing a stack of duckgres sink PRs up to date with master and driving their CI green. It surfaced when merging master into #68808: the merged tree failed a test that neither branch had touched. Running the same test against a clean origin/master checkout isolated it to master itself.

The fix was scoped deliberately. mark_primed's new run_uuid requirement is correct and intentional (#69101 added it to stop a retired run's late promotion from flipping a newer run's row), so the production signature is left alone and the stale call site is updated instead. I considered giving run_uuid a default to unbreak the call site, and rejected it: a defaultable generation pin defeats the CAS that #69101 exists to enforce.

The commit was first made on the #68808 branch, then split out and cherry-picked onto master so it can land on its own rather than waiting behind that PR. #68808 was independently force-pushed mid-work, so nothing from that branch is carried here.

Skills invoked: /django-migrations (while resolving an unrelated max_migration.txt conflict on #68808; no migration is touched in this PR).

Worth a reviewer's eye: master's product-test shards were still in progress when this was opened, so the breakage may not have surfaced on the master run yet. It reproduces locally on origin/master at c0067304c.

…eration

69101 made mark_primed CAS on backfill_run_uuid, but the call site added by
68785 was never updated — the two merged in sequence and left master red.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EDsCODE EDsCODE self-assigned this Jul 9, 2026
@EDsCODE EDsCODE added the skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs label Jul 9, 2026
@EDsCODE
EDsCODE marked this pull request as ready for review July 9, 2026 22:18
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 9, 2026 22:19
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(data-warehouse): pin mark_primed str..." | Re-trigger Greptile

@EDsCODE
EDsCODE enabled auto-merge (squash) July 9, 2026 22:28
…t fix

69025 landed the same one-line fix with a different argument layout. Making the
two byte-identical means whichever merges first, the other auto-merges instead
of conflicting in this hunk.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 9, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@EDsCODE
EDsCODE disabled auto-merge July 9, 2026 23:14
@EDsCODE
EDsCODE merged commit 3083698 into master Jul 9, 2026
187 of 205 checks passed
@EDsCODE
EDsCODE deleted the fix/duckgres-mark-primed-run-generation-test branch July 9, 2026 23:30
@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 23:51 UTC Run
prod-us ✅ Deployed 2026-07-10 00:04 UTC Run
prod-eu ✅ Deployed 2026-07-10 00:08 UTC Run

fercgomes pushed a commit that referenced this pull request Jul 10, 2026
… streak-reset test"

This fix is unrelated to the wizard PR-ready email feature and is already landed properly upstream on master (#69839). Reverting so this branch doesn't carry a duplicate/out-of-scope change; the next merge from master picks up the real fix.

Generated-By: PostHog Code
Task-Id: 2e8e65a4-30b1-41ff-b086-1fd0ac10d64a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants