Skip to content

refactor(settings): 重构设置页分区并统一分组设置的覆盖交互 - #576

Merged
tbphp merged 15 commits into
mainfrom
claude/settings-project-analysis-d3b435
Sep 6, 2026
Merged

refactor(settings): 重构设置页分区并统一分组设置的覆盖交互#576
tbphp merged 15 commits into
mainfrom
claude/settings-project-analysis-d3b435

Conversation

@tbphp

@tbphp tbphp commented Sep 6, 2026

Copy link
Copy Markdown
Owner

关联 Issue / Related Issue

无 / N/A(来自使用过程中整理的交互问题)

变更内容 / Change Content

  • Bug 修复 / Bug fix
  • 新功能 / New feature
  • 其他改动 / Other changes

围绕「设置页」和「分组设置页」做一轮交互与视觉统一,让两个页面共用同一套覆盖/继承的表达方式,并顺带移除一个没有配置价值的开关。

1. 设置页重构

  • 按业务语义重排分区(路由与亲和 / 连接 / 可靠性 / Header 与跨域 / 数据与维护 / 系统信息),替代原先按实现维度切分的分区。
  • 抽出 SettingRow(单值设置行)与 SettingBlock(多字段规则编辑块)两个共享组件替换 RuntimeOverrideRow,设置页与分组设置页共用。
  • 每行只表达「来源 + 当前生效值 + 一个切换动作」:说明文字统一收进 label 旁的 tooltip;覆盖/恢复默认改为无底色图标按钮(PencilLine / RotateCcw)+ tooltip;未覆盖行的「覆盖」图标悬停才出现。
  • 控件尺寸统一缩小一档(新增 --setting-control-height),折叠态与编辑态行高一致,点开编辑不再跳动。
  • 上游请求头规则并入「Header 与跨域」分区,与 CORS、下游响应头规则同区;命名统一为「上游请求头规则 / 下游响应头规则」,便于区分方向。

2. 分组设置页对齐同一套交互

  • 请求亲和:三态 SegmentedControl(继承/开启/关闭)→ 与设置页一致的覆盖模式(折叠态显示生效值,覆盖后才出现开关,后面跟恢复默认)。
  • 上游请求头规则<details> 折叠 → SettingBlock,并补上此前缺失的独立覆盖开关(原先是「一编辑即写入覆盖」,没有显式启停)。
  • 移除顶部已展示过的只读渠道信息。
  • 验活模型:普通输入框 → 带候选的搜索输入(复用参数覆盖规则里的 datalist 模式)。候选取上游模型 ID(验活按该值请求上游),别名作为副标题;后端不限制该字段取值,仍可自由输入。

3. 修复

  • 分组设置点「恢复默认」后仍回显未保存的旧覆盖值,看起来像「点了没反应」:补上待恢复态(占位文案 + 徽标),保存后才回填真实的全局生效值。覆盖出站代理、超时、重试/拉黑次数、请求亲和、上游请求头规则。
  • 设置页 header_rules 覆盖开关往返会丢掉已有规则(开启覆盖时未从已发布值回填)。
  • 折叠态误显示草稿值而非已发布生效值(请求亲和、日志同步两处)。
  • 深链进入指定分区时滚动失效:分区尚未渲染时滚动会静默失败,且随后被路由的 scrollBehavior 重置到顶部,改为以即时滚动重试。

4. 移除 inject_usage_options

该开关只对 OpenAI 兼容格式生效,关闭也换不到实际收益,配置价值不足;改为始终开启,后端类型/解析/校验/网关逻辑与前端资源、i18n 一并移除。

数据迁移 / Migration

新增 0008_remove_inject_usage_options:删除 system_settings 中该行,并从每个分组的 overrides JSON 里剥离该键。已在 SQLite、PostgreSQL 16、MySQL 8 上注入历史数据实测——其中两个只在 PostgreSQL 上暴露的方言问题(反引号标识符、[]byte 写入 json 列)已随 1f67db7a 修复。

验证 / Verification

  • make check 全绿(gofmt / go mod tidy -diff / vet / lint / format / web build / go build / 全量 Go 测试)。
  • 前端交互在隔离实例(独立端口、DATA_DIRAUTH_KEY,不接触真实数据)里逐项走查:覆盖与恢复默认往返、待恢复态、Header 规则编辑器启停与规则计数、验活模型候选/自由输入/清空、保存落库结果。

