Repository navigation
Commit 1d934ff
skills(project): the platform catalog lists units of measure as shipped (#36059)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D4n2wzAmmp4Z6W5jsqtM2qx)_
Fixes #35970
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:做应用的人(和他们的
AI)查「平台已经提供什么」这一页时,计量单位现在列在「已提供」里,并写明字段上怎样声明单位;这一页不再教他们先自己做一个临时的单位下拉字段。
- 为什么做:计量单位已经上线,这一页却还写着「不可用」,属于计量单位交付的收尾,和上一次工作日历那一页的修正是同一类事。
- 出错会怎样:只是文档一页和一道评测题,写错了会误导应用作者,可以直接撤回,不影响运行中的系统。
- 要你做什么:这是对外发布的技能包,并且改了生成这一页的脚本,属于 Tier H:需要你本人合并,或由授权审批人批准后落地。
## What changes
- `packages/spec/scripts/lib/platform-catalog.ts`: one object row,
`sys_unit`, joins the "Money, imports and approvals" table beside
`sys_exchange_rate`, the object ADR-0158 U3 compares it to. The row
names the declaration that uses it: `unitConfig` on a `number` field
(`unitMode: 'fixed'` with `unit`, `'record'` with `unitField`) or on a
`text` field (`'code'`); a stored code is a standard one (UN/ECE Rec 20:
`KGM`, `H87`) or a row the organization adds in Setup; data API, no
delete.
- The Planned row narrows to what ADR-0158 still leaves unbuilt: "Unit
display, totals and conversion", state "contract accepted; a quantity
shows and sums as a bare number". The link stays ADR-0158.
- The Planned paragraph loses its interim unit field (a `select` whose
option values are `H87`, `KGM`). The platform now ships the declaration,
and the advice did not parse either: a `select` option value `H87` is
refused ("System identifier must be lowercase"), measured on this head.
- `skills/objectstack-project/references/platform-catalog.md` is
regenerated from that source (`gen:skill-refs`), not edited by hand.
- `skills/objectstack-data/evals/objects-fields-relationships.json` case
22 now expects the shipped answer (see Evals).
- Changeset: `@objectstack/skills` patch. `@objectstack/spec` takes
none: `packages/spec/scripts/**` is not in that package's `files`.
**The hand-written ceiling is paid, not raised.** The page's
hand-written text is capped at 1581 tokens (6324 bytes) and stood at
6322 bytes. The new row costs 255 bytes (24 + 231). It is paid by:
| Change | Bytes | Why |
|:--|--:|:--|
| Planned paragraph: the interim-unit clause ("an interim unit field
stores the contract's UN/ECE Rec 20 codes (`H87`, `KGM`) as option
values, the business's spellings as labels") | -131 | no longer true,
and the option values it taught are refused |
| Planned row: "Units of measure (a standard unit table, organization
units, a quantity field with its unit)" / "contract accepted, nothing
shipped" becomes "Unit display, totals and conversion" / "contract
accepted; a quantity shows and sums as a bare number" | -30 | the
narrowing itself |
| Planned paragraph: "Each row is **not available**:" | -31 | every
row's State cell, written by the generator, opens with the same words |
| Intro: "(objectstack-project §0, question 3)" | -38 | the page's one
inbound link is that question, so it restates where the reader came from
|
| Capability rows `ai-seat`, `governance`, `audit-compliance`,
`access-policy-console`: "cloud " | -24 | the derived Edition column
prints `cloud` on the same four rows |
Result: 6322 + 255 - 254 = 6323 bytes, 1581 tokens, at the ceiling. The
ceiling constant and the test file are untouched.
**Read first** (by risk):
1. `packages/spec/scripts/lib/platform-catalog.ts`, the `sys_unit` row
and the Planned row: every claim on a published page, and the only place
under `skills/` that names `unitConfig`.
2. The three restatement cuts in the table above, in the same file's
`PROSE` and `CAPABILITY_ROWS`.
3. Eval case 22 in `objects-fields-relationships.json`, its two token
lists.
## Evals
Case 22 keeps its prompt ("Add a `uom` text field to our `product`
object"). Its reference answer is now the shipped one: `uom` is a `text`
field declaring `unitConfig: { unitMode: 'code' }`, it stores a standard
code (`H87`, `KGM`, `XBX`) or one of the organization's own units, and
the app declares no unit object and no option list.
- `must_contain`: `unitConfig`, `unitMode`, `H87`, `KGM` (was
`PLATFORM-CANDIDATE`, `select`, `H87`, `KGM`).
- `must_not_contain`: `uom: Field.select(` and `type: 'select'` (was
`uom: Field.text(` and `uom: { type: 'text'`, which the correct answer
now writes).
- Neither forbidden token is in the case's own reference answer, and all
four required tokens are.
- Graded with the repository's grader (`gradeAnswer`): the reference
answer passes; the old interim answer fails (two tokens missing, one
forbidden); a bare `Field.text` answer fails; the variant where a
quantity points at `uom` and `uom` carries no declaration passes.
No case was added or removed (24 ids). The eval was not run against a
model here.
## Tests
<details><summary>Readings on head e3a7561</summary>
- Net added lines: +6 (34 added, 28 deleted, 4 files, changeset
included; budget 40).
- Generator test, under the verify lock: `pnpm --filter
@objectstack/spec exec vitest run --project local --maxWorkers=2
scripts/platform-catalog.test.ts`: `Test Files 1 passed (1)`, `Tests 20
passed (20)`, `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/spec run check:skill-refs` exit 0: `10
generated files in sync with packages/spec`.
- Hand-written text: 6322 -> 6323 bytes (ceiling 6324), 1581 -> 1581
tokens (ceiling 1581).
- Generated page: 10855 -> 10888 bytes, 2714 -> 2722 tokens, 154 -> 153
lines (generator-owned, measured, not ratcheted).
- Eval fixture: 28586 -> 28835 bytes, 7147 -> 7209 tokens, 437 -> 437
lines (measured, not ratcheted).
- Whole `skills/` tree: 22829 -> 22828 lines; every `SKILL.md` together
4944 -> 4944 lines.
- `node scripts/check-skills-token-ratchet.mjs` exit 0: authored 197411
-> 197411 of 202541; whole shipped tree 288604 -> 288674.
- The eval catalog loads with the repository's loader: 14 bundles, 341
cases, 0 refusals.
- `dispatch-gates --commands` derived 76 commands; all 76 were started
(`--ran`: 76 derived, 76 run, 0 UNRUN). 71 exited 0.
`check:doc-formula-expressions` exited 3 (prerequisite) and exited 0
after building its two packages under the lock. The other four are the
next line.
- NOT MEASURED, left to CI: `check:dts-closure`,
`check:dual-build-cjs-loads`, `check:lean-entry-closure`,
`check:sourcemap-no-sources-content`. Each exits 3 asking for a full
build, and reads built output this diff does not change.
- `overlap-check --branch=claude/area-a4A-35970`: `VERDICT clean exit
0`, 0 PR heads.
- No ablation: the diff changes generator data, a generated page, an
eval fixture and a changeset, and no behaviour a test pins.
</details>
## Acceptance notes
- The row sits under "Money, imports and approvals" without renaming the
group: a title change costs bytes under the same ceiling.
- "A stored code" covers `record` and `code` fields. A `fixed` unit
takes a standard code only, checked at build; an organization code
written there is refused with a message that names `unitMode: 'record'`.
- The row does not teach `unitDimension`, retiring a unit, or `os
migrate unit-codes`. At the merge base no file under `skills/` names
`unitConfig`, so this row is the catalog's whole teaching of it; a
fuller treatment in the data skill is not part of this card.
- The Planned state is measured by absence at `8145424b53`: the readers
of `unitConfig` are the schema (`field.zod.ts`, `object.zod.ts`), the
write check and the backfill (`packages/objectql`), `os migrate
unit-codes`, and three metadata plumbing files. None is under `ui/`, the
analytics service or the lint package; the control, `currencyConfig`, is
read in 108 files under `ui/`.
- When the display, aggregate or base-quantity work lands, that PR owes
the Planned row and case 22's last sentence.
## Verification
Two-minute check: `pnpm --filter @objectstack/spec run check:skill-refs`
prints `10 generated files in sync with packages/spec`.
Premise, measured on origin/main `8145424b53`:
- `sys_unit` is in `PLATFORM_OBJECTS_BY_PACKAGE`
(`platform-object-names.ts:102`), in the always-registered manifest of
the platform-objects plugin (`plugin.ts:241`, beside `SysExchangeRate`),
and in the Setup navigation as "Units of Measure"
(`setup-nav.contributions.ts:141`). Its `apiMethods` are get, list,
create, update and bulk.
- `unitConfig` is a key of `FieldSchema` (`field.zod.ts`): three closed
shapes, `fixed` and `record` on a `number` field, `code` on a `text`
field. Parsed from source on this head: a `text` field with `unitMode:
'code'`, a `number` with `unitMode: 'record'` pointing at a `text`
field, and `unitMode: 'fixed'` with `KGM` all parse; `unit: 'EA'`, an
organization code under `fixed`, and a `code` marker on a field a
quantity points at are refused.
- The write check is `assertUnitCodes`
(`packages/objectql/src/validation/unit-code-membership.ts`), called
from the insert, update and validate paths.
- Still unbuilt from ADR-0158's release plan: display of the value with
its unit, the refusal of a raw aggregate over a `record` quantity, and
the base-quantity projection (0 files name `factorField` under
`packages/`, `ui/`, `skills/`, `examples/` or `content/`; control
`unitField`, 24 lines in `field.zod.ts`).
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4d1ZJL93Kin2UHFXbFv)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 78f7160 commit 1d934ff
4 files changed
Lines changed: 34 additions & 28 deletions
File tree
- .changeset
- packages/spec/scripts/lib
- skills
- objectstack-data/evals
- objectstack-project/references
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
202 | | - | |
203 | | - | |
| 203 | + | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
226 | | - | |
227 | | - | |
| 227 | + | |
| 228 | + | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| |||
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 253 | + | |
| 254 | + | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
393 | | - | |
| 392 | + | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
399 | | - | |
| 398 | + | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 147 | + | |
| 148 | + | |
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
153 | | - | |
| 152 | + | |
154 | 153 | | |
0 commit comments