Skip to content

feat: hide fake streaming whitelist and responses WS from system settings UI#1162

Merged
ding113 merged 1 commit into
devfrom
feat/hide-streaming-ws-settings
May 8, 2026
Merged

feat: hide fake streaming whitelist and responses WS from system settings UI#1162
ding113 merged 1 commit into
devfrom
feat/hide-streaming-ws-settings

Conversation

@ding113

@ding113 ding113 commented May 8, 2026

Copy link
Copy Markdown
Owner

Summary

This PR hides two advanced system settings from the UI while preserving their backend functionality:

  1. Fake Streaming Whitelist: Changed default from 4 image models to empty array (disabled by default) and removed the whitelist editor UI from system settings
  2. OpenAI Responses WebSocket: Removed the toggle from system settings form (Codex-only feature)

Backend state variables and save payload remain intact - these features can still be configured via API or database.

Problem

The Fake Streaming feature (added in PR #1132) and OpenAI Responses WebSocket (addressed in PRs #1153/#1154) were exposed as configurable UI elements in system settings. However:

  • These are advanced features primarily for specific use cases (long-running image generation, Codex CLI)
  • The default whitelist of 4 image models was auto-enabled, which may not be desired by all deployments
  • These settings add complexity to the system settings UI for users who don't need them

Solution

UI Simplification

  • Hide the Fake Streaming Whitelist editor from system settings form
  • Hide the OpenAI Responses WebSocket toggle from system settings form
  • Keep all state management and save logic intact for API/database configuration

Default Policy Change

  • DEFAULT_FAKE_STREAMING_WHITELIST changed from 4 models to empty array (empty/disabled by default)
  • This allows deployments to explicitly opt-in to fake streaming rather than having it auto-enabled
  • Existing persisted configurations are preserved

Related Issues & PRs

Context / History

Implementation History

Changes

File Change
src/types/system-config.ts DEFAULT_FAKE_STREAMING_WHITELIST to empty array
src/app/[locale]/settings/config/_components/system-settings-form.tsx Removed Fake Streaming Whitelist editor section; Removed OpenAI Responses WebSocket toggle; Cleaned up unused imports (Plus, Radio, Trash2, GroupMultiSelect)
tests/unit/actions/system-config-fake-streaming-setting.test.ts Updated test expectations to reflect empty default; test descriptions clarified
tests/unit/settings/system-settings-form-fake-streaming.test.tsx Replaced UI interaction tests with state-driven tests (editor no longer rendered)

Verification

  • bun run typecheck (verified)
  • bun run lint (verified, only pre-existing warnings)
  • bun run test (verified, all related tests updated and passing)

Backend Compatibility

  • State variables (fakeStreamingWhitelist, enableOpenaiResponsesWebsocket) remain in form state
  • Save payload structure unchanged - existing API consumers unaffected
  • Database schema unchanged - persisted settings preserved

Breaking Changes

None - this is a UI-only change. The features remain functional via:

  • Direct API calls to update system settings
  • Database manipulation of system_settings table
  • Any existing persisted settings continue to work

Migration Notes

Deployments that relied on the default 4-model whitelist being auto-enabled will need to:

  1. Via API: Set fakeStreamingWhitelist to the desired model list
  2. Via Database: Update the system_settings table to include the whitelist

Pre-configured whitelist (pre-0.7.5):

  • gpt-image-2 (all groups)
  • gpt-image-1.5 (all groups)
  • gemini-3.1-flash-image-preview (all groups)
  • gemini-3-pro-image-preview (all groups)

Testing Checklist

  • System settings form renders without removed UI elements
  • Form submission preserves existing whitelist values
  • Empty whitelist is correctly saved as explicit opt-out
  • Non-empty whitelist values are trimmed and empty entries dropped before save
  • All existing unit tests pass with updated expectations

Description enhanced by Claude AI - adds related Issue/PR context for better traceability

Greptile Summary

This PR hides the Fake Streaming Whitelist editor and the OpenAI Responses WebSocket toggle from the system settings UI while keeping both settings' state variables and save-payload fields intact, so previously configured values continue to be round-tripped to the server on every save.

  • DEFAULT_FAKE_STREAMING_WHITELIST is changed from 4 hardcoded image-model entries to [], meaning installations with no persisted whitelist (DB null) will now default to fake streaming disabled instead of the prior four-model set.
  • The form component removes both UI sections and their associated imports (GroupMultiSelect, Plus, Radio, Trash2) but retains the state and persistence logic, so the feature is hidden rather than removed.
  • Test suite is updated to replace DOM-interaction tests with state-driven equivalents; one locale-string test continues to validate i18n keys for the now-hidden UI section without explanation.

Confidence Score: 4/5

Safe to merge; the only user-visible behaviour change is that fresh installations default to fake streaming disabled, which is the stated intent.

The form correctly keeps both hidden settings in state and in the save payload, so no data is silently dropped on save. The default change from four image models to an empty list is intentional, but deployments that relied on the implicit whitelist without ever explicitly saving it will silently lose fake-streaming for those models after the next settings save.

tests/unit/settings/system-settings-form-fake-streaming.test.tsx — the all-locales test validates strings for removed UI without explanation.

Important Files Changed

Filename Overview
src/types/system-config.ts DEFAULT_FAKE_STREAMING_WHITELIST changed from 4 hardcoded image-model entries to an empty array; comment updated to reflect the new upgrade-path semantics.
src/app/[locale]/settings/config/_components/system-settings-form.tsx Removed the Fake Streaming Whitelist editor UI and the OpenAI Responses WebSocket toggle from the rendered form; state variables and save-payload fields are kept intact so the hidden settings are still persisted on save.
tests/unit/actions/system-config-fake-streaming-setting.test.ts DEFAULT_FAKE_STREAMING_MODELS updated to [] and test names updated to match the new empty-default semantics; all assertions remain accurate.
tests/unit/settings/system-settings-form-fake-streaming.test.tsx UI-interaction tests replaced with state-driven equivalents; a locale-string test that validates strings for now-removed UI is retained without explanation, which could confuse future maintainers.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SystemSettingsForm mounts] --> B[useState: fakeStreamingWhitelist\ninitialised from initialSettings]
    A --> C[useState: enableOpenaiResponsesWebsocket\ninitialised from initialSettings]
    B --> D{UI editor\nrendered?}
    D -- Before this PR --> E[Fake Streaming Whitelist editor shown to user]
    D -- After this PR --> F[Editor hidden]
    C --> G{WebSocket toggle rendered?}
    G -- Before this PR --> H[Toggle shown to user]
    G -- After this PR --> I[Toggle hidden]
    F --> J[User clicks Save]
    I --> J
    E --> J
    H --> J
    J --> K[saveSystemSettings called with both values still in payload]
    K --> L[(DB values persisted unchanged)]
Loading

Comments Outside Diff (1)

  1. tests/unit/settings/system-settings-form-fake-streaming.test.tsx, line 267-284 (link)

    P2 Locale test validates strings for removed UI

    The "all locales define fake streaming labels" test still asserts that every locale defines title, description, modelLabel, groupsLabel, allGroupsHint, addModel, remove, modelPlaceholder, and emptyState for the fakeStreaming section — but the form that renders those strings was deleted in this PR. The test will continue to pass (the message files still have the strings), but it now gives false coverage confidence for UI that isn't reachable. If the intent is to preserve the strings as a re-enablement safety net, a short comment stating that would prevent a future contributor from being confused by why the test exists.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: tests/unit/settings/system-settings-form-fake-streaming.test.tsx
    Line: 267-284
    
    Comment:
    **Locale test validates strings for removed UI**
    
    The `"all locales define fake streaming labels"` test still asserts that every locale defines `title`, `description`, `modelLabel`, `groupsLabel`, `allGroupsHint`, `addModel`, `remove`, `modelPlaceholder`, and `emptyState` for the `fakeStreaming` section — but the form that renders those strings was deleted in this PR. The test will continue to pass (the message files still have the strings), but it now gives false coverage confidence for UI that isn't reachable. If the intent is to preserve the strings as a re-enablement safety net, a short comment stating that would prevent a future contributor from being confused by why the test exists.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
tests/unit/settings/system-settings-form-fake-streaming.test.tsx:267-284
**Locale test validates strings for removed UI**

The `"all locales define fake streaming labels"` test still asserts that every locale defines `title`, `description`, `modelLabel`, `groupsLabel`, `allGroupsHint`, `addModel`, `remove`, `modelPlaceholder`, and `emptyState` for the `fakeStreaming` section — but the form that renders those strings was deleted in this PR. The test will continue to pass (the message files still have the strings), but it now gives false coverage confidence for UI that isn't reachable. If the intent is to preserve the strings as a re-enablement safety net, a short comment stating that would prevent a future contributor from being confused by why the test exists.

Reviews (1): Last reviewed commit: "feat: hide fake streaming whitelist and ..." | Re-trigger Greptile

…ings UI

- DEFAULT_FAKE_STREAMING_WHITELIST changed to []
- Removed Fake Streaming Whitelist editor from settings form
- Removed OpenAI Responses WebSocket toggle from settings form
- Keep state vars and save payload intact
- Update related tests
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

高层概览

此 PR 移除系统设置表单中的两个配置 UI 部分(OpenAI WebSocket 响应开关和完整的假流白名单编辑器),将默认假流白名单从四个图像模型列表改为空数组,并更新所有相关测试以验证新的行为。

变更

假流配置移除

层 / 文件 摘要
配置常量
src/types/system-config.ts
DEFAULT_FAKE_STREAMING_WHITELIST 从包含四个图像模型的列表改为空只读数组。
UI 组件移除
src/app/[locale]/settings/config/_components/system-settings-form.tsx
移除 OpenAI WebSocket 开关和完整的假流白名单编辑器部分(包括添加/删除行和分组标签控制);移除未使用的 Lucide 图标和 GroupMultiSelect 导入。
动作和数据转换测试更新
tests/unit/actions/system-config-fake-streaming-setting.test.ts
DEFAULT_FAKE_STREAMING_MODELS 改为空数组;转换器默认测试和仓库回退测试更新以断言缺失的白名单默认为空数组。
系统设置表单测试更新
tests/unit/settings/system-settings-form-fake-streaming.test.tsx
移除 DOM 查询辅助函数和用户交互测试;添加新的断言验证添加/删除/模型输入元素不存在,以及显式空白名单被保留为选择退出。

预估代码审查工作量

🎯 2 (简单) | ⏱️ ~12 分钟

可能相关的 PR

  • ding113/claude-code-hub#1132 — 该 PR 直接触及与本 PR 相同的 system-settings-form 和 DEFAULT_FAKE_STREAMING_WHITELIST,涉及白名单 UI 的移除。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地反映了此PR的核心变更:从系统设置UI中隐藏两个功能选项(虚假流和WebSocket响应)。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed PR description comprehensively explains the changes: hiding two UI sections (Fake Streaming Whitelist editor and OpenAI WebSocket toggle), changing the default from 4 models to empty array, and preserving backend functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/hide-streaming-ws-settings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added enhancement New feature or request area:UI labels May 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/unit/actions/system-config-fake-streaming-setting.test.ts (1)

63-63: ⚡ Quick win

避免在测试中重复定义默认常量。

Line [63] 本地常量与 src/types/system-config.ts 的默认值语义重复,后续再次调整默认值时容易出现测试与实现漂移。建议直接复用源常量。

建议修改
+import { DEFAULT_FAKE_STREAMING_WHITELIST } from "@/types/system-config";
...
-const DEFAULT_FAKE_STREAMING_MODELS: { model: string; groupTags: string[] }[] = [];
+const DEFAULT_FAKE_STREAMING_MODELS = [...DEFAULT_FAKE_STREAMING_WHITELIST];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/actions/system-config-fake-streaming-setting.test.ts` at line 63,
The test defines a local DEFAULT_FAKE_STREAMING_MODELS which duplicates the
canonical default; instead of redefining it, import and reuse the exported
DEFAULT_FAKE_STREAMING_MODELS from the module where the default is defined (the
system-config types module) and remove the local declaration; update the test's
imports to reference that exported symbol so future changes to the source
default stay in sync with the tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/unit/actions/system-config-fake-streaming-setting.test.ts`:
- Line 63: The test defines a local DEFAULT_FAKE_STREAMING_MODELS which
duplicates the canonical default; instead of redefining it, import and reuse the
exported DEFAULT_FAKE_STREAMING_MODELS from the module where the default is
defined (the system-config types module) and remove the local declaration;
update the test's imports to reference that exported symbol so future changes to
the source default stay in sync with the tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 900ae85a-69d7-489b-bf24-382fbb540a97

📥 Commits

Reviewing files that changed from the base of the PR and between a9c1e83 and ef9025d.

📒 Files selected for processing (4)
  • src/app/[locale]/settings/config/_components/system-settings-form.tsx
  • src/types/system-config.ts
  • tests/unit/actions/system-config-fake-streaming-setting.test.ts
  • tests/unit/settings/system-settings-form-fake-streaming.test.tsx
💤 Files with no reviewable changes (1)
  • src/app/[locale]/settings/config/_components/system-settings-form.tsx

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the user interface for configuring the OpenAI Responses WebSocket and the Fake Streaming Whitelist from the system settings form. Additionally, the default fake streaming whitelist has been changed to an empty array, and the associated unit tests have been updated to verify that these UI components are no longer rendered and that the new default is correctly handled. I have no feedback to provide.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

🧪 测试结果

测试类型 状态
代码质量
单元测试
集成测试
API 测试

总体结果: ✅ 所有测试通过

@github-actions github-actions Bot added the size/M Medium PR (< 500 lines) label May 8, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

No significant issues identified in this PR.

PR Size: M

  • Lines changed: 232
  • Files changed: 4

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - Clean
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Adequate
  • Code clarity - Good

Automated review by Codex AI

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Identified open PR #1162 and reviewed the full diff across the 4 changed files.
  • Applied size label size/M (20 additions, 212 deletions; 232 lines changed).
  • Posted a PR review summary (gh pr review --comment) with “No significant issues identified” and no inline comments (no findings met the ≥80 confidence threshold).
  • Note: local lint/test validation wasn’t run here because bunx isn’t available in this runner (bunx: command not found).

@ding113 ding113 merged commit a383506 into dev May 8, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Claude Code Hub Roadmap May 8, 2026
@ding113 ding113 deleted the feat/hide-streaming-ws-settings branch May 13, 2026 06:22
@github-actions github-actions Bot mentioned this pull request May 13, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI enhancement New feature or request size/M Medium PR (< 500 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant