Repository navigation
Commit 5c005e0
feat(lint): dashboard and report advisories carry a localized user sentence (#33118)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoWK5rFW1SUGSkDw9iatZE4f)_
Fixes #32837
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:仪表盘和报表的保存提示(advisory)现在也有给最终用户看的一句话,11 种平台语言都有:组件绑定规则 7 条、报表图表规则
2 条,共 9 条规则 id;规则 id、`message`、`hint` 一字不变。
- 为什么改:按 #32835 / #32655 已落地的做法(裁决 6819749037 选 C),中文 Studio
里保存仪表盘看到的仍是英文提醒;现在由出提醒的规则自己按用户语言出文案。卡片表里 11 条中有 2
条保存时根本不会返回(数据集层面的聚合提醒、页面可视化提醒),它们没有用户文案,原因写在验收说明里。
- 风险与回滚:只新增文案和发现对象上的一个可选字段;保存接口现在还不填 `userMessage`(那是
#32656),所以所有返回内容不变。`@objectstack/lint` 按 patch 发版。回滚即 revert。
- 先看:`packages/lint/src/validate-widget-bindings.user-text.ts`(7
条的各语言文案)、`packages/lint/src/validate-chart-bindings.ts`(只在报表图表系列条目上带参数的那两处)、`packages/lint/src/finding-user-text.dashboards.test.ts`。
- 两分钟验证:`pnpm --filter @objectstack/lint exec vitest run
src/finding-user-text.dashboards.test.ts`,应见 24
个测试全绿,其中两条是从发布门(仪表盘写入、报表写入)拿到的提示渲染成能被 `RuntimeAuthoringIssueSchema` 解析的
`userMessage`。
- 需要你做的:无,席位落地。
## What changes
Layer 1 of #32654 for the dashboard and report advisories, in the
pattern #32655 landed (`validate-security-posture.user-text.ts`,
`finding-user-text.test.ts`), under ruling record 6819749037 (option C).
**Re-measured first.** The card's table (11 ids, a static-scan upper
bound) was checked by running every warning push site of the three files
whole-stack and through `runRuntimeAuthoringRules` on `main` `2c98485d`.
Nine ids reach the publish door; two do not:
| Rule file | Door-reaching advisory ids | Not reaching the door |
|---|---|---|
| `validate-widget-bindings.ts` (dashboard write) |
`widget-legacy-analytics-shape`, `dashboard-filter-field-unprovisioned`,
`chart-field-unknown` (x-axis site, and the y-axis/series site),
`chart-measures-missing`, `widget-measures-missing`,
`chart-dimensions-missing`, `table-count-only` |
`measure-aggregate-incoherent` |
| `validate-chart-bindings.ts` (report write, a report chart's
`series[]` entry) | `chart-measure-unknown`, `chart-axis-not-selected` |
— |
| `validate-page-visualization-bindings.ts` | — |
`page/visualization-without-binding` |
The seat agreed to cover the nine only (thread record, 14:18Z). See
Acceptance notes for why the two stay on the English `message`.
**`packages/lint`.**
- `validate-widget-bindings.user-text.ts` (new, beside the rule): the 7
widget ids' sentences in all 11 `PLATFORM_LOCALE_TAGS`, in the dashboard
editor's terms from `ui/packages/i18n` (dashboard, widget, dataset,
dimensions, values, measure, metric). `chart-field-unknown` has one arm
per position (`axis`: `x`, `y`, `series`) and `widget-measures-missing`
one per what the widget fails to show (`shows`: `number` for the metric
family, `table` for the tabular one), as the rule's message does.
- `validate-chart-bindings.user-text.ts` (new): the 2 chart ids'
sentences, addressed to the report's chart series entry, the one
advisory position the door reaches. `chart-axis-not-selected` names the
measure the chart plots.
- Push sites: `validate-widget-bindings.ts` sets `userTextParams` at the
8 push sites of the 7 ids (both `chart-field-unknown` sites);
`validate-chart-bindings.ts` sets it on the two ids' `report-series`
findings only, carrying the report name on the report chart binding
(`ChartBinding.report`). Both finding interfaces gain `userTextParams?`.
A query-position `chart-measure-unknown` (an error) and the page-chart
presentation positions (judged on pages, which no per-write snapshot
carries) carry none. Rule ids, `message` and `hint` are unchanged.
- `finding-user-text.ts`: `FINDING_USER_TEXT_CATALOG` merges the two
catalogs beside the security one via `mergeUserTextCatalogs`.
- No new export: the catalogs stay internal, as
`SECURITY_POSTURE_USER_TEXT` is.
**Changeset.** `.changeset/32837-advisory-user-text.md`,
`@objectstack/lint` `patch`, with `Clause-②: no` and `Metadata-protocol:
none`. Precedent followed: #32790 (the #32655 PR) declared
`Metadata-protocol: added` only because `@objectstack/spec` gained the
authorable `RuntimeAuthoringIssueSchema.userMessage` key, and it shipped
its `packages/lint` half (catalog, params, merge) as `patch`. This PR is
that lint half alone: no spec key, no accepted value, nothing a metadata
author writes changes, so `none` and `patch`.
**Not in this PR.** The save door composing `userMessage` (#32656) and
the console rendering it (#32657). Until #32656 lands, every save and
publish response is byte-identical.
## Tests
Counts from the tree at `6f88ae2d` (main `2c98485d`). The head
`715ce9e3` merges `main` `e997113c` through
`scripts/pm/os-regen-merge.sh` (3 incoming commits: a hook description
in `packages/spec`, a skills reference, PM docs; none touches
`packages/lint`; no conflict; no generated artifact left to regenerate).
After the merge: `pnpm --filter @objectstack/spec build` then
`check:generated` (all 14 artifacts up to date), and the two user-text
pin files, 52 passed (52), `VERDICT command-exit 0`.
- `packages/lint/src/finding-user-text.dashboards.test.ts` (new, 24
tests):
- exact coverage: the widget catalog holds exactly the 7 ids and the
chart catalog exactly the 2, each in exactly the 11 platform locales;
both are the entries `FINDING_USER_TEXT_CATALOG` serves; the 9 ids are
pinned by value;
- the two ids the door never returns have no catalog entry;
- every push site rendered from the rule's real findings (12 cases: 8
widget push sites with both `widget-measures-missing` arms and all three
`chart-field-unknown` positions, and both chart ids): severity
`warning`, the exact params, every locale truthy, no `undefined` or
template residue, every interpolated name present, and no English
stand-in in any non-English locale;
- the three `chart-field-unknown` arms render apart in every locale, and
the two `widget-measures-missing` arms differ in every locale;
- zh-Hans and en spot checks; `chart-axis-not-selected` names the
plotted measure;
- no params where the finding is not door advice: a query-position
`chart-measure-unknown` error, a page chart's two presentation warnings,
and `measure-aggregate-incoherent`;
- from the runtime gate to the wire field: a `dashboard` write's
`chart-dimensions-missing` and a `report` write's
`chart-axis-not-selected` come out of `runRuntimeAuthoringRules` with
their params, and the rendered `userMessage` (zh-CN request; fr-FR
request in a zh-CN workspace) parses under `RuntimeAuthoringIssueSchema`
beside the unchanged rule id and message.
- `pnpm --filter @objectstack/lint test`: Test Files 203 passed (203),
Tests 8639 passed (8639), `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/lint typecheck` (`tsc --noEmit` and
`check:test-typecheck`): exit 0.
- Consumer reading (`@objectstack/metadata-protocol`, which runs the
gate on every save): Test Files 337 passed, 7 skipped (344); Tests 22799
passed, 36 skipped; `VERDICT command-exit 0`.
<details><summary>Ablations (committed first at 6f88ae2, mutated
through scripts/ablation-replace.mjs, restored to the HEAD
blob)</summary>
| # | Mutation | Observed |
|:--|:--|:--|
| 1 | `validate-widget-bindings.ts`: drop `userTextParams` at the
`table-count-only` push site | 1 failed, 23 passed (that site's render
case) |
| 2 | `validate-chart-bindings.ts`: drop `report: reportName` from the
report chart binding | 4 failed, 20 passed (both chart render cases, the
plotted-measure case, the report-write gate case) |
Each mutation landed (anchor 1 → 0, blob changed) and each restore read
`blob == HEAD and git diff HEAD is empty`.
</details>
## Acceptance notes
- **Two card ids stay on the English fallback, by measurement.**
`measure-aggregate-incoherent` is judged on `datasets[]`; a dashboard
write carries the live datasets as context in both differential passes,
so the finding cancels, and a dataset write does not run
`validateWidgetBindings` (its registry entry declares `runtimeTypes:
['dashboard']`). `page/visualization-without-binding` is a
reference-integrity member on the frozen `flow` default, and no
per-write snapshot carries `pages[]`; a page write does not dispatch it.
A sentence the door can never render would be declared but not
delivered. Parent #32835 allows naming such ids with the reason they
stay on the English fallback.
- **Agent-written non-English sentences, for the native-review round.**
All non-English sentences in both new catalogs are agent-written: 10
locales (`zh-Hans`, `zh-Hant`, `es`, `ar`, `fr`, `pt-BR`, `ru`, `de`,
`ja`, `ko`) × 9 entries, 13 sentences per locale counting arms
(`widget-legacy-analytics-shape`,
`dashboard-filter-field-unprovisioned`, `chart-field-unknown` ×3,
`chart-measures-missing`, `widget-measures-missing` ×2,
`chart-dimensions-missing`, `table-count-only`, `chart-measure-unknown`,
`chart-axis-not-selected`). Points worth a native reader's eye: `de`
uses the console's "Datensatz" for dataset, so `table-count-only` says
"Einträge" for records to avoid the clash; `ar` uses the console's
"مقياس" both for the metric widget type and for a measure, so the metric
widget is spelled "عنصر من نوع مقياس"; Korean particles are written in
the dual form (`을(를)`, `이(가)`) because the name is interpolated.
- **API names, not labels**, as the security catalog does (its N3,
accepted): the rule is a pure function of the stack with no label lookup
in the request's language. A dashboard or widget with no name shows the
rule's stand-in.
- **New test file, not `finding-user-text.test.ts`.** The pins sit in
`finding-user-text.dashboards.test.ts` so this card and its parallel
sibling #32836 do not both grow the precedent's file; the shape is the
same. Moving them into that file is a mechanical follow-up if the seat
prefers it.
- Card #33072 edits `validate-expressions.ts`; this PR does not touch
it. #32836 also adds one line to `finding-user-text.ts`; whichever lands
second merges `main` and keeps both catalogs.
## Verification
Local subset at `6f88ae2d` (the merge brought in no file this derivation
reads, and the change set against `main` is the same 7 paths), derived
with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` (60 families), every line run with stdin
closed and its exit code captured before any pipe, then reconciled with
`--ran`: **60 derived, 60 run, 0 NOT-MEASURED (a derived zero: all 60
recorded an exit code, none is 3)**. All 60 exit 0. The record is
`spec-seat-2/r2026-11-13/out/32837-gates-ran-6f88ae2d.list` in the
project files.
<details><summary>Four families needed a prerequisite before their
reading</summary>
- `node scripts/check-plugin-teardown-shape.mjs --self-test`: exit 3 on
the shallow clone (pinned fixture commit `621a4876` absent); exit 0
after fetching that commit.
- `pnpm check:dts-closure`: exit 1 (a consumer closure built without
declarations); exit 0 after a full workspace build with declarations.
- `pnpm check:dual-build-cjs-loads`, `pnpm check:lean-entry-closure`:
exit 3 PREREQUISITE NOT MET (no dist); exit 0 after the same full build.
</details>
`node scripts/check-cli-command-ids.mjs` (run after editing the
catalogs, since a pt-BR or es sentence opening with "os " trips it):
exit 0, 1322 command-id literals resolve.
CI runs the rest of the farm on this PR; its check-runs are the reading
for every family outside the local subset.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibyUPga1xgca5r6vaew)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7c36f52 commit 5c005e0
7 files changed
Lines changed: 1043 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
153 | 155 | | |
154 | 156 | | |
155 | 157 | | |
156 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
157 | 163 | | |
158 | 164 | | |
159 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
203 | 210 | | |
204 | 211 | | |
205 | 212 | | |
| |||
211 | 218 | | |
212 | 219 | | |
213 | 220 | | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| |||
308 | 316 | | |
309 | 317 | | |
310 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
311 | 326 | | |
312 | 327 | | |
313 | 328 | | |
| |||
463 | 478 | | |
464 | 479 | | |
465 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
466 | 486 | | |
467 | 487 | | |
468 | 488 | | |
| |||
486 | 506 | | |
487 | 507 | | |
488 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
489 | 516 | | |
490 | 517 | | |
491 | 518 | | |
| |||
610 | 637 | | |
611 | 638 | | |
612 | 639 | | |
| 640 | + | |
613 | 641 | | |
614 | 642 | | |
615 | 643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
0 commit comments