noticeEmbedderBackendIgnored function

void noticeEmbedderBackendIgnored(
  1. PreferredBackend? requested
)

Says out loud that getActiveEmbedder(preferredBackend:) did not reach the embedder, from ONE place that every shell calls.

It lives here rather than in a backend because a backend cannot see the singleton cache: the shells serve a second getActiveEmbedder from the cached instance without calling createModel at all, so a notice inside a backend is unreachable in the most ordinary sequence — build an embedder, then ask for one with a backend.

CPU is not a fallback here and this is not a warning about degradation: it is the only correct answer, because LiteRT's GPU delegate returns all-zero vectors for EmbeddingGemma's int4 weights and the ONNX client appends no execution provider. What was wrong was accepting the argument in silence.

Implementation

void noticeEmbedderBackendIgnored(PreferredBackend? requested) {
  if (!ActiveEmbedderParams.isIgnoredBackend(requested) || _warned) return;
  // Spend the one shot only on a line that can actually appear. `gemmaLog`
  // returns early in a release build and when the level is `none`, and the
  // level is public API — so setting the flag first turned "say it once" into
  // "suppress once" for an app that starts silent and raises the level later
  // to debug exactly this.
  if (!kDebugMode || gemmaLogLevel == GemmaLogLevel.none) return;
  _warned = true;
  gemmaLog(
    'ℹ️  Embeddings run on CPU: preferredBackend ${requested!.name} is not '
    'applied. Read EmbeddingModel.activeBackend for the backend in use — it '
    'is available in release builds, where this line is not.',
  );
}