fix(core): require explicit mock adapter construction#266
Open
besmpl wants to merge 2 commits into
Open
Conversation
Author
|
Stacked consumer preview: #268 at exact head The preview remains explicitly draft/non-mergeable and will be rebased to Android-only commits after this prerequisite lands. |
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
Remove only the implicit fabricated mock fallback:
core.NewInstancenow remains empty when no registered provider yields an adapterRequestAdapterreports that failure instead of returning a fabricated mock adapterNewInstanceWithMockhal/allbackendskeeps its current desktop software-backend registration behaviorThe public constructors and explicit fallback providers remain available.
Why
A configured provider set that yields no adapter could previously look like successful GPU initialization because core fabricated a test adapter. That masks loader, registration, and platform-support failures.
Failing closed makes provider availability observable while preserving explicit software and mock use.
Validation
Go 1.25.12:
go test ./core ./hal/allbackends .Go 1.26.5:
go test -race ./core .go vet ./core ./hal/allbackends .Focused tests cover empty-provider failure and explicit mock construction.
This correction is independent of the Android backend preview.
Android preview relationship
This Android-independent prerequisite is stacked into draft #268 at exact head
e97e4901ee76d9e5f587569c073b38114221c4e6. The draft will rebase it out after merge; Android runtime claims remain gated in that PR.