Repository navigation
fix(core): a dashboard dateRange that omits defaultRange takes the spec default preset (objectui#10339) - #10346
Conversation
…kes the spec default preset The spec declares DashboardSchema.dateRange.defaultRange with a default; the read site now applies it, derived from the spec schema rather than a copied string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nge.defaultRange; add changeset Refs objectui#10339.
…o claude/issue-10339-daterange-default
✅ 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 judgmentsReviewed at The change is as claimed.
The default comes from the spec, not from a constant.
Explicit values are unchanged. The existing test that pins Blast radius is zero. There are exactly three authored Importing a runtime spec schema into core is allowed.
The derivation is robust against objectstack
Every entry point shares the change. All readers go through No new SSR or bundle exposure.
Tests. vitest could not be re-run in this container, because the root workspace is missing ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
Closes #10339
Clause-②: yes. The published runtime behaviour changes: an omitted
defaultRangenow filters tothis_month. An isolated at-tier review happens before enqueue.What
@objectstack/specdeclaresDashboardSchema.dateRange.defaultRangeasz.enum(DATE_RANGE_DEFAULT_RANGES).default('this_month')(installed 17.4.0 and objectstackmainatfc6ddb87both).resolveDashboardFilterDefsin@object-ui/coretreated an omitteddefaultRangeas "no filter", sodateRange: { field: 'created_at' }rendered UNFILTERED while the platform's parse of the same document saysthis_month.Direction (i), per #7759 ruling 5617465269 rule 1: the read site applies the spec's default.
packages/core/src/utils/dashboard-filters.ts: when an authoreddateRangehasdefaultRange === undefined, the preset is read FROM THE SPEC by parsing an empty element throughDashboardSchema.shape.dateRange(imported from@objectstack/spec/ui, the same subpath this module already importsDATE_RANGE_PRESETSfrom; core already imports runtime zod schemas from the spec, e.g.FieldSchemainreference-keys.ts). No hand-copied string. Computed lazily on first use and cached, becauseDashboardSchemais alazySchemaand forcing it at module load would cost every importer of core.defaultRange,'custom'included, is unchanged.allowCustomRangeis untouched (already consumed as!== false). No authoreddateRangestill yields no built-in filter.content/docs/guide/dashboard-filters.md: thedefaultRangebullet now states the omitted behaviour..changeset/10339-daterange-spec-default.md: minor on@object-ui/core, with the behaviour note. plugin-dashboard source did not change (tests only), so it carries no bump.Blast radius (dashboards that will now show this_month)
Every authored
dateRangeobject inexamples/,content/,apps/andpackages/source was enumerated withgit grep -nE 'dateRange"?\s*:\s*\{'plus the multi-line and YAML forms. All authored dashboards (examples/schema-catalog/.../filtered-dashboard*.jsonx3,content/docs/guide/dashboard-filters.md,packages/plugin-dashboard/README.md) setdefaultRangeexplicitly. Zero authored dashboards omit it, so no example, story or E2E fixture changes what it shows.packages/types/src/__tests__/dashboard-config.test.tsauthors adateRangewithoutdefaultRange, but that is the separateDashboardConfig(enabled/presets) shape, whichresolveDashboardFilterDefsdoes not read. The only in-product producer is the metadata-admin designer: a dashboard saved there with a baredateRangenow opens on this_month, as the spec says.Tests
dashboard-filters.test.ts: three new cases. The omitted case resolves to{ preset: 'this_month' }and compiles to month bounds. A second case pins that the value equals the spec schema's own parse of an empty element. A third keeps explicitdefaultRange/allowCustomRange: falseas authored and gives no def withoutdateRange.DashboardFilterBar.dateDefault.test.tsx: the control for a baredateRangereads "This month", not "All time".DashboardRenderer.filters.test.tsx: a baredateRangebroadcasts acreated_atrange into the widget query.af43adbc1, via objectstackscripts/ablation-replace.mjs): replaced? specDefaultDateRangePreset()with? undefined(anchor 1 to 0, blob2761b23360eato124c918877e7). Result:Tests 4 failed | 53 passed (57), and the failures are exactly the four new cases. Restore then gave blob == HEAD and an emptygit diff HEAD.9bf3ea525(after merging origin/main): built the@object-ui/plugin-dashboard^...closure;type-checkon core and plugin-dashboard green;vitest run packages/core/src/utils/__tests__/dashboard-filters.test.ts packages/plugin-dashboard/src/__tests__/givesTest Files 121 passed (121),Tests 1199 passed (1199).mainfc6ddb87, packed, and injected withnode scripts/spec-main-shape-gate.mjs inject. Against it, coretsc --noEmit(src) exit 0, plugin-dashboardtype-checkexit 0, and the three touched test files57 passed(runtime parse through main'sstrictObjectdateRange). Then restored the pinned install; the restored specdist/ui/index.mjshash equals the shared checkout's pinned 17.4.0 and differs from the main build.--no-inline-configon the 4 changed TS files: 0 errors (17 pre-existingno-explicit-anywarnings, none on changed lines).check-changeset-presenceexit 0;check:new-line-citationsgives0 new citation(s);check-changeset-no-majorexit 0.Acceptance notes
main, core'stsconfig.test.jsonleg fails in an untouched file:normalize-list-view.pageResidual-8429.test.tsTS2344,"page"does not satisfynever. This is spec-main drift unrelated to this diff. TheSpec Main Shape GateCI job owns that reading.Co-Authored-Bytrailer that I wrote by mistake. It is not rewritten, because force-push is banned here. Squash-merge text is the seat's to trim.Generated by Claude Code