fix(wfctl): isIaCNotFound — gRPC string fallback for adoption#734
Merged
Conversation
Adoption ("look up, fall back to create" for adopt_existing
resources) calls driver.Read and expects to skip on
ErrResourceNotFound. For remote gRPC-bridged plugins the typed
adapter loses sentinel identity across the wire — `errors.Is`
returns false even though the wrapped string is the canonical
ErrResourceNotFound.Error() ("iac: resource not found").
Result: workflow-plugin-digitalocean v2 database adoption fails
every apply with "rpc error: code = Unknown desc = database
\"multisite-pg\": iac: resource not found".
Add a substring fallback to isIaCNotFound that matches the
canonical sentinel message. Native typed-sentinel + platform-typed
paths still handled first. 4 tests cover all branches.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Improves wfctl infra apply adoption behavior by reliably treating certain remote-plugin Read() failures as “not found”, even when the gRPC boundary flattens the original sentinel error such that errors.Is no longer matches.
Changes:
- Extend
isIaCNotFoundto fall back to substring matching oninterfaces.ErrResourceNotFound.Error()after typed checks. - Add unit tests covering typed sentinel detection, gRPC-flattened string detection, nil safety, and non-matching errors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/wfctl/infra_apply.go | Adds a string-based fallback to detect “resource not found” across gRPC-flattened errors so adoption can safely fall back to create. |
| cmd/wfctl/infra_apply_isiacnotfound_test.go | Adds focused unit coverage for isIaCNotFound across sentinel, gRPC-string, nil, and unrelated error cases. |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Adoption falls back to create when driver.Read says not-found. For remote gRPC plugins the typed adapter loses sentinel identity, so errors.Is fails. Substring fallback restores the adoption path. 4 unit tests.