boardx / boardx/workspacex

fix(plan-control): PlanConfirmGate 把 gate.reason 枚举码直接当文案渲染给用户

Open
#2,486 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

源于 #2476(视觉重设计过程中截图核对时发现)。

## 问题

\`components/plan-control/plan-confirm-gate.tsx\` 里:

\`\`\`tsx

{gate.reason}


\`\`\`

\`gate.reason\` 的类型是契约 \`PlanGateDecision.reason\`(\`packages/contracts/src/plan-control.ts\` 的 \`PlanGateReason\`)——一个封闭枚举 \`"no-plan" | "single-step" | "multi-step" | "user-forced"\`,是 UC-8 的判定码,不是给用户看的文案。组件没有做任何"枚举 → 中文"的映射,直接原样渲染。

也就是说,**生产环境的确认门今天显示给真实用户的是英文枚举码本身**(比如字面 \`multi-step\`),不是一句人话(例如"这是一个多步、会产出对外报告的任务")——这条不是我编的,是给 [\`app/preview/plan-control-live/page.tsx\`](apps/web/app/preview/plan-control-live/page.tsx)(issue #2476 加的真实组件预览页)喂契约形状的数据时,类型检查直接报错才发现的:预览用的 \`lib/mock/plan-control.ts\` 里那句人话文案跟契约字段完全不是一回事。

## 修法方向

- 在契约的 4 个 \`PlanGateReason\` 枚举值上加一份中文文案映射,单一事实源(参考仓库里已有的 \`PLAN_PHASE_LABEL_ZH\` 这类"枚举→中文"单一映射的写法,同一套纪律:不建第二份、不在组件里现造文案)。
- \`plan-confirm-gate.tsx\` 改成渲染映射后的文案,不是原始枚举值。

## 验证建议

- 单测:4 个枚举值各自对应正确中文,未知值有可辨识的兜底(不是空字符串)。
- 真栈/e2e:确认门实际渲染出的文本不包含英文枚举码字面量。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with packages/contracts/src/plan-control.ts and components/plan-control/plan-confirm-gate.tsx, then inspect the existing PLAN_PHASE_LABEL_ZH mapping pattern. Add coverage for all four PlanGateReason values and an identifiable fallback, and run the relevant unit tests plus the plan-control live preview or e2e check. Done means the gate renders Chinese text rather than the raw enum codes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.