Reviewer 须知 / Notes

  • web/src/styles/components.css 与当前 main 有一处冲突:双方各自在文件末尾追加了新块(main.filterable-value,本分支是控件尺寸变量覆盖),语义不重叠,合并时保留双方即可。
  • internal/dialect/openai_usage_options.go 及其测试在本次移除后已无调用方,属于死代码,本 PR 未一并删除,可后续单独清理。

自查清单 / Checklist

  • 我已运行 make check,或在说明中写明无法运行的原因和未验证范围。 / I ran make check, or documented why it could not run and what remains unverified.
  • 本 PR 范围聚焦,未包含无关改动。 / This PR is focused and contains no unrelated changes.
  • 我已更新必要的公开文档或发布说明。(三份 README 未提及被移除的配置项,无需同步改动) / I updated any required public documentation or release notes.
  • 我已确认提交、日志和测试数据不包含敏感信息。 / I confirmed that commits, logs, and fixtures contain no sensitive data.
  • 如适用,我已说明兼容性或数据迁移影响。(见「数据迁移」) / Where applicable, I documented compatibility or data-migration impact.

tbphp added 12 commits September 5, 2026 18:42
- 路由策略并入亲和分区(路由与调度),validation_interval 移出超时分组并入重试/凭据健康,
  models_dev_auto_sync_enabled 从请求转发移至数据与维护,header_rules 与 inject_usage_options
  合并为上游请求改写;6 个分区拆为 7 个语义更清晰的分区。
- 新增 SettingRow 承载默认态单行展示、覆盖态才展开控件与说明文字,默认态徽标与操作按钮收敛,
  避免逐字段重复常驻的说明文案。
- SettingRow 从设置页移至 components/config,替换分组设置页运行时区块里的
  RuntimeOverrideRow,行为对齐:默认态收敛徽标/按钮、覆盖态才展开控件与说明。
- RuntimeOverrideRow 无剩余引用,一并删除。
- 顺带修正分组页 inject_usage_options 折叠态展示 help 文案而非当前值的问题,
  改为展示已启用/已禁用,说明文字移入 help 提示。
- 请求亲和沿用原有 SegmentedControl 三态控件,未纳入本次迁移。
- 提示统一用已有 AppTooltip 组件,替换原生 title;且不论是否覆盖,说明都只在
  标签旁以 tooltip 展示,不再于覆盖态额外常驻一份。
- 覆盖/恢复默认按钮从行尾移到值后面,改回可见的按钮样式,不再靠悬停淡入。
- 覆盖态不再叠加“显式覆盖”徽标,仅保留左侧强调色与底色区分;待恢复/环境变量
  锁定两种状态的徽标保留。
- 路由策略改用 SegmentedControl 二选一切换,替换下拉选择,和代理等控件观感一致。
- 各分区行列表之间补上小间距,避免行与行贴在一起。
文字按钮换成小方形图标按钮:覆盖用 PencilLine,恢复默认用 RotateCcw,配色沿用
原有 action/warning 两种 tone;按钮不再显示文字,改为 hover/聚焦时通过
AppTooltip 展示对应文案,无障碍上保留 aria-label。
去掉常驻边框和背景色,图标默认裸露显示,与旁边的说明提示图标风格保持一致;
悬停/聚焦时才出现对应 tone 的浅色背景。
未覆盖态(含待恢复默认)的“覆盖”图标恢复为鼠标悬停/键盘聚焦到该行才显示,
平时隐藏;已覆盖态的“恢复默认”图标保持常驻可见,因为该行本身已有强调色和
底色区分,不需要靠图标常驻来提示。窄屏和纯触屏环境下始终显示,避免无法触发。
移除 inject_usage_options 配置,改为始终注入:
- 该开关只在「OpenAI Completions + 原生透传 + 流式」这一条路径生效(转换路径的
  usage 来自 SDK,Anthropic/Gemini 原生流自带 usage),默认即为开启,暴露为用户
  配置的收益远低于理解成本。
- 后端删除设置键、分组覆盖与渠道约束校验,IncludeUsage 固定为 ObserveUsage;
  新增迁移 0008 清理 system_settings 行与分组 overrides 中的历史键,否则解析器
  会以 "unknown runtime setting" 拒绝整份配置。
- 前端删除两处设置行、资源投影字段与三语文案。

设置页与分组设置页的控件:
- 新增 --setting-control-height,并在 .setting-row/.setting-block 上覆盖
  --control-compact/xs/sm,让输入框、切换控件、下拉统一小一档;变量继承进子组件,
  不需要和组件自身 scoped 样式比优先级。
- 固定行内容高度,折叠态与覆盖态不再有高度差,点开编辑时行不会跳动。
- 块级说明(CORS 策略、下游响应头规则)从常驻小字改为标签旁 tooltip,与设置行一致。

分组设置页删除只读的渠道展示:顶部已有渠道信息,此处重复且不可编辑。
- 反引号是 MySQL/SQLite 语法,PostgreSQL 解析 `key` = ? 直接报 syntax error,
  导致启动中断。改用 GORM 结构体条件,由驱动按方言自行加引号。
- 往 json 列写 []byte 时 PostgreSQL 驱动按 bytea 处理,报 invalid input syntax
  for type json。改为写字符串。

已在 SQLite / PostgreSQL 16 / MySQL 8 三种方言上实跑升级路径:注入历史的
system_settings 行与分组 overrides 后启动,确认键被清除、分组只剩其余覆盖、
迁移正常记账。
- 分组页控件尺寸未跟着变小,是因为上一轮的尺寸变量覆盖只挂在 .setting-row/
  .setting-block 上;分组页的姓名/验活模型输入框、权重与请求亲和的 SegmentedControl
  都不在这两个类名内。改为挂在 .settings__content/.group-settings__content 内容区
  (不含侧边导航与保存栏),覆盖 --control-compact/xs/sm/md 四个尺寸变量,让设置页
  和分组页的所有交互控件统一收敛到 26px。

- "上游请求改写"分区被删除,header_rules 合并进浏览器访问分区,与 CORS、
  下游响应头规则放在一起(顺序:CORS → 上游请求头规则 → 下游响应头规则);
  该分区原本只剩 header_rules 一项(inject_usage_options 上一轮已删除),
  单独占一个侧边菜单已经没有意义。

- 请求头/响应头命名统一:全局设置页"全局 Header Rules"改名"上游请求头规则",
  与已有的"下游响应头规则"对称;分组页"HeaderRules"同步改名"上游请求头规则"。
  新分区标题定为"Header 与跨域"。

- 清理合并后失效的 settings.headers.* 键(title/currentPublishedRuleCount/
  defaultSource/overrideSource/pendingRestoreSource/override/restoreDefault/
  inherited/resetPending/replacementWarning/securityNotice),改用已有的
  settings.runtime.* 通用状态词汇,与 CORS、下游响应头规则保持一致。

已用真实浏览器验证:分区合并后的顺序与文案、校验横幅跳转到正确分区并定位到
非法输入框、分组页控件高度与设置页一致。
请求亲和由三态 SegmentedControl 改为 SettingRow 覆盖/恢复默认模式;
上游请求头规则由 details 折叠改为 SettingBlock,并补上独立的覆盖开关,
与设置页的交互模式完全一致;同步移除废弃的展开态路由状态与文案。
分组已保存覆盖值后,草稿中点击恢复默认会读到仍是旧覆盖值的 effective
快照,导致视觉上"看起来没变"。为出站代理、超时/次数类、请求亲和、
上游请求头规则补充待恢复态:展示占位文案与徽标,保存后才回填真实的
全局生效值,与设置页面的重置反馈保持一致。
复用参数覆盖规则里模型输入的 datalist 模式,把分组当前模型作为候选,
输入即过滤;候选取上游模型 ID(验活按该值请求上游),别名作为副标题
展示。后端不限制该值,仍保留自由输入。
Copilot AI lite review requested due to automatic review settings September 6, 2026 04:08
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Team

Run ID: 15100878-8151-4a80-807e-a0100bfd7b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 3a5dd3d and a54e52f.

📒 Files selected for processing (5)
  • internal/storage/database_integration_test.go
  • web/src/features/settings/BrowserAccessSection.vue
  • web/src/features/settings/ConnectionSettingsSection.vue
  • web/src/features/settings/ReliabilitySettingsSection.vue
  • web/src/i18n/locales/en-US/group.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

本次变更移除了 inject_usage_options 的运行时配置、API 字段、群组覆盖和全局设置,并新增 0008 号数据迁移。网关现在仅根据 ObserveUsage 请求上游用量。设置页面拆分为多个功能区块,并新增统一的设置行、待恢复状态、头部规则编辑和模型自动补全。

