Skip to content

Commit 1d934ff

Browse files
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/35970-catalog-units.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
The platform catalog (`objectstack-project/references/platform-catalog.md`) now lists units of measure as shipped. `sys_unit` has a row beside `sys_exchange_rate`, and the row names the declaration that uses it: `unitConfig` on a `number` field (`unitMode: 'fixed'` with `unit`, or `'record'` with `unitField`) or on a `text` field that holds a unit code (`unitMode: 'code'`). A stored code is a standard UN/ECE Rec 20 code or one of the organization's own units, added in Setup, so an app no longer builds a unit table or a unit picklist. The Planned row narrows to what is still missing: showing the unit beside a quantity, totals per unit and conversion. The page no longer describes an interim unit field, and `objectstack-data` eval 22 expects the shipped answer.

‎packages/spec/scripts/lib/platform-catalog.ts‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const APP_FACING_OBJECT_GROUPS: readonly { readonly title: string; readon
118118
title: 'Money, imports and approvals',
119119
rows: [
120120
{ name: 'sys_exchange_rate', builds: 'an exchange-rate table', reach: '`currencyConfig.homeAmount` converts at write; Setup edits rates; data API' },
121+
{ name: 'sys_unit', builds: 'a unit table or picklist', reach: '`unitConfig` on a `number` field (`unitMode: \'fixed\'` with `unit`, `\'record\'` with `unitField`) or a `text` field (`\'code\'`); a stored code is standard (UN/ECE Rec 20: `KGM`, `H87`) or a row added here in Setup; data API, no delete' },
121122
{ name: 'sys_work_calendar', builds: 'a business-hours calendar', reach: 'kept per organization in Setup; an approval\'s `escalation.clock: \'working_time\'` reads it; data API' },
122123
{ name: 'sys_work_calendar_exception', builds: 'a holiday table', reach: 'a calendar\'s holidays and make-up workdays, kept in Setup; data API' },
123124
{ name: 'sys_import_job', builds: 'a bulk-import job table', reach: '`POST /api/v1/data/OBJECT/import/jobs`; data API read' },
@@ -184,10 +185,10 @@ export const CAPABILITY_ROWS: Readonly<Record<string, string>> = Object.freeze({
184185
settings: 'the settings store',
185186
webhooks: 'outbound webhooks',
186187
'hierarchy-security': 'hierarchy-relative permission scopes',
187-
'ai-seat': 'the cloud AI-seat tier',
188-
governance: 'the cloud governance tier',
189-
'audit-compliance': 'the cloud audit-compliance tier',
190-
'access-policy-console': 'the cloud access-policy console',
188+
'ai-seat': 'the AI-seat tier',
189+
governance: 'the governance tier',
190+
'audit-compliance': 'the audit-compliance tier',
191+
'access-policy-console': 'the access-policy console',
191192
});
192193

193194
/** Master data each suite keeps, matched across suites by key contract. */
@@ -199,8 +200,8 @@ export const NOT_PLATFORM_ROWS: readonly { readonly concept: string; readonly ru
199200
/** Carded, not shipped. Each row is **not available**; the shipping PR moves it into the main table. Capped at a few rows. */
200201
export const PLANNED_ROWS: readonly { readonly concept: string; readonly state: string; readonly link: string }[] = [
201202
{
202-
concept: 'Units of measure (a standard unit table, organization units, a quantity field with its unit)',
203-
state: 'contract accepted, nothing shipped',
203+
concept: 'Unit display, totals and conversion',
204+
state: 'contract accepted; a quantity shows and sums as a bare number',
204205
link: 'https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md',
205206
},
206207
{
@@ -223,8 +224,8 @@ export const PROSE = Object.freeze({
223224
'> (not runnable in an installed app). Names come from `@objectstack/spec`.',
224225
],
225226
intro: [
226-
'Read this before adding an object, a field or a flow (objectstack-project §0,',
227-
'question 3). `list_objects` over MCP hides system objects, so look here.',
227+
'Read this before adding an object, a field or a flow. `list_objects` over MCP',
228+
'hides system objects, so look here.',
228229
],
229230
objects: [
230231
'"Data API" means the generic `/api/v1/data/OBJECT` routes, as the object',
@@ -249,10 +250,8 @@ export const PROSE = Object.freeze({
249250
'platform" here.',
250251
],
251252
planned: [
252-
'Each row is **not available**: nothing below can be declared or installed.',
253-
'The app may build its own meanwhile, marked `// PLATFORM-CANDIDATE:` with',
254-
'the link; an interim unit field stores the contract\'s UN/ECE Rec 20 codes',
255-
'(`H87`, `KGM`) as option values, the business\'s spellings as labels.',
253+
'Nothing below can be declared or installed. The app may build its own',
254+
'meanwhile, marked `// PLATFORM-CANDIDATE:` with the link.',
256255
],
257256
});
258257

‎skills/objectstack-data/evals/objects-fields-relationships.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,18 @@
385385
{
386386
"id": 22,
387387
"prompt": "Add a `uom` text field to our `product` object for the unit of measure (pcs, kg, box, …).",
388-
"expected_output": "Does not add a free-text unit. Checks the platform catalog (objectstack-project §0, question 3): units of measure are a Planned row there, not available yet, with the accepted contract linked. Builds the smallest thing the app needs meanwhile, a `select` field whose option values are the contract's UN/ECE Rec 20 codes in exact uppercase (`H87` for a piece, `KGM`, `XBX`) with this business's spellings (pcs, kg, box) as the labels, so the platform unit table later adds validation and leaves stored values unchanged, and marks it `// PLATFORM-CANDIDATE: <link>` so the bump sweep replaces it when that table ships. If the request only wanted a quantity, says the quantity stays a `number` and the unit lives on the field, not inside the value.",
388+
"expected_output": "Adds `uom` as a `text` field that declares what it holds, `uom: Field.text({ unitConfig: { unitMode: 'code' } })`, neither a bare free-text field nor a `select`: the platform catalog (objectstack-project §0, question 3) lists `sys_unit` and `unitConfig` as what the platform ships, so the app declares no unit object and no option list. The field stores a unit code in exact uppercase: a standard UN/ECE Rec 20 code (`H87` for a piece, `KGM`, `XBX` for a box) or one of the organization's own units, which an administrator adds in Setup. The write path refuses any other value, so pcs, kg and box are what people say, not what is stored. If a quantity sits beside it, the quantity is a `number` field with `unitConfig: { unitMode: 'record', unitField: 'uom' }`, and `uom` then carries no `unitConfig` of its own; a quantity with one unit declares `unitMode: 'fixed'` with `unit`. Showing the unit beside a quantity, totals per unit and conversion are in the catalog's Planned section, not available yet.",
389389
"files": [],
390390
"assertions": {
391391
"must_contain": [
392-
"PLATFORM-CANDIDATE",
393-
"select",
392+
"unitConfig",
393+
"unitMode",
394394
"H87",
395395
"KGM"
396396
],
397397
"must_not_contain": [
398-
"uom: Field.text(",
399-
"uom: { type: 'text'"
398+
"uom: Field.select(",
399+
"type: 'select'"
400400
]
401401
}
402402
},

‎skills/objectstack-project/references/platform-catalog.md‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
> `pnpm --filter @objectstack/spec gen:skill-refs`
55
> (not runnable in an installed app). Names come from `@objectstack/spec`.
66
7-
Read this before adding an object, a field or a flow (objectstack-project §0,
8-
question 3). `list_objects` over MCP hides system objects, so look here.
7+
Read this before adding an object, a field or a flow. `list_objects` over MCP
8+
hides system objects, so look here.
99

1010
## Platform objects an app would otherwise build
1111

@@ -50,6 +50,7 @@ a seed) without declaring it.
5050
| Object | Mounted by | What you would otherwise build | How the app reaches it |
5151
|:--|:--|:--|:--|
5252
| `sys_exchange_rate` | every boot | an exchange-rate table | `currencyConfig.homeAmount` converts at write; Setup edits rates; data API |
53+
| `sys_unit` | every boot | a unit table or picklist | `unitConfig` on a `number` field (`unitMode: 'fixed'` with `unit`, `'record'` with `unitField`) or a `text` field (`'code'`); a stored code is standard (UN/ECE Rec 20: `KGM`, `H87`) or a row added here in Setup; data API, no delete |
5354
| `sys_work_calendar` | every boot | a business-hours calendar | kept per organization in Setup; an approval's `escalation.clock: 'working_time'` reads it; data API |
5455
| `sys_work_calendar_exception` | every boot | a holiday table | a calendar's holidays and make-up workdays, kept in Setup; data API |
5556
| `sys_import_job` | every boot | a bulk-import job table | `POST /api/v1/data/OBJECT/import/jobs`; data API read |
@@ -126,10 +127,10 @@ whether or not the stack lists it. Declare what the app uses
126127
| `settings` | the settings store | open | every boot |
127128
| `webhooks` | outbound webhooks | open | on `requires` |
128129
| `hierarchy-security` | hierarchy-relative permission scopes | enterprise | on `requires` |
129-
| `ai-seat` | the cloud AI-seat tier | cloud | on `requires` |
130-
| `governance` | the cloud governance tier | cloud | on `requires` |
131-
| `audit-compliance` | the cloud audit-compliance tier | cloud | on `requires` |
132-
| `access-policy-console` | the cloud access-policy console | cloud | on `requires` |
130+
| `ai-seat` | the AI-seat tier | cloud | on `requires` |
131+
| `governance` | the governance tier | cloud | on `requires` |
132+
| `audit-compliance` | the audit-compliance tier | cloud | on `requires` |
133+
| `access-policy-console` | the access-policy console | cloud | on `requires` |
133134

134135
## Not owned by the platform
135136

@@ -143,12 +144,10 @@ platform" here.
143144

144145
## Planned: carded, not shipped
145146

146-
Each row is **not available**: nothing below can be declared or installed.
147-
The app may build its own meanwhile, marked `// PLATFORM-CANDIDATE:` with
148-
the link; an interim unit field stores the contract's UN/ECE Rec 20 codes
149-
(`H87`, `KGM`) as option values, the business's spellings as labels.
147+
Nothing below can be declared or installed. The app may build its own
148+
meanwhile, marked `// PLATFORM-CANDIDATE:` with the link.
150149

151150
| Concept | State | Contract |
152151
|:--|:--|:--|
153-
| Units of measure (a standard unit table, organization units, a quantity field with its unit) | **not available** (contract accepted, nothing shipped) | https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md |
152+
| Unit display, totals and conversion | **not available** (contract accepted; a quantity shows and sums as a bare number) | https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md |
154153
| Working-day formulas | **not available** (contract accepted; no formula reads a calendar yet) | https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0157-working-calendars-are-org-editable-runtime-data-resolved-by-code-or-refused.md |

0 commit comments

Comments
 (0)