Skip to content

fix(platform): show the model ids Save sends after a source switch - #4315

Merged
yannickmonney merged 1 commit into
mainfrom
fix/model-allowlist-text-sync
Oct 4, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/model-allowlist-text-sync

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

A custom provider's credential form could show model IDs that Save would not store (#3664). Here is the reproduction:

  1. Edit a custom provider set to Enter model IDs, with alpha, beta.
  2. Switch Models to Discover from the endpoint and remove alpha.
  3. Switch back to Enter model IDs.

The field still read alpha, beta, but Save sent, and the server stored, ["beta"] only.

Cause. ProviderExtraFields renders the free-entry field and the catalog picker in the same child slot, so React keeps one ModelAllowlistField across the Models radio. The field's free-text draft came from useState(value.join(', ')), which is seeded once. When the picker changed the list, the draft never heard of it. The component comment assumed the opposite ("the dialogs unmount this field on close, so the draft can never go stale"). The add flow has the same root: on the custom entry, type IDs, switch to Discover, remove a chip, then switch back.

Fix: model-allowlist-field.tsx. The field shows its raw draft only while the draft still parses to the list it holds; otherwise it shows the list itself. Typing resyncs the draft, so in-progress commas (alpha, beta,) survive as before, and a trip through the picker that changes nothing leaves the draft alone. There is no effect, no state set during render, and no key at the call site, so the guarantee lives in the component for every caller. The adapter's private sameList moves next to the field, so the list comparison has one copy.

Manual layer. The SET-F43 row in reference/automation.md now names this behaviour and the new spec.