Merge Risk: 🔵 Low · up to ff019

This change removes the usage-injection setting and restructures settings interactions. The remaining risk is limited to a rare settings deep-link navigation race that may scroll a user back to an earlier section; it does not affect persisted configuration or gateway behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 21 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed PR 描述完整覆盖关联 Issue、变更内容、自查清单和迁移影响。描述详细说明了设置页重构、分组设置页交互统一、缺陷修复、数据迁移和验证结果。
Title check ✅ Passed 标题准确概括了设置页分区重构和分组设置覆盖交互统一这两个主要变更,表述简洁且与 PR 内容一致。
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 12.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 21 files. (3 skipped: 3 unsupported.)


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.

Copilot AI 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.

🟡 Changes recommended

The new navigation route parsing drops backward compatibility for existing deep links and there are a few behavioral/operational issues in the new shared settings components and initial scroll retry that should be addressed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the Settings and Group Settings UIs to share a unified “override / restore default” interaction model (via new shared components), reorganizes Settings into semantic sections with improved deep-link behavior, and removes the deprecated inject_usage_options setting end-to-end (including a storage migration).

Changes:

  • Introduce shared SettingRow / SettingBlock components and refactor Settings + Group Settings to use consistent override/pending-restore interactions.
  • Repartition global Settings sections (routing/connection/reliability/headers&cors/data maintenance/system) and add a first-render deep-link scroll retry.
  • Remove inject_usage_options from UI, APIs, state resolution, and persistency; add migration 0008_remove_inject_usage_options.
File summaries
File Description
web/src/styles/tokens.css Add unified --setting-control-height token for settings controls.
web/src/styles/components.css Scope smaller control sizing to settings content areas.
web/src/i18n/locales/zh-CN/settings.ts Update Settings section labels/descriptions; remove inject_usage i18n.
web/src/i18n/locales/zh-CN/group.ts Align Group settings labels/help; add pending-restore copy; remove inject_usage i18n.
web/src/i18n/locales/ja-JP/settings.ts Same as zh-CN Settings i18n updates.
web/src/i18n/locales/ja-JP/group.ts Same as zh-CN Group i18n updates.
web/src/i18n/locales/en-US/settings.ts Same as zh-CN Settings i18n updates.
web/src/i18n/locales/en-US/group.ts Same as zh-CN Group i18n updates.
web/src/features/settings/SystemInfoSection.vue Match heading typography to new section title token.
web/src/features/settings/SettingsView.vue Wire new sections; adjust dirty/valid tracking; add deep-link retry scroll.
web/src/features/settings/settings-route.ts Rename/replace section IDs and default section behavior.
web/src/features/settings/settings-patch.ts Ensure header rules are cloned on override enable; remove inject_usage handling.
web/src/features/settings/RuntimeSettingsSection.vue Remove legacy forwarding section implementation.
web/src/features/settings/RoutingSettingsSection.vue New routing section using SettingRow with override semantics.
web/src/features/settings/ReliabilitySettingsSection.vue New retries/health section using SettingRow.
web/src/features/settings/LogsMaintenanceSection.vue Remove legacy logs section implementation.
web/src/features/settings/GlobalHeaderRulesSection.vue Remove standalone header rules section (moved into BrowserAccess).
web/src/features/settings/DataMaintenanceSection.vue New data/maintenance section (retention + models.dev sync).
web/src/features/settings/ConnectionSettingsSection.vue New connection/timeouts section (proxy + timeouts).
web/src/features/settings/BrowserAccessSection.vue Refactor CORS + header rules into SettingBlock; add header-rules validity plumbing.
web/src/features/settings/AffinitySettingsSection.vue Remove legacy affinity section implementation.
web/src/features/groups/settings/GroupSettingsTab.vue Refactor Group overrides to shared components; add explicit header-rules override toggle; remove inject_usage override.
web/src/features/groups/settings/GroupSettingsBaseForm.vue Replace validation model input with datalist-based “search or enter” UX.
web/src/features/groups/settings/group-settings-patch.ts Remove inject_usage from group overrides cloning.
web/src/features/groups/group-route.ts Remove headers=expanded route state for group settings.
web/src/composables/use-section-navigation.ts Allow callers to override scroll behavior per selection.
web/src/components/config/SettingRow.vue New shared single-setting row component.
web/src/components/config/SettingBlock.vue New shared multi-field settings block component.
web/src/components/config/RuntimeOverrideRow.vue Remove legacy runtime override row component.
web/src/app/resources/settings.ts Remove inject_usage from Settings DTO modeling/projection.
web/src/app/resources/groups.ts Remove inject_usage from Group DTO modeling/projection.
web/src/api/control/types.ts Remove inject_usage from API types.
internal/storage/migrations/0008_remove_inject_usage_options.go New migration removing system row + stripping group overrides key.
internal/storage/migration.go Register migration 0008.
internal/storage/migration_test.go Include 0008 in ordered registry assertion.
internal/storage/migration_recovery_test.go Adjust recovery test expectations to exclude future migrations.
internal/storage/db_test.go Update expected migration ledger IDs to include 0008.
internal/state/snapshot.go Remove InjectUsageOptions from compiled group view snapshot.
internal/state/runtime_settings.go Remove inject_usage key + resolution/validation; default is now unconditional include_usage behavior.
internal/state/runtime_settings_test.go Remove inject_usage-related runtime settings tests.
internal/gateway/stream_integration_test.go Update streaming test to assert include_usage is always requested upstream.
internal/gateway/handler_test.go Update “frozen snapshot across retry” test to use a different setting.
internal/gateway/execution_forward.go Always include usage when observation is enabled (no per-group gate).
internal/control/settings.go Remove inject_usage from settings API response mapping.
internal/control/settings_test.go Remove inject_usage from control/settings tests.
internal/control/group_settings.go Remove inject_usage cross-channel constraint validation.
internal/control/group_settings_test.go Remove inject_usage from group settings tests and expectations.
internal/control/group_models_test.go Update model update tests to stop asserting inject_usage persistence.
internal/control/group_detail.go Remove inject_usage from group effective config response.
Review details
  • Files reviewed: 49/49 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/storage/migrations/0008_remove_inject_usage_options.go
Comment thread web/src/components/config/SettingBlock.vue
Comment thread web/src/components/config/SettingRow.vue
Comment thread web/src/features/settings/SettingsView.vue
Comment thread web/src/features/settings/settings-route.ts

@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.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (5)
web/src/features/settings/BrowserAccessSection.vue-62-66 (1)

62-66: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

待恢复态的取值规则未同步到响应头规则块。

第 62-66 行让 header_rulesheaderRulesPendingRestore 为真时取草稿值。setSettingsOverride 在取消覆盖时把草稿值重置为 { set: {}, remove: [] }web/src/features/settings/settings-patch.ts 第 99-100 行),所以取消覆盖后请求头列表与 headerRuleCount 会立即清空,不再回显旧值。

第 73-77 行的 responseRules 没有包含 responseRulesPendingRestore。取消响应头覆盖后,列表和计数仍显示 base 中的旧覆盖值。两个同类区块的待恢复表现不一致。

请把同一规则应用到 responseRules

🐛 建议的对齐修改
 const responseRules = computed(() =>
-  responseRulesOverridden.value
+  responseRulesOverridden.value || responseRulesPendingRestore.value
     ? props.draft.values.response_header_rules
     : props.base.settings.values.response_header_rules,
 )
web/src/features/settings/BrowserAccessSection.vue-465-465 (1)

465-465: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Sensitive Data Exposure (CWE-522): Insufficiently Protected Credentials

Reachability: Internal · Exploitability: Theoretical

补充请求头凭据的明文存储警告。

show-notice="false" 会隐藏 HeaderRulesEditor 的存储提示。三种语言的 settings.headers.description 均未说明请求头值会以明文持久化。请在三种语言中补充该风险说明,或恢复内置提示。

web/src/features/settings/SettingsView.vue-242-242 (1)

242-242: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

阻止延迟定位覆盖后续导航。

此定时器始终滚动到首次捕获的 target。如果用户在 120ms 内选择其他分区,或路由已切换到其他分区,回调仍会把页面移回旧分区。

执行回调前检查 activeSection.value 或当前路由是否仍对应 target。组件卸载时也应清除该定时器。

web/src/features/settings/ReliabilitySettingsSection.vue-78-82 (1)

78-82: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

将可靠性设置的空输入转换为 Number.NaN

setPolicyCountsetValidationInterval 收到空字符串时,Number(value) 会产生 0retry_countblacklist_threshold0 可通过 isValidNonNegativeInteger 并保存;validation_interval0 会被判为无效,但输入仍会回写为 0。请在这两个写入点使用 value.trim() === '' ? Number.NaN : Number(value),其中 setPolicyCount 同时覆盖 retry_countblacklist_threshold

web/src/features/settings/ConnectionSettingsSection.vue-118-122 (1)

118-122: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

ConnectionSettingsSection.vue 中处理空的超时输入。

AppTextInput 通过 @update:model-value 调用 setTimeoutValue,受控值来自 String(draft.values[key])。当用户清空输入框时,Number('') 会将 0 写入连接超时设置,随后受控输入显示 0ReliabilitySettingsSection.vue 不处理这些设置,修改该文件不会修复此路径。

🐛 建议的修改
 function setTimeoutValue(key: TimeoutSettingKey, value: string): void {
   const draft = cloneDraft()
-  draft.values[key] = Number(value)
+  draft.values[key] = value.trim() === '' ? Number.NaN : Number(value)
   publish(key, draft)
 }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Team

Run ID: 0c04ff11-4b24-4809-952d-8d79e9ef5e10

📥 Commits

Reviewing files that changed from the base of the PR and between 4a99ab1 and 6e0c0ad.

📒 Files selected for processing (49)
  • internal/control/group_detail.go
  • internal/control/group_models_test.go
  • internal/control/group_settings.go
  • internal/control/group_settings_test.go
  • internal/control/settings.go
  • internal/control/settings_test.go
  • internal/gateway/execution_forward.go
  • internal/gateway/handler_test.go
  • internal/gateway/stream_integration_test.go
  • internal/state/runtime_settings.go
  • internal/state/runtime_settings_test.go
  • internal/state/snapshot.go
  • internal/storage/db_test.go
  • internal/storage/migration.go
  • internal/storage/migration_recovery_test.go
  • internal/storage/migration_test.go
  • internal/storage/migrations/0008_remove_inject_usage_options.go
  • web/src/api/control/types.ts
  • web/src/app/resources/groups.ts
  • web/src/app/resources/settings.ts
  • web/src/components/config/RuntimeOverrideRow.vue
  • web/src/components/config/SettingBlock.vue
  • web/src/components/config/SettingRow.vue
  • web/src/composables/use-section-navigation.ts
  • web/src/features/groups/group-route.ts
  • web/src/features/groups/settings/GroupSettingsBaseForm.vue
  • web/src/features/groups/settings/GroupSettingsTab.vue
  • web/src/features/groups/settings/group-settings-patch.ts
  • web/src/features/settings/AffinitySettingsSection.vue
  • web/src/features/settings/BrowserAccessSection.vue
  • web/src/features/settings/ConnectionSettingsSection.vue
  • web/src/features/settings/DataMaintenanceSection.vue
  • web/src/features/settings/GlobalHeaderRulesSection.vue
  • web/src/features/settings/LogsMaintenanceSection.vue
  • web/src/features/settings/ReliabilitySettingsSection.vue
  • web/src/features/settings/RoutingSettingsSection.vue
  • web/src/features/settings/RuntimeSettingsSection.vue
  • web/src/features/settings/SettingsView.vue
  • web/src/features/settings/SystemInfoSection.vue
  • web/src/features/settings/settings-patch.ts
  • web/src/features/settings/settings-route.ts
  • web/src/i18n/locales/en-US/group.ts
  • web/src/i18n/locales/en-US/settings.ts
  • web/src/i18n/locales/ja-JP/group.ts
  • web/src/i18n/locales/ja-JP/settings.ts
  • web/src/i18n/locales/zh-CN/group.ts
  • web/src/i18n/locales/zh-CN/settings.ts
  • web/src/styles/components.css
  • web/src/styles/tokens.css
