Skip to content

fix(panel): 定时测试「同步到全部槽」复制整块设置,表单跟随外部修改 - #520

Merged
dofastted merged 1 commit into
dofastted:mainfrom
Niutopia:fix/test-schedule-sync-all
Oct 18, 2026
Merged

dofastted merged 1 commit into
dofastted:mainfrom
Niutopia:fix/test-schedule-sync-all

Conversation

@Niutopia

Copy link
Copy Markdown
Contributor

摘要

定时测试的「同步到全部槽」只覆盖调度时间,并保留各槽原有开关。在一个槽打开定时测试后点同步,其余槽仍是暂停,看起来没有任何作用。另外,定时测试表单只在首次加载时读一次计划,面板开着时别处的修改(包括同步)不会反映到表单上,此时点「保存计划」会静默覆盖掉别处的修改。

变更

  • src/lib/admin/vm-test-schedule.mjs:syncSchedules 新增可选参数 test(enabled、model、prompt、max_tokens / reasoning_effort)。
    • 带 test 时把整块设置覆盖到目标槽。
    • 另一类槽(Claude 与 Codex 互为另一类)只同步开关和时间,保留自己的模型与 Prompt。
    • 先整体校验 test,任何一项不合法时一个槽都不写。
    • 不带 test 时行为与原来一致。
  • src/lib/admin/panel-routes.mjs:/api/panel/test-schedule/sync 透传 test。
  • web/src/features/vm/vm-test-schedule.tsx
    • 「同步到全部槽」发送当前表单的整块设置,不需要先保存;确认文案如实列出会覆盖的内容。
    • 计划每 30 秒刷新一次。表单未编辑时跟随外部修改;正在编辑时提示「此槽的计划已在别处修改」,并提供「载入最新」,不再静默覆盖。
    • 判定逻辑抽成纯函数 reconcileSchedule。
  • detail-page.tsx、vm-test-dialog.tsx:给定时测试组件加 key={vm.id},切换槽位时重新载入。
  • 测试:test/unit/vm-test-schedule.test.mjs 新增 2 个用例;新增 web/src/features/vm/vm-test-schedule.test.ts(4 个用例)。
  • CHANGELOG.md:在「未发布」里追加一条。

自检

  • vm-test-schedule 后端测试 9/9 通过。
  • 前端 vitest 42 个文件、372 项全部通过,pnpm build(含 tsc)通过。
  • biome format 与 pnpm format:check 均通过。

未做

  • 「同步到本槽」保持原样,仍只同步时间。

@cursor
cursor Bot force-pushed the fix/test-schedule-sync-all branch 2 times, most recently from 1445bc6 to 97bfd08 Compare October 18, 2026 02:41

@dofastted dofastted left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

复审通过(HEAD 97bfd08)。

  • 产品:主聊已确认接受扩大同步(同类型整块;异类只开关+时间)。
  • CHANGELOG「未发布」保留 #521 条 + 本条同步句;无 #508/#509/#511 回灌;下接 ## 1.3.188。
  • diff:定时测试 sync 整块 + 表单 30s 刷新/stale 提示,行为与授权一致。

Approve 后等五职绿再 squash 合 tip gap;勿 tip 189。

@cursor
cursor Bot force-pushed the fix/test-schedule-sync-all branch from 97bfd08 to ce39013 Compare October 18, 2026 02:48

@dofastted dofastted left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

复审通过(HEAD ce39013)。

  • rebase → tip 0fa4b2d7(含 #521+#522);CHANGELOG「未发布」三句齐,下接 ## 1.3.188。
  • 产品扩大同步已确认;CI run 39091412241 五职绿后 squash 合 tip gap。
  • 勿 tip 189。

「同步到全部槽」原先只覆盖调度时间、保留各槽原开关,在一个槽开启后同步,
其余槽仍是暂停,看起来没有任何作用。

- POST /api/panel/test-schedule/sync 新增可选 test 字段(enabled、model、
  prompt、max_tokens/reasoning_effort);带 test 时整块覆盖,另一类槽
  (Claude/Codex)只同步开关与时间。请求先整体校验,不会写一半。不带 test
  的旧行为不变。
- 前端「同步到全部槽」发送当前表单的整块设置,确认文案如实说明。
- 定时测试表单原先只在首次加载时读一次,之后保存会静默覆盖别处的修改:
  改为每 30 秒刷新,未编辑时跟随外部修改,编辑中提示而不覆盖;
  切换槽位重新挂载。

Co-authored-by: ted <kuhlmangarry24@gmail.com>
@cursor
cursor Bot force-pushed the fix/test-schedule-sync-all branch from ce39013 to 9d44874 Compare October 18, 2026 02:56
@dofastted
dofastted merged commit 004b38a into dofastted:main Oct 18, 2026
5 checks passed
dofastted added a commit that referenced this pull request Oct 18, 2026
Tip-cut v1.3.189 — packs #521+#522+#519+#520.

CHANGELOG + VERSION only.
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.

2 participants