Commit 9846f27
fix(app-showcase): give the task Grid rowColor a colours map the renderer actually resolves (#18787)
Fixes #15100
`examples/app-showcase`'s task **Grid** view declared `rowColor: {
field: 'priority' }` with no
`colors` map, so objectui `plugin-grid`'s `useRowColor` returned before
it read a record and every
row kept the default background, while the metadata parsed, validated
and published clean.
```ts
rowColor: {
field: 'priority',
colors: { low: 'slate', medium: 'blue', high: 'amber', urgent: 'red' },
},
```
## The card's stated reason for not fixing this was half right, and the
other half is the point
The card says the map "is not mechanical: which colour each `priority`
value should get is a design
choice … not a shape pinned by existing evidence". The evidence does
exist — the `priority` field
declares a colour per option in the same app
(`src/data/objects/task.object.ts`: `low #94A3B8`,
`medium #3B82F6`, `high #F59E0B`, `urgent #EF4444`) — **but copying
those hexes straight across
would have been the same defect one layer deeper.**
Read at `objectstack-ai/objectui` @ `cfcc17d9`,
`packages/plugin-grid/src/useRowColor.ts`:
`colorToClass` hands a value that already begins `bg-` through
untouched, otherwise looks the
lower-cased value up in its own `COLOR_TO_CLASS` map of **colour
names**, and returns `undefined`
for anything else. It never fabricates a class string — the sibling
module
`packages/plugin-detail/src/headerColor.ts` records why in measured
detail: Tailwind v4 has no
runtime, it builds the stylesheet by scanning source text for complete
class tokens, so a
concatenated `bg-` + value names no rule at all.
A hex map therefore **clears the resolver's `if (!config?.field ||
!config.colors)` guard, silences
the author-time diagnostic `view/row-color-without-colors`, and still
colours no row** — the defect
made invisible rather than fixed. Demonstrated below (ablation leg B).
So the values are colour **names**, chosen by one stated uniform rule
rather than by taste: each is
the entry of the renderer's own vocabulary nearest to the colour the
option already declares,
measured in OKLab against this workspace's pinned `tailwindcss@4.3.3`
palette over every shade of
every vocabulary family.
```
low #94A3B8 -> slate | nearest slate-400 Δ0.0083 (runner-up gray-400 Δ0.0138)
medium #3B82F6 -> blue | nearest blue-500 Δ0.0260 (runner-up sky-600 Δ0.0706)
high #F59E0B -> amber | nearest amber-500 Δ0.0233 (runner-up orange-400 Δ0.0501)
urgent #EF4444 -> red | nearest red-500 Δ0.0292 (runner-up rose-500 Δ0.0525)
```
Every winner is its own family's shade at the hue the field already
declares, so no palette was
invented here. It also answers the full-row contrast question: the
renderer paints the `-100` tint
of the name (`red` -> `bg-red-100`), never the saturated fill — the
desaturation is the renderer's,
not a judgement call made in the app.
## Evidence
**Author-time diagnostic, before and after** — tree
`objectstack-issue-15100`, the branch head,
`pnpm --filter @objectstack/example-showcase validate`:
| | occurrences of `view/row-color-without-colors` | total advisories |
exit |
|---|---|---|---|
| before (`922923b8a` content) | 1 — `view container [0] ›
listViews.grid` | 84 | 0 |
| after | **0** | 83 | 0 |
Exactly one advisory moved. The rule is WARNING severity, so `validate`
exits 0 either way — which
is why the new pin asserts on the findings, not on the exit code.
**Regression pin** — `examples/app-showcase/test/inert-wirings.test.ts`,
the file whose charter is
this app's declared-but-inert wirings. Two arms: the shipped ADR-0078
rule
(`validateFunctionalCompleteness`, aliased to `packages/lint/src` by
this app's vitest config) must
report no `view/row-color-without-colors` finding, and every authored
row colour must be a value
`colorToClass` can resolve. The vocabulary itself is deliberately
**not** transcribed into this
repo — a hand-copy of another repo's 23-entry map is a second opinion
that drifts; the arm asserts
the shape rule that separates a resolvable value from a hex.
**Reverse verification**, run from the committed state, each leg proved
on disk before it was read,
restored with `git checkout HEAD --` on the target path and the restored
blob hash compared against
`HEAD:examples/app-showcase/src/ui/views/task.view.ts` (`cb97b5e23…`,
matched):
| leg | mutation | result |
|---|---|---|
| A | drop the `colors` map (the card's original shape) | 1 failed / 37
passed — arm ① `reports no view/row-color-without-colors finding` |
| B | replace the names with the declared option **hexes** | 1 failed /
37 passed — arm ② only; **arm ① stayed green**, which is the "silences
the diagnostic and still colours nothing" claim demonstrated |
| C | control, unmutated | 38 passed |
## How far this could be proved here
The renderer lives in `objectstack-ai/objectui`, which this container
can read but not run — no
`node_modules` there, and this session has no write access to it. So the
renderer half is a
**source reading at a named revision** (`cfcc17d9`), plus a mechanical
membership check run against
that file's real bytes: each of the four declared hexes resolves to
`undefined` through
`colorToClass`, each of the four authored names resolves to a
`bg-NAME-100` class. It is not a
rendered screenshot, and is not claimed as one.
One thing that reading does settle: `bg-slate-100`, `bg-blue-100`,
`bg-amber-100` and `bg-red-100`
are complete literals inside `packages/plugin-grid/src/useRowColor.ts`,
and
`apps/console/src/index.css` scans `packages/plugin-grid/src/**`, so
those four classes are in the
compiled stylesheet by the same mechanism the renderer relies on.
## Changeset
None — measured, not defaulted. `@objectstack/example-showcase` declares
`"private": true`, and a
probe over all 70 non-private workspace packages grepped every root
their `files[]` actually ships
for a symbol unique to this diff (`urgent: 'red'`): **0 hits**. Positive
control on the same probe,
`RowColorConfigSchema`: 4 hits, including
`packages/spec/dist/view.zod-*.d.ts`, so the probe does
reach shipped `dist`. Nothing published moves.
## Acceptance notes
- `packages/lint/src/showcase-shape.fixtures.ts` still carries the inert
`rowColor: { field: 'priority' }`
line. That is deliberate and untouched: its header records the
2026-08-13 maintainer ruling that
it must not be re-synced with the live app. Both the card and triage
name that boundary.
- `RowColorConfigSchema` is unchanged — making `colors` required is
spec-side and belongs to
#14111, which is not addressed here and remains open on its own terms.
- Reported back to the dispatching seat rather than filed from here:
`RowColorConfigSchema.colors`
describes itself as a "Map of field value to color (hex/token)", while
the only renderer resolves
neither a hex nor an arbitrary token. An author who follows that
description — or who copies the
colours the same object's own select field declares — writes metadata
the runtime silently drops,
and the diagnostic added for #14111 reports presence only, so it goes on
reading green.
---
_Generated by [Claude
Code](https://claude.ai/code/session_017ef78bLdybu3AffehKkhfk)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7572329 commit 9846f27
2 files changed
Lines changed: 119 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
232 | 258 | | |
233 | 259 | | |
234 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
741 | 746 | | |
742 | 747 | | |
743 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
0 commit comments