Skip to content

feat(service-analytics): resolve dimension display labels (select options / lookup names) - #1680

Merged
os-zhuang merged 2 commits into
mainfrom
fix-analytics-dimension-labels
Jun 10, 2026
Merged

feat(service-analytics): resolve dimension display labels (select options / lookup names)#1680
os-zhuang merged 2 commits into
mainfrom
fix-analytics-dimension-labels

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Problem

On the showcase Chart Gallery (and any dashboard/report), charts grouped by a dimension showed the raw stored value, never the human-readable text:

  • lookup / master_detail dimensions → the FK id (8eqtuKI4G9IhUsPS)
  • select dimensions → the stored value (backlog, high)

Fix (server-side, ADR-0021)

AnalyticsService.queryDataset now post-processes the result rows to resolve dimension display labels:

  • select → the option label (via the field's options)
  • lookup / master_detail → the related record's display name (via an injected id→label fetch)

The console plots row[dimension] verbatim, so this single server-side pass fixes every chart with zero frontend change.

Implementation

  • New dimension-labels.ts: pure resolution logic + pickDisplayField (name > title > label > first text field). De-dupes lookup ids, leaves unresolved values untouched (no blanks), no-op for date/number/string dims.
  • AnalyticsServiceConfig.labelResolver injects two low-level capabilities; the plugin wires them from the data engine — field metadata via getObject, id→name pairs via the existing executeAggregate bridge (group by id + display field). No new engine capability.
  • 16 tests (unit + queryDataset integration), all green (service-analytics 100/100).

Browser verification

Ran the showcase Chart Gallery against this build:

DimensionBeforeAfter
status (select)backlog, done, todoBacklog, Done, To Do
priority (select)high, urgentHigh, Urgent
account (lookup)8eqtuKI4G9IhUsPSFabrikam (account name)

Programmatic axis scan after the fix: zero id-like strings remain.

Out of scope (follow-up)

Date dimensions (created_at) still render raw epoch-millis on a couple of trend charts — a separate date-formatting concern, not part of this lookup/select bug.

🤖 Generated with Claude Code

os-zhuangand others added 2 commits June 10, 2026 12:42
…ions / lookup names)
Dashboard/report charts grouped by a `select` dimension showed the stored option
`value` (e.g. `backlog`), and by a `lookup`/`master_detail` dimension showed the
raw FK `id` (e.g. `8eqtuKI4G9IhUsPS`) — never the human-readable text.
`queryDataset` now post-processes result rows (ADR-0021): a `select` dimension
renders its option `label`, and a `lookup` dimension renders the related record's
display name. The console plots `row[dimension]` verbatim, so this single
server-side pass fixes every chart with no frontend change.
- new `dimension-labels.ts`: resolution logic (select via field options; lookup
via injected id→label fetch) + `pickDisplayField` (name > title > label > first
text field). De-dupes lookup ids; leaves unresolved values untouched (no blanks);
no-op for date/number/string dimensions.
- `AnalyticsServiceConfig.labelResolver` injects the two low-level capabilities;
the plugin wires them from the `data` engine — field metadata via `getObject`,
id→name pairs via the existing `executeAggregate` bridge (group by id + display
field), so no new engine capability is needed.
- 16 tests (unit + queryDataset integration). Verified in the browser on the
showcase Chart Gallery: status→Backlog/Done/To Do, priority→High/Urgent,
account lookup→Fabrikam; zero raw ids remain.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 10, 2026 7:48am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling size/m labels Jun 10, 2026
@os-zhuang
os-zhuang merged commit 7e3021e into mainJun 10, 2026
12 checks passed
@os-zhuang
os-zhuang deleted the fix-analytics-dimension-labels branch June 10, 2026 09:10
xuyushun441-sys added a commit that referenced this pull request Jun 13, 2026
Picks up objectui#1684 — interface pages (ADR-0047) now render data
columns when the referenced source view is served hollow (columns only
in named views), instead of a bare row-number grid. Also rolls up
#1680/#1681/#1682 (toolbar viz dropdown, URL filter persistence, lookup
quick-filter e2e) that landed after the previous pin (76c38108544d).
build-console.sh builds clean at this SHA (33 MB dist, verified locally).
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@os-zhuang