Skip to content

fix(bigquery-firestore-export): stop retrying deploy-time misconfigurations - #2983

Open
IzaakGough wants to merge 3 commits into
kitsfrom
fix/bfe-fail-fast-upsert
Open

fix(bigquery-firestore-export): stop retrying deploy-time misconfigurations#2983
IzaakGough wants to merge 3 commits into
kitsfrom
fix/bfe-fail-fast-upsert

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Aug 26, 2026

Copy link
Copy Markdown

What was broken

upsertTransferConfig retried five times over 2.5 minutes before dead-lettering, even for failures no retry can fix: a missing TRANSFER_CONFIG_NAME, a stored config document with no name, an unparseable transfer config, a scheduled query deleted out from under a stored document, and any param that fails validation. The logs never said what to change.

What changed

Those paths throw PermanentConfigurationError. handleUpsertTransferConfig catches only that type, logs it at error level and returns, so Cloud Tasks sees a 2xx and stops. Everything else still throws and still retries.

How it was verified

32 unit tests and a clean build. Deployed to a real project, attempts counted in Cloud Logging:

Case Baseline b8cc1113 Head
Blank DATASET_ID 5 attempts, HTTP 500 1 attempt, HTTP 204
Vanished transfer config 5 attempts, HTTP 500 not deployed
Happy path not deployed run output reached Firestore

Notes

Treating a vanished config as permanent matches the client's retry policy: GetTransferConfig retries on DEADLINE_EXCEEDED and UNAVAILABLE only, so a transient blip surfaces as one of those and still retries.

The extension reported these through the Extensions runtime, so the message showed in the console. Kits have lifecycle hooks but no status channel, since setProcessingState is scoped to an extension instance via EXT_INSTANCE_ID. The message goes to Cloud Logging at error level with the remediation steps in it, so a deploy that stops without acting is easier to miss.

PARTITIONING_FIELD is also on the permanent list, but that guard is itself wrong (#2985). Not fixed here.

Tracked in #2974 (parity analysis), rows 7a to 7c.

…ations

The upsert task retried every failure five times before dead-lettering,
including misconfigurations that no retry can fix, such as clearing
PARTITIONING_FIELD on an existing transfer config. Cloud Tasks retries
any non-2xx and the lifecycle task has no deploy-status channel, so
those paths now throw PermanentConfigurationError, which the handler
logs at error level before returning.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new PermanentConfigurationError to handle deploy-time misconfigurations that cannot be resolved by retrying, preventing unnecessary Cloud Tasks retries. It refactors error handling in dts.ts and handlers.ts to throw this new error and gracefully abort execution, and adds corresponding unit tests. The reviewer suggests also updating the transfer config lookup failure in constructUpdateTransferConfigRequest to throw PermanentConfigurationError instead of a generic Error to fully align with this goal.

Comment thread kits/bigquery-firestore-export/src/dts.ts
…s permanent

Building the handler context ran outside the upsert catch, so every param
validation error was retried five times before dead-lettering. The context
now arrives as a factory and resolveConfig reports validation failures as
PermanentConfigurationError.

A vanished transfer config threw a bare error from the update path and was
retried the same way. It now names the stale config document and what to
do about it.
… failures

The invalid-structure error told users to point TRANSFER_CONFIG_NAME at a
scheduled query or clear it, but that path only runs when the param is already
unset, so following the advice changed nothing. It now says to delete the
deployment's document from the configs collection.

The linked-config-not-found error offered to clear the param so the deployment
creates its own. Clearing it alone sends a previously linked config, which
storeTransferConfig stamped with extInstanceId, down the update branch and
rewrites its query, schedule and topic. The message now names the document that
also has to be deleted.
@IzaakGough
IzaakGough marked this pull request as ready for review August 27, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants