Repository navigation
Commit 4203db7
docs(skills): the objectstack-data skill names the platform's exchange-rate table and teaches unitConfig (#38980)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBG4YD4RMAt72Ga5PdYYZDAQ)_
Part of #38939
Claim for this branch: #38939 comment 7314913435
Clause-②: no
Metadata-protocol: none
repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzeatqKfTRUzTJVa9jQ
## 维护者速读
- 用户能看到什么变化:用户无感,界面和运行行为都没变;照着数据建模技能文档做多币种报价或带计量单位的产品的作者和
AI,现在能直接读到平台已经自带汇率表和计量单位规则,不会再自己另建一张汇率表、写一段换算逻辑,或做一个随手填写的单位字段。
- 为什么做:正式发布前的验收评测里,有两道题带着技能也答错;这两条事实以前只写在项目管理技能的平台清单里,只装数据建模技能的人读不到。
- 出错会怎样:只改文字,不改任何运行行为;如果新说法有误,作者会照着写错汇率或单位的声明,撤回本次合并即可复原。
- 要你做什么:这是对外发布的技能包,需要你审阅后亲手合并。
- 本 PR 之后卡片仍开着:卡片第 3 条(评测题 objects 22、24 带技能重跑通过)未测,由评测席重跑后再关卡。
## What changes
Two published files of `skills/objectstack-data`, two rows of the token
ratchet, and one changeset. No eval fixture, no file of
`skills/objectstack-project`, no schema and no runtime file is touched.
| Place | Before | After |
|:--|:--|:--|
| `rules/field-types.md`, § Currency, the `homeAmount` paragraph | Said
the engine stores the home amount at the `rateDate` rate. It did not say
where the rates live. | Adds: the rates are the platform's
`sys_exchange_rate`, which an administrator keeps in Setup; never an app
rate object or a conversion hook; a foreign amount with no rate on or
before `rateDate` is refused (`ERR_EXCHANGE_RATE_MISSING`). |
| `rules/field-types.md`, new § Unit of measure (under Common Field
Configurations, after Currency) | No file of the skill outside `evals/`
held `unitConfig`, `unitMode`, `H87`, `KGM` or `sys_unit`. | One
type-checked example with the three shapes: `unitMode: 'code'` on a
`text` field, and on a `number` field `'fixed'` with `unit: 'KGM'` and
`'record'` with `unitField`. One paragraph: a unit is never free text, a
picklist or an app unit object; `unitMode` has no default; the stored
code is exact uppercase, a standard UN/ECE Rec 20 code (`H87`, `KGM`,
`XBX` named) or one the organization adds to `sys_unit` in Setup; the
two write refusals; `unitDimension`; the free-text conversion run. |
| `rules/field-types.md`, the `text` and `number` rows | Config lists
without `unitConfig`. | Each list ends with `unitConfig` and a pointer
to the new section, as the `currency` row points at Currency. |
| `rules/field-types.md`, `## Choosing a type` and `## Changing a field
that has data`, first line of each | Each carried a parenthetical that
repeated a fact stated elsewhere. | Both parentheticals are cut (the
paydown, below). |
| `SKILL.md`, `## Where to go`, the Field Types row | "A field's type
and config, a default, changing a field that has data" | The same, plus
"exchange rates (`sys_exchange_rate`), units of measure (`unitConfig`)".
|
| `SKILL.md`, `## Where to go`, the sentence above the table | "Open the
file for your task first." | Cut (the paydown, below). The table's "Open
first" column header says the same; the platform and ui entries have no
such sentence. |
| `scripts/check-skills-token-ratchet.mjs` | `SKILL.md` 2224,
`rules/field-types.md` 4200 | 2233 and 4566, each pinned at its
measurement, each with its accounting comment. |
**Why the entry file changes at all.** A request to "create an
exchange-rate object and a conversion hook" is routed by the entry to
the object and hook files, which do not mention the rate table. Without
a word in the routing table, nothing sends that request to § Currency.
The row now names both identifiers, so the request meets them before it
builds anything.
**Every added sentence, and the code it was read from**
| Sentence | Source |
|:--|:--|
| The rates are `sys_exchange_rate` |
`packages/objectql/src/home-amount-projection.ts`,
`EXCHANGE_RATE_OBJECT`;
`packages/platform-objects/src/system/sys-exchange-rate.object.ts` |
| An administrator keeps it in Setup |
`packages/platform-objects/src/apps/setup-nav.contributions.ts`,
`nav_exchange_rates`; the object's "Who writes" note (organization
administrators) |
| No app rate object or conversion hook | The projection converts at
write and is the only writer of the home and rate fields (same file,
"Who writes the two fields") |
| A foreign amount with no rate on or before `rateDate` is refused,
`ERR_EXCHANGE_RATE_MISSING` | Same file: the latest `effective_date` on
or before the document date, else refused; an amount in the home
currency needs no rate row, hence "foreign" |
| `unitConfig` on a `number` field (`'fixed'`, `'record'`) or a `text`
field (`'code'`); no default `unitMode` |
`packages/spec/src/data/field.zod.ts`, `UnitConfigSchema`,
`UNIT_CONFIG_MODES_BY_FIELD_TYPE`, `unitModeMessage` |
| The field `unitField` names is a `text` field of the same object with
no `unitConfig` or `valueDomain` |
`packages/spec/src/data/object.zod.ts`, `refuseDishonestRecordUnitField`
|
| Exact uppercase; `H87` piece, `KGM` kilogram, `XBX` box;
`STANDARD_UNITS` in `@objectstack/spec/data` |
`packages/spec/src/data/standard-units.ts` |
| An organization's own unit lives in `sys_unit`, added in Setup, and
cannot be a `fixed` unit | `sys-unit.object.ts`;
`setup-nav.contributions.ts`, `nav_units_of_measure`; `fixedUnitMessage`
in `field.zod.ts` |
| `ERR_UNIT_CODE_UNKNOWN` (`pcs`, `kg`, `C62`, `EA`),
`ERR_UNIT_CODE_REQUIRED` |
`packages/objectql/src/validation/unit-code-membership.ts`; `C62` and
`EA` are in no standard row and cannot be organization codes |
| `unitDimension` on `'record'` and `'code'` only | The three closed
shapes in `field.zod.ts` |
| `os migrate unit-codes` |
`packages/cli/src/commands/migrate/unit-codes.ts` |
The same facts are in the generated platform catalog
(`skills/objectstack-project/references/platform-catalog.md`, the
`sys_exchange_rate` and `sys_unit` rows), which this PR does not touch.
### Size
| File | Lines | Bytes | Tokens (`ceil(utf8 bytes / 4)`) |
|:--|:--|:--|:--|
| `skills/objectstack-data/rules/field-types.md` | 318 to 346 | 16799 to
18262 (+1463) | 4200 to 4566 (+366) |
| `skills/objectstack-data/SKILL.md` | 167 to 165 | 8923 to 8958 (+35) |
2224 to 2233 (+9; the 27-byte stamp line is not priced) |
| All `SKILL.md` files of the catalog | 2141 to 2139 | 120425 to 120460
| |
| `skills/objectstack-data`, authored files outside `evals/` | 3696 to
3722 | 175542 to 177040 | |
| Whole shipped tree, the ratchet's own total | | | 287587 to 287962
(+375) |
The entry file stays inside its router budget of 9 KB: 8958 bytes.
### The ratchet raise
Both rows had zero headroom. Raise path: ruling record 6513306068,
letter B. The standing ruling, verbatim and untranslated:
「A:先削重复,余额按实测提高」.
- `rules/field-types.md`: +1560 bytes of new text. Paid down first by
two restatement cuts in the same file, 97 bytes (45 + 52): the `secret`
parenthetical under `## Choosing a type` (its home is the `secret` row
of the same file, which says encrypted at rest and names ADR-0100) and
the parenthetical under `## Changing a field that has data` that
repeated the entry's first trap, which the same line already points at.
The row moves by the measured remainder, +366, to 4566.
- `SKILL.md`: +71 bytes on the routing row. Paid down first by the
sentence above the routing table, 36 bytes. The row moves by the
measured remainder, +9, to 2233.
## Tests
Read on head `bf4e7c2be3` (the branch with `origin/main` at `d38006b9b3`
merged in).
- `node scripts/check-skills-token-ratchet.mjs`: exit 0;
`skills/objectstack-data/SKILL.md is 2233 tokens (ceiling 2233; headroom
0)`, `skills/objectstack-data/rules/field-types.md is 4566 tokens
(ceiling 4566; headroom 0)`. `--self-test`: exit 0, 111 cases pass.
- `pnpm --filter @objectstack/spec run check:skill-examples`: exit 0,
"342 prose examples type-check across 3 surface(s)". The new block
carries the check marker and is one of them: with `unitMode` misspelled
in it on disk (a one-time check, restored and hash-compared to the
committed blob), the same command exits 1 with `error TS2561` at
`skills/objectstack-data/rules/field-types.md:228:41`.
- `pnpm --filter @objectstack/spec run check:skill-docs`,
`check:skill-served-sections`, `check:skill-refs`: exit 0 each. `pnpm
check:skill-links`, `check:skill-identifier-liveness`,
`check:skill-compatibility`, `check:skill-frame-sync`,
`check:doc-authoring`, `check:nul-bytes`: exit 0 each.
- A runtime parse of the example by the built spec
(`ObjectSchema.safeParse`): accepted. The same probe confirmed each
refusal the paragraph states at the build door: a lowercase `unit`,
`C62`, a missing `unitMode`, `'code'` on a `number` field, `'fixed'` on
a `text` field, `unitConfig` on a `currency` field, `unitDimension`
under `'fixed'`, and a pointed-at field that carries `unitConfig` or
`valueDomain`.
- The write refusals were not booted. Their codes were read from source,
and the two test files that pin them pass on this head:
`unit-code-membership.test.ts` and `home-amount-projection.test.ts`, 70
tests.
<details>
<summary>Derived gate set: 70 commands, 68 run, 2 not measured</summary>
`node scripts/pm/dispatch-gates.mjs --ran` on `bf4e7c2be3`: "70 derived
famil(ies) accounted for — 68 run, 2 NOT-MEASURED (1 DERIVED from a
recorded exit 3, 1 claimed)". All 68 exited 0.
- NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3, PREREQUISITE
NOT MET. It reads the built output of every dual-build package, and this
diff touches no package, so no workspace build is owed locally. CI runs
it after its build.
- NOT MEASURED: `pnpm check:pm-dispatch-gates`. It did not finish inside
the 10-minute foreground limit (stopped at 570 s, exit 124, every check
printed until then green). CI runs it.
- `pnpm --filter @objectstack/lint run check:doc-formula-expressions`
and `pnpm check:lean-entry-closure` first answered exit 3; each exited 0
after the targeted build its refusal names.
- The derivation is from `bf4e7c2be3`. `origin/main` has moved three
commits since; none touches a path of this PR.
</details>
<details>
<summary>Token read for eval objects #22 and #24</summary>
Counts of each assertion token in the lines this PR adds, and in the two
files after the change.
| Case | Token | Added lines | `SKILL.md` | `rules/field-types.md` |
|:--|:--|:--|:--|:--|
| 22 must contain | `unitConfig` | 8 | 1 | 7 |
| 22 must contain | `unitMode` | 4 | 0 | 4 |
| 22 must contain | `H87` | 1 | 0 | 1 |
| 22 must contain | `KGM` | 2 | 0 | 2 |
| 24 must contain | `sys_exchange_rate` | 2 | 1 | 1 |
| 24 must contain | `homeAmount` | 0 | 0 | 4 (already there) |
| 24 must contain | `currencyMode: 'record'` | 0 | 0 | 3 (already there)
|
No forbidden token of either case is in an added line: `uom:
Field.select(`, `type: 'select'`, `name: 'exchange_rate'`, `event:
'afterInsert'`, 0 each. The new paragraph says "a picklist" and "an app
rate object" for that reason, so an answer that copies it writes no
forbidden literal.
The with-skill re-run of the two cases is NOT MEASURED here. A model run
is the eval seat's round, and this PR ran none.
**What remains on #38939, so this PR is `Part of`:** card note 3, the
with-skill re-run of eval objects 22 and 24. The card stays open with
`pm:dispatched` until the eval seat records that re-run.
</details>
## Acceptance notes
- **The entry file changes in two places, not one.** The card allows one
routing line. The second change, the sentence above the routing table,
is the paydown the ratchet's raise path requires in the same file. It is
in the same section. If the owning seat reads the fence as excluding it,
the alternative is to restore the sentence and carry `SKILL.md` at 2242
tokens with no deletion shown, which the raise path does not allow.
- **Two derived gates are not measured locally**, named under Tests.
- **Case 22 forbids a literal the bundle writes.** `type: 'select'` is
in `skills/objectstack-data/references/examples-objects.md` for other
fields, and a right answer that warns against a select by naming it
would fail the case. That is an eval assertion, which #38941 holds;
noted, not changed here.
- **The catalog and the data skill now both state these two facts.** The
catalog is generated from
`packages/spec/scripts/lib/platform-catalog.ts`; the data skill's text
is hand-written. A change to either table's contract needs both.
- The unit row of the weekly skills sweep card #35769 asks for the same
unit teaching and for `H87` and `KGM` literally; it is carried here.
## Verification
Read first, by risk:
1. `skills/objectstack-data/rules/field-types.md`, the new `### Unit of
measure` paragraph: every clause is a claim about what the write path
refuses.
2. Same file, the sentence added to the `homeAmount` paragraph: "never
an app rate object or a conversion hook" is the instruction an agent
will follow.
3. `skills/objectstack-data/SKILL.md`, `## Where to go`: the routing
row, and the sentence that was cut above the table.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints
"skills/objectstack-data/rules/field-types.md is 4566 tokens (ceiling
4566; headroom 0)" and "skills/objectstack-data/SKILL.md is 2233 tokens
(ceiling 2233; headroom 0)", and `git diff origin/main...HEAD --stat`
lists four files.
Governed surface (`skills/**`, Tier H): this PR stays draft. No reviewer
is requested and nothing is queued or armed by the author.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ)_
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzeatqKfTRUzTJVa9jQ -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1095535 commit 4203db7
4 files changed
Lines changed: 82 additions & 11 deletions
File tree
- .changeset
- scripts
- skills/objectstack-data
- rules
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1054 | 1054 | | |
1055 | 1055 | | |
1056 | 1056 | | |
1057 | | - | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
1058 | 1069 | | |
1059 | 1070 | | |
1060 | 1071 | | |
| |||
1655 | 1666 | | |
1656 | 1667 | | |
1657 | 1668 | | |
1658 | | - | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1659 | 1686 | | |
1660 | 1687 | | |
1661 | 1688 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
67 | | - | |
| 65 | + | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
| |||
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
218 | 247 | | |
219 | 248 | | |
220 | 249 | | |
| |||
274 | 303 | | |
275 | 304 | | |
276 | 305 | | |
277 | | - | |
278 | | - | |
| 306 | + | |
279 | 307 | | |
280 | 308 | | |
281 | 309 | | |
| |||
291 | 319 | | |
292 | 320 | | |
293 | 321 | | |
294 | | - | |
| 322 | + | |
295 | 323 | | |
296 | 324 | | |
297 | 325 | | |
| |||
0 commit comments