fix(data-imports): recognize DeltaError as a transient object-store error - #73454
Conversation
|
Hey @Gilbert09! 👋 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.
Low-risk fix broadening a transient-error classifier to also match DeltaError alongside OSError, in best-effort maintenance logging code that doesn't gate the actual sync; change matches the PR description, is well-tested, and author is on the owning team with STRONG familiarity in these exact files.
- Author wrote 100% of the modified lines and has 40 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 20L, 1F substantive, 39L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (39L, 2F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 2090a5a · reviewed head c0ecbd1 |
c0ecbd1 to
4e2fe4f
Compare
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Small, well-tested broadening of an error classifier for a best-effort maintenance path; no risky territory touched, author owns the code with full familiarity.
- Author wrote 100% of the modified lines and has 45 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 15L, 1F substantive, 34L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (34L, 2F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ bf342ab · reviewed head 4e2fe4f |
a03b0fe to
033d0ad
Compare
|
Thanks — this finding is on 🦉 via talyn.dev |
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Small, well-tested fix broadening an error classifier to also recognize DeltaError for the same transient S3 throttling text; no risky territory (no schema/API/auth/billing/CI changes), diff matches description, and the only flagged comment concerns an unrelated file not touched by this PR.
- Author wrote 100% of the modified lines and has 13 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 15L, 1F substantive, 34L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (34L, 2F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 7c4151e · reviewed head 033d0ad |
…rror `is_transient_object_store_error` only matched `OSError`, but delta-rs's table-level ops (`vacuum()`, `optimize.compact()`) wrap the same S3 error text in `deltalake.exceptions.DeltaError` instead, so an S3 SlowDown throttling blip during pre-write maintenance fell through to `capture_exception` instead of being logged as a warning. Generated-By: PostHog Code Task-Id: 36ba5ca6-7bdb-499b-805e-762d0600b738
033d0ad to
aa220eb
Compare
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
|
/trunk merge |
There was a problem hiding this comment.
Small, contained fix broadening an exception classifier for self-healing S3 throttling errors in best-effort maintenance code; author owns this area with strong familiarity, tests were extended to cover the exact bug, and the unrelated security finding raised in comments is on a different file that merely passed through via a master merge, not part of this diff.
- Author wrote 100% of the modified lines and has 20 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 15L, 1F substantive, 35L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (35L, 2F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ c033211 · reviewed head aa220eb |
CI status: blocked by an unrelated master regression, not by this PRThis branch is rebased cleanly on top of latest
The root failure is entirely unrelated to this PR (which only touches
This reproduces identically on Nothing to fix in this PR. Holding here until the parser regression is resolved on 🦉 via talyn.dev |
…ssification Generated-By: PostHog Code Task-Id: b6b9ce1a-4805-483f-ba80-1cfca8ed089c
|
Update: the 🦉 via talyn.dev |
Problem
Error tracking surfaced a
DeltaErrorfromrun_pre_write_defensive_compactinproducts/warehouse_sources/backend/temporal/data_imports/pipelines/common/extract.py, during a Postgres incremental sync's pre-write maintenance pass (issue).The call path:
run_pre_write_defensive_compact->DeltaTableHelper.run_maintenance->vacuum_if_stale->vacuum_table-> delta-rs'stable.vacuum(), which needs to read a_delta_logmanifest from S3. S3 responded with itsSlowDownthrottling error (503 Service Unavailable), and after exhausting delta-rs's internal retries the failure surfaced as aDeltaError.This module already has a classifier for exactly this situation,
is_transient_object_store_error, used byrun_pre_write_defensive_compactto log a warning instead of capturing an error-tracking issue for a self-healing S3 blip (the docstring explicitly calls out that a maintenance failure must never block the actual sync). The problem: the classifier only recognizedOSError, because that's the exception typeDeltaTable.is_deltatable()raises for this same class of object-store error. Other table-level operations —vacuum(),optimize.compact()— wrap the identical underlying error text indeltalake.exceptions.DeltaErrorinstead. Same transient blip, different Python exception type depending on which delta-rs entry point hit it, so the vacuum path's throttling error fell through tocapture_exceptionand generated a noisy error-tracking issue for something that isn't a bug.This is best-effort maintenance code, so the sync itself was never at risk — this only affects whether a self-healing throttling blip gets reported as a defect.
Changes
is_transient_object_store_errorindelta_table_helper.pyto also matchdeltalake.exceptions.DeltaErrorinstances, not justOSError, against the same substring list.How did you test this code?
Extended the existing parameterized
test_logs_transient_object_store_error_without_capturingintest_extract.pywith aDeltaError-wrapped case carrying the same S3 SlowDown error text — this is exactly the shape of the bug this PR fixes: without the classifier change, this case would fall through tocapture_exceptionlike the plainRuntimeErrorcase intest_swallows_maintenance_failureabove it.Ran:
uv run pytest products/warehouse_sources/backend/temporal/data_imports/pipelines/common/test/test_extract.py -k TestRunPreWriteDefensiveCompact— 8 passeduv run mypy --cache-fine-grained .(repo-wide, as CI runs it) — cleanruff check --fix/ruff format— cleanhogli ci:preflight --fix— 0 failuresAutomatic notifications
Docs update
N/A — internal error-classification change, no user-facing behavior change.
🤖 Agent context
Autonomy: Fully autonomous
Triaged directly from the linked error-tracking issue via PostHog's error-tracking MCP tools (
query-error-tracking-issue,query-error-tracking-issue-events), which surfaced the full stack trace and confirmed the failure originates in the vacuum step of pre-write maintenance, not the Postgres source connector. Confirmeddeltalake.exceptions.DeltaErrorisn't a subclass ofOSErrordirectly against the installeddeltalakepackage before concluding this was the gap.Checked for duplicate open PRs by exception type, message phrase, module path, and the maintainer's own open PR queue. Found two related-but-non-overlapping fixes in the same file: #73386 (classifies
django.dbconnection errors as transient, a different exception source) and #73407 (adds S3SlowDowntext to the transient-error substring list, for thereset_table/_purge_s3_prefixpath, still gated onisinstance(error, OSError)) — neither touches theOSError-vs-DeltaErrorgap this PR closes.Invoked
/writing-testsbefore extending the regression test.Created with PostHog Code