From 15e372539c0ee2ec6465a766c39b52e417d482f7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 10:45:33 +0000 Subject: [PATCH 1/7] fix(console): a stored settings select value outside the current options reads as no longer available Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L6bhgVUz5oS8fMgmncxU96 --- .../src/pages/settings/SettingsField.tsx | 16 ++++ ...SettingsField.retiredOption-37480.test.tsx | 88 +++++++++++++++++++ ui/packages/i18n/src/locales/ar.ts | 1 + ui/packages/i18n/src/locales/de.ts | 1 + ui/packages/i18n/src/locales/en.ts | 3 + ui/packages/i18n/src/locales/es.ts | 1 + ui/packages/i18n/src/locales/fr.ts | 1 + ui/packages/i18n/src/locales/ja.ts | 1 + ui/packages/i18n/src/locales/ko.ts | 1 + ui/packages/i18n/src/locales/pt-BR.ts | 1 + ui/packages/i18n/src/locales/ru.ts | 1 + ui/packages/i18n/src/locales/zh-Hans.ts | 1 + ui/packages/i18n/src/locales/zh-Hant.ts | 1 + 13 files changed, 117 insertions(+) create mode 100644 ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx diff --git a/ui/apps/console/src/pages/settings/SettingsField.tsx b/ui/apps/console/src/pages/settings/SettingsField.tsx index 264177c1a11..5d85d54a374 100644 --- a/ui/apps/console/src/pages/settings/SettingsField.tsx +++ b/ui/apps/console/src/pages/settings/SettingsField.tsx @@ -974,6 +974,14 @@ export function SettingsField(props: SettingsFieldProps) { />, ); } + // A stored value the manifest no longer offers (an option removed in a + // later release) has no item to name it, so the trigger would read + // blank. It gets one disabled item of its own, named with the stored + // code and a "no longer available" mark; picking a current option is + // an ordinary write, and the retired item cannot be picked back. + const stored = value == null ? '' : String(value); + const retired = + stored !== '' && !(spec.options ?? []).some((opt) => String(opt.value) === stored); return wrapper( , ); } - case 'radio': + case 'radio': { + // Same named state as the closed select above: a stored value the + // manifest no longer offers gets one disabled, checked item of its own, + // so the group does not read as nothing chosen. + const stored = value == null ? '' : String(value); + const retired = + stored !== '' && !(spec.options ?? []).some((opt) => String(opt.value) === stored); return wrapper( + {retired ? ( +
+ + +
+ ) : null} {spec.options?.map((opt) => (
@@ -1031,6 +1048,7 @@ export function SettingsField(props: SettingsFieldProps) { , undefined, ); + } case 'multiselect': { const arr = Array.isArray(value) ? (value as (string | number)[]) : []; return wrapper( diff --git a/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx b/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx index da265fe3587..0b48081a3f9 100644 --- a/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx +++ b/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx @@ -86,3 +86,37 @@ describe('objectstack#37480 — a stored select value outside the current option expect(screen.queryByTestId('settings-select-retired')).toBeNull(); }); }); + +/** The same options drawn as a radio group. */ +const ADAPTER_RADIO: Specifier = { ...ADAPTER, type: 'radio' }; + +function renderRadioIn(language: string, value: unknown) { + const instance = createI18n({ defaultLanguage: language, detectBrowserLanguage: false }); + render( + + + , + ); + return instance; +} + +describe('objectstack#37480 — a stored radio value outside the current options is named', () => { + it('the group shows a checked, disabled item reading the stored code marked "no longer available"', () => { + const en = renderRadioIn('en', 'ragflow'); + const named = en.t('console.settingsView.selectValueRetired', { value: 'ragflow' }); + + const item = screen.getByRole('radio', { name: named }); + expect(item).toBeChecked(); + expect(item).toBeDisabled(); + // The current options stay pickable and unchecked. + expect(screen.getByRole('radio', { name: 'Dify' })).not.toBeChecked(); + expect(screen.getByRole('radio', { name: 'Dify' })).toBeEnabled(); + }); + + it('CONTROL — a stored value among the options checks its own item, with no retired item', () => { + renderRadioIn('en', 'dify'); + expect(screen.getByRole('radio', { name: 'Dify' })).toBeChecked(); + expect(screen.getAllByRole('radio')).toHaveLength(2); + expect(screen.queryByTestId('settings-radio-retired')).toBeNull(); + }); +}); From c3405b5cc97faf581bb58da1e7c0a43213ba629f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 11:25:18 +0000 Subject: [PATCH 5/7] chore(changeset): name the radio arm too Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L6bhgVUz5oS8fMgmncxU96 --- .changeset/37480-settings-retired-option.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/37480-settings-retired-option.md b/.changeset/37480-settings-retired-option.md index 295ece0503c..ea2e75ea7ce 100644 --- a/.changeset/37480-settings-retired-option.md +++ b/.changeset/37480-settings-retired-option.md @@ -3,11 +3,11 @@ '@object-ui/i18n': patch --- -fix(console): a stored settings select value the setting no longer offers reads as "no longer available" instead of a blank box +fix(console): a stored settings select or radio value the setting no longer offers reads as "no longer available" instead of nothing chosen Clause-②: no Metadata-protocol: none -When a settings select's stored value is not among the options the setting declares today (an option removed in a later release, such as the knowledge adapter `ragflow`), the Setup select showed an empty box: no label and no placeholder. It now shows the stored code with a mark, for example "ragflow (no longer available)", as one disabled entry in the list. The admin can still pick a current option, which saves as before; the retired entry cannot be picked back. Values among the options, and an unset value, render as before. +When a settings select's stored value is not among the options the setting declares today (an option removed in a later release, such as the knowledge adapter `ragflow`), the Setup select showed an empty box: no label and no placeholder. It now shows the stored code with a mark, for example "ragflow (no longer available)", as one disabled entry in the list. A radio group shows the same text as one checked, disabled item. The admin can still pick a current option, which saves as before; the retired entry cannot be picked back. Values among the options, and an unset value, render as before. New locale key: `console.settingsView.selectValueRetired` (`{{value}}` is the stored code), in all eleven Console language packs. No props or exports change. From 7adfba2b794b66a76242b23734fd80ae0469204e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 11:50:12 +0000 Subject: [PATCH 6/7] fix(console): a stored settings multiselect member outside the current options reads as no longer available Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L6bhgVUz5oS8fMgmncxU96 --- .../src/pages/settings/SettingsField.tsx | 31 +++++++++++ ...SettingsField.retiredOption-37480.test.tsx | 51 ++++++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/ui/apps/console/src/pages/settings/SettingsField.tsx b/ui/apps/console/src/pages/settings/SettingsField.tsx index 3172a02ff20..cc8b6f7a7fc 100644 --- a/ui/apps/console/src/pages/settings/SettingsField.tsx +++ b/ui/apps/console/src/pages/settings/SettingsField.tsx @@ -1051,8 +1051,39 @@ export function SettingsField(props: SettingsFieldProps) { } case 'multiselect': { const arr = Array.isArray(value) ? (value as (string | number)[]) : []; + // Stored members the manifest no longer offers are named, checked, in + // the same "no longer available" words as the select and radio arms. + // Ticking a current option keeps them in the array (the next set is + // built from the whole stored array, as before), and the server refuses + // a write of this key while one is in it (`invalid_option`), so each + // stays UNTICKABLE: unticking drops it, and once dropped it is gone + // from the list, so it cannot be ticked back. + const offered = new Set((spec.options ?? []).map((opt) => String(opt.value))); + const retiredMembers = Array.from(new Set(arr.map(String))).filter( + (v) => v !== '' && !offered.has(v), + ); return wrapper(
+ {retiredMembers.map((v) => ( + + ))} {spec.options?.map((opt) => { const v = String(opt.value); const checked = arr.map(String).includes(v); diff --git a/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx b/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx index 0b48081a3f9..eff5a368df9 100644 --- a/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx +++ b/ui/apps/console/src/pages/settings/__tests__/SettingsField.retiredOption-37480.test.tsx @@ -20,7 +20,7 @@ */ import { describe, it, expect, vi, afterEach } from 'vitest'; -import { render, screen, cleanup } from '@testing-library/react'; +import { render, screen, cleanup, fireEvent } from '@testing-library/react'; import { createI18n, I18nProvider } from '@object-ui/i18n'; import { SettingsField } from '../SettingsField'; @@ -120,3 +120,52 @@ describe('objectstack#37480 — a stored radio value outside the current options expect(screen.queryByTestId('settings-radio-retired')).toBeNull(); }); }); + +/** The same options drawn as a multiselect. */ +const ADAPTER_MULTI: Specifier = { ...ADAPTER, type: 'multiselect' }; + +function renderMultiIn(language: string, value: unknown, onChange = vi.fn()) { + const instance = createI18n({ defaultLanguage: language, detectBrowserLanguage: false }); + render( + + + , + ); + return instance; +} + +describe('objectstack#37480 — a stored multiselect member outside the current options is named', () => { + it('the member shows as a checked checkbox reading the stored code marked "no longer available"', () => { + const en = renderMultiIn('en', ['ragflow', 'dify']); + const named = en.t('console.settingsView.selectValueRetired', { value: 'ragflow' }); + + expect(screen.getByRole('checkbox', { name: named })).toBeChecked(); + expect(screen.getByRole('checkbox', { name: 'Dify' })).toBeChecked(); + expect(screen.getByRole('checkbox', { name: 'Built-in' })).not.toBeChecked(); + }); + + it('ticking a current option keeps the retired member in the array, as before', () => { + const onChange = vi.fn(); + renderMultiIn('en', ['ragflow'], onChange); + fireEvent.click(screen.getByRole('checkbox', { name: 'Dify' })); + expect(onChange).toHaveBeenCalledWith(['ragflow', 'dify']); + }); + + it('unticking the retired member drops it from the array', () => { + const onChange = vi.fn(); + const en = renderMultiIn('en', ['ragflow', 'dify'], onChange); + fireEvent.click( + screen.getByRole('checkbox', { + name: en.t('console.settingsView.selectValueRetired', { value: 'ragflow' }), + }), + ); + expect(onChange).toHaveBeenCalledWith(['dify']); + }); + + it('CONTROL — members all among the options draw only the option checkboxes', () => { + renderMultiIn('en', ['dify']); + expect(screen.getAllByRole('checkbox')).toHaveLength(2); + expect(screen.getByRole('checkbox', { name: 'Dify' })).toBeChecked(); + expect(screen.queryByTestId('settings-multiselect-retired')).toBeNull(); + }); +}); From ec4e9149bb8554c586f42b7c7ad4332077ea69c2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 11:52:41 +0000 Subject: [PATCH 7/7] chore(changeset): name the multiselect arm too Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L6bhgVUz5oS8fMgmncxU96 --- .changeset/37480-settings-retired-option.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/37480-settings-retired-option.md b/.changeset/37480-settings-retired-option.md index ea2e75ea7ce..8994b1d76b9 100644 --- a/.changeset/37480-settings-retired-option.md +++ b/.changeset/37480-settings-retired-option.md @@ -3,11 +3,11 @@ '@object-ui/i18n': patch --- -fix(console): a stored settings select or radio value the setting no longer offers reads as "no longer available" instead of nothing chosen +fix(console): a stored settings select, radio or multiselect value the setting no longer offers reads as "no longer available" instead of nothing chosen Clause-②: no Metadata-protocol: none -When a settings select's stored value is not among the options the setting declares today (an option removed in a later release, such as the knowledge adapter `ragflow`), the Setup select showed an empty box: no label and no placeholder. It now shows the stored code with a mark, for example "ragflow (no longer available)", as one disabled entry in the list. A radio group shows the same text as one checked, disabled item. The admin can still pick a current option, which saves as before; the retired entry cannot be picked back. Values among the options, and an unset value, render as before. +When a settings select's stored value is not among the options the setting declares today (an option removed in a later release, such as the knowledge adapter `ragflow`), the Setup select showed an empty box: no label and no placeholder. It now shows the stored code with a mark, for example "ragflow (no longer available)", as one disabled entry in the list. A radio group shows the same text as one checked, disabled item. A multiselect shows each stored member outside the options as a checked checkbox with the same text: ticking a current option keeps the member in the saved list, as before (and the server still refuses a save of that list while it holds one); unticking it removes it, and it cannot be ticked back. The admin can still pick a current option, which saves as before; the retired entry cannot be picked back. Values among the options, and an unset value, render as before. New locale key: `console.settingsView.selectValueRetired` (`{{value}}` is the stored code), in all eleven Console language packs. No props or exports change.