fix(rds-postgres-server): skip db_name check on unlink of never-created link#13
Merged
jcastiarena merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
…ed link When a link transitions to a failed state before fully materializing, its .link.attributes never receives the db_name parameter. Subsequent unlink actions then hit `ERROR: db_name is required to create a link` and the link gets stuck — user cannot retry nor remove it cleanly. Mirror the pattern from rds-postgres-db/scripts/aws/build_context (which sets LINK_NEVER_CREATED=true when .type == "delete" and there is no server hostname): on a delete action with missing db_name, log a warning and exit cleanly instead of failing the unlink workflow. The error is preserved for create/link actions, where missing db_name is still a user error. Reproduced on the Galicia POC (CLIEN-759): a second link test with invalid parameters left the link in failed state; the unlink could never clean it up. Pairs with #12 (TFSTATE_BUCKET propagation). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build_permissions_contextfails withERROR: db_name is required to create a linkwhen an unlink runs against a link that was never fully materialized — e.g. the create-link workflow failed partway through, so.link.attributesnever receiveddb_name. The link is then stuck: it can't retry, and it can't be cleaned up without manual state surgery.Fix
Mirror the pattern already used by
rds-postgres-db/scripts/aws/build_context, which handles the equivalent case withLINK_NEVER_CREATED=truewhen.type == "delete". For the server script, the minimal equivalent is: on adeleteaction with missingdb_name, log a warning and exit cleanly instead of failing.The error path is preserved for
create/linkactions — missingdb_namethere is still a real user error and should fail fast.Repro
Exercised on the Galicia POC (CLIEN-759):
rds-postgres-servercreated successfully.failedwith nodb_namein.link.attributes.ERROR: db_name is required to create a link.With this change, step 3 emits a
WARNING: unlink without db_name — link likely never fully created. Exiting cleanly.and returnsexit 0, allowing the link to be removed.Test plan
rds-postgres-serverand trigger a link with an invaliddb_nameto force a failed linkdb_namepresent in attributes) and confirm unchanged behaviorRelated
fix(rds-postgres-server): propagate TFSTATE_BUCKET through link/unlink workflows. Same module, adjacent file region, independent root cause. Can merge in any order; a trivial rebase may be needed for whichever lands second.🤖 Generated with Claude Code