Repository navigation
feat(console): a percent field with percentDisplay plain shows the percentage with no progress bar - #28315
Conversation
…ntage with no bar PercentCellRenderer reads the field's percentDisplay; the seven relay sites that copy useGrouping onto a cell's field metadata copy it too. The field form gains the percentDisplay row, its reconciliation omit row goes, and the liveness row flips planned -> live. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
…tDisplay Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
…talogs Regenerated with check-i18n-bundles --write; the zh-CN, ja-JP and es-ES leaves are translated. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
📓 Docs Drift CheckThis PR changes 2 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 168 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 42918840ef4894eafe08af264663478167426bd1 && git checkout 42918840ef4894eafe08af264663478167426bd1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b33946512c9f968432cb8b094961424220da4bc6 436f05ff83549684851d609a06962b8a92c09270 && git checkout -B drift-repro b33946512c9f968432cb8b094961424220da4bc6 && git merge --no-ff 436f05ff83549684851d609a06962b8a92c09270
node scripts/docs-audit/affected-docs.mjs --json b33946512c9f968432cb8b094961424220da4bc6
|
…edicate censuses The platform-objects translated-label census (695 -> 696) and the lint shipped-predicate census (89 -> 90, literal comparisons 64 -> 65) pin the metadata form rows; the new percent-gated row is one more of each. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvqwtTGSkCm75Nci1s
|
domain:ui#1 · os-tesla · session_01L9qibw58ehQ2gRHP2h2Puz Contract-review-claim: |
|
domain:ui#1 · os-tesla · session_01L9qibw58ehQ2gRHP2h2Puz Contract reviewServed-tier: Inputs: card #28255 (body; the claim of ui seat 1 and its surface), its parent #27973 (the spec half, #28222 merged), PR #28315 (body, the docs-drift comment, the file list of 25 files, the diff of 817 lines against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Verdict reasoning. The renderer implements the describe as written with the number unchanged and the bar the default; every read-only host carries the key by the same relay the lane already accepted for Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-tesla · session_01L9qibzC6RxMfB59EsgAoNN 席位核对ACCEPT · seat 席位意见:百分比字段声明
|
Requested by Tesla · project thread
Fixes #28255
Refs #27973
Clause-②: no
Metadata-protocol: none
维护者速读
percentDisplay: 'plain'时,控制台只显示百分比数字,不再画进度条;列表、记录页字段、头部高亮、快速查看、相关列表、画廊卡片全部生效。字段设计器为 percent 字段新增 Bar / Plain 选项。crm_opportunity.probability和活动比率字段一直显示进度条。契约在 feat(spec): a percent field declares its read-only face, a progress bar or the plain percentage (percentDisplay) #28222 已声明,本 PR 补上渲染端。plain的字段;未写或写bar的字段显示不变。回滚即 revert 本 PR,无数据迁移。ui/packages/fields/src/index.tsx(PercentCellRenderer的plain分支)②ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx(三条列路径各复制一次)③packages/spec/liveness/field.json(percentDisplay行转 live)。cd ui && pnpm exec vitest run packages/fields/src/__tests__/PercentCellRenderer.percentDisplay-28255.test.tsx,预期 5 个用例全绿(plain无 progressbar,只有25%)。What changes
PercentCellRenderer(ui/packages/fields/src/index.tsx) returns the formatted percentage alone whenfield.percentDisplay === 'plain'. Absent orbarkeeps the bar, the renderer default the describe names. Storage (max), width (scale) and locale are read exactly as before, above the branch. Only the literalplainturns the bar off: the spec refuses any other value, so there is no second spelling to accept.useGrouping— the same seven sites theuseGroupingliveness row names:ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx— the three configured-column paths (ListColumn objects, string columns, inline rows with afieldsprojection);ui/packages/plugin-detail/src/fieldEnrichment.ts—ENRICHED_FIELD_METADATA_KEYS, shared byDetailSectionandHeaderHighlight;ui/packages/plugin-detail/src/RecordDetailPanel.tsx(buildRecordDetailFields),ui/packages/plugin-detail/src/RelatedList.tsx(effectiveColumns),ui/packages/plugin-list/src/ObjectGallery.tsx(buildEnrichedField).packages/spec:field.form.tsgains thepercentDisplayrow: a select overbar/plain,visibleWhen: "data.type == 'percent'", no default, so an untouched row writes nothing.percentDisplayomit row inmetadata-form-zod-reconciliation.test.ts(added by feat(spec): a percent field declares its read-only face, a progress bar or the plain percentage (percentDisplay) #28222) goes.liveness/field.json: the row flipsplanned→live, withevidence(the renderer read) andproducernaming the seven relay sites the way theuseGroupingrow does. The describe (and its TSDoc) drops the not-yet-read clause. Regenerated:content/docs/references/**(three pages, the describe) andliveness/state-counts/field.md(live 100 → 101, planned 9 → 8)..changeset/28255-percent-display-plain.md, allpatch.Clause-② measured on the diff:
no. The accepted set is unchanged (no schema edit;check:authorable-surfacegreen), and the declaration surface is unchanged (check:api-surfacegreen against an unmodifiedapi-surface/;ENRICHED_FIELD_METADATA_KEYSis not exported from@object-ui/plugin-detail's entry). The form row offers a key the schema already accepted, and the liveness flip records a reader; neither widens what parses or what the package entries declare. Metadata-protocol:none: what an author can write and what it means are unchanged; the renderer now honours it.platform-objectsmetadata-forms catalogs andpnpm check:i18nwent red on it (7 bundles drifted).packages/platform-objects/src/apps/translations/{en,zh-CN,ja-JP,es-ES}.metadata-forms.generated.ts(+16 lines) are regenerated withnode scripts/check-i18n-bundles.mjs --write, and the three translated locales are hand-translated, so no source-hash entry is left behind. That is the only file outside the order's surface.Tests
ui/packages/fields/src/__tests__/PercentCellRenderer.percentDisplay-28255.test.tsx—plaindraws noprogressbarand prints25%;plainkeeps the declared storage and width (max: 100,scale: 1→33.3%);barand absent keep the bar (control); a blank value is still the empty face.ui/packages/plugin-grid/src/__tests__/gridPercentDisplay-28255.test.tsx— each of the three configured-column paths, plus the auto-generated columns as the reference face; a same-shape control field with no key keeps its bar.ui/packages/plugin-detail/src/__tests__/percentDisplayRelay-28255.test.tsx—DetailSectionandHeaderHighlight(the enrichment key list),RecordDetailPanelwith no data source (the panel's own copy is the only road),RelatedList's cell bag; one control bar per surface.ui/packages/plugin-list/src/__tests__/ObjectGallery.percentDisplay-28255.test.tsx— the gallery card.Acceptance notes
PercentCellRendereralso drawsprogressand textual fields promoted byformat: 'percent'. The spec describes the key forpercent, and the form row is gated topercent; aprogressfield that carriedplainwould also drop its bar. Not widened in the spec, not refused in the renderer.ui/packages/app-shell/src/utils/auditHistoryDisplay.ts) also copiesuseGrouping, but it formats text only and never draws the percent cell or its bar, so it is not apercentDisplayrelay site and is unchanged.@object-ui/types'PercentFieldMetadatadoes not declarepercentDisplay(it was outside the order's surface), so the grid, panel and related-list sites read it the way they readscale, throughas any. Declaring it there (typed fromSpecField['percentDisplay'], asNumberFieldMetadata.useGroupingis) would let those sites drop the casts.useGroupingliveness row'sproducerstill namesui/packages/plugin-grid/src/ObjectGrid.tsx#generateColumns; the column builder now lives inobjectGridGenerateColumns.tsx, which is what the newpercentDisplayrow names. The path still resolves, socheck:livenessis green; noted, not touched.Verification
The full readings below were taken at
7faff9ec(based onorigin/main6285203). Head988c264cthen merges seven newermaincommits (clean; none touchesui/) and regenerates the three reference-doc pages the merge driver deferred (main'scurrencyConfig.homeAmountrows). Scoped re-checks at988c264c: specsrc/data/field src/system/metadata-form src/data/form22 files / 692 tests passed,check:liveness,check:authorable-surface,check:api-surface,check:generated(14 of 14 current after--fix),check:i18n,check:i18n-stale-fill,check:nul-bytes,check:doc-authoring,check-changeset-no-major,check-sdui-manifest: all exit 0.New pins and ablation (6 legs, each restored by blob hash)
node scripts/ablation-replace.mjsper leg, then the four new test files (cd ui && pnpm exec vitest run ...). All ui test imports resolve@object-ui/*from source, so no rebuild between legs.if (percentField.percentDisplay === 'plain')→if (false)plainpin on every host)(fieldMeta as any).percentDisplay =copies →void(--expect 3)'percentDisplay'deleted fromENRICHED_FIELD_METADATA_KEYSDetailSection,HeaderHighlight)buildRecordDetailFieldscopy deletedRecordDetailPanel)RelatedList)buildEnrichedFieldcopy deletedObjectGallery)Each leg printed
ok mutation landed: anchor N -> 0andok restored: blob == HEAD;git diff --quiet HEAD -- uiheld after every leg.Package tests and type-check
cd ui && pnpm exec vitest run --maxWorkers=2 packages/fields/ packages/plugin-grid/ packages/plugin-detail/ packages/plugin-list/—Test Files 1074 passed | 2 skipped (1076),Tests 11502 passed | 25 skipped (11527)(lock VERDICT command-exit 0).pnpm --filter @object-ui/fields --filter @object-ui/plugin-grid --filter @object-ui/plugin-detail --filter @object-ui/plugin-list run type-check— exit 0, each package'stype-checkechoed.cd packages/spec && pnpm exec vitest run src/data/field src/system/metadata-form src/data/form—Test Files 22 passed (22),Tests 692 passed (692);pnpm check:livenessexit 0.env -u OS_SKIP_DTS pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated— 12 of 14 up to date,check:docsandcheck:livenessstale as expected;--fixregenerated exactly those two.Derived gates: 109 derived, 109 run, 0 NOT-MEASURED
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackagainst this diff (109 families after the i18n commit addedcheck:i18n-stale-fill), each line run with stdin redirected from /dev/null, exit codes recorded, reconciled withdispatch-gates.mjs --repo objectstack-ai/objectstack --ran:✓ 109 derived famil(ies) accounted for — 109 run, 0 NOT-MEASURED. Every recorded exit is 0. Three first-pass non-zeros, each re-run green:pnpm check:i18nexit 1 → the bundle drift above; regenerated and translated → exit 0.node scripts/check-plugin-teardown-shape.mjs --self-testexit 3 (shallow clone could not read pinned commit 621a487) → fetched it → exit 0, 48 cases.pnpm check:type-check-debtexit 3 (queue-timeout: the lock was held by this branch's own ui test run) → re-run under the lock → exit 0.Prerequisites: a full platform build (
env -u OS_SKIP_DTS pnpm turbo run build --filter='!@objectstack/docs' --filter='!@object-ui/*', 77 tasks) and the ui dependency closure (49 tasks), both exit 0.Generated by Claude Code