fix: draw the API key once, and let status answer the dimensions question
Release / release (push) Successful in 6s

Two things a user setting this up hit immediately.

The card drew `embeddingApiKey` twice. The render loop walked every entry in
FIELDS, and the secret — which is drawn by hand, as a write-only password
control — was one of them, so a second control appeared beside it: an ordinary
text input, echoing the key in clear as you typed. One key, two boxes, one of
them visible. The loop skips secrets now, and the tests count controls rather
than checking that each expected label is present, because a duplicate beside
the real control passed the old assertions.

`status` could not answer the one question a new user cannot look up: how wide
is this model? The probe that reports it was gated on every required setting
being present, so in exactly the state that needs the answer — dimensions
unset — it reported nothing and said "Missing: embedding_dimensions". It now
runs whenever the endpoint can be named (a model and a base URL), and the
status message names the width it observed:

  Missing: embedding_dimensions. The endpoint is reachable and returned 768
  dimensions, so set embeddingDimensions to 768.

The probe also tells "not set yet" apart from "set wrong", because the two have
different remedies.

Also documents both ways to read the width by hand, since a wrong value is
frozen into the index at first use and costs a full re-embed to correct.
This commit is contained in:
dsh-slopo agent committed 2026-09-26 07:05:36 +01:00
1 parent 85c0d4dccd
commit 9ebd484e60
7 files changed
+142 -7

No files matched your search

+22
View File
@@ -632,6 +632,28 @@ test('the API key is a write-only password control that reports only whether one
assert.match(findAll(tree, (node) => node.props['data-state'] === true).map((node) => node.children.join('')).join(''), /A key is stored/)
})
test('the API key has exactly one control, and it is never a plain text field', () => {
// The regression: the render loop walked every entry in FIELDS, so the secret
// drew a second control — an ordinary text input, echoing the key in clear —
// beside the write-only password control. One key, two boxes, one of them
// visible.
const { render } = registered()
const tree = render()
const labelled = findAll(tree, (node) => node.type === 'input' && node.props['aria-label'] === 'Embedding API key')
assert.equal(labelled.length, 1, 'the key must have exactly one control')
assert.equal(labelled[0].props.type, 'password')
})
test('the card draws one control per schema field, and no more', () => {
// A count, not a list of names: the label assertions above pass just as
// happily with a duplicate row sitting beside the real one.
const { render } = registered()
const controls = findAll(render(), (node) => node.type === 'input')
assert.equal(controls.length, 15, 'the schema declares 15 fields, so each gets one control')
const labels = controls.map((node) => node.props['aria-label'])
assert.equal(new Set(labels).size, labels.length, `duplicate controls: ${labels.join(', ')}`)
})
test('a deployment with no key says so', () => {
const { render } = registered({ secrets: [{ path: ['embeddingApiKey'], set: false }] })
const tree = render()