fix(data-warehouse): stop a repartition retry abandoning the table - #95956
Conversation
The attempt cap is charged before the rewrite runs, so on the sync run that charges the last attempt the stored count already reads the cap. That run's own Temporal retry read it as spent and gave up, which cleared the pending target, engaged the daily cooldown and reported RepartitionAttemptsExhausted, without the retry ever running the rewrite. The cap check now discounts a charge the current run made itself, so the last attempt gets its retries. A retry that fails cleanly still gives up at the cap, because the failure path counts the charge itself. Generated-By: PostHog Desktop Task-Id: 525d61af-596c-448f-8879-7bc0b96922f8
|
😎 Merged successfully - details. |
🤖 CI report
|
| File | Patch | Uncovered changed lines |
|---|---|---|
products/warehouse_sources/backend/temporal/data_imports/workflow_activities/repartition_table.py |
87.5% | 713 |
🤖 Agents: add a test covering the lines above, or note why under "How did you test this code?". Machine-readable gap list: the patch-coverage artifact on this run (gh run download 34109754203 -n patch-coverage), or the coverage-data block at the end of this comment.
Per-product line coverage (touched products)
| Product | Coverage | Lines |
|---|---|---|
warehouse_sources |
███████████████████░ 97.2% |
409,547 / 421,449 |
Report-only. Patch coverage = changed backend lines covered vs origin/master. Sorted lowest first.
Known gaps: lines covered only by Temporal tests show as uncovered; core line numbers may drift if master changed the same file.
There was a problem hiding this comment.
Approved.
Small, focused bugfix by an author on the owning team, with a new test covering the exact scenario described; no schema/API/security surface touched, and the only review comment is a bot that couldn't actually review (quota limit), not a substantive concern.
- Author wrote 0% of the modified lines and has 108 merged PRs in these paths (familiarity MODERATE).
- copilot-pull-request-reviewer[bot] reviewed the current head.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 19L, 1F substantive, 49L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (49L, 2F, single-area, fix) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ 1820958 · reviewed head 1820958 |
|
/trunk merge |
Problem
RepartitionAttemptsExhaustedwithfinal=true.Changes
charged_job_idagainst this run's job id.How did you test this code?
test_a_retry_inside_the_run_that_spent_the_cap_still_rewrites: it fails when the cap check ignores the current run's charge, which is the defect fixed here. Its siblingtest_retries_inside_one_sync_run_burn_a_single_attemptstarts from zero attempts, so no existing case reaches the cap inside one run.test_repartition_controller.pyitself. Its session setup needs ClickHouse, which this sandbox has no server for. The file collects, and CI runs it.Automatic notifications
Docs update
None. The README already describes the cap as consecutive failed sync runs, which is what this restores.
🤖 Agent context
Autonomy: Fully autonomous
warehouse_repartition_failedevents. The terminal one was anRepartitionAttemptsExhaustedgive-up, and reading the charge and give-up bookkeeping found the retry that never rewrites./writing-tests,/writing-code-comments,/writing-pr-descriptions.