Repository navigation
fix(plugin-charts): keep the xAxis object on any declared presentation key (objectui#10516) - #10571
Conversation
…n key, not three hand-named ones normalizeChartSchema kept the x-axis object only when it carried format, title or showGridLines, so an axis with only min / max / stepSize / logarithmic / position beside its field was dropped whole and a scatter's authored x scale never reached its axis. The gate now keeps the object whenever normalizeAxis kept any key other than field, which is the spec's ChartAxisSchema key set by construction (tied by the 7690 key-set pin). Pins: one per presentation key read off the installed spec (title, format, showGridLines were already green; min, max, stepSize, logarithmic, position were red on the base), the card's reproduction, falsy values, and two controls (field alone; refused values). A ChartRenderer seam pin reads the scatter's bottom ticks with a title-carrying twin as the lit control. The docs caveat that described the defect is removed, and the axisPresentation docblock in core that spelled out the old x-axis answer no longer restates it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN
…d of any Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN
✅ 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: ① Derived judgmentsInputs read. Card body + 3 comments (triage The new gate is derived, not hand-listed. Head: Probe (scratch
y-axis branch is ungated. Pins. Prose hunks. Both texts were made false: mdx caveat "take effect only when the same object also carries main moved. Pending changesets. Grep over ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #10516
Clause-②: no
Executes triage
5829695041:normalizeChartSchemakeeps the x-axis object whenever it carries any declared presentation key, pinned per key withtitleas the control. Implemented by theos-devdispatched from seatdomain:ui#2(claim5829769784), sessionhttps://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN.The change
The x gate in the axes block was
xAxisSpec.format || xAxisSpec.title || xAxisSpec.showGridLines !== undefined. It now asks whetherObject.keys(xAxisSpec)holds any key other thanfield, the data key hoisted toxAxisKey. The object is kept whenevernormalizeAxiskept one.There is no second key list. The presentation set is whatever
normalizeAxisread, andnormalizeChartSchema.specAxisKeys-7690.test.tsalready ties that read set to the installed spec'sChartAxisSchemakeys in both directions. The new per-key pins read their key list offChartAxisSchema.shapeminusfield, so a key the spec adds joins them on the next install. No new dependency:@objectstack/specstays a devDependency, and the runtime test runs over the normalized object.Mechanism hypotheses, measured on the base
9cbe4dbca{ field, min, max, stepSize, logarithmic, position }normalized to noxAxis(see the red rows below).normalizeAxisreturns is kept,{}included, and that is what preserves the secondary-axis count.ChartRenderer, with normalizer and renderer as one path and recharts in a fixed 510x350 box, on the head:min/max/stepSizeon a scatter x axis set the bottom ticks to0 50 100 150 200. On the base they were0 25 50 75 100. This is pinned.logarithmic: trueon a scatter x axis with x = 1, 10, 100, 1000 gives markcxgaps of143 143 143. On the base, and on the head withfalse, the gaps are4 39 385. This was a one-off probe and is not kept.position: 'top'onxAxisleaves the tick labels atorientation="bottom"for both scatter and bar, on the base and on the head. The key survives normalization now, but no renderer reads it. That is reported as its own finding below and is not implemented here.Red on base, green on head
normalizeChartSchema.xAxisPresentationGate-10516.test.ts(unit project) andChartRenderer.scatterXAxisScale-10516.test.tsx(dom project) were first run against the unchanged base source, then against the fix.titlealone besidefield(the control)formataloneshowGridLinesaloneminalonemaxalonestepSizealonelogarithmicalonepositionalonemin: 0,logarithmic: false,showGridLines: falsefieldalone yields noxAxisstepSize: -5,min: 'zero',position: 'middle') yield noxAxismin/max/stepSizewith no title0 25 50 75 100titleTotals over the two files: base
8 failed / 7 passed, head15 passed.Files beyond the claim's surface, and why
The claim named
normalizeChartSchema.ts, the tests beside it and one changeset. Two more files changed. Each holds a published sentence that this change makes false, and the dispatch contract says such a sentence is repaired in the same change:content/docs/plugins/plugin-charts.mdx: removed the caveat saying that onxAxis,min,max,stepSizeandlogarithmictake effect only when the object also carriestitle,formatorshowGridLines. That caveat described this defect. The page's 14 fenced blocks are byte-identical between base and head (sha256 prefix84a4534a0330fcf9on both sides).packages/core/src/utils/chart-presentation.ts: theaxisPresentationdocblock is exported, so it ships in core's.d.ts. It said the normalizer keeps onlyformat/title/showGridLineson the x-axis. It now points at the normalizer and the new pin rather than restating an answer (AGENTS.md 完善设计器的每一个细节 #9). This is a comment-only edit.No pending changeset sentence becomes false.
9675-scatter-spec-axesand7113-chart-data-modeldescribe x-axis keys reaching the normalized axis, and this change makes that true for more axes, not fewer.Gates
The union was re-run at
01f7648b6, the head of this PR. Each entry quotes the gate's own verdict line.pnpm --filter @object-ui/plugin-charts --filter @object-ui/core run type-check: both packages echotsc --noEmit && tsc -p tsconfig.test.jsonand end withDone.--listFilesshows both new test files inside plugin-charts' test program. The dependency closure (@object-ui/plugin-charts^..., 9 packages) was built first.pnpm exec vitest run packages/plugin-charts/ packages/core/src/utils/:Test Files 163 passed (163),Tests 2564 passed (2564). Fullpackages/core/at4cc8be66f(core's bytes have not changed since):171 passed,3486 passed. The four plugin-dashboard files that importnormalizeChartSchemaor read the axes lowering, at4cc8be66f:78 passed.check-changeset-presence:4 source file(s) of 2 released package(s) changed, and this change declares 1 changeset(s).check-changeset-no-majorandcheck-changeset-overwriteare green.check:changeset-claims:No pending changeset names a file this change touches.check:pending-changeset-literalsis green.check:new-line-citations:0 new citation(s).check:control-bytes:OK.check-doc-links:Links are valid across 17 scan roots.check:doc-types,check:doc-example-ids,check:doc-fencesandcheck:doc-example-readersare green.check:vi-mock-specifiers,check:vi-mock-inherit,check:vi-mock-override-shape,check:test-path-rootsandcheck:spec-symbolsare green.--format jsonreports 4 files and 0 errors. The new files add no warnings, and the existingno-explicit-anywarnings innormalizeChartSchema.tspredate this change. The root config is not type-aware (noparserOptions.projectorprojectService), and no local rule reads the filesystem, so this diff cannot move any untouched file's verdict. The repo-wide lint run belongs to CI.check:doc-snippetsandcheck:doc-examples. Reason: PREREQUISITE NOT MET, because they need a 34-package scoped build. Declared narrowing: the doc diff removes one prose line outside any fence, the fenced blocks are byte-identical, and those gates read fenced blocks only. CI runs them in full.Acceptance notes
AdvancedChartImplProps.xAxisdocblock listsformat/title/showGridLinesas the category-axis presentation. Since objectui#9675 the scatter branch has also readmin/max/stepSize/logarithmicfrom it. The docblock was incomplete before this change and is not made false by it, andAdvancedChartImpl.tsxis outside the claim. Noted here, not filed.ChartRenderer.tsxchanged on main after the base (objectui#8086, PR 10554). The seam pin renders through it, but the changed arm isseries, which the pin does not write. The pin was not re-run on a merge; the merge queue rebuilds on main.Finding, not fixed here
xAxis.positionis declared (specChartAxisSchema.position, "Axis position", with valuesleft/right/top/bottom, referenced on objectui'sChartSchema.xAxis). After this change it reaches the normalized axis, but no renderer reads it:position: 'top'still draws the x axis at the bottom on scatter and bar (H4 above). The docs table row "The side of the chart the axis belongs to" is its doc half.Seam: spec:ChartAxisSchema.position → runtime:normalizeChartSchema x-axis → renderer:AdvancedChartImpl XAxis (no orientation read)Generated by Claude Code