fix(objects): drop scale from every currency field — objectstack main refuses it - #1968
Merged
Merged
Conversation
objectstack main refuses `scale` on a `currency` field (semantic entry `field-currency-scale-refused`, no forward conversion), so hotcrm's artifact cannot boot there with it. A currency's decimals are the currency's ISO 4217 minor unit, not a field setting. `scale` is optional at the pinned @objectstack/spec 17.4.0, so the deletion is legal on both versions. 23 lines deleted in 8 object files, one per currency field; nothing added. `scale` on number, percent, formula and summary fields is untouched. Co-authored-by: Claude <noreply@anthropic.com>
… refuses the tail With `scale` gone from currency fields, the quote's money fields accept a write with more than 2 decimals, so the two comments that said the field refuses an unrounded product are no longer true. They now say what the rounding does: it keeps discount_amount and total_price in whole cents. The round() expressions and the value pins are unchanged; only the flow comment, the test docblock and the test title move. Adds the patch changeset for the currency `scale` removal. Co-authored-by: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
hotlong
marked this pull request as ready for review
September 28, 2026 07:08
hotlong
pushed a commit
that referenced
this pull request
Oct 3, 2026
Conflict: docs/STATUS.md, resolved by recomputing from the merged tree's own `pnpm validate` rather than by picking a side: main retired the demo_bootstrap flow (30 Flows) and this branch adds opportunity_status_change_approval, so the merged stack registers 18 Objects / 361 Fields / 31 Flows. Semantic conflict, resolved in this merge: main dropped `scale` from every currency field (#1968) and the 17.6.0 pin now refuses the key outright ("`scale` is not valid on a `currency` field — delete the key"). The two currency fields this branch adds, expected_tender_amount and expected_signing_amount, carried `scale: 2`; it is removed so the merged tree validates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ER8ntXZhYebyQ66aXWdjfT
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 #1965
Part of objectstack-ai/cloud#2440
Clause-②: no
What
This PR deletes
scalefrom everycurrencyfield: 23 lines in 8 object files, one per field, with nothing added in their place. objectstackmainrefuses the key ("scaleis not valid on acurrencyfield"; semantic entryfield-currency-scale-refused), and no forward conversion exists for it. A currency's decimals are its ISO 4217 minor unit, not a field setting.scaleonnumber,percent,formulaandsummaryfields is left alone (5 formula, 6 number, 4 percent and 1 summary are untouched).The maintainer ruled this route on the card. First the card ruling (「平台修转换 + HotCRM 先删 scale(推荐)」), then comment 5864798033 on the display window (「现在删,cloud 两次抬版本同一次部署(推荐)」).
The two comments that the deletion made false are reworded, and nothing else changes in those files.
src/revenue/flows/quote-generation.flow.tssaid the quote's money fields refuse an unrounded product; after this PR they accept it.test/flow-quote.test.tshad the same claim in its docblock and in its title, which now reads "rounds discount_amount and total_price to whole cents (#1206)". Theround()expressions and the value pins are unchanged.This PR adds one patch changeset,
.changeset/currency-fields-drop-scale.md.Display window (measured, and accepted by the ruling)
At the pinned
@objectstack/console17.4.0 (built from objectui53ded82bf7a4), two faces format a currency value with the field'sscale ?? 0:plugin-gridbundle,r?.scale??0, which feeds min/max fraction digits;object-metrictile:plugin-dashboardbundle,ie.scale??0, which picks0,0.00vs0,0.After this PR they show whole units. In hotcrm this reaches 17 currency
summary:columns across 8 list views, plus the Revenue (Won) and Pipeline Value tiles on Sales Home. Record cells do not change: they already use the currency's own minor unit.I measured this in the UI on two local
objectstack devservers with the same seed. Port 4801 ran main; port 4802 ran this deletion.Every seeded amount is a whole unit, so on the demo data the only change is the dropped
.00. In the grid, the footer then matches the cells, which already show94,000. Non-integer totals round to whole units. For example, the product view's avg list_price goes from 22,346.15 to 22,346; that figure is computed from the shipped formatter, not captured in the UI.The window closes when the console includes objectui
0651e7ab4(objectui#10348):merge-base --is-ancestorexits 1, and the control leg exits 0..objectui-shaefead6c6: exits 1, control exits 0.main's console pinf8a9d0fb: exits 0.Cloud avoids the window by shipping the framework re-cut (cloud#2332) and the objectui pin move (cloud#2441) in one deploy. That constraint is recorded on both cloud cards. The hotcrm-local half (
pnpm dev/objectstack startat 17.4.0) closes when hotcrm bumps to 17.5.x.Verification, on HEAD
8d558193pnpm verifychain, command by command:2f7b23268d558193pnpm validatepnpm typecheckpnpm lintpnpm lint:i18n-gatei18n/missing-*issues")pnpm hygienepnpm hygiene:tokenspnpm buildpnpm testpnpm teston this PR hit only 5000 ms or 60000 ms timeouts, with the box's load average between 40 and 77 (other agents' builds):global-actions,lint-i18n-gateandsource-token-ratchet.case-sla-matrixandsource-token-ratchet.source-token-ratchetfile passed 40/40 once at the default timeout, and later timed out again at the default.global-actions+source-token-ratchet+case-sla-matrixpassed 119/119 with--testTimeout=60000.lint-i18n-gate+flow-quote(and the others in that rerun) passed.No assertion failed in any run. CI owns the clean full-suite reading.
Artifact probe. The objectstack
862b6cedist ranObjectStackDefinitionSchema.safeParse(applyArtifactForwardConversions(...))on this branch'sdist/objectstack.json:scalescale: the chart keys (16 type, 9 xAxis, 9 yAxis) andassignedProfiles(6) remain, pending objectstack#20390scaleThis PR's artifact is identical, section by section, to main's artifact with only those 23 keys stripped. The comment edits do not reach it.
Other checks.
@objectstack/spec17.4.0 accepts a scale-less currency field inFieldSchema,Field.currency()andObjectSchema.create(), so the deletion is legal at the pin.git merge-tree --write-treeof this deletion against draft feat(revenue): quotes and contracts follow the account (controlled_by_parent) — #549 #1956 exits 0, and against draft feat(opportunity): REQ-0006 qualification, the customer calendar, narrative and approval on status change #1950 exits 0. The positive control, a same-line edit, exits 1.Acceptance notes
max_scaleon a currency field only through the field'sscale(dist/core.js, numeric branch). With the key gone, a money write with more than 2 decimals on these 23 fields is accepted where it used to be refused. That is the platform's ruled contract for currency from 17.5 on, arriving early here. No hotcrm test pins the old refusal (0 hits formax_scaleundertest/). The Generate Quote flow still rounds to whole cents, so its amounts do not change.scale: 2to two new currency fields,expected_tender_amountandexpected_signing_amount. That PR's author needs to drop them before it lands, or objectstack main will refuse them. Its textual merge with this PR is clean.assignedProfilesfamilies, 40 issues at a 17.4.0 runtime label. At a 17.5.0 label both families convert forward and nothing remains.Generated by Claude Code