Repository navigation
fix(app-shell): keep the dataset seed's count measure on the first base-object pick (objectui#12848) - #12864
Conversation
…se-object pick objectChangePatch reset `measures: []` on every base-object change, so a new dataset's first pick overwrote the create seed's `count` measure and the dataset saved with no measures. The patch now keeps every measure that names no field (no `field` or the `'*'` row wildcard, no measure-scoped `filter`, not `derived`), and leaves `measures` out when the draft holds none, so the save merges the seed's under the draft. A move still clears include, dimensions, filter and every field-bound measure. Claude-Session: https://claude.ai/code/session_017JcVa6nPANGXQ5yRKeTxDE Co-authored-by: Claude <noreply@anthropic.com>
The dataset designer's base-object hint said a change clears the dataset's measures; since a move now keeps a measure that names no field, the en and zh rows say field measures are cleared and a row count is kept. A pin reads the hint in both locales. Claude-Session: https://claude.ai/code/session_017JcVa6nPANGXQ5yRKeTxDE Co-authored-by: Claude <noreply@anthropic.com>
…ectui#10586 string pin Claude-Session: https://claude.ai/code/session_017JcVa6nPANGXQ5yRKeTxDE Co-authored-by: Claude <noreply@anthropic.com>
…taset-first-pick-measures
✅ 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
|
席位核对 — ACCEPT · objectui#12848 · head
|
main 8106db1 |
this branch | |
|---|---|---|
PUT body measures |
[] |
[{"name":"count","aggregate":"count"}] |
| reread draft | "measures":[] |
the same count |
| reopened designer | Measures 0, "Add a measure" | Measures 1 (count), preview Count 9 |
Screenshots, read by the seat (never-merged claude/issue-12848-evidence at 23700d5):
- after save: the branch reopens with Measures 1 =
countand a preview Count of 9;mainwith Measures 0; - after the first pick: Measures 0 on both, as measured.
Taken at 91d0bc6, before the hint commit; the hint is pinned in en and zh. Sent to the maintainer at 2026-10-17T07:14Z.
Tests:
- The new
DatasetDefaultInspector.firstPickKeepsCount-12848.test.tsx, 6 tests, runs the realMetadataResourceEditPageand designer over a recording in-memory server:- first pick, then save, keeps the seed's measures, and so does A then B;
- CONTROL: a move clears the field-bound measure, the filtered count and the derived ratio, and keeps the plain and
'*'counts; - CONTROL: the same object returns only
{ object }; - the hint renders the new copy in en-US and zh-CN.
- Five ablations, each red and each restored to the HEAD blob.
- 187 files, 2532 tests passed.
type-check,build, eslint (0 errors),check:i18n-keys,check:i18n-driftand changeset presence: all exit 0.
Changeset: @object-ui/app-shell patch; user-facing prose, the hint included.
CI: running at this record. Landing waits for green.
Rulings
- The objectui#10586 string-pin entry: accepted. That pin lists the dataset inspector's en strings word for word, so the ruled copy could not land without moving its one entry for this hint. Nothing else in it moved. The change is mechanical and follows the amendment.
- A derived measure is cleared on a move, and a
'*'count is kept: A, as ruled in the amendment. - The live run predates the hint commit: accepted. The hint is copy, pinned in both locales, and the behaviour it describes is unchanged since
91d0bc6. - The out-of-scope finding (the create designer shows Measures 0 while the save writes the seed's
count) becomes visible only once this fix lands. The seat files it as its own card after a dedupe.
Implemented-by: cloud session session_017JcVa6nPANGXQ5yRKeTxDE, branch claude/issue-12848-dataset-first-pick-measures
Generated by Claude Code
Landing · head
|
Fixes #12848
Clause-②: no
What changed
objectChangePatchinDatasetDefaultInspector.tsxresetmeasures: []on every base-object change. On a new dataset the draft holds nomeasures; the create seed'scountis merged in only at save, bybuildCreateModeBody({ ...seed, ...draft }). The first base-object pick therefore wrotemeasures: []into the draft, and that overwrote the seed'scount. Every dataset created by open, pick an object, save was stored with no measures.The patch now takes the draft being re-based as a third argument and applies one rule. The hint under the base-object picker now states that rule.
The rule implemented
field(or only the'*'row wildcard), no measure-scopedfilter(its keys are fields) and noderivedspec. This is the row count: it means the same on any object.field, one with afilter, and everyderivedmeasure. A derived measure combines other measures, and in every measured case at least one of them is filtered or names a field (won_ratecombineswon_count, which has a filter, anddeal_count). Keeping it would leave a reference to a cleared measure, which the spec refuses as a reference to an unknown measure.measures, so the patch writes none and the save keeps the seed'scount.include,dimensionsandfilterare cleared as before. Frommeasures, only the measures that name no field are kept.object, as before.measures: []), as before. The existingobjectChangePatchpin inDatasetDefaultInspector.test.tsxis unchanged.Shapes measured: the spec seed is
{ name: 'count', aggregate: 'count' }, with nofield. Every hotcrm dataset (account, contact, lead, task, event, product, case) and every app-showcase dataset carries a plain count with no field and no filter. They also carry field-bound sums and averages, counts with afilter(case, chart-gallery, revenue-pulse) andderivedratios over a filtered count.createBody.tsis unchanged: the patch alone fixes the saved body.The base-object hint
The hint under the picker (
engine.inspector.dataset.baseObjectChangeHintinmetadata-admin/i18n.ts) used to say a change clears the dataset's measures. It now reads:Those are the only two rows of that key, and nothing else in
i18n.tschanges. The objectui#10586 string pin (inspectorStrings.i18n-10586.test.tsx) lists every en string the dataset inspector renders, word for word; its one entry for this hint now holds the new en copy.Live before and after
The backend was hotcrm
objectstack dev --freshon :4712, with the console run from this worktree on :5712. Steps: open a new dataset, type a Label and a Name, pick Account (crm_account), Save.main(8106db1): PUT bodymeasures: []. The reread draft (GET /api/v1/meta/dataset/main_probe?state=draft) has"measures":[], and the reopened designer shows Measures 0 and "Add a measure".measures: [{"name":"count","aggregate":"count"}]. The reread draft has the same value, and the reopened designer shows Measures 1 (count), with a preview Count of 9.In the designer itself, right after the first pick, the Measures section reads 0 on both
mainand this branch. In create mode the draft never holds the seed's measures: they are merged only in the save body, socountappears once the saved item reopens. The live run was taken at91d0bc6, before the hint commit; the hint is pinned by tests.Screenshots (light)
Tests (at
524d225)New file
DatasetDefaultInspector.firstPickKeepsCount-12848.test.tsx, 6 tests:MetadataResourceEditPageand the real dataset designer run over a recording in-memoryMetadataClientserver; the/meta/typesentry carries the spec seed and the dataset JSON schema. Open, pick an object, save: the body carries the seed's measures. Open, pick A, pick B, save: the body still carries them.include,dimensions,filter, the field-bound measure, the filtered count and the derived ratio. It keeps the plain count and the'*'count.{ object }.Ablation: each mutation was run against the committed fix and restored with
git checkout HEAD(blob hash compared to HEAD,git diff HEADempty):measures: []when the draft has none: both page tests red.Gates, all exit 0 at
524d225:createBody.test.ts,createBody.seedPlaceholders-12810.test.ts,ResourceEditPage.seedPlaceholder-12810,ResourceEditPage.nameSurvivesLabel-12680,ResourceEditPage.servedDraftTakenAsIs-10765andcreateConformance: 187 files, 2532 passed and 1 skipped.type-checkandbuildfor@object-ui/app-shell.check:i18n-keys;check:i18n-drift(every changed en designer row is followed by its zh row);check-changeset-presence.Session:
https://claude.ai/code/session_017JcVa6nPANGXQ5yRKeTxDE🤖 Generated with Claude Code
Generated by Claude Code