Repository navigation
feat(spec, fields): a roll-up of a stored home amount declares currencyMode dynamic and is drawn in the home currency - #33710
Conversation
…c and draws in the home currency Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
…or a dynamic roll-up of a home amount Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
…encyConfig description Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
📓 Docs Drift CheckThis PR changes 1 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 172 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin fb61d66797998727d51c33a37b81fabd6d6d6c58 && git checkout fb61d66797998727d51c33a37b81fabd6d6d6c58
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 48e695966ad76eee523d8a1321a88317ee4acfa6 f5b947e183d893b862280f9b677ee8b1187012a6 && git checkout -B drift-repro 48e695966ad76eee523d8a1321a88317ee4acfa6 && git merge --no-ff f5b947e183d893b862280f9b677ee8b1187012a6
node scripts/docs-audit/affected-docs.mjs --json 48e695966ad76eee523d8a1321a88317ee4acfa6
|
|
domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS Contract reviewServed-tier: Inputs read: card #33659 (body, comments 6889945413, 6890000941, 6890800748), PR #33710 (body, file list, net diff against Findings: one should-fix (S1), seven nits (N1 to N7), no must-fix. ① Derived judgments
② Semver level
③ Boundary flagsThe report's
The PR's author is the fleet bot, so no relay note applies. ④ Design judgment
Implemented-by: VERDICT: PASS |
…ck, and a single-object save does not judge it yet Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
…s an escape Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
|
domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS Contract review — deltaServed-tier: Findings: no must-fix, no should-fix, one nit (D1). S1 is discharged. What the delta changesTwo commits (
No file under S1 discharge
The skills follow-up is filed as #33714 (open, New findings
Changeset: still well-formed. Front matter unchanged ( Checks on the new head when read: PR-body guards, Check Changeset, Check Documentation Links, Spec property liveness and Governed Surface Queue Guard green; the lint, type-check, build and test jobs still in progress. This review ran nothing locally, so the Lint UI fix (the VerdictPASS. The delta is exactly the three prose and card items S1 asked for, plus a meaning-preserving escape in one test regex. Every owed item is done and the new prose agrees with the stack door, the object door and the engine door as they stand at Implemented-by: claude/project-thread-5zm2ol |
…e fixed-only key Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
|
domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS ACCEPT · PR #33710 (#33659) · head
|
…over a child field that is not a stored home amount, in defineStack's words (objectstack-ai#33855) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XThUCLpnVeG2WSghJgQjdG7)_ domain:spec#4 · os-project-manager · session_01FEkQ5nU2dZbC2HWMg47r4D Fixes objectstack-ai#33713 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: none — `skills/**` teaches no `dynamic` roll-up yet (its home roll-up paragraph is owed by follow-up objectstack-ai#33714), so no page states which door refuses the wrong one. ## 维护者速读 - 改了什么:运行中的服务器上,单对象保存/发布(元数据 API)现在和 `defineStack` 一样,拒绝"声明 `currencyMode: 'dynamic'`、却汇总的不是子对象本位币金额字段"的汇总字段,返回 422 `INVALID_METADATA`,提示原文与 `defineStack` 完全一致(同一份拼写)。扩展(`object_extension`)加进来的汇总或子字段,按服务器实际提供的对象来判;子对象上的 `homeAmount` 只有在其声明本身合法时才算数,扩展无法把普通数字字段"冒充"成本位币字段。 - 为什么改:objectstack-ai#33710 放开了"本位币汇总声明 dynamic",但只在 `defineStack` 判子字段;单对象保存那道门只判 `record` 汇总,于是汇总固定 EUR 金额、普通数字或公式的 dynamic 汇总能被存下,页面用本位币符号显示其合计,币种是错的。 - 风险与回滚:收窄的只是 objectstack-ai#33710 刚放开、尚未进任何稳定版(最新稳定版 18.4.0 不含)的形状;合法的本位币汇总照常保存。回滚即 revert 本 PR。 - 先看:`packages/objectql/src/record-currency-aggregate-door.ts` 中 `followRefusalsOf` 新增的两段 (d);`packages/spec/src/data/record-currency-path.ts` 末尾的 `storedHomeAmountSourceOf`(N7 的判据)。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run src/protocol-batch-object-registration.test.ts`,`[objectstack-ai#33713]` 一组 5 项全过(三种错误字段 422、本位币汇总照常保存、扩展加汇总同样 422)。 - 需要你做的:无,席位落地。 ## What changes **S1, the engine door.** `recordCurrencyFollowRefusal` (`packages/objectql/src/record-currency-aggregate-door.ts`) gains case (d) beside its `record` case (c). A `summary` with `function` `sum` / `min` / `max` / `avg` that declares `currencyMode: 'dynamic'`, or a `currencyConfig` naming no mode, is refused when its child field is not a stored home amount on the child as this server serves it. It is judged at both ends, as (c) is: at the parent's save, over a registered child, and at the child's save, under a registered parent's roll-up (a child saved so that the roll-up no longer reads a home amount). A child field the child does not hold is no verdict, as for (c). The refusal is `RecordCurrencyFollowRefusedError`, the code and status the `record` refusal already uses: `INVALID_METADATA` / 422. Nothing in the measurement gave a reason for another code. The pair key is a new kind, `dynamic`, so a summary moved from a refused `record` declaration to a refused `dynamic` one is the run's own change (R7). **One spelling of (d).** The sentence moves from `stack.zod.ts` into `packages/spec/src/data/record-currency-path.ts`, which already shares (a) and (c), as `recordCurrencyDynamicRollupNotHomeError`. `defineStack` and the engine both print it. The file is already exported from `@objectstack/spec/data`, so the data barrel is untouched. Its two new exports appear in `api-surface/data.json` and `export-origins/data.json`. **N7.** `storedHomeAmountSourceOf` (same file) replaces `homeAmountSourceOf`, at both doors. A `homeAmount` makes its `field` a stored home amount only where it is valid as declared, which is the object door's reading in `refuseDishonestHomeAmount`. It must sit on a `record`-mode `currency` amount and name another field of the same map. That field must be a `currency` field in `dynamic` mode (an absent mode is `dynamic`), `readonly: true`, with no `expression`, and claimed by that one amount. An authored object already guarantees this, so `defineStack` answers the same for every stack whose fields are all authored. A map merged with an extension's fields, or an object as a server serves it, can no longer launder a plain number, a `fixed` amount, a writable or computed field, or a doubly claimed column. The candidate list in the refusal now names only valid home amounts. **N6.** No registration path was added and `registry.ts` is untouched. Since objectstack-ai#33621 the follow door is asked with the object as served (`servedFoldWithLayer`). That covers an `extend` layer in its slot, and a `lookup` that returns the served child with every enabled extension. It is asked at a single save, in the batch writer and at the end of a registration run. So the new arm judges a roll-up an extension adds to a parent, and a child field an extension adds, by that same path. `defineStack` still skips an end it knows only through an extension, because it cannot see that object's owner. Its docblock now says the engine judges such a pair at the end of the run that installs the stack. **N1.** The `FieldSchema.currencyConfig` `.describe()` now says the roll-ups it lists are refused "by `defineStack` and by a single-object save or publish on a running server alike". The reference pages are regenerated. **Docs (surface amendment 6893463231).** `content/docs/data-modeling/currency.mdx` had two sentences from objectstack-ai#33710 saying a single-object save "does not judge the child field yet (objectstack-ai#33713)". This fix makes both false, so both now state the 422 at the metadata API, as the `record` bullet beside them does. **Liveness.** `field/currencyConfig` gains a dated `NARROWED 2026-11-15 (objectstack-ai#33713 …)` line naming the new reader and the shared spelling. The verdict stays LIVE. **ADR-0087.** One semantic entry, `summary-dynamic-currency-rollup-home-amount-judged-as-served`, and the changeset carries `adr-0087: registered` with it. It is owed for the measurement below. The gate would also refuse `not-required (no-migration-prescription)` on any `Metadata-protocol: narrowed` changeset. ## Tests - `packages/objectql/src/protocol-batch-object-registration.test.ts`, new describe `[objectstack-ai#33713]` (real kernel, real registry, `saveMetaItem` published on the `meta-envelope` face): - A `dynamic` roll-up over a `fixed` EUR amount, a plain number and a formula is refused 422 `INVALID_METADATA` (`RecordCurrencyFollowRefusedError`). The message opens with the case (d) sentence, and nothing is stored or registered. - CONTROL: the objectstack-ai#33659 probe shape, a `dynamic` roll-up of `amount_home`, saves and is served. - CONTROL: a `count` roll-up and a roll-up declaring no currency save as before. - A `record` roll-up over the fixed amount answers as before, 422 with (c)'s sentence. - N6: an `object_extension` item adding the roll-up is refused 422 and stores nothing. - `packages/objectql/src/record-currency-guards.test.ts`, new describe for case (d), at the registry's single-save question: - The three child fields are refused whichever end registers second. Each message is EQUAL to `defineStack`'s finding for the same pair, so the wording is pinned at both doors. - A `{}` config and `min` / `max` / `avg` are refused the same way. - A roll-up over the record-mode amount itself stays D6's first (`RecordCurrencySummaryRefusedError`), pinned and not re-judged. - CONTROL: the probe shape registers in either order for all four functions. No-currency and `fixed` roll-ups are not judged. - A child save that de-homes a registered roll-up's field is refused, naming the parent's roll-up. A registration run that leaves an old pair as it found it is not refused (R7), and one that de-homes it is. - N6: an extension adding the roll-up is refused at a single save. An extension adding the child field is judged at either end. A post-seal `registerApp` whose `objectExtensions` add the roll-up is refused at the end of its run and leaves nothing of the package. - N7: an extension forging `homeAmount` over a plain number does not admit the roll-up, and its message equals `defineStack`'s. CONTROL: an extension with its own valid home field and amount does admit it. - `packages/spec/src/data/currency-summary-home-rollup.test.ts`, two new describes: - N7 at `defineStack`: an `objectExtensions` entry forging `homeAmount` over a writable amount, a `number` field, a `fixed` amount, a computed field, or a doubly claimed home field is refused. A valid extension home amount is admitted. `storedHomeAmountSourceOf` over the parsed probe child answers `amount` for `amount_home` and nothing for every other field. - Wording: `defineStack`'s finding equals `recordCurrencyDynamicRollupNotHomeError(...)` for four child fields. - **Ablations** (mutation through `scripts/ablation-replace.mjs`, restored to the HEAD blob each time, `git diff HEAD` empty): - Dynamic arm: `declaresDynamicCurrency` forced false in `record-currency-aggregate-door.ts`. 9 tests red (2 metadata-API, 7 registry). All controls stayed green. - N7 check: `storedHomeAmountSourceOf` put back to the old any-`homeAmount` reading. Spec was rebuilt and `ablation-dist-preflight` found the marker in 2 dist files. 3 spec tests and 2 objectql tests went red. After the restore, spec was rebuilt and the preflight `--absent` read clean. ## Acceptance notes - **The migration measurement.** The latest stable `@objectstack/spec`, 18.4.0 (published 2026-11-13T12:30Z), does not carry objectstack-ai#33710: none of its tarball's files hold the object door's new wording. The `next` snapshot `0.0.0-next-20261115100430` (dist-tag `next`, published 2026-11-15T10:32Z, `gitHead` bd96ec9) does: 4 dist files hold it. That is a published version with the widening, so the entry is added. Against the last stable release, the net change is still a widening (18.4.0 refused every `dynamic` summary). - **A single save does not apply R7.** A single save judges its layer against an empty slot (`before: null`), as it already does for (a) and (c). So once a bad `dynamic` roll-up is stored past this door (stored before this release and hydrated at boot), re-saving the child unchanged through `/meta` is refused over it. A registration run compares the pair and does not refuse it. The test pins the run's half. - **(d) does not read `rateDate` / `rateField`.** They say nothing about which currency the home field holds. The object door still judges them on an authored object. - **N2 is unchanged.** On the engine, D6's roll-up door answers first for a roll-up over an amount in each row's own currency. For an amount that follows the parent through the very `master_detail`, D6 admits the roll-up and (d) refuses it in `defineStack`'s words, the same order the stack pass has. - `packages/objectql/src/registry.ts`'s comment above the single-save follow question still names only the following amount and the `record` roll-up. It is outside the surface (`registry.ts` was granted for an N6 call site only, and none was needed). Noted, not edited. ## Verification All readings on head `c6d372dc` (base `b76df9a6`; `origin/main` is 19 commits ahead, none touching this diff's files). <details><summary>Package suites, typecheck, dogfood</summary> - `pnpm --filter @objectstack/spec test`: Test Files 842 passed (842), Tests 26948 passed, 1 todo. - `pnpm --filter @objectstack/objectql test`: Test Files 596 passed (596), Tests 13151 passed. - `pnpm --filter @objectstack/spec typecheck && pnpm --filter @objectstack/objectql typecheck`: exit 0. - Full dogfood battery (owed by the `(narrowing)` arm), `pnpm --filter @objectstack/dogfood test` under the lock after the closure build: `VERDICT command-exit 0`, Test Files 467 passed, 3 skipped (470), Tests 3958 passed, 42 skipped (4000). </details> <details><summary>Derived gates</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 121 commands. Each was run with its exit code captured before any pipe. - 119 passed on the first pass. `check:dual-build-cjs-loads` and `check:published-readme-exports` answered exit 3 (PREREQUISITE NOT MET: six packages outside this diff had no `dist/`). After building them, both exit 0. - `--ran`: `121 derived famil(ies) accounted for — 121 run, 0 NOT-MEASURED`. - `pnpm --filter @objectstack/spec check:generated`: exit 0 after `gen:api-surface`, `gen:export-origins`, `gen:schema` and `gen:docs`. - The log is `pm-orders/spec/33713-gates-ran.txt`. CI runs every other family. </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (CI). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5nU2dZbC2HWMg47r4D)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…ome amount (objectstack-ai#34076) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JJcYUaBywmN3uCa97Wdw7C)_ Fixes objectstack-ai#33714 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:数据技能 `field-types.md` 的「货币」一节补上一段加一个示例:对子对象本位币存储字段(某个 `homeAmount.field` 指向的字段)做 `sum`/`min`/`max`/`avg` 汇总时,汇总字段声明 `currencyConfig: { currencyMode: 'dynamic' }`、不写 `defaultCurrency`,界面就按组织本位币显示;并说明其他 `dynamic` 汇总会被 `defineStack` 拒收、`count` 不能带货币。另加一条评测用例。 - 为什么改:objectstack-ai#33710 已让平台接受这种写法,但技能没教;AI 照技能写只会留成裸数字,或者写成 `fixed` 加本位币代码,而 ADR-0144 规定元数据不得写出本位币。 - 风险与回滚:纯技能文档加评测,不动 schema 和运行时;为了腾预算删了两处同文件重复(`currency` 行的键列表改成指向「货币」一节;自动编号的重复示例),被删的内容在同文件别处仍在。token 棘轮行 3208 → 3349,按实测钉死。回滚 = revert 本 PR。 - 先看:`skills/objectstack-data/rules/field-types.md` 的「A roll-up of the home field」段与示例;`scripts/check-skills-token-ratchet.mjs` 该文件那一行及注释;评测文件末尾的第 20 条。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs | grep field-types` 应显示 `3349 / 3349`,且命令退出 0。 - 需要你做的:本 PR 碰 `skills/**`,按受治理流程保持 draft,等 GOVERNED_APPROVERS 批准后由席位落地。 ## What changes - **`skills/objectstack-data/rules/field-types.md` § Currency**, right after the `homeAmount` paragraph: one paragraph, "A roll-up of the home field", and a three-line `Field.summary` snippet (`project.actual_cost` = `sum` of `expense.amount_home`, `currencyConfig: { currencyMode: 'dynamic' }`). It teaches: - a `sum` / `min` / `max` / `avg` `summary` over a child's `homeAmount.field` declares `currencyMode: 'dynamic'` with no `defaultCurrency`, and shows in `localization.currency`; undeclared, a bare number; - ADR-0144: metadata never names the home currency, so never `'fixed'` with it; - `defineStack` (`os validate`, the build) refuses `'dynamic'` on any other roll-up, and any `currencyConfig` on a `count`. - **Sources, on main `fb79d47c`:** - `packages/spec/src/stack.zod.ts` `collectRecordCurrencyPathErrors` case (d): "A `summary` (`sum`, `min`, `max`, `avg`) declaring `currencyMode: 'dynamic'` … is admitted only when the child field it rolls up is a stored home amount: a field that some `currencyConfig.homeAmount.field` on the child object names … Any other `dynamic` roll-up is refused". - `packages/spec/src/data/object.zod.ts` `refuseUnadmittedSummaryCurrency` (wired into the object schema, so `defineStack` runs it): "A count is a number of rows, never an amount, so it has no currency: delete `currencyConfig`." The same function admits `dynamic` only "(no `defaultCurrency`)". - `content/docs/data-modeling/currency.mdx` § Totals in the home currency: "declare `currencyMode: 'dynamic'` on it, with no code … the metadata never names which currency that is"; ADR-0144 D8 rule 5: "Metadata never names the home currency". - **Paid down first** under the standing ruling 「A:先削重复,余额按实测提高」 (records 6513306068, 6784270263), two same-file restatement cuts, 115 bytes: - the `currency` table row's `currencyConfig` key list `(currencyMode, defaultCurrency, currencyField, homeAmount)` becomes `(→ Currency)` (-45 B as first cut; the round-1 arrow form is 2 B shorter again). Surviving home: § Currency, whose snippet and prose spell all four keys. - the § Autonumber `{ type: 'autonumber', format: 'CASE-{0000}' }` snippet (-70 B). Surviving home: the `autonumber` row (`format` … e.g. `"CASE-{0000}"`, line 132) and the token table's `CASE-{0000}` row. - Considered and kept: the Lookup snippet (the data skill's only home of the `lookupFilters` shape) and the Formula snippet (only home of the `F` template import). - **Token ratchet row** `skills/objectstack-data/rules/field-types.md` 3208 → 3349, pinned at the measurement (`wc -c` 13395 → ceil(13395 / 4) = 3349, zero headroom), with a dated comment naming both cuts and their homes. - **Eval:** case 20 appended at the tail of `skills/objectstack-data/evals/objects-fields-relationships.json` (no existing case touched; objectstack-ai#33432 holds the `writeRequiresMasterRead` case of this file). The prompt tempts "just set the total's currency to USD"; `must_contain` `summary`, `amount_home`, `currencyMode: 'dynamic'`; `must_not_contain` `defaultCurrency: 'USD'` (the code a wrong answer writes; a correct restatement such as "no `defaultCurrency`" or "never `currencyMode: 'fixed'`" does not trip it). The expected output satisfies its own assertions (checked by script). - **Changeset:** `.changeset/33714-home-currency-rollup-skill.md`, `@objectstack/skills` patch. ### Size readings (published `skills/**`) | Reading | Before (`fb79d47c`) | After | |:--|--:|--:| | `field-types.md` lines / bytes | 246 / 12821 | 252 / 13395 | | `field-types.md` tokens / ceiling | 3206 / 3208 | 3349 / 3349 | | `objectstack-data` package, all files, lines / bytes | 4311 / 211790 | 4334 / 213777 | | all `skills/**/SKILL.md`, lines / bytes | 4596 / 237075 | 4596 / 237075 (unchanged) | | ratcheted (authored) tokens / ceilings, at `78cfc281` | 187806 / 194122 | 187950 / 194264 | | eval fixtures tokens | 46787 | 47140 | | bundle total tokens | 246388 | 246885 | ## Tests No code changed, so there is no unit test and no ablation. Forced test edits: none. Gates at head `78cfc281` (base `fb79d47c`), run in this worktree after the last commit: - Build closure first: `turbo run build --concurrency=2 --filter='./packages/**'` under `os-verify-lock.sh`: `VERDICT command-exit 0` (7m22s). - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 63 derived commands, every one exit 0. `--ran` reconciles: "63 derived famil(ies) accounted for — 63 run, 0 NOT-MEASURED (a DERIVED zero …)". - Also run: `pnpm --filter @objectstack/spec check:skill-examples` exit 0, `check:skill-docs` exit 0, `check:skill-refs` exit 0; the author ran `check-skills-token-ratchet.mjs --self-test` exit 0 (104 cases), `pnpm check:skill-links` exit 0, `pnpm check:skill-identifier-liveness` exit 0, and a control-character grep on the four files (no hits). - `test:repo`, the type-check lanes and the CI-only families are CI's; read their check-runs on this PR. <details><summary>The 63 derived commands and their exits</summary> ```text node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0 node scripts/check-adr-0087-registration.mjs --self-test :: exit 0 node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs --self-test :: exit 0 node scripts/check-doc-route-spelling.mjs --advisory :: exit 0 node scripts/check-doc-route-spelling.mjs --self-test :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-empty-changeset.mjs --base origin/main :: exit 0 node scripts/check-empty-changeset.mjs --self-test :: exit 0 node scripts/check-self-test-wired.mjs :: exit 0 node scripts/check-self-test-wired.mjs --self-test :: exit 0 node scripts/check-self-test-workflow-commands.mjs :: exit 0 node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0 node scripts/check-skills-token-ratchet.mjs :: exit 0 node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0 node scripts/check-whole-set-label-write.mjs :: exit 0 node scripts/check-whole-set-label-write.mjs --self-test :: exit 0 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/ci/snapshot-next.mjs --self-test :: exit 0 node scripts/pm/bare-root-worklist.mjs --self-test :: exit 0 node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0 node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0 node scripts/release-pending-publish.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:bash32-floor :: exit 0 pnpm check:changeset-gate-self-tests :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:cli-command-ids :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:corpus-claim-drift :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 0 pnpm check:entry-guard :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:parse-guard :: exit 0 pnpm check:pm-dispatch-gates :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-skill-id-lint :: exit 0 pnpm check:pnpm-filter-targets :: exit 0 pnpm check:pnpm-flag-spellings :: exit 0 pnpm check:published-files :: exit 0 pnpm check:ratchet-remedy-authority :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:role-word :: exit 0 pnpm check:scripts-symbol-anchors :: exit 0 pnpm check:skill-compatibility :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:skill-identifier-liveness :: exit 0 pnpm check:skill-links :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` </details> ## Acceptance notes - **Authoring route.** `dispatch-gates --tier` mandates the contract-review tier for `skills/**` (clause ①). This card thread is served below that tier, so the `skills/**` text, the eval case, the changeset and the ratchet row were authored and committed by an isolated `os-dev` subagent pinned to that tier, on this same branch and worktree, as the claim records. The thread verified the facts against main, ran the gates, pushed and opened this PR. - Left out for budget: the running-server half of the refusal (a metadata-API save or publish answers `INVALID_METADATA` / 422 with the same message). `currency.mdx` § Roll-ups and datasets carries it. - The `count` refusal is the object door (`refuseUnadmittedSummaryCurrency`), which `defineStack` runs as part of the object parse; the skill names `defineStack` for both refusals in one sentence. - `skills/objectstack-data/evals/README.md` lists each eval file's topics and does not say "currency" (already true before this PR, since case 18). Left untouched: outside the claimed file surface. - **Review round 1** (at-tier review record 6898808993 at `78cfc281`, PASS with one should-fix), head `7c9814a6`, authored at the contract-review tier like the first commit, after merging `origin/main` (`a640ecf3`, clean): - F1: eval case 20 `must_not_contain` is now `defaultCurrency: 'USD'` alone; the bare `defaultCurrency` and `currencyMode: 'fixed'` entries failed a correct answer that restates the rule. Checked: the restatement "No defaultCurrency here, and never `currencyMode: 'fixed'` with it." passes; `currencyConfig: { currencyMode: 'fixed', defaultCurrency: 'USD' }` is caught. - N1: "without it, as a bare number" → "undeclared, a bare number". - N2: the `currency` row pointer is `(→ Currency)`, the file's arrow form. - N3 (optional `relationshipField` in the snippet): skipped, about +30 B with nothing to pay for it. - Ratchet row re-pinned 3350 → 3349 at the measurement (13395 B); comment numbers updated. - Re-run at `7c9814a6`: `check-skills-token-ratchet.mjs` 0, `--self-test` 0, spec `check:skill-docs` 0, `check:skill-refs` 0, `check:skill-examples` 0 (after a spec rebuild under the lock; the first run answered 3, stale `dist` after the merge), `check:skill-links` 0, `check-nul-bytes` 0, case-20 self-consistency script 0. The 63-command derived set below is the run at `78cfc281`. - Out-of-scope findings: none. ## Verification ```bash node scripts/check-skills-token-ratchet.mjs | grep field-types # 3349 / 3349, exit 0 pnpm --filter @objectstack/spec check:skill-docs pnpm --filter @objectstack/spec check:skill-examples ``` --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmPwzDmc8SYayZfateR)_ <!-- signed: domain:skills#2 · os-steve · session_01ADHkmPwzDmc8SYayZfateR --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Leehom · project thread
Fixes #33659
Clause-②: yes (widening: a
sum/min/max/avgsummary over a stored home amount is admitted withcurrencyMode: 'dynamic')Metadata-protocol: added
Skills-docs: follow-up #33714 —
skills/objectstack-data/rules/field-types.md(itshomeAmountparagraph teaches the stored home field but not that asummaryover it declarescurrencyMode: 'dynamic');content/docs/data-modeling/currency.mdxandcontent/docs/data-modeling/field-types.mdxare updated here.维护者速读
homeAmount.field指向的那个存储字段)被父对象summary汇总时,现在可以声明currencyConfig: { currencyMode: 'dynamic' }(不写币种代码)。spec 只在汇总对象确实是本位币金额时接受它;控制台的记录页和列表单元格据此把汇总值画成组织本位币(localization.currency)的金额。其他dynamic汇总、count汇总照旧拒绝。250.00)。之前没有一种汇总声明既被接受又诚实:record只给跟随父记录币种的汇总,dynamic一律被拒,fixed要在元数据里写死本位币代码,而 ADR 规定元数据不写本位币。同一字段的仪表盘指标卡却显示货币符号,两处不一致。HotCRM PSA 模块需要它(hotcrm#2316)。dynamic的汇总字段(以前 spec 不允许存在)。回滚即 revert。单对象保存(不经defineStack)只校验「指向了子字段且没写defaultCurrency」,是否本位币字段只在defineStack校验,见 Acceptance notes。packages/spec/src/stack.zod.ts(collectRecordCurrencyPathErrors新增 (d) 段与dynamicRollupNotHomeError),packages/spec/src/data/object.zod.ts(refuseUnadmittedSummaryCurrency的dynamic分支),ui/packages/fields/src/currency.ts(summaryDeclaresCurrency)。pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/data/currency-summary-home-rollup.test.ts,预期 11 个用例全绿:探针形状被接受,非本位币字段上的dynamic被拒且消息点名子对象的本位币字段。Head-sha4171fcd);本 PR 不触及受管路径(Tier S),按 pm-dispatch 规则由 spec 席位在 CI 全绿后落地。What changes
Spec, object door (
packages/spec/src/data/object.zod.ts#refuseUnadmittedSummaryCurrency). Adynamicsummary (written, or acurrencyConfigwith nocurrencyMode, which parses asdynamic) is let through only when itssummaryOperationsnames a child object and field and it carries nodefaultCurrency; whether that child field is a home field needs the child object, so the stack pass judges it. Refused here, as before: adynamicsummary naming no child field (new message: "...with nosummaryOperationsnaming a child field, so it rolls up no stored home amount..."), and acountin every mode. Newly worded refusal: adynamicsummary with adefaultCurrency("dynamicreads nodefaultCurrency, and metadata never names the home currency"); it was refused before by the blanketdynamicarm. The sharedadmittedsentence every refusal here ends with now names three cases:fixed,record, anddynamicover a stored home amount.Spec, stack pass (
packages/spec/src/stack.zod.ts#collectRecordCurrencyPathErrors, new case (d)). Asum/min/max/avgsummary declaringdynamicis admitted when the child field it rolls up is named by somecurrencyConfig.homeAmount.fieldon the child object (homeAmountSourceOf). Any otherdynamicroll-up is refused withdynamicRollupNotHomeError, which names what the child field does support: for a record-mode amount, its own stored home field (orrecordon the parent when the amount follows this record); for afixedchild amount, thatfixedcode; otherwise the child's home amounts, or that it stores none. A child this stack does not declare, or a child field it does not hold, is not judged, the same stance case (c) takes for arecordroll-up. Adynamicroll-up is judged by (d) before (b) and (c), so it is reported once.Spec, text.
FieldSchema.currencyConfig.describe()and theCurrencyConfigSchemadocblock (packages/spec/src/data/field.zod.ts) state the new admitted case;content/docs/references/data/{field,object}.mdxandcontent/docs/references/system/migration.mdxregenerated bypnpm gen:docs.packages/spec/liveness/field.json,field/currencyConfig: a datedWIDENED 2026-11-15 (#33659 ...)line naming the reader that now consumesdynamicon a summary. Verdict unchanged: LIVE.Console (
@object-ui/fields).summaryDeclaresCurrency(ui/packages/fields/src/currency.ts) answers true fordynamic(and a config with nocurrencyMode). Both roll-up faces that read it,SummaryField(record page) andFormulaCellRenderer(index.tsx, list cell), already pass the tenant currency fromuseLocalization()and the parent row intoresolveFieldCurrency, which answerslocalization.currencyfor a non-recordconfig with nofixedcode: the same callObjectMetricWidgetmakes for a tile over the home field (resolveFieldCurrency(valueFieldDef, tenantCurrency)). Comments in those two faces updated; no export line inindex.tsxtouched.Docs.
content/docs/data-modeling/currency.mdx: a bullet in "Roll-ups and datasets" and the declaration with an example under "Totals in the home currency"; both namedefineStack(os validateand the build) as the door that refuses adynamicroll-up over a non-home field, and say a single-object save on a running server does not judge it yet (#33713).content/docs/data-modeling/field-types.mdx: thesummary"In the Console" paragraph says a roll-up declaring its currency is drawn as money.Changeset:
.changeset/33659-home-rollup-dynamic-currency.md:@objectstack/specminor,@object-ui/fieldspatch.Readers measured (order step 3)
packages/services/service-analytics/src/plugin.tssourceFieldMetarelays a code only forfixed(defaultCurrency) and a pointer only forrecord; adynamicsummary relays neither, as the home field itself does.measure-currency-coherence.ts#assertMeasureCurrenciesCoherentjudges only those two, so adynamicsummary cannot trip it against the home field it sums. No change.packages/objectql/src/record-currency-aggregate-door.tsjudges summaries over record-mode child amounts andrecordsummaries only (summaryDeclaresRecord); a summary over a home field (a plaincurrencyfield) is admitted whatever its owncurrencyConfig. No change, and nothing inpackages/objectqltouched (open PR feat(objectql)!: judge an extension's record-mode amount against its object as served, refusing a bad follow pair at the run that completes it #33621 edits that file).Tests
packages/spec/src/data/currency-summary-home-rollup.test.ts(11 cases), on the card's probe shape (crm_probe_expense.amountrecord-mode withhomeAmount: { field: 'amount_home', rateDate: 'expense_date', rateField: 'rate_used' },crm_probe_project.home_expense_totalasumoveramount_home): admitted bydefineStackwithdynamic, withmin/max/avg, and with{}; the object door alone lets it through. Refused:dynamicover a plain currency field nohomeAmountnames (names'amount_home'), over the record-mode amount itself (prescribes its home field), over a child storing no home amount, over afixedchild (prescribes the code); at the object,dynamicwith nosummaryOperations(and its message names the third admitted case) anddynamicwith adefaultCurrency; acountstill refused with the old message head.packages/spec/src/data/currency-config-record-mode.test.ts: the two cases that pinned "dynamicrefused on every summary" now pin the narrower refusal (no child field) at the object, and the stack's (d) refusal with therecordprescription for a following amount. Every other case unchanged.ui/packages/fields/src/__tests__/summaryFaces.homeRollup-33659.test.tsx(9 cases): list cell and record page draw$250.00under home USD and the yuan symbol (CN¥1,800.00, never$) under home CNY;{}reads asdynamic; no home currency gives250.00with no symbol; an undeclared summary stays250. Acceptance 3: under USD, CNY, de-DE/EUR and ja-JP/JPY the record page, the list cell and the metric tile's own call over the home field (formatCurrency(v, resolveFieldCurrency(HOME_FIELD, tenant), locale)) give the same text.Ablations (each on committed head 7abcd20, via scripts/ablation-replace.mjs, restored to the HEAD blob with git diff HEAD empty)
The suites import the mutated modules from source (relative imports in both packages), so no build sits between mutation and test.
if (namesChild && named === undefined) continue;, blob42c0b107→b7aedbd9):currency-summary-home-rollup.test.ts8 failed | 3 passed (the admissions and every stack-pass case, which now meet the object refusal first). Restored to42c0b107.errors.push(dynamicRollupNotHomeError(...))line replaced by a no-op, blob70e8c845→ff1e8126): 5 failed | 67 passed across the two spec files (the four non-home refusals and the record-mode-filedynamiccase). Restored to70e8c845.summaryDeclaresCurrencywithoutmode === 'dynamic', blob0748515cmutated):summaryFaces.homeRollup-33659.test.tsx8 failed | 1 passed (only the undeclared-summary case stays green). Restored to0748515c.Acceptance notes
ui/packages/plugin-grid/src/useColumnSummary.ts#formatSummaryLabelon console list footer: the total of a summary field (Field.summary, scale 2) renders without decimals ("Paid 230,000" next to a currency "Open 215,000.00") #33542 (claim 6889088903, amendment 6889142643); that PR exportssummaryDeclaresCurrencyfromui/packages/fields/src/index.tsxand decides money in the footer by it, so adynamicsummary reaches the footer once both land. Whether the footer then resolvesdynamicto the tenant currency with no record is the check to make after both merge (resolveFieldCurrencyanswers the tenant default for any non-recordconfig, so it should).defineStack's cross-reference pass. A save of one object through the metadata API parsesObjectSchema(the object door), which admits adynamicsummary naming any child field and nodefaultCurrency; the engine registry judgesrecordpairs at a single-object save (data/record-currency-path.tswording) but has nodynamicarm. So adynamicsummary over a non-home child field saved alone, outsideos validate/defineStack, is stored and drawn in the home currency. Carrier: metadata save: adynamicroll-up over a child field that is not a stored home amount is admitted by a single-object save on a running server (stack door refuses it) #33713 (carrying the (d) judgement into the engine registry,packages/objectql, with theFieldSchema.currencyConfigdescribe wording, review N1).content/docs/data-modeling/currency.mdxnames this gap and the door that does refuse (defineStack:os validateand the build).currencyConfigon asummaryoutside the ADR-0144 admitted roll-up parses and is inert #31958): a summary saved then with adynamiccurrencyConfig(or the old parsed{ currencyMode: 'dynamic', defaultCurrency: 'CNY' }) now draws as money in the tenant currency. Not measured whether any such row exists; the spec has refused that shape at save since spec(currency):currencyConfigon asummaryoutside the ADR-0144 admitted roll-up parses and is inert #31958.Skills-docs:follow-up skills: field-types teaches the stored home field but not that a summary over it declarescurrencyMode: 'dynamic'#33714 onskills/objectstack-data/rules/field-types.md(skills/**is outside this card's surface).Verification
Round 1 on head
7abcd20e(baseorigin/mainb95d9156). Gate log:/mnt/project-files/pm-orders/spec/33659-gates-ran.txt.Round 2 (contract review 6890873219, S1, and Lint UI job 132733878394) on head
4171fcd6:currency.mdxand the changeset'sSkills-docs:line (prose only), and the oneno-irregular-whitespaceerror insummaryFaces.homeRollup-33659.test.tsx(a literal non-breaking space in a regex, now the\u00a0escape).eslinton the four touched ui files: 0 errors (170 pre-existing warnings); the test file 9/9 green; the 35 derived doc, changeset and citation families rerun on the new tree, all exit 0 (log:33659-gates-ran-r2.txt). No schema or code file changed in this round.Package suites and typechecks
pnpm --filter @objectstack/spec test: exit 0, Test Files 842 passed (842), Tests 26891 passed | 1 todo.pnpm --filter @objectstack/spec typecheck: exit 0.ui/packages/fields:pnpm run type-check(both projects) exit 0;pnpm exec vitest run packages/fields/fromui/: Test Files 306 passed | 1 skipped (307), Tests 4624 passed | 7 skipped.Derived gates
node scripts/pm/dispatch-gates.mjs --commandsderived 118 families on the diff; first pass 115 exit 0, 3 exit 3 for prerequisites:check-plugin-teardown-shape --self-test(pinned commit fetched),check:skill-examplesandcheck:dual-build-cjs-loads(dist missing). Afterturbo run build --concurrency=2(8m13s, shared box) all three exit 0.--ranthen named one more derived family,@objectstack/spec check:generated. First run exit 1:check:test-typecheck's tsc died of V8 heap exhaustion ("failed without diagnostics"), not a ratchet move; rerun withNODE_OPTIONS=--max-old-space-size=8192:check:test-typecheckOK (52 files / 240 errors / 131 pinned signatures held),check:generatedexit 0, "All 14 generated artifacts are up to date".dispatch-gates --ran: "119 derived famil(ies) accounted for — 119 run, 0 NOT-MEASURED".!in the title, no(narrowing)arm).test:repo, Test UI, Build Core).🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
Generated by Claude Code