Skip to content

feat(config): autoReview 默认关——启动不自动派发 codex review - #60

Merged
ghbvf merged 2 commits into
developfrom
Feature/codex-default-manual-review
Jun 17, 2026
Merged

ghbvf merged 2 commits into
developfrom
Feature/codex-default-manual-review

Conversation

@ghbvf

@ghbvf ghbvf commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

把 AppConfig::default() 的 auto_review 默认值翻为 false——全新/重置配置启动时不再自动派发 codex review,改为仅手动触发。

Why / 背景

项目启动时 scheduler 一旦发现 dispatchable PR 就自动派发 review → 懒启动 codex app-server。开发/测试时这会与「其他正在 review 的进程」冲突(另一终端跑 codex、或另一实例)。auto_review 是控制该链路的现成门控(pr/scheduler.rs::auto_review_enabled,scheduler 轮询 + webhook 两路每轮重读),把默认翻关即可让启动默认只轮询/emit PR、不拉起 codex;手动入口 start_review / start_codex 不受影响,PR 监控功能不变。

Refs

无关联 issue(ship --L2 直接实施)。
ref: src-tauri/src/config/model.rs(默认真值源)、src-tauri/src/pr/scheduler.rs(auto_review_enabled 门控)、src/config/fields.ts(autoReview 开关定义)。

Risk / 兼容性

  • 行为变更(非破坏性):仅影响全新/重置配置的默认值。serde #[serde(default)] 语义下,已 onboarding 保存的 config.json(已含 autoReview:true)保留原值、加载后仍自动 review——需在「设置 → 轮询 → 自动 review」手动关,或删 config.json 重置。
  • 不做强制迁移:技术上无法区分「用户显式选 true」与「继承旧默认 true」(serde default 不留痕),强制翻会覆盖用户已保存选择,故不迁移。
  • 跨切片契约:AppConfig wire 形状不变(只改值不改字段/键名);serde golden / forward-compat 测试两侧均用 AppConfig::default() 符号引用,随默认值一起移动、保持绿。前端 src/config/types.ts 字段无变化。
  • 回归锁:新增 default_auto_review_is_off 测试锁住新默认,静默翻回 true 会 CI 失败。

Test plan

  • pnpm build 本地通过(vue-tsc 类型检查 + vite build)
  • cargo build --manifest-path src-tauri/Cargo.toml --locked 本地通过
  • cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --locked -- -D warnings 0 告警
  • cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check 干净
  • cargo test --manifest-path src-tauri/Cargo.toml --locked 通过(180 passed;含新增 default_auto_review_is_off 与 golden/forward-compat)
  • pnpm test(vitest)97 passed

🤖 Generated with Claude Code

项目启动时 scheduler 一旦发现 dispatchable PR 即自动派发 review、懒启动
codex app-server,测试/开发时与其他 review 进程冲突。把 AppConfig::default()
的 auto_review 翻为 false,使全新/重置配置默认仅手动触发(start_review /
start_codex 手动入口不受影响;scheduler 仍轮询并 emit PR 列表)。前端 draft
占位同步镜像后端,避免加载前的勾选闪烁。新增 default_auto_review_is_off 测试
锁住该默认,防静默翻回 true。

已存配置(已持久化 autoReview:true)保留原值,不做强制迁移;需在设置里手动关。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ghbvf ghbvf added the pr-status/in-progress ship 实施 + 内置 review/fix 中 label Jun 17, 2026
内置 review 的 P3 small findings:wire-shape golden fixture 与两处前端
测试 fixture 的 autoReview/auto_review 硬编码仍为 true,与新默认方向相反,
构成阅读歧义(不影响测试正确性——这些断言不关心该字段的值)。统一对齐为
false 消除认知噪音。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ghbvf

ghbvf commented Jun 17, 2026

Copy link
Copy Markdown
Owner Author

🛠 ship review + fix

reviewer 1 · Findings 2(已修 small 2 · 遗留 large 0 · OUT_OF_SCOPE 0)· 结论 LGTM

  • F1 [P3·small·DX/测试] src-tauri/src/config/model.rs:251 — wire-shape golden fixture 的 auto_review 硬编码 true,与新默认方向相反 → ✅ 已修
  • F2 [P3·small·DX/测试] src/config/fields.test.ts:28 · src/config/useConfigStore.test.ts:28 — 前端测试 fixture autoReview 硬编码 true,同向不一致 → ✅ 已修
完整详表(根因 + 证据 + 建议 + 处置)

F1 [P3·small·DX/测试] src-tauri/src/config/model.rs:251

  • 证据:auto_review: true,(app_config_wire_shape_is_camel_case 的 fixture),而 Default 已翻为 auto_review: false
  • 根因:该 golden 测试只断言 camelCase 键存在 / snake_case 键缺席,不关心 autoReview 的值——fixture 硬编码 true 不影响测试正确性,但翻默认后读起来方向相反,构成认知噪音
  • 建议:fixture 对齐为 false(不改测试逻辑,纯 DX)
  • 处置:✅ 已修(commit 4eae660)

F2 [P3·small·DX/测试] src/config/fields.test.ts:28 · src/config/useConfigStore.test.ts:28

  • 证据:两处 fixture helper(validDraft() / cfg())autoReview: true
  • 根因:validateStep / useConfigStore 测试均不断言该字段的值(GROUPS covers all 18 keys 只比 key 名),但与新默认方向相反,误导阅读者
  • 建议:两处 fixture 对齐为 false
  • 处置:✅ 已修(commit 4eae660)

闭环核查(reviewer 六问确认,无 finding)

  1. 前后端默认值一致、无遗漏镜像点:Rust AppConfig::default()、SettingsView.vue/OnboardingWizard.vue draft 占位、types.ts 接口、service.rs fallback 全部 false。
  2. 两条自动派发路径均经 auto_review_enabled() 门控:scheduler.rs:264(轮询)+ lib.rs:71(webhook)→ 默认 false 时两路均不派发、不拉起 codex;手动入口 start_review/start_codex 不受影响。目标闭环。
  3. serde golden(app_config_wire_shape_is_camel_case,键名断言)+ forward-compat(empty_object_deserializes_to_default / partial_object_fills_rest_from_default,符号引用 AppConfig::default())均仍成立。
  4. 新增 default_auto_review_is_off(assert!(!AppConfig::default().auto_review))= Medium 载体(cargo test 机器可判定),注释含意图与守护对象,符合 ai-robust 章程。
  5. fields.ts 的 autoReview hint 值中立,无需改。
  6. 架构合规:切片内改动、无跨切片 import、serde camelCase 对齐、未新增 Tauri command。

门禁:cargo test 180 passed · fmt clean · clippy 0 warn · vue-tsc + vite build OK · vitest 97 passed。

下一步:切 pr-status/needs-review-again(待再审:codex / /pr-review #60;有需改再 /fix #60)。


🤖 PR #60 · Generated with Claude Code · branch Feature/codex-default-manual-review · worktree worktrees/Feature/codex-default-manual-review · session —

@ghbvf ghbvf added pr-status/needs-review-again ship 交接后首审一次(review changes-requested 后转 needs-fix) and removed pr-status/in-progress ship 实施 + 内置 review/fix 中 labels Jun 17, 2026
@ghbvf

ghbvf commented Jun 17, 2026

Copy link
Copy Markdown
Owner Author

CI 检查结果

状态:通过(已通过 2 / 共 2 个检查)

  • Frontend (vue-tsc + build) — pass (2m12s)
  • Rust (fmt + clippy + build) — pass (2m11s)

run: https://github.com/ghbvf/prmonitor/actions/runs/27699364949


🤖 PR #60 · Generated with Claude Code · branch Feature/codex-default-manual-review · worktree worktrees/Feature/codex-default-manual-review · session —

@ghbvf

ghbvf commented Jun 17, 2026

Copy link
Copy Markdown
Owner Author

🔍 pr-review(六维度分级审查)

根因簇 0 · Findings 0(P0 0·P1 0·P2 0·P3 0 | small 0·large 0)· 结论 通过

根因簇

  • 无根因簇。已核对代表文件:src-tauri/src/config/model.rs、src/config/OnboardingWizard.vue、src/config/SettingsView.vue、src/config/fields.ts、src/config/useConfigStore.ts、src-tauri/src/pr/scheduler.rs、src-tauri/src/lib.rs。rg 结果显示 autoReview/auto_review 调用点仍集中在配置字段、scheduler/webhook 门控和手动 review 入口,未发现系统性漂移。

Findings(每条带 file:line,/fix 无损提取)

  • 无 finding。
完整详表(证据 + 建议 + 根因 + 方案种子,/fix 读此)

无 finding。

验证:

  • cargo test --manifest-path src-tauri/Cargo.toml --locked default_auto_review_is_off 通过。
  • pnpm vitest run src/config/fields.test.ts src/config/useConfigStore.test.ts 通过。

复杂度汇总:按根因簇 small: 0 / large: 0;按 Finding small: 0 / large: 0
修复分流:无 small 簇,无需 /fix;无 large 簇,无需人工决策。
结论:默认值翻为手动 review 的行为、前后端配置面、scheduler/webhook 自动派发门控和新增 Medium 测试锁一致;未发现需要修改的问题。


🤖 PR #60 · Generated with Claude Code · branch Feature/codex-default-manual-review · worktree /Users/shengming/Documents/code/prmonitor/worktrees/Feature/codex-default-manual-review · session —

@ghbvf ghbvf added pr-review/approved review 无需改 pr-status/ready --check 验证全修复,可合并 and removed pr-status/needs-review-again ship 交接后首审一次(review changes-requested 后转 needs-fix) labels Jun 17, 2026
@ghbvf
ghbvf merged commit 15f976d into develop Jun 17, 2026
2 checks passed
@ghbvf
ghbvf deleted the Feature/codex-default-manual-review branch July 4, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-review/approved review 无需改 pr-status/ready --check 验证全修复,可合并

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant