Skip to content

feat(spec, fields): a roll-up of a stored home amount declares currencyMode dynamic and is drawn in the home currency - #33710

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-5zm2ol
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-5zm2ol

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #33659

Clause-②: yes (widening: a sum/min/max/avg summary over a stored home amount is admitted with currencyMode: 'dynamic')
Metadata-protocol: added
Skills-docs: follow-up #33714 — skills/objectstack-data/rules/field-types.md (its homeAmount paragraph teaches the stored home field but not that a summary over it declares currencyMode: 'dynamic'); content/docs/data-modeling/currency.mdx and content/docs/data-modeling/field-types.mdx are updated here.

维护者速读

  • 改了什么:子对象上的「本位币金额」字段(某个金额字段的 homeAmount.field 指向的那个存储字段)被父对象 summary 汇总时,现在可以声明 currencyConfig: { currencyMode: 'dynamic' }(不写币种代码)。spec 只在汇总对象确实是本位币金额时接受它;控制台的记录页和列表单元格据此把汇总值画成组织本位币(localization.currency)的金额。其他 dynamic 汇总、count 汇总照旧拒绝。
  • 为什么改:ADR-0144 D6 规定合并总额读存储的本位币字段,总额算对了,但显示成裸数字(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 被拒且消息点名子对象的本位币字段。
  • 需要你做的:无。契约复审已在本 PR 通过(首轮 6890873219,增量 6891007506,Head-sha 4171fcd);本 PR 不触及受管路径(Tier S),按 pm-dispatch 规则由 spec 席位在 CI 全绿后落地。

What changes

Spec, object door (packages/spec/src/data/object.zod.ts#refuseUnadmittedSummaryCurrency). A dynamic summary (written, or a currencyConfig with no currencyMode, which parses as dynamic) is let through only when its summaryOperations names a child object and field and it carries no defaultCurrency; whether that child field is a home field needs the child object, so the stack pass judges it. Refused here, as before: a dynamic summary naming no child field (new message: "...with no summaryOperations naming a child field, so it rolls up no stored home amount..."), and a count in every mode. Newly worded refusal: a dynamic summary with a defaultCurrency ("dynamic reads no defaultCurrency, and metadata never names the home currency"); it was refused before by the blanket dynamic arm. The shared admitted sentence every refusal here ends with now names three cases: fixed, record, and dynamic over a stored home amount.

Spec, stack pass (packages/spec/src/stack.zod.ts#collectRecordCurrencyPathErrors, new case (d)). A sum / min / max / avg summary declaring dynamic is admitted when the child field it rolls up is named by some currencyConfig.homeAmount.field on the child object (homeAmountSourceOf). Any other dynamic roll-up is refused with dynamicRollupNotHomeError, which names what the child field does support: for a record-mode amount, its own stored home field (or record on the parent when the amount follows this record); for a fixed child amount, that fixed code; 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 a record roll-up. A dynamic roll-up is judged by (d) before (b) and (c), so it is reported once.

Spec, text. FieldSchema.currencyConfig .describe() and the CurrencyConfigSchema docblock (packages/spec/src/data/field.zod.ts) state the new admitted case; content/docs/references/data/{field,object}.mdx and content/docs/references/system/migration.mdx regenerated by pnpm gen:docs. packages/spec/liveness/field.json, field/currencyConfig: a dated WIDENED 2026-11-15 (#33659 ...) line naming the reader that now consumes dynamic on a summary. Verdict unchanged: LIVE.

Console (@object-ui/fields). summaryDeclaresCurrency (ui/packages/fields/src/currency.ts) answers true for dynamic (and a config with no currencyMode). Both roll-up faces that read it, SummaryField (record page) and FormulaCellRenderer (index.tsx, list cell), already pass the tenant currency from useLocalization() and the parent row into resolveFieldCurrency, which answers localization.currency for a non-record config with no fixed code: the same call ObjectMetricWidget makes for a tile over the home field (resolveFieldCurrency(valueFieldDef, tenantCurrency)). Comments in those two faces updated; no export line in index.tsx touched.

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 name defineStack (os validate and the build) as the door that refuses a dynamic roll-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: the summary "In the Console" paragraph says a roll-up declaring its currency is drawn as money.

Changeset: .changeset/33659-home-rollup-dynamic-currency.md: @objectstack/spec minor, @object-ui/fields patch.

Readers measured (order step 3)

  • packages/services/service-analytics/src/plugin.ts sourceFieldMeta relays a code only for fixed (defaultCurrency) and a pointer only for record; a dynamic summary relays neither, as the home field itself does. measure-currency-coherence.ts#assertMeasureCurrenciesCoherent judges only those two, so a dynamic summary cannot trip it against the home field it sums. No change.
  • packages/objectql/src/record-currency-aggregate-door.ts judges summaries over record-mode child amounts and record summaries only (summaryDeclaresRecord); a summary over a home field (a plain currency field) is admitted whatever its own currencyConfig. No change, and nothing in packages/objectql touched (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

  • New packages/spec/src/data/currency-summary-home-rollup.test.ts (11 cases), on the card's probe shape (crm_probe_expense.amount record-mode with homeAmount: { field: 'amount_home', rateDate: 'expense_date', rateField: 'rate_used' }, crm_probe_project.home_expense_total a sum over amount_home): admitted by defineStack with dynamic, with min/max/avg, and with {}; the object door alone lets it through. Refused: dynamic over a plain currency field no homeAmount names (names 'amount_home'), over the record-mode amount itself (prescribes its home field), over a child storing no home amount, over a fixed child (prescribes the code); at the object, dynamic with no summaryOperations (and its message names the third admitted case) and dynamic with a defaultCurrency; a count still refused with the old message head.
  • packages/spec/src/data/currency-config-record-mode.test.ts: the two cases that pinned "dynamic refused on every summary" now pin the narrower refusal (no child field) at the object, and the stack's (d) refusal with the record prescription for a following amount. Every other case unchanged.
  • New ui/packages/fields/src/__tests__/summaryFaces.homeRollup-33659.test.tsx (9 cases): list cell and record page draw $250.00 under home USD and the yuan symbol (CN¥1,800.00, never $) under home CNY; {} reads as dynamic; no home currency gives 250.00 with no symbol; an undeclared summary stays 250. 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.

  1. Object-door admission deleted (if (namesChild && named === undefined) continue;, blob 42c0b107 → b7aedbd9): currency-summary-home-rollup.test.ts 8 failed | 3 passed (the admissions and every stack-pass case, which now meet the object refusal first). Restored to 42c0b107.
  2. Stack (d) refusal removed (the errors.push(dynamicRollupNotHomeError(...)) line replaced by a no-op, blob 70e8c845 → ff1e8126): 5 failed | 67 passed across the two spec files (the four non-home refusals and the record-mode-file dynamic case). Restored to 70e8c845.
  3. Renderer branch removed (summaryDeclaresCurrency without mode === 'dynamic', blob 0748515c mutated): summaryFaces.homeRollup-33659.test.tsx 8 failed | 1 passed (only the undeclared-summary case stays green). Restored to 0748515c.

Acceptance notes

Verification

Round 1 on head 7abcd20e (base origin/main b95d9156). 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.mdx and the changeset's Skills-docs: line (prose only), and the one no-irregular-whitespace error in summaryFaces.homeRollup-33659.test.tsx (a literal non-breaking space in a regex, now the \u00a0 escape). eslint on 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/ from ui/: Test Files 306 passed | 1 skipped (307), Tests 4624 passed | 7 skipped.
Derived gates
  • node scripts/pm/dispatch-gates.mjs --commands derived 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-examples and check:dual-build-cjs-loads (dist missing). After turbo run build --concurrency=2 (8m13s, shared box) all three exit 0.
  • --ran then 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 with NODE_OPTIONS=--max-old-space-size=8192: check:test-typecheck OK (52 files / 240 errors / 131 pinned signatures held), check:generated exit 0, "All 14 generated artifacts are up to date".
  • dispatch-gates --ran: "119 derived famil(ies) accounted for — 119 run, 0 NOT-MEASURED".
  • Dogfood battery: not run (no ! in the title, no (narrowing) arm).
  • CI owns the rest (lint farm, Test Core including test:repo, Test UI, Build Core).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa


Generated by Claude Code

…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
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 5 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/spec/liveness/field.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/concepts/metadata-driven.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/data-modeling/external-datasources.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/data-modeling/field-types.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/data-modeling/validation-rules.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/deployment/troubleshooting.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/deployment/validating-metadata.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/getting-started/quick-reference.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/kernel/contracts/data-engine.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/protocol/backward-compatibility.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/protocol/objectql/types.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/protocol/objectui/concept.mdx (via FieldSchema (symbol, a top-level const))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/releases/v17/17-1.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/releases/v18/18-3.mdx (via FieldSchema (symbol, a top-level const))
  • content/docs/releases/v18/18-4.mdx (via FieldSchema (symbol, a top-level const))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/spec/liveness/field.json) — pages documenting those are invisible to this run
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 172 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 48e695966ad76eee523d8a1321a88317ee4acfa6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from fb61d66797998727d51c33a37b81fabd6d6d6c58 — the merge of head f5b947e183d893b862280f9b677ee8b1187012a6 into base 48e695966ad76eee523d8a1321a88317ee4acfa6, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 48e695966ad76eee523d8a1321a88317ee4acfa6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 7abcd20e6b3e7a683143dc9804ee0974d95131b5
Local-runs: none
Scope: packages/spec/src/data/object.zod.ts,packages/spec/src/stack.zod.ts,packages/spec/src/data/field.zod.ts + packages/spec/liveness/field.json, ui/packages/fields/src/currency.ts, ui/packages/fields/src/widgets/SummaryField.tsx, ui/packages/fields/src/index.tsx, content/docs/data-modeling/currency.mdx, content/docs/data-modeling/field-types.mdx

Inputs read: card #33659 (body, comments 6889945413, 6890000941, 6890800748), PR #33710 (body, file list, net diff against main), the check-runs on this head, ADR-0144 (D4, D5, D6 with its 2026-11-09 amendment, D8 rule 5). Code outside the diff was read, not reviewed. The tests, the regenerated reference pages and the changeset body are the lane seat's ACCEPT at TIER_DEFAULT.

Findings: one should-fix (S1), seven nits (N1 to N7), no must-fix.

① Derived judgments

  • ObjectSchema accept set (object door, refuseUnadmittedSummaryCurrency): widened. A sum / min / max / avg summary with currencyMode: 'dynamic' (or a currencyConfig naming no mode), a summaryOperations naming a child object and field, and no defaultCurrency now parses. Right, and it is the only change: the count arm runs first and is untouched, a dynamic summary naming no child field or carrying a defaultCurrency is still refused, the record and fixed arms are unchanged. Nothing accepted before is refused now.
  • defineStack accept set (collectRecordCurrencyPathErrors, new case (d)): of the roll-ups the object door now lets through, the stack admits only the one whose child field some currencyConfig.homeAmount.field on the child object names, when the stack declares the child and holds the field. Right. It is a strict subset of the object door's new set, so the stack door is narrower than the object door by design.
  • The two doors therefore publish different accept sets, and the one a single-object save meets is the wider one. Wrong as left: see S1 under ③.
  • FieldSchema and CurrencyConfigSchema accept sets: unchanged (text only in field.zod.ts). Right.
  • No key, enum value, export or type is added or removed; currencyMode keeps its three values. Right.
  • Console public surface: summaryDeclaresCurrency keeps its signature and now answers true for dynamic and for a config object with no mode; it answers false for a null or non-object config, as before. Right, and it is the one function both roll-up faces read.
  • Liveness ledger row field/currencyConfig: a dated WIDENED line is prepended, the verdict stays LIVE, the evidence line is unchanged. Right: the reader it names is in this diff.
  • Gate verdicts on this head: completed and green are Check Changeset (both runs), Governed Surface Queue Guard, Spec property liveness, PR-body guards, Check Documentation Links, Type Check · source gates, Build UI Deps, Dogfood Regression Gate and the planners. Still in progress or queued when read: Build Core, Build Docs, all eight Test Core shards, all sixteen Test UI shards, Type Check · workspace, · consumer gates, · debt ledger, Type Check UI, Lint UI, the Lint farm, Live E2E UI, Build & E2E UI. Those are not a pass. This record judges the contract; it does not stand in for them, and the landing condition (every check green) is unmet until they complete.

② Semver level

  • Clause-②: yes (widening) is right: a published accept set grows and nothing narrows. The changeset's sentence names which door refuses what, and it is accurate door by door.
  • Metadata-protocol: added is right: a newly accepted value on an existing key, for one field type. No key is removed, no meaning or default changes (an absent currencyConfig on a summary still means no currency).
  • @objectstack/spec minor matches the kind. @object-ui/fields patch is right for a renderer that starts honouring a declaration the spec newly admits; it publishes no new authorable surface. Both declaration lines are in the PR body and the changeset body, and Check Changeset concluded success on this head.
  • Skills-docs: follow-up owed — skills/objectstack-data/rules/field-types.md is a valid form of the third line; the seat owes the card and the rewrite to its number before ACCEPT.

③ Boundary flags

The report's open_questions is empty. Its three out-of-scope findings:

The PR's author is the fleet bot, so no relay note applies.

④ Design judgment

packages/spec/src/data/object.zod.ts. Holds. The door can see only one object, so it lets through exactly the shape that could be the admitted roll-up (child object and field named, no code) and leaves home-ness to the pass that holds the child. Refusing a defaultCurrency here is right against D8 rule 5 ("Metadata never names the home currency") and against the reader, which ignores it under dynamic. The docblock's account of the arms matches the code. The refusal messages name the third admitted case and a remedy each.

packages/spec/src/stack.zod.ts. Holds against ADR-0144. The test for "stored home amount" is the homeAmount.field pointer, the ADR's own definition (D5), and the object door refuseDishonestHomeAmount already guarantees that such a field is a stored currency field in dynamic mode, readonly, with no expression, claimed by one amount. So every row of it is in localization.currency, and D4's lock keeps the stored rows and the setting in step. The total is therefore in that currency for sum, min, max and avg alike, through any relation (a lookup included, since no row carries another currency). Tried against it:

  • home field renamed while the summary still names the old field: the child no longer holds the field, so (d) says nothing, as (c) says nothing. The roll-up itself is broken and is the engine's to report. N4, nit, accepted.
  • a roll-up of a parent's own dynamic home total (a nested summary), or of a plain dynamic currency field: refused, though both are drawn in the tenant currency in their own cells. This is the narrow reading the card's Acceptance 2 asks for. N3, nit; a follow-up if a consumer needs the nested total.
  • a home amount declared by an objectExtensions entry on a declared child: merged into the child's field map, so admitted. Right.
  • a summary on a parent the stack knows only through an extension, or a child it knows only that way: neither door judges it. This predates the PR for every mode, but dynamic now has a reader there. Likewise homeAmountSourceOf takes any field's homeAmount.field at its word, which the object door guarantees only for authored objects. N6, N7, nits; both belong in S1's server card.
  • count: never reaches (d); the object door refuses it in every mode.
  • (d) runs before (b), so a dynamic roll-up over a child amount that follows this record now gets (d)'s general prescription instead of (b)'s exact currencyField spelling, and (b)'s "It declares currencyMode: 'dynamic'" branch is reachable only for an extension-only child. The finding is still correct and reported once. N2, nit.
  • tenant with no home currency: resolveFieldCurrency answers nothing and the faces draw a plain amount; the spec side is unaffected.
  • summaries stored before the 2026-11-09 narrowing with a dynamic config now draw as money in the tenant currency. That is what the declaration said then; not measured whether any exists. N5, nit, accepted deviation.

packages/spec/src/data/field.zod.ts. The CurrencyConfigSchema docblock is accurate and names both doors. The .describe() on FieldSchema.currencyConfig says "any other dynamic summary ... are refused" without naming a door, the form the record clause beside it has always had; with S1 open it is true at defineStack only. N1, nit; leave the schema file alone and correct it with the server card.

packages/spec/liveness/field.json. Agrees with the tree sentence by sentence: the reader, the two faces, the two doors and "service-analytics is unchanged" all check out (sourceFieldMeta relays a code only under fixed and a pointer only under record, so assertMeasureCurrenciesCoherent has nothing to compare for a dynamic summary, as for the home field itself).

ui/packages/fields/src/currency.ts, widgets/SummaryField.tsx, index.tsx. Agree with the contract. summaryDeclaresCurrency reads an absent mode as dynamic, the spec's own parse. Both faces already pass the tenant currency and the parent row to resolveFieldCurrency, which answers the tenant default for a config that is neither record nor fixed: the call the metric tile makes for the home field. That meets the first consumer (record page, list cell) and Acceptance 3's "same currency as the tile". An undeclared summary is untouched (Acceptance 2). The comments describe the code.

content/docs/data-modeling/currency.mdx, field-types.mdx. Agree with the contract except the two sentences named in S1. The example is the admitted shape, and the page claims the record page and list cell only, not the footer.

Implemented-by: claude/project-thread-5zm2ol
Reviewed-by: session_01FEkQ5mecqk8M5q9vjKj6aS

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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS

Contract review — delta

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4171fcd63b18043361dcb961844a216d439e3a2b
Delta-of: 6890873219 (head 7abcd20e6b3e7a683143dc9804ee0974d95131b5)
Local-runs: none
Scope: the net diff 7abcd20..4171fcd and the PR body

Findings: no must-fix, no should-fix, one nit (D1). S1 is discharged.

What the delta changes

Two commits (396b6cfc, 4171fcd6), three files, 12 insertions and 7 deletions. The PR's head on GitHub is 4171fcd63b18043361dcb961844a216d439e3a2b.

  • .changeset/33659-home-rollup-dynamic-currency.md: one line. Skills-docs: follow-up owed becomes Skills-docs: follow-up #33714; the rest of the line is unchanged.
  • content/docs/data-modeling/currency.mdx: two passages. The dynamic bullet in "Roll-ups and datasets" (lines 257 to 266) and the closing paragraph of "Totals in the home currency" (lines 475 to 478).
  • ui/packages/fields/src/__tests__/summaryFaces.homeRollup-33659.test.tsx: one line. The regex in the text helper held a literal non-breaking space (bytes c2 a0, read from the old blob with od); it is now / /g. Both spell the same single code point U+00A0 with the same g flag and the same replacement, so the helper matches exactly what it matched before. No other line of the file moved, and no assertion changed.

No file under packages/ is in the diff (git diff --stat 7abcd20e 4171fcd6 -- packages is empty). No schema, generated reference, liveness ledger or runtime source moved; the only code file is the test above.

S1 discharge

The skills follow-up is filed as #33714 (open, documentation, finding, pm:blocked) and both the changeset and the PR body name it.

New findings

Changeset: still well-formed. Front matter unchanged (@objectstack/spec minor, @object-ui/fields patch). The Clause-②: and Metadata-protocol: lines are byte-identical to the reviewed head; the Skills-docs: line now names a filed card instead of "owed". "Check Changeset" has one completed run green on the new head.

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 no-irregular-whitespace error) is confirmed by reading the bytes, not by a green ESLint job.

Verdict

PASS. 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 4171fcd6. No schema or runtime file moved, the changeset is well-formed, and the one new finding is a nit carried by #33713.

Implemented-by: claude/project-thread-5zm2ol
Reviewed-by: session_01FEkQ5mecqk8M5q9vjKj6aS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
…e fixed-only key

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS

ACCEPT · PR #33710 (#33659) · head f5b947e183d893b862280f9b677ee8b1187012a6 · 2026-11-15T08:24Z

席位核对

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 08:24
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit f64c0f9 Nov 15, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-5zm2ol branch November 15, 2026 08:57
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…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>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A summary over a stored home-currency amount is drawn as a bare number, and no summary currencyConfig can say "the home currency" without naming it

1 participant