Skip to content

fix(console): a data-page filter chip on a select field shows the option label - #37285

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37259-url-filter-chip-option-label
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37259-url-filter-chip-option-label

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37259
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在仪表盘图表「在列表中打开」后的数据列表页,选择型字段的筛选标签显示选项的显示名(如「产品类别 = 软件」),不再显示内部存储值(「software」)。
  • 为什么做:仪表盘下钻到列表是用户从图表查看明细记录的常规路径,标签显示内部代码会让用户看不懂当前筛选条件,中文界面下还会夹杂英文。
  • 出错会怎样:最坏情况是筛选标签上的文字显示不对,列表本身的筛选结果不受影响;合并后可直接撤回。
  • 要你做什么:无。

What changes

On the bare data page (/:objectName/data?filter[...], ADR-0055), the screen a dashboard drill's "Open in list" lands on, a URL filter chip on a field that declares options drew the stored option value (Category = software) instead of its label (软件 in zh-CN).

  • groupFilterChips (drillUrlFilters.ts) takes an optional comparandText(field, value) callback and draws every whole-value comparand through it: equality (= X), does-not-equal ([ne]) and each member of a membership list ([in], [nin]). The default is String(value), so every existing caller and test reads as before. Range bounds and text-operator fragments (contains, starts_with, ...) stay verbatim: a fragment names no option.
  • ObjectDataPage passes a labeller that reuses the grid cell's path: translateOptions(objectDef.name, field, options) from useObjectLabel (the call generateColumns makes for the grid), then the option whose value equals the comparand, drawn with optionDisplayLabel from @object-ui/core (what TextCellRenderer draws). A comparand that matches no declared option stays raw, so a stale or hand-edited address still shows what it filters by.
  • The chips are computed per render instead of in a useMemo, the same as the field half's fieldLabel, so both halves of a chip read the translation catalogue at the same moment (an app bundle that loads after the first render reaches the chip too).

Responsibility:

  • Whose code: the platform's own console data surface (@object-ui/app-shell URL filter chips).
  • Existing platform path: the grid cell's option label (translateOptions over the field's declared options).
  • Who reaches it: every user who opens a chart grouped by a select field in a list through the dashboard drill's 「在列表中打开」.

Read first (by risk):

  1. ui/packages/app-shell/src/views/ObjectDataPage.tsx, the groupFilterChips(urlFilters, ...) labeller: the field lookup, the exact-value match and the raw fallback.
  2. ui/packages/app-shell/src/views/drillUrlFilters.ts, groupFilterChips: which operators go through comparandText (WHOLE_VALUE_OP_WORDS plus equality) and which stay raw.
  3. ui/packages/app-shell/src/views/ObjectDataPage.filterChipI18n-9159.test.tsx, the objectstack#37259 describe.

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/ObjectDataPage.filterChipI18n-9159.test.tsx from the repo root; expect 17 passed, with the seven objectstack#37259 cases among them.

Tests

New top-level describe in the existing chip harness ObjectDataPage.filterChipI18n-9159.test.tsx (real page, real I18nProvider, an app bundle carrying fieldOptions.showcase_invoice.category.software = 软件):

Case On main (1b91538bb2) On this head
equality chip, zh-Hans: = 软件 red (= software) green
equality chip, en: = Software red (= software) green
membership [in], zh-Hans: 属于 软件, 硬件 red (属于 software, hardware) green
negation [ne], zh-Hans: 不等于 软件 red (不等于 software) green
CONTROL unknown comparand stays raw: = legacy_code green green
CONTROL text operator keeps its fragment: 包含 software green green
CONTROL field without options keeps today's text: = software green green

The three controls are green on both sides by design: they pin what must not change.

The harness also gains a module-top import '@objectstack/lint', which check:test-source-alias asks of an edited test whose source reaches that dynamic import.

Readings (head eab0575)
  • Green: pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/ObjectDataPage.filterChipI18n-9159.test.tsx packages/app-shell/src/views/drillUrlFilters.test.ts: Test Files 2 passed (2), Tests 99 passed (99).
  • Red on main: ObjectDataPage.tsx and drillUrlFilters.ts restored from 1b91538bb2 (tree only), harness at HEAD: Tests 4 failed | 13 passed (17); the four failures are the four label cases above (expected '= software' to be '= 软件', and so on). Restored with git checkout HEAD --: git diff HEAD empty, both blobs equal to HEAD.
  • Ablation, node scripts/ablation-replace.mjs on ObjectDataPage.tsx, anchor return option ? optionDisplayLabel(option) : raw; replaced by return raw;: mutation landed (anchor 1 to 0, blob 1bc2af587dc6 to 95bff3d412e5), Tests 4 failed | 13 passed (17), the same four cases; restored, blob after restore 1bc2af587dc6 equal to HEAD, git diff HEAD empty. The subject is imported by relative path from src/, not through a package exports, so no dist/ preflight applies.
  • App-shell view suites packages/app-shell/src/views/ObjectDataPage* and packages/app-shell/src/views/drill*: Test Files 16 passed (16), Tests 241 passed (241).
  • pnpm --filter @object-ui/app-shell type-check after pnpm --workspace-concurrency=2 --filter "@object-ui/app-shell^..." build: exit 0.
  • pnpm --dir ui exec vitest run --maxWorkers=2 scripts/: Test Files 172 passed | 2 skipped (174), Tests 5130 passed | 2 skipped (5132).

Acceptance notes

  • The match is exact on the stored value (String(option.value) === comparand). The grid's findDeclaredOption adds a case-insensitive fallback for mixed-case seed data; the chip does not, because the comparand is the filter the server applies, and a label for a value that only matches case-insensitively could name an option the filter did not select.
  • The labeller applies to any field that declares a non-empty options list, which is the same test the grid's TextCellRenderer uses, not only to select / multiselect / radio.
  • Out of scope, noted only: a boolean comparand still reads = true / = false, and a lookup comparand still reads as the referenced record's id, not its name.
  • Browser repro through the drill: NOT MEASURED. The shared verification lock was held by another run for about 100 minutes while this change waited, and booting a backend plus the Console would have added a second heavy load on that box. The page-level pins render the real ObjectDataPage under real packs instead.

Verification

Local gate families from node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack (38 commands) were all run on head eab0575f6d and all exit 0. check:type-check-debt re-measured inside the verification lock: 0 ledger entr(ies) re-measured, 0 raw tsc error(s) total. The CI type-check programs that dispatch-gates names but cannot run locally (Type Check UI, the workspace type-check lanes) are left to this PR's check-runs.


Generated by Claude Code

…ion label (#37259)

A whole-value comparand (equality, not-equals, in, not-in) on a field that
declares options is drawn through translateOptions, the grid cell's path,
and the matched option's label; an unmatched value and a text-operator
fragment stay raw.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Final head for L1 (p1) · area a4-U · 2026-11-25T12:04Z
Head-sha: eab0575f6dd776f18df91c471438cff16ecec255

Card #37259. Dev report: 7161424954.

  • Root cause: groupFilterChips built the comparand as String(comparand), and ObjectDataPage drew that half without a label; only the field half went through fieldLabel.
  • Fix:
    • groupFilterChips takes an optional comparandText(field, value), which defaults to String. It applies to equality, [ne] and each member of [in]/[nin].
    • Range bounds and text-operator fragments stay raw.
    • ObjectDataPage passes a labeller built on the grid cell's own path: useObjectLabel().translateOptions(...), then an exact-value match drawn with core's optionDisplayLabel.
    • An unmatched comparand stays raw.
    • Chips are now computed per render, like fieldLabel, rather than in a useMemo.
  • Pins, in the page-level chip harness ObjectDataPage.filterChipI18n-9159.test.tsx:
    • zh equality, en equality, [in] and [ne];
    • three controls: unknown comparand, contains fragment, non-option field.
  • Red on main: with both sources restored from 1b91538bb2, 4 tests fail and 13 pass. The 4 failures are the four label cases; the controls are green on both sides by design.
  • Ablation: return option ? optionDisplayLabel(option) : raw; → return raw; gives the same 4 failures. It was restored to blob == HEAD.
  • Readings, from the dev:
    • pins 99 of 99;
    • app-shell ObjectDataPage* and drill* 241 of 241;
    • app-shell type-check exit 0;
    • ui scripts/ 172 passed;
    • 38 of 38 dispatch-gates commands exit 0.
  • Not measured: a browser repro through the dashboard drill (a shared-lock hold). The page-level harness renders the zh translation, which is the visible surface the card names.
  • Out of scope, in Acceptance notes, not filed:
    • Boolean comparands still read = true/= false, and lookup comparands still read as the id. The card names both as out of scope.
    • Matching is exact, unlike the grid's case-insensitive fallback. This is deliberate, because the comparand is the server filter.
  • Size: +162 −15 across 4 files, not governed.
  • Check-runs at this head: 38 success, 13 skipped, 0 failing or pending.
  • K: 15 against current main. Main will be merged through the relay's pr_update_branch before landing; a merge-only head move keeps an ACCEPT.

Handed to the seat session for L1.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head eab0575f6dd776f18df91c471438cff16ecec255 · 2026-11-25T12:20Z

  • Shape: draft PR into main. The body's first line is Fixes #37259, and the whole card is delivered, so Fixes is right. No closing keyword sits beside any other open card number. 4 files, +162/−15, not governed. Base 1b91538bb2, K=15 against origin/main 4ed453dc21.

  • Root cause, not a mask: the premise holds. On base, groupFilterChips drew the comparand bare: String(comparand) in the word arm (the card's :723) and String(list[0][2]) in the = arm. The page then drew text raw, and only the field half went through fieldLabel. The fix adds an optional comparandText(field, value) (default String) used by both arms. The page passes a labeller with this flow:

    • it reads the field's declared options from objectDef.fields[field];
    • useObjectLabel().translateOptions(objectDef.name, field, options) runs it through the current-language catalogue, the same call the grid makes (plugin-grid/objectGridGenerateColumns.tsx);
    • an exact-value match is drawn with core's optionDisplayLabel.

    So the label comes from the declared options, in the user's locale.

  • Edge cases, read from the source at head:

    • Unknown value: shown raw, and pinned (= legacy_code).
    • Multi-select: declares options, so an = comparand or each [in]/[nin] member is labelled one by one, and an unmatched member stays raw in the joined list.
    • Boolean: [bool]=true reads back as [f,'=',true]. With no options it falls to String, so the chip still reads = true. The card puts this out of scope, and the changeset says "unchanged", which is accurate.
    • Lookup: still the record id, except the related-list source.t chip that exists today. The card names lookups as out of scope ("probably want … out of scope here"), so out of scope is confirmed.
    • i18n-map label: cannot be authored. SelectOptionSchema.label is z.string() (packages/spec/src/data/field.zod.ts:381), and translation goes only through the catalogue, which translateOptions already covers. If unvalidated runtime metadata carries a non-string label anyway, optionDisplayLabel falls back to the value: no throw, and no regression from base.
    • Text-operator fragments and range bounds: stay verbatim (WHOLE_VALUE_OP_WORDS = not_equals/in/not_in, plus =). The contains case is pinned.
  • Pins re-run at head in a throwaway worktree, after pnpm --filter "@object-ui/app-shell^..." build (exit 0). vitest run ObjectDataPage.filterChipI18n-9159.test.tsx drillUrlFilters.test.ts gave Test Files 2 passed (2), Tests 99 passed (99), which matches the dev's reading.

  • Red on base: with both sources restored from 1b91538bb2 and the harness at head: Tests 4 failed | 13 passed (17). The four failures are the zh =, en =, [in] and [ne] cases.

  • Ablations, all run with scripts/ablation-replace.mjs. Every mutation landed and every file was restored to blob == HEAD with git diff HEAD empty.

    # File Mutation Result
    A1 (the dev's) page return option ? optionDisplayLabel(option) : raw; → return raw; 4 failed
    A2 drillUrlFilters.ts the word-arm draw → String(v) 2 failed ([in], [ne])
    A3 drillUrlFilters.ts the = arm → String(list[0][2]) 2 failed (zh/en =)
    A4 drillUrlFilters.ts 'contains' added to WHOLE_VALUE_OP_WORDS 1 failed (the text-fragment control)
    A5 drillUrlFilters.ts 'not_in' removed from WHOLE_VALUE_OP_WORDS 99 passed, see S1
  • S1 (should-fix): the [nin] arm is advertised but not pinned.

    • The changeset ("each comparand of an … membership filter") and the PR body ("each member of a membership list ([in], [nin])") both claim it.
    • Ablation A5 removes not_in from the set and every pin stays green.
    • The behaviour at head is correct by reading, since [nin] goes through the same draw as [in].
    • Fix: one filter[category][nin]=software case in the objectstack#37259 describe, expecting ${packLabelOf('zh-Hans','filterBuilder.operators.not_in')} 软件. Fold it into any patch round; if none happens before landing, carry it on the follow-up card below. It does not block on its own.
  • N1 — exact match vs the grid's matcher:

    • The labeller matches exactly. The grid's findDeclaredOption (ui/packages/fields/src/index.tsx:805) adds a case-insensitive fallback.
    • So on seed data stored as Software against a declared value software, the grid reads 软件 while the chip reads = Software.
    • The dev disclosed this and gave a reason. Conforming data cannot hit it, because SelectOptionSchema.value is a lowercase SystemIdentifier.
    • The changeset's "the same text the grid cell shows for that value" is therefore true only for conforming data. That is acceptable, and recorded here.
  • N2 — the changeset's example sentence: "in zh-CN, Category = software" puts the English field label beside a zh locale. The real chip reads 产品类别 = software. This is cosmetic.

  • Browser repro marked NOT MEASURED (the dev cited a shared-lock hold):

    • It is weighed as a low residual, not a gap. The harness renders the real ObjectDataPage under the real I18nProvider and packs, with an app bundle shaped {ns}.fieldOptions.{object}.{field}.{value}.
    • The one link left unproven is that a served bundle and objectDef reach this page with the same shape. The card's own repro says the grid on this same screen already draws 软件 through the same translateOptions call, which covers that link.
    • The zone can glance at HotCRM product_catalog_dashboard → top_products → 软件 → 在列表中打开 after landing. This does not block.
  • Changeset, sentence by sentence ('@object-ui/app-shell': patch):

    • That package is private: true but versioned under privatePackages.version: true; 245 changesets on main already name it, so this one follows practice.
    • Sentence 1 (bare data page, drill landing, raw value shown): true (see N2).
    • Sentence 2 (equality, does-not-equal and membership drawn as the translated label, "same text as the grid cell"): true at head. [nin] is unpinned (S1), and the grid comparison is subject to N1.
    • Sentence 3 (unmatched value stays raw): true and pinned.
    • Sentence 4 (text filters keep their fragment, fields without options unchanged): true; both are pinned.
    • Sentence 5 (boolean and lookup unchanged): true by reading.
  • 维护者速读, sentence by sentence:

    • "选择型字段的筛选标签显示选项的显示名": true. The fix in fact covers any field that declares options, which the body's Acceptance notes also say.
    • "为什么做": consistent with the card's p1 rationale.
    • "列表本身的筛选结果不受影响": true. filterChips is read only by the chip render (ObjectDataPage.tsx:1056). "Save as view" folds urlFilters triples, not chip text, and the dropped useMemo has no dependents.
    • "要你做什么:无": correct, since nothing is governed.
  • Declarations:

    • Clause-②: no: correct. groupFilterChips/ComparandText are internal to the private @object-ui/app-shell and absent from its src/index.ts. The new parameter is optional, so no accepted set or public surface widens.
    • Metadata-protocol: none: correct. Nothing an author writes changes; the change is display only. Both lines appear in the PR body and in the changeset body.
  • Check-runs at eab0575f6d: 51 total, 38 success and 13 skipped, none failed or pending. Lint & Repo Gates, TypeScript Type Check and Type Check UI are all success.

  • Mechanics:

    • git merge-tree --write-tree origin/main eab0575f6d is clean (tree aa7f8be4e5).
    • The 15 commits on main since base touch none of the 4 files, nor core/evaluator/optionRules.ts or i18n/useObjectLabel.ts.
    • None of the 41 other open PRs touches ObjectDataPage.tsx, drillUrlFilters.ts or the chip harness.
  • Dev report and zone final:

    • Dev report 7161424954 (2026-11-25T11:43:53Z) and zone final 7161902302 (2026-11-25T12:05:17Z) both pin this head.
    • Their readings match the seat's own re-runs. The extra import '@objectstack/lint' is inside the declared harness, as check:test-source-alias requires.
  • Same-family chip and summary producers left raw, named for one follow-up card (not filed by this seat):

    • (a) Lookup comparand on /data: a dashboard drill on a lookup dimension shows the record id (ObjectDataPage chip, =/[in] arms). It needs a name resolve.
    • (b) Boolean comparand on /data: shows = true/= false. The sibling FilterConditionField.describeCondition already uses filterBuilder.trueLabel/falseLabel.
    • (c) FilterConditionField.describeCondition (ui/packages/fields/src/widgets/FilterConditionField.tsx:636, used by the report builder and the metadata-admin dataset and field inspectors): maps options to the authored label without translateOptions, and draws the field label untranslated.
    • (d) S1's [nin] pin, if not folded in before then.
    • Checked and not raw: the saved-filter and condition surfaces plugin-list UserFilters and ListConditionsBlock, and plugin-dashboard DashboardFilterBar, all of which go through translateOptions.
    • Checked and not a chip: the /apps/:app/:object equality arm (objectViewListUrlState.ts, parseUrlEqualityFilterTriples) draws no comparand chip.
  • Landing: the zone merges main first (K ≥ 15); a merge-only head move keeps this ACCEPT.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Landing · area a4-U · 2026-11-25T12:43Z · head 0a94178d570c3cfc0e5e3bf5db6a4e34eeab29f2

reading value
L1 ACCEPT 7162252170 (seat repo:objectstack#4) on eab0575f. This head is origin/main merged in by the relay's pr_update_branch, with no change to the PR's own files (git diff eab0575f 0a94178d over its 4 files: empty), so the ACCEPT carries
check-governed-merges.mjs --pr 37285 NOT governed · 177 changed lines ≤ 3000
check-runs at this head 38 success, 13 expected skip, 0 failed, 0 pending · mergeable_state clean
K was 15 at eab0575f, so main was merged first; now 0

The seat's S1 (the [nin] pin), and the same-family raw comparands it named, are carried on #37288 (blocked on this PR). N1 and N2 are optional and are not pushed.

State change: ready for review, and auto-merge is armed. The queue lands it. On MERGED, #37259 closes through Fixes #37259.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 12:44
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 1d20c45 Nov 25, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37259-url-filter-chip-option-label branch November 25, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data surface URL filter chip shows a select field's raw option value (产品类别 = software) instead of its label

2 participants