Repository navigation
fix(fields,core): every percent face scales by the field's declared storage; the magnitude guess retires (objectui#11475) - #11490
Conversation
…torage; the magnitude guess retires (objectui#11475) percentDisplayValue and formatPercent take the storage (the spec's PercentScale) as a required argument. The percent cell, the record header chip, the grid footer and mobile card, the gantt tooltip, the dashboard record renderer and object metric tile read it with percentCellScale (the spec's percentScaleOf); a face with no field states it. The cell hosts that dropped `max` (grid paths A/B/C, gallery, related list, dashboard FieldMeta) now carry it. PercentField reads percentScaleOf by reference. Claude-Session: https://claude.ai/code/session_01YLg8XqWGJ785fwQ5v4pH37 Co-authored-by: Claude <noreply@anthropic.com>
…w declare it (objectui#11475) An unannotated measure column and an undeclared percent field are a fraction now; the rows that meant points say `whole` / declare a `max` above 1. The grid pin waits for the schema's own label. Claude-Session: https://claude.ai/code/session_01YLg8XqWGJ785fwQ5v4pH37 Co-authored-by: Claude <noreply@anthropic.com>
…rcent-declared-storage Claude-Session: https://claude.ai/code/session_01YLg8XqWGJ785fwQ5v4pH37 Co-authored-by: Claude <noreply@anthropic.com>
…declare it; the boundary rows read by storage (objectui#11475) Rows whose stored value is percentage points now sit on a field declaring a `max` above 1; the rows that pinned the magnitude guess's boundary (exactly 1, negatives) are rejudged by the declared storage. Chip-against-cell and text-against-bar pins are unchanged. Claude-Session: https://claude.ai/code/session_01YLg8XqWGJ785fwQ5v4pH37 Co-authored-by: Claude <noreply@anthropic.com>
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: Read for this record, 2026-10-02T17:31Z: card #11475 (body and all six comments, triage ① Derived judgmentsPublic surface,
Faces that hold a field (each verified in the diff and in the head tree census: 15 calls in 11 files, matching the pin's table call by call):
Cell hosts that dropped plugin-report: no source change. A legacy Enumeration pin Fixture triage: rows whose stored value meant points now declare a Docs: ② Semver level
③ Boundary flagsDev round 1 (
Dev round 2 (
Implemented-by: VERDICT: PASS |
Fixes #11475
Clause-②: yes
Every percent face now scales a stored value at the storage its field declares: the spec's
percentScaleOf(@objectstack/spec/data), which says a fraction unless the field declares amaxabove 1. The read-only form already worked this way.percentDisplayValue's magnitude guess, which multiplied a value strictly between -1 and 1 by 100 and passed everything else through, is gone. A face that holds no field states its storage explicitly. Before this change, one stored value showed two percentages: at6007dd4e4the read-only form and the list cell read the card's three rows as100%/1%,150.0%/1.5%and0.5%/50.0%.Contract notes
For the at-tier review. Both exports are released on
@object-ui/coreand@object-ui/fields. The changeset isminorand carries the BREAKING banner.percentDisplayValue(value)TOpercentDisplayValue(value, percentScale)(@object-ui/core).percentScaleis the spec'sPercentScale('fraction' | 'whole'), which core already re-exports. Any other value throws aTypeError; it no longer falls silently to one branch.formatPercent(value, precision, locale)TOformatPercent(value, percentScale, precision, locale)(@object-ui/fields). The storage comes second because it is a required argument.percentCellScale(field)(@object-ui/fields): the storage the percent cell reads. It returnspercentScaleOf({ type: 'percent', max }), which always gives an answer, except forprogress, which is stated'whole'. The spec answersundefinedforprogress, and its only editor (SliderField) stores the slider position on a 0–100 range. Every face that renders the cell's number for the same field reads this one function.summaryChipPercentPoints(raw)becomessummaryChipPercentPoints(raw, percentScale)(plugin-detail, module-internal).FieldMetagainsmax(plugin-dashboard, copied from the schema field def only). As aFieldMetamember it joinsObjectDataTable's read-side refusal band, so an authored column cannot restate how its field stores.Every caller, and where its storage comes from. The pin
scripts/__tests__/percent-storage-callers-11475.test.tsenumerates these from disk, so a new caller fails until it is listed:formatMeasurepercentScaleannotation; an unannotated%pattern is read as numeral reads it:'fraction'formatPercentbodyPercentCellRenderer(text and bar)percentCellScale(field)MetricWidget(%pattern)'fraction': numeral's%multiplies by 100ObjectMetricWidget(aggregate over apercentfield)percentCellScale(valueFieldDef); it renders the tile itself, the way it renders a currencyrenderFieldValue%branchpercentCellScale(fieldMeta)for percent/progress, otherwise the pattern's'fraction'percentCellScaleover the merged field bagpercentrowpercentCellScale(def)percentCellScale(column), withmaxread off the fieldpercentonlypercentCellScale(percentDef)Cell hosts that dropped
max, and so would have read a whole-stored50as5000%, now carry it. All of them use the shape each one already uses forscale: plugin-gridObjectGridcolumn paths A/B/C, plugin-listObjectGallerybuildEnrichedField, plugin-detailRelatedList's cell bag, and plugin-dashboardbuildFieldMeta.PercentFieldnow askspercentScaleOfby reference instead of restating the rule. Every shipped percent field (CRMprobabilityanddiscount_percent, showcasef_percentandallocation_percent, todoprogress_percent) declaresmax: 100, so their readings do not move.Visible changes, named
probability,percent,rate,ratio,confidence,score). A field that is not apercentdeclares no percent storage, so such a field now prints through its own cell with no percent affix. The showcase'slead_scoreandtax_rate(bothField.number) are the shipped fields this moves. This follows the seat's answer 3 on5955873664.%measure ormetricpattern is read as a fraction (numeral's reading). An unannotated57used to read57%and now reads5700%. Every first-party%measure is a server-annotated ratio, so none of them moves.ReportViewerdraws atype: 'percent'report column through the cell with the column's ownReportField. That field declares nomaxand is not hydrated, so it reads a fraction. Measured at6007dd4e4: no producer in objectui or objectstack writes a percent column into a legacy report, andspecReportToPresentationwrites columns with notype.Tests
0.25control (PercentCellRenderer.declaredStorage-11475.test.tsx);maxcarriage on every grid path, the gallery and the related list;percentDisplayValue/formatMeasure;ReportViewerreading.maxabove 1. Rows that pinned the guess's boundary (exactly1, negatives) are re-judged by the declared storage. Rows whose subject was locale, width or layout keep their bytes.ee688e10a:Tests 52 passed (52).type-check: source andtsconfig.test.json) after a closure build: core, fields, plugin-dashboard, plugin-detail, plugin-gantt, plugin-grid, plugin-list and plugin-report all exit 0;type-check:scriptsalso exits 0.Reverse verification
The prediction was written before each run.
6007dd4e4, with the new pin at HEAD. Predicted 10 red / 2 green; measuredTests 10 failed | 2 passed (12). The cell read1%,1.5%and50.0%against the form's100%,150.0%and0.5%. The controls (0.25, a whole-stored50) stayed green. Restore was proven by blob equal to HEAD on all four paths and an emptygit diff HEAD.scripts/ablation-replace.mjs: anchor 1 → 0, blob changed). Predicted 5 red / 7 green; measuredTests 5 failed | 7 passed (12)(the three rows, the bar,progress). Restore was proven: blob equal to HEAD and an emptygit diff HEAD.Gates at
ee688e10acheck:control-bytesOK;check:new-line-citations0 new citation(s);check-changeset-presenceOK (6 changesets);check:changeset-claimsexit 0 (report-only).check:readme-exportsis NOT MEASURED: a prerequisite collapse ("366 self-import(s) could not be judged", unbuilt packages). No README fence changed (compared fenced content against6007dd4e4), socheck:doc-snippetsdoes not apply..ts/.tsxfiles: 0 errors (JSON count 48). Narrowing proof:eslint.config.jsfiles: ['**/*.{ts,tsx}'];tseslint.configs.recommended, noparserOptions.project), and no rule ineslint-rules/reads the filesystem, so the diff cannot move any untouched file's verdict.Acceptance notes
plugin-report'sformatValuehas its ownformat: 'percent'arm (a value printed verbatim with%), a third percent face outside the formatter family. No carrier.ObjectMetricWidget'sinvertis still the magnitude-gated1 - v(0 to 1 only). No carrier.percentScaleOfgives no answer forprogress. This PR states'whole'at the one call site; an upstream spec card is the maintainer's choice.Generated by Claude Code