Checklist

  • bun run check passes (format, lint, typecheck, all tests). Not run locally: a whole-workspace run exceeds this 4 GiB sandbox. The scoped equivalents under Test plan pass, and CI runs the full gate.
  • bun run lint:sast passes (Opengrep). I ran the pinned v1.22.0 via tools/opengrep/run.sh on the 4 changed code files: 162 rules, 0 findings. The pre-commit hook passed too.
  • Translations: N/A. No user-visible string was added, changed or removed, and no catalog changed.
  • Docs: N/A. docs/*/platform/admin/providers.md already says Enter model IDs lists the exact IDs in Model allowlist. The field now shows that list, and no documented statement changes.
  • README: N/A.

Test plan

  • New model-allowlist-field.test.tsx (3 tests). It uses a controlled harness that toggles freeText the way the Models radio does.

    • The picker removes alpha, and back in free entry the field shows beta. This test includes an axe check.
    • The reader's draft keeps its commas while it holds the same list.
    • A list replaced from outside is shown, and typing continues from it.
  • New page test in providers-settings.test.tsx. It covers the card's exact flow through the real ProvidersSettings → CredentialEditDialog → providerCredentialAdapter, with the mutation hooks stubbed at the module boundary. Edit, choose Discover from the endpoint, use Remove alpha, choose Enter model IDs, and the field reads beta. Save then sends modelAllowlist: ["beta"] with catalogSource: 'none'.

  • Fails on main. On main's component (9e8f87f68), 3 of the 4 new tests fail on toHaveValue (received alpha, beta). The draft test passes on main: it's a control that guards against an over-eager fix. A probe on main recorded manual alpha,beta -> discovery removes alpha -> manual textbox displays "alpha, beta"; Save sends ["beta"], the card's observation.

  • Catches an over-eager fix. I made the field always show value.join(', '). That fails 3 tests: the draft test, the outside-replacement test, and the existing requires model ids when the endpoint cannot list them (the comma vanishes while typing).

  • Branch. model-allowlist-field.test.tsx, providers-settings.test.tsx and credential-edit-dialog.test.tsx pass 39/39 with vitest.ui.config.ts on one worker (Node 24).

  • Gates.

    • oxfmt --check and type-aware oxlint on the changed files are clean (4 files, 226 rules, 0 diagnostics).
    • A tsc --noEmit scoped to the changed files and their importers (both credential dialogs and providers-settings.tsx) exits 0.
    • bun run lint:manual passes.
    • error-message-description.guard passes.
    • single-failure-toast.guard passes 51/51 when run alone with a longer timeout. Run alongside the other guard on this shared host, its scan hit vitest's 30 s default once.
  • Not run locally:

    • a real-browser pass, E2E and the backend stack (none in this sandbox, so the persisted readback is unproven here; the jsdom suite owns the behaviour);
    • the whole platform suite;
    • a whole-workspace tsc.

    CI runs the suite and tsc.

Closes #3664

A custom provider's form keeps one ModelAllowlistField across its Models
choice (Enter model IDs / Discover from the endpoint). The free-entry draft
was seeded once from the list and never heard of a change the picker made,
so removing a model under discovery and switching back showed the removed
id while Save sent, and stored, the shorter list.

The field now shows its draft only while the draft still parses to the
list it holds, and otherwise the list itself; typing resyncs the draft,
so in-progress commas survive. The adapter's list comparison moves next
to the field, so one copy remains.

Closes #3664
@yannickmonney

Copy link
Copy Markdown
Contributor Author

TALE-700 — independent review of PR #4315

Verdict: ACCEPT at source level, exact head 6fa534e0aadfde1401bd4e3f01592aa65483841e. No blocking source-level finding. This is not merge authorization, a native approval, or proof of green CI. Root's rule applies: a blocking finding overrides acceptance; outstanding execution gates remain explicit.

Reviewer: Codex #7 ecfaae72, run 58de0bdf-2c06-4b9b-a843-98432088b1c8; distinct from author Claude #6 53fe2a33, run d764b275. Contract: TALE-203 and GitHub #3664. PR: #4315. Exact head confirmed at start and rechecked before posting.

Findings and evidence

  • Displayed IDs match the Save candidate. The raw manual draft is displayed only when its trimmed, deduplicated IDs equal the controlled allowlist in order. Otherwise the current allowlist is displayed. The actual edit dialog regression executes manual alpha, beta → discovery → remove alpha → manual: textbox is beta, and Save calls the credential mutation with modelAllowlist: ['beta'] and manual catalog source. The adapter's Save mapping still uses the same controlled allowlist, not the draft.
  • Typing still works. Raw trailing commas/spacing and duplicate-ID input remain intact while the held list is parsed/deduplicated. Independent probes cover typing immediately after discovery removal, repeated source switches and a second discovery removal, plus clearing the returned list and typing a fresh ID. Neither path revives alpha.
  • Discovery unchanged. Catalog/stale-ID option construction and the complete MultiSelect branch compare byte-for-byte equal with current main. Its value, callback, labels, disabled state and modal flag are unchanged; actual removal controls execute in the tests.
  • Security/locales. No logging statement, credential handling, request shape or persistence code is added or changed. No new user-visible copy or catalog keys; existing EN/DE/FR keys stay unchanged. Synthetic test error logging contains refusal codes/messages, not credential secret values. The list-comparison helper was moved unchanged from the adapter into the field module already imported there; no divergent duplicate or new cycle.
  • Negative proof on main. Freshly fetched main dcfca98191803add59081567ea3eb9af807e0f42, with head's regression tests overlaid but main production code retained: 3 committed regressions fail, 1 typing control passes (33 unrelated tests filtered out). Discovery-return and external-list replacement show stale alpha, beta; the edit dialog expects beta and fails on alpha, beta. Separately, 1 independent repeated-switch regression fails and 1 clear/retype control passes on main. Expected red runs exit 1, not setup failures.

Executed light checks

Installed Node v24.21.0, Vitest 4.1.11, one worker, 2 GiB Node heap where set. Isolated source archives under this task's delivery box; preinstalled dependencies reused; explicit Vite aliases resolve UI/shared exports to each snapshot.

Check Observed result
Changed component, ProvidersSettings and credential-edit dialog 39/39 pass, 3 files
Two independent adversarial component probes 2/2 pass
Providers + credentials consumer folders, including those probes 91/91 pass, 11 files (89 committed tests + 2 reviewer probes)
Same four committed regressions on current main 3 fail / 1 pass, expected exit 1
Independent probes on current main 1 fail / 1 pass, expected exit 1
Scoped oxlint --type-aware --type-check --threads 1 --no-ignore --format json 5 selected changed/importing files, 226 rules, zero diagnostics, exit 0
oxfmt --check --threads 1 All 4 matched TS/TSX files pass; Markdown is not matched by this formatter invocation
PR git diff --check Pass
Discovery branch/options exact comparison and source blob provenance Pass

Initial stock-config test attempt was blocked before test import by Vite's filesystem allowlist for symlinked font assets. The review-only config explicitly allows the snapshot and existing dependency directory, maps workspace packages to snapshot exports, and deduplicates React; corrected positive and negative runs above are the relied-upon evidence. Initial human-format lint runs exited 0 with no printed summary; the JSON run explicitly confirms five files and zero diagnostics. No product source was changed to accommodate the harness.

Unrun and handoff

  • Unrun: real browser/keyboard/screen reader/visual analyzer, E2E, native backend/PostgreSQL/config readback, live discovery endpoint or external provider, two-session/manual rounds, manual-register gate, full platform/workspace checks, whole-workspace tsc, SAST and knip. Scoped experimental type-check is not a whole-workspace TypeScript pass. jsdom/axe and mutation-spy Save proof do not establish browser behavior or persisted readback; bug(platform): switching custom-provider model source shows removed model IDs that Save does not store #3664's original native persistence proof was read but not rerun here.
  • CI read-only snapshot: 5 successful Resolve source checks, 16 queued; no exact-head CI-green claim. No CI watch that reruns work, rerun or cancellation.
  • Next owner: TALE-359 retains exact-head CI, resource-admitted browser/native evidence and protected completion/merge gates. Preserve TALE-203's pending human review capture. No source repair requested by this review.
  • Actions: verdict posted on PR, TALE-203 and TALE-359; receipts recorded separately. No push, commit, merge, branch publication, card/status move or native review action. Shared standing clone left untouched except required fetch and clean origin/auth setup.

Artifacts: reviewed patch, source blob provenance, focused/head/main logs, independent probe, review-only config, reproduction commands, CI snapshot and posting receipts in this exact delivery box. Temporary owned source archives are removed after evidence retention.

@yannickmonney
yannickmonney merged commit 157e964 into main Oct 4, 2026
@yannickmonney
yannickmonney deleted the fix/model-allowlist-text-sync branch October 4, 2026 20:02
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.

bug(platform): switching custom-provider model source shows removed model IDs that Save does not store

1 participant