Repository navigation
fix(marketing,sales): Response Rate %, ROI % and Attainment % read as percentages (#2919) - #2931
Conversation
… percentages (#2919) Declare the campaign's Response Rate % and ROI % and the forecast's Attainment % as `returnType: 'percent'` with `max: 100`, the way #2910 declared a project's Budget Used % and Gross Margin % (maintainer ruling B, docs/developers/number-formats.md). The expressions keep `* 100`, so the API value is unchanged in percentage points; the console now draws `41.67%` where it drew `41.67`. Response Rate % and ROI % are rates and draw plain; Attainment % is progress toward the quota and keeps the bar. The three declarations are pinned in test/money-rollup-currency.test.ts, with every percent formula in the app held to percentage points. The forecasting docs say the field reads `0.00%` and that the API reads `106.00` where the screen shows `106.00%`. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K Independent read-only review (Fable) · head
Evidence: Seat: per AGENTS.md ("maintainer until the reviewer says otherwise"), the independent reviewer rules reviewer-class. The seat lands it once every check is finished and green. |
Resolve test/money-rollup-currency.test.ts by keeping both appended blocks: the #2920 approved-discount pin and the #2919 three-formula pin with its app-wide percent-formula row (approved_discount is a Field.percent, not a formula, so the row is unaffected). Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K L1 review: ACCEPT · reviewer-class (per the independent review above) · seat lands (2026-12-03T02:17Z)
|
Closes #2919
Clause-②: no
Metadata-protocol: none
Metadata-impact: reviewer — three existing formula fields change only how they are drawn (
returnType: 'percent',max: 100); the expressions are byte-identical, nothing is stored, the API value is unchanged (measured below), and nothing changes who can see or change what. Precedent note: #2910 declared the same kind of change maintainer; the reviewer decides.维护者速读
What changes
crm_campaign.response_rate(Response Rate %) andcrm_campaign.roi(ROI %):returnType: 'percent',max: 100,percentDisplay: 'plain'(a rate, and ROI goes negative on a loss, so no progress bar). Expressions unchanged, still* 100.0 /.crm_forecast.attainment_pct(Attainment %):returnType: 'percent',max: 100; keeps the bar (progress toward the quota). Expression unchanged.docs/developers/number-formats.md(ruling B on feat: totals of amounts show the tenant currency; Budget Used % and Gross Margin % read as percentages (#2569) #2910): amaxabove 1 is the platform's statement (percentScaleOfgiveswhole) that the value is in percentage points, so the API keeps reading41.67.0.00%and that the API reads106.00where the screen shows106.00%.Readers checked (none changes behaviour)
src/sales/views/forecast.view.tslistsattainment_pctas a column in three views and deliberately does not sort by it (a formula). No view listsresponse_rateorroi.forecast_metrics' Attainment measure is a derivedclosed_sum / quota_sumratio and does not readattainment_pct; no dataset, dashboard, report or page readsresponse_rateorroi.forecast-snapshot.flow.tsandopportunity.campaign-metrics.hook.tsname the formulas only in comments; they write the stored operands, never read the formula. No validation reads any of the three.campaign.actions.tsmentionsresponse_ratein a comment only.campaign-member-uniqueassertsresponse_ratereads100through the engine, still green;campaign-member-lifecycle,campaign-enrollment-gates,seed-consistency,hooks-runtime-service,flow-scheduledgreen.Measurement
objectstack devon this branch and on theorigin/maindeclarations, same seed, admin, Chromium on the record pages andGET /api/v1/data/...:41.6741.67%400.00400.00%106.07106.07%All 7 campaigns and all 7 forecasts read identical API values before and after (sorted diff, ids aside).
Tests
test/money-rollup-currency.test.ts: a new block pins the three declarations (returnType: 'percent',percentScaleOfgiveswhole, expression keeps* 100,percentDisplayplain for the two rates and absent on Attainment %), and holds everypercentformula in the app to percentage points.max: 100removed from ROI %, 2 of 35 go red ("points, not a fraction: expected 'fraction' to be 'whole'", in the pin and the app-wide row); restored, 35 passed.Acceptance notes
Verification
Files to read first:
src/marketing/objects/campaign.object.ts(the two formulas),src/sales/objects/forecast.object.ts(Attainment %),test/money-rollup-currency.test.ts(the new block).Two-minute check:
pnpm exec vitest run test/money-rollup-currency.test.tsreads 35 passed; open a campaign with responses and Response Rate % reads with a%.Local readings on f661bec
pnpm validate"Validation passed",pnpm typecheck,pnpm lint,pnpm hygiene: chain exit 0 (os-verify-lock VERDICT command-exit 0).vitest runmoney-rollup-currency, docs-locale-callouts, docs-object-coverage, docs-role-hierarchy, docs-setup-navigation-names, skills-integrity, campaign-member-unique, flow-scheduled: 8 files, 181 passed.pnpm testandpnpm build; CI runs them.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K