💤 Files with no reviewable changes (16)
  • web/src/features/groups/settings/group-settings-patch.ts
  • web/src/api/control/types.ts
  • web/src/features/settings/RuntimeSettingsSection.vue
  • internal/control/settings.go
  • web/src/features/settings/LogsMaintenanceSection.vue
  • internal/state/snapshot.go
  • internal/state/runtime_settings_test.go
  • internal/control/group_detail.go
  • web/src/app/resources/settings.ts
  • web/src/features/settings/AffinitySettingsSection.vue
  • web/src/features/settings/GlobalHeaderRulesSection.vue
  • web/src/components/config/RuntimeOverrideRow.vue
  • web/src/features/groups/group-route.ts
  • internal/control/group_settings.go
  • web/src/app/resources/groups.ts
  • internal/state/runtime_settings.go

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Repository owner deleted a comment from chatgpt-codex-connector Bot Sep 6, 2026
components.css 冲突为双方各自在文件末尾追加新块(main 的 .filterable-value
与本分支的设置页控件尺寸变量覆盖),语义不重叠,合并时保留双方。
@tbphp tbphp self-assigned this Sep 6, 2026
@tbphp tbphp added the enhancement New feature or request label Sep 6, 2026
@tbphp tbphp added this to the v2.0.0 milestone Sep 6, 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/i18n/locales/en-US/group.ts (1)

337-338: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

改进 pendingRestoreSource 的英文文案。

Pending inherit 不是自然的英文表达。它也不能清楚说明保存后才会继承全局设置。

请改为 Pending inheritanceWill inherit after save,并与 resetPending 的说明保持一致。


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Team

Run ID: 20d6fc1e-146a-48b4-ae84-12725160fbd6

📥 Commits

Reviewing files that changed from the base of the PR and between 6e0c0ad and 3a5dd3d.

📒 Files selected for processing (5)
  • web/src/api/control/types.ts
  • web/src/i18n/locales/en-US/group.ts
  • web/src/i18n/locales/ja-JP/group.ts
  • web/src/i18n/locales/zh-CN/group.ts
  • web/src/styles/components.css

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

- 外部数据库契约里的迁移账本断言硬编码到 0007,只在 PostgreSQL/MySQL 下
  执行,本地 SQLite 会跳过,导致 0008 落库后仅 CI 报错
- 下游响应头规则的待恢复态未取草稿值,取消覆盖后仍回显旧规则,与同区的
  上游请求头规则表现不一致
- 连接与可靠性分区的数字输入清空后写入 0,其中重试次数与拉黑阈值的 0 合法,
  会被静默保存;改为与路由分区一致按 NaN 处理
- 修正 pendingRestoreSource 的英文文案
@tbphp

tbphp commented Sep 6, 2026

Copy link
Copy Markdown
Owner Author

Review 处理说明

已修复(a54e52f2)

  • BrowserAccessSection.vue 响应头待恢复态responseRules 已按建议纳入 responseRulesPendingRestore,与同区的请求头规则块对齐。已在隔离实例验证:发布一条响应头覆盖后点恢复默认,计数归零、规则行清空、显示待恢复徽标(此前会继续回显旧规则)。
  • ConnectionSettingsSection.vue / ReliabilitySettingsSection.vue 空数字输入(共 3 处):改为 value.trim() === '' ? Number.NaN : Number(value),与本 PR 内 RoutingSettingsSection.vue 的写法一致。验证:清空输入框后保持为空并标记无效,不再被写入 0;此前 retry_count0 合法,会被静默保存成“关闭重试”。
  • pendingRestoreSource 英文文案:改为 Pending inheritance
  • 另外修复了 CI 的 Database contract 失败:database_integration_test.go 的迁移账本断言硬编码到 0007,该断言只在外部数据库下执行、本地 SQLite 会跳过,所以 0008 落库后仅在 CI 报错。已在本地 postgres:18 + mysql:8.4 复跑 CI 原命令通过。

未采纳

  • 请求头凭据明文存储提示show-notice="false" 在本 PR 的合并基线上本就是 false(旧 GlobalHeaderRulesSection.vue:120、旧 BrowserAccessSection.vue:458),本 PR 未改变该行为,且与本轮“精简说明、收进 tooltip”的方向冲突。如需补充风险说明,建议单独处理。
  • SettingsView.vue 延迟定位定时器:与 Copilot 的同一条已在对应 thread 说明——要落进挂载后 120ms 的窗口需在分区刚渲染出来时点中另一个分区,概率极低,卸载后触发亦为 no-op。

其余 Copilot 意见(迁移分批查询、sourceLabel 冗余、旧分区深链 ID 兼容)的结论见各自 thread。

@tbphp
tbphp merged commit 1807999 into main Sep 6, 2026
11 checks passed
@tbphp
tbphp deleted the claude/settings-project-analysis-d3b435 branch September 6, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants