Skip to content

fix(core): require explicit mock adapter construction#266

Open
besmpl wants to merge 2 commits into
gogpu:mainfrom
besmpl:besmpl/no-implicit-mock
Open

fix(core): require explicit mock adapter construction#266
besmpl wants to merge 2 commits into
gogpu:mainfrom
besmpl:besmpl/no-implicit-mock

Conversation

@besmpl

@besmpl besmpl commented Jul 15, 2026

Copy link
Copy Markdown

Summary

Remove only the implicit fabricated mock fallback:

  • core.NewInstance now remains empty when no registered provider yields an adapter
  • RequestAdapter reports that failure instead of returning a fabricated mock adapter
  • deterministic tests opt in with NewInstanceWithMock
  • existing explicit software/noop registration remains available
  • hal/allbackends keeps its current desktop software-backend registration behavior

The 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.

@besmpl besmpl requested a review from kolkov as a code owner July 15, 2026 15:59
@besmpl

besmpl commented Jul 15, 2026

Copy link
Copy Markdown
Author

Stacked consumer preview: #268 at exact head b11d2671e80081a191705c41c4e77e8b61472017 incorporates this PR's head e97e4901ee76d9e5f587569c073b38114221c4e6 (matching stable patch IDs).

The preview remains explicitly draft/non-mergeable and will be rebased to Android-only commits after this prerequisite lands.

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.

1 participant