Repository navigation
fix(opportunity): 补齐 needs_analysis 的阶段路径与 Open Deals 行着色,并加派生式完整性守卫 - #761
Merged
Merged
Conversation
…ls row colours `crm_opportunity.stage` has seven canonical values in OPPORTUNITY_STAGE_OPTIONS, but the detail page's `record:path` and the Open Deals `rowColor` map each enumerated six, both omitting `needs_analysis`. A deal in Needs Analysis lit up no step on the path and got no row tint, which reads as corrupted data rather than as missing metadata. The path gains a step between Qualification and Proposal (funnel order; the two terminal stages stay last), and `rowColor` gains teal #14b8a6 — between the cool qualification blue and the warm proposal amber. Deliberately not the #FFD700 the option carries in _picklists.ts: that map is a separate Tailwind palette and gold is one hue step from proposal's #f59e0b, so reusing it would leave two adjacent stages tinting rows indistinguishably. The existing guards checked these surfaces only in the subset direction — every value written must be a real option — which passes on a map listing six of seven. Four assertions add the converse, derived from OPPORTUNITY_STAGE_OPTIONS rather than hand-copied, so an eighth stage cannot ship half-covered. Fixes #759 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrPAGEgFDoHjphqYG4BMa
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…st name The assertion is derived from OPPORTUNITY_STAGE_OPTIONS; spelling "seven" in the title reintroduces, in the test name, the hand-copied count the guard exists to prevent — an eighth stage would leave the name lying while the test passed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHrPAGEgFDoHjphqYG4BMa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #759
前提复核(对
origin/main= c55aaf5)issue 的两处指认都成立,唯一的更正是路径那处的键名是
stages而不是steps,以及 picklist 的实际路径是src/objects/_picklists.ts(issue 正文写对了,派单摘要写成了src/data/):src/objects/_picklists.ts:111-119OPPORTUNITY_STAGE_OPTIONS有 7 个规范取值。src/pages/opportunity_detail.page.ts的record:path只列了 6 个,缺needs_analysis。src/views/opportunity.view.tsopen_opportunities的rowColor.colors只列了 6 个,同样缺needs_analysis。并且按要求排查了"是否还有别的逐项枚举 stage 的地方也漏了" —— 结论是没有,这两处就是全部:
opportunity.object.ts:110stage字段 options[...OPPORTUNITY_STAGE_OPTIONS],派生)opportunity.object.ts:421-428状态机 transitionsopportunity.hook.tsSTAGE_PROBABILITY/STAGE_FORECASTstage.optionsmass_update_stage的stage参数plainOptions(...),派生)pipeline_kanbangroupByField: 'stage',列由 picklist 生成)closed_won/$nin: [closed_won, closed_lost]这类过滤,不逐项列举)quote-generation.flow.tsneeds_analysis)所以无需另开 issue,越界文件面为空。
修法
阶段路径 —— 在 Qualification 与 Proposal 之间插一步。终态的处理沿用现有约定:
closed_won/closed_lost仍排在最后(先赢后输),与lead_detail的 converted/unqualified 收尾一致,不做 variant 之类的特殊标注。行着色 —— 取 teal
#14b8a6。这里没有照搬 issue 建议的、_picklists.ts里该项自带的#FFD700:rowColor用的是另一套 Tailwind 调色板(slate-400 / blue-400 / amber-500 / purple-500 / green-600 / red-600),而金色与相邻的 proposal#f59e0b只差一个色相档,两个相邻阶段的行会染成看不出差别的同一种颜色 —— 那等于用一种更难发现的形式把 bug 重新做一遍。teal 落在 qualification 冷蓝与 proposal 暖琥珀之间,正好接上这条冷→暖的漏斗渐变。守卫
test/metadata-references.test.ts原本已经检查这两处,但只查一个方向:写下来的每个值必须是真实 option(子集)。一张只列了 7 个里的 6 个的表,在子集检查下完全合法 —— 这就是它没被发现的原因。新增 4 条断言补上反方向,且期望值派生自OPPORTUNITY_STAGE_OPTIONS而非手抄:手抄的清单需要和它守卫的元数据在同一个 commit 里一起改,也就会在同一个 commit 里一起被忘掉。crm_opportunity.stage的record:path上有一步;rowColor里有一项;crm_opportunity.stage字段本身必须仍然由该常量构建(否则前两条就是在对着一份运行时已经不认的清单较劲)。两条完整性断言各自先
expect(sites.length).toBeGreaterThan(0)—— 组件类型或statusField一旦改名,站点集合会静默变空、断言退化成空转,这个文件的注释里记着导航守卫就是这么"一直通过"了很久的。反向验证(方向是先预测再跑的)
预测:红,并且报出被删阶段的名字。断言遍历的是
canonical(删 UI 条目不会让它变短),而sites.length守卫挡住了"集合变空所以通过"那条退路 —— 所以这里不存在 #5046 那种"删掉一条反而少一个 finding"的计数反转,也不存在 #5009 那种前后都红的倒挂。四项实测与预测一致:删掉路径那一步:
删掉 rowColor 那一项:
把
needs_analysis的颜色改成 proposal 的#f59e0b(即"照搬#FFD700会走到的那一步"的放大版):把
statusField改名(验证守卫本身不空转):验证
平台依旧钉在
17.0.0-rc.2,无版本变动、无平台绕行。文件面严格限于 issue 授权范围:stale_opportunities的注释块(#744)与closing_this_quarter的过滤(#746)均未触碰,content/docs/**未触碰(#758/#756 在飞)。用户可见,已附 changeset。Generated by Claude Code