dashboard: fail Test Connection on an invalid embedding.dimensions

Merged
YI
5h ago
+87-12

Follow-up to the dashboard dimensions probe added in #893, raised by the review there after merge.

The bug

dimensions bounds were enforced with z.number().int().min(1).max(8192), so a user config can hold an invalid width. The Test Connection probe discarded such a value and tested the endpoint default, which reported success for a config the runtime has actually paused.

Verified against the real loader, not assumed: with embedding.dimensions set to 0, "768", 8193 or 1.5, loadPluginConfigDetailed returns loadOutcome: "schema-recovery" and recoveredFieldPaths: ["embedding.dimensions"]. That path satisfies affectsEmbeddingRegistration in embedding-bootstrap-helpers.ts, so isConfigLoadUntrusted is true and embedding-bootstrap.ts preserves the last-known-good registration — embeddings stop.

The change

  • New embedding-probe-dimensions.ts exports resolveProbeDimensions, returning either the width to send or an error message.
  • The probe reports that message and sends nothing when the value is invalid. The field is still omitted from the request only when it is unset, so the documented "unset means endpoint default" behavior is unchanged.
  • Tests cover the unset case, valid boundaries (1, 768, 8192), every rejected shape, and assert the bound matches the runtime schema by reading it, so the two cannot drift apart.

Files: packages/dashboard/src/components/ConfigEditor/{ConfigEditor.tsx, embedding-probe-dimensions.ts, embedding-probe-dimensions.test.ts}.

Verification

  • bun test src in packages/dashboard: 198 pass, 0 fail (4 new).
  • bun run typecheck: clean.
  • bunx biome check src: clean.

Refs #893


Summary by cubic

Fails the dashboard Test Connection probe when embedding.dimensions is invalid, instead of silently testing the endpoint default and reporting success for a config the runtime has paused.

  • Invalid widths (0, "768", 8193, 1.5) pause embedding registration at runtime, so the probe now reports an error before sending a request.
  • The field is omitted from the request only when unset, keeping the documented "unset means endpoint default" behavior unchanged.
  • Tests check the upper bound against the runtime schema by reading it, so the two cannot drift apart.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; invalid dimensions are rejected without changing valid or unset behavior.

Summary

Test Connection now rejects invalid embedding.dimensions before contacting the endpoint.

  • Test Connection stops when embedding dimensions are invalid.

No actionable issues were found. Review checks were static; tests were not run.

Reviews (1) · Last reviewed commit: "dashboard: fail Test Connection on an in..." · Reviewed by Greptile