Skip to content

fix: return underlying error in EnsureMigrationTable instead of swallowing it - #164

Merged
sinmetal merged 1 commit into
cloudspannerecosystem:masterfrom
TangoEnSkai:fix/ensure-migration-table-error-handling
Sep 29, 2026
Merged

sinmetal merged 1 commit into
cloudspannerecosystem:masterfrom
TangoEnSkai:fix/ensure-migration-table-error-handling

Conversation

@TangoEnSkai

Copy link
Copy Markdown
Contributor

Context

EnsureMigrationTable probes for the migration table with a Read, and
treats any non-nil error from that read as "table does not exist,"
unconditionally falling through to CREATE TABLE.

What

Only treat a codes.NotFound error as "table does not exist." Any other
error (e.g. permission denied, deadline exceeded) is now returned wrapped
in the existing Error type instead of being swallowed.

Why

If the read fails for a reason other than "table not found" (permission
error, timeout, etc.), wrench used to silently ignore that real error and
attempt to create the table anyway — which then fails with a confusing or
misleading error instead of surfacing the actual problem, exactly as
described in the issue.

Completion Criteria

  • go build ./... and go vet ./... pass
  • Existing TestEnsureMigrationTable (both "table already exists" and
    "table does not exist" cases) continues to pass the same behavior
  • CI (Spanner emulator integration tests) passes

close #114

…owing it

EnsureMigrationTable treated any read error as "table does not exist"
and unconditionally attempted to create the migration table. This
masked real failures such as permission errors or deadlines, since
the CREATE TABLE call would then fail with a confusing or misleading
error instead of the original one.

Now only a NotFound error is treated as "table does not exist"; any
other error is returned wrapped in the existing Error type.

Fixes cloudspannerecosystem#114
@google-cla

google-cla Bot commented Aug 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@TangoEnSkai

Copy link
Copy Markdown
Contributor Author

CLA signed. All checks (cla/google, test, scan-pr, check-changes) are now passing.

@TangoEnSkai

Copy link
Copy Markdown
Contributor Author

@sinmetal @utahta could one of you take a look when you have a moment? All checks are green. Thanks!

@TangoEnSkai

Copy link
Copy Markdown
Contributor Author

Following up on this error-handling fix: the PR is still mergeable, with the test, security scan, and CLA checks passing. @sinmetal @utahta could you review when convenient, or let me know if any changes would help move it forward? Thanks!

@sinmetal
sinmetal self-requested a review September 29, 2026 07:54
@sinmetal

Copy link
Copy Markdown
Collaborator

@TangoEnSkai Sorry for the delay in reviewing. Thank you for your contribution.

@sinmetal
sinmetal merged commit 61195b1 into cloudspannerecosystem:master Sep 29, 2026
8 checks passed
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.

EnsureMigrationTable ignores an error

2 participants