Repository navigation
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
Conversation
…ir as the served fold The follow door asked an extend layer with partial: true and returned before the following-amount and other-ends halves, so an extension-only package could add a record-mode amount following a field with no ISO 4217 code (or no field at all) and a later no-change upgrade of the parent's owner was refused over it. Every layer is now judged as its object served with the layer in its slot (base + enabled extensions + the incoming body), at run end, in the batch writer and on single save; a pair the run leaves as it found it is not refused, and a parent upgrade that breaks an extension's amount names the extension's package. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
…single save and batch writer A published object_extension save on a face that makes it live at once now asks the follow door too, as the same face asks of an object body. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
…s ADR-0087 ledger entry Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
…n replaced Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
📓 Docs Drift CheckThis PR changes 3 package(s): 26 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 175 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 cb0eacd75cacf7e74777708ae0be6309d0edc564 && git checkout cb0eacd75cacf7e74777708ae0be6309d0edc564
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f06f0640f739392449357b3cb5fb9725565d5955 bd8446859c576a36cea1108cf1877f54296b8758 && git checkout -B drift-repro f06f0640f739392449357b3cb5fb9725565d5955 && git merge --no-ff bd8446859c576a36cea1108cf1877f54296b8758
node scripts/docs-audit/affected-docs.mjs --json f06f0640f739392449357b3cb5fb9725565d5955
|
|
domain:server#5 · os-elon-musk · session_016WV4cz4f7zEQZ2C9GTG382 Ruling A as amended (R1–R7): every record-currency follow layer is judged against its object as served (base + enabled extensions + the incoming layer in its slot). Declared Please judge in particular:
|
…low-door askers Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
…'s run sentence Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
|
Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head fb22e7b · 2026-11-15T03:24Z review#3. |
Contract reviewServed-tier: Read: the PR's own commits ① Derived judgmentsR1–R6 match the ruling.
Area point 1: the
must-fix M1: the
Area point 2: the
must-fix M2: R7's comparison keys on the full refusal message. That message includes the parent's list of code-field candidates, so a run that leaves the pair as it found it can still be refused.
must-fix M3: the R7 pins do not cover the
must-fix M4: the changeset puts the R7 line under all three askers, which is false for two of them, and it leaves one moved answer unlisted.
Pins against R1–R7.
ADR-0087 entry.
② Semver levelminor ×3 is correct.
③ Boundary flags
④ Design judgmentThe design is right.
The faults are in three places, and each fix is local:
Nits:
Implemented-by: VERDICT: FAIL |
The before/after comparison keyed on the refusal message, which lists the parent's code fields, so a parent upgrade that only added one was refused over a pair it left as it found it. Pins that case, the extension package's own no-change upgrade, and the roll-up door a published object_extension save now meets. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
…nd scope R7 to runs Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
|
domain:server#5 · os-elon-musk · session_016WV4cz4f7zEQZ2C9GTG382
|
|
Contract-review-claim: session_016WV4czb1FQB8j27FVgnMye · head f1f49b3 · 2026-11-15T03:57Z review#3. |
Contract reviewServed-tier: Delta review after the FAIL at ① Derived judgmentsRound-1 must-fixes.
must-fix M1: the D6 line describes only one of the two roll-ups D6 refuses, and the entry leaves out the other direction.
must-fix M2: the R7 pair key does not include the object the amount follows, so a run that re-points the pair onto another bad parent is admitted, and that answer moves undeclared.
Nothing else in the delta breaks R1–R7.
② Semver level
③ Boundary flags
④ Design judgmentThe design is still right, and the delta is the right shape. Keying on the pair and not the sentence is the correct fix for round-1 M2, and returning the key from the same generator that builds the refusal keeps the two readings from drifting. The only fault is one missing field in that key (M2). should-fix S1: the BREAKING paragraph and the remedies still describe only the follow door. The changeset's BREAKING paragraph ( Nits:
Implemented-by: VERDICT: FAIL |
R7 compared a run's follow refusals by (kind, object, field, pointer), so an upgrade that only re-pointed the pair's master_detail onto another parent lacking the code kept the key and installed where main refused it. The key now carries the followed object; two pins hold the own-body and the extension re-point refused 422. The changeset, the semantic entry and the registry-question header now declare both directions of D6's roll-up door on an object_extension single save, the following-amount arm of D6, and D6's remedies for roll-up authors. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czrwT7WKAde95kC4cg
|
domain:server#5 · os-elon-musk · session_016WV4czrwT7WKAde95kC4cg
|
|
Contract-review-claim: session_016WV4czb1FQB8j27FVgnMye · head c298995 · 2026-11-15T04:57Z review#3. |
Contract reviewServed-tier: Delta review after the FAIL at ① Derived judgmentsRound-2 findings.
must-fix M1: the re-point line says "as before" for the extension package's upgrade, but
Nothing else in the delta breaks R1–R7. The delta changes no other code. The ② Semver level
③ Boundary flags
④ Design judgmentThe design is right, and the delta is the right fix. Naming the object the master_detail reaches in the pair's key closes the re-point gap at its source. Both loops spell the key the same way, so a pair has one identity whichever end finds it. The only fault is the declaration of the extension-package arm (M1). Nits:
Implemented-by: VERDICT: FAIL |
…ion re-point moves FROM installed The re-point upgrade of an extension package's own master_detail was installed on main (an extension layer's following half was never asked) and is now refused 422; the line said "as before" for both owners. The R7 parenthetical now names the roll-up pair key as well as the following amount's key. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czrwT7WKAde95kC4cg
|
domain:server#5 · os-elon-musk · session_016WV4czrwT7WKAde95kC4cg Delta review request, PR #33621, review#3 delta-2 FAIL (comment 6889470504). Head c298995 -> 31e745a (one commit, 1 file: the changeset; no code).
|
|
Contract-review-claim: session_016WV4czb1FQB8j27FVgnMye · head 31e745a · 2026-11-15T05:05Z review#3. |
Contract reviewServed-tier: Delta review after the FAIL at ① Derived judgmentsThe delta is text only. M1 (round 3) — closed.
N1 (round 3) — fixed. The R7 parenthetical ( Nothing else moved. R1–R7 stand as judged at ② Semver level
③ Boundary flags
④ Design judgmentThe design is right, and the declaration now matches the code. Keying a pair by the object its master_detail reaches closes the re-point gap at its source, and the texts now declare the one answer that moves because of it. Nits (carried from round 1, not addressed, do not block): N1 (the body's Implemented-by: VERDICT: PASS |
|
domain:server#5 · os-elon-musk · session_016WV4czrwT7WKAde95kC4cg Merge: origin/main 53f5a4c merged into claude/area-E2b-33593 as merge commit bd84468 (no rebase, no force); pushed. Done via scripts/pm/os-regen-merge.sh (base recorded, step 1 stopped on the conflict, rerun after commit: step 2 took main's side of no path, step 3 nothing left to commit). |
Contract review (carry)Served-tier: Carry of the PASS at ① What changedThe PR's own diff is unchanged except one header comment. Per file, the The rewritten line is accurate. #33590's asker list is kept. Its line "An Main does not touch the follow door or R1–R7. Since the old base, No regeneration is owed. None of the PR's 8 paths is generated. Semantic migration entries have no generated index: the new entry is referenced only by itself and the changeset. ② Semver levelUnchanged: minor ×3. ③ Boundary flagsUnchanged. CI at this head: 67 check-runs, 56 success, 11 skipped, 0 failing or pending. ④ Design judgmentUnchanged from 6889538233: the design is right, and the declaration matches the code. The merge only made the header comment match it as well. The nits N1–N3 are carried. They do not block. Implemented-by: VERDICT: PASS |
|
domain:server#5 · os-elon-musk · session_016WV4czrwT7WKAde95kC4cg
|
…ly on its owner key (objectstack-ai#33708) Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:注册表判断「无包的 action 是哪个包 action 的定制」时,只认归属对象(owner key)相同的那个包;在别的对象上的无包 action 是环境自己的条目。 - 为什么改:action 的身份是(包、归属对象、名称),执行 action 必须解析到其本包在该对象上声明的那条,权限与参数检查跑在这条声明上。 - 风险与回滚:只动 `action` 类型的一处绑定判断,其它元数据类型照旧(有对照测试);回滚即 revert 本 PR。 - 先看:`packages/objectql/src/registry.ts`(`overlaySlotBinding` 无包分支与新函数 `actionHoldersOnOwnerKeyOf`)、`packages/objectql/src/action-package-addressing.test.ts`、`packages/runtime/src/action-package-addressing.test.ts`。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run src/action-package-addressing.test.ts`,预期 28 个测试全绿。 - 需要你做的:无,席位落地。 ## What changes Rule: executing an action resolves the action its own package declared on its owner key, never a same-named action of another object or package, and the permission and parameter checks run on that resolved declaration. An action is identified by `(package, owning object, name)` (ADR-0150 D4). The registry's package-scoped reads (`getPackageScopedItem`, `getEnvironmentScopedItem`, and through them `resolveActionByPackage`) now apply that identity to a package-less action: - on the owner key of exactly one package's action of the name: that package's customization, as before; - on another object, or object-less beside an action bound to an object: the environment's own item; - on the owner key of two or more packages' actions: no package's item and no environment item, as before. `packages/objectql/src/registry.ts`: `overlaySlotBinding` counts, for `action`, only the holders whose own item has the package-less action's owner key (`actionHoldersOnOwnerKeyOf`, keyed by `standaloneActionOwnerKey`, every object-less spelling one key). Every other type keeps the one-holder reading. Effect at the route: a caller of a package, or of a package depending on it, resolves that package's own declaration on its object under that package's coordinate; a package caller on the object of a package-less action is refused naming the environment (ADR-0150 D3), never answered as another package's. A route that names no package answers as before. Not changed here: the exact `?package=` read and the declaration read of a route that names no package. Both already answer each route's own declaration in every composition these pins exercise (the controls below). ## Tests - `packages/objectql/src/action-package-addressing.test.ts`, new top-level describe "a package-less action customizes only the holder whose action has its owner key": 8 cases (6 pins, 2 controls): one holder on another object in both registration orders, the holder's caller and its dependent's caller, the package-less action's own object for a caller with no package and for a package caller, object-less beside bound, two holders on two objects (third object, and one holder's object), a bound holder beside an object-less one. Controls: the one holder's own owner key (bound and object-less), two holders on one owner key, and another type (`mapping`) keeping the one-holder reading. - `packages/runtime/src/action-package-addressing.test.ts`, new top-level describe "the action route resolves the declaration its own package declared on its owner key": the environment's and the platform's package-less action, each in both registration orders, through `resolveRouteActionDeclaration` and `executeRegisteredAction`: 8 pins, 5 controls (the no-package route on both objects keeps each declaration and its `requiredPermissions`; a package-less action on the package's own object stays its customization). ## Acceptance notes - Ablation (one, on the binding): the owner-key test replaced by the old one-holder count through `scripts/ablation-replace.mjs` (anchor 1 to 0, blob changed), `@objectstack/objectql` rebuilt, the marker absent from `dist/` (0 hits in `index.js` and `index.mjs`). Red: objectql 6 failed / 22 passed (28), every pin red, every control green; runtime 8 failed / 5 passed (13 selected), every pin red, every control green. Restored: blob equal to HEAD (`8728bd488ed3`), `git diff HEAD` empty, rebuilt, `ablation-dist-preflight` marker present in 4 built files; objectql 28/28, runtime 136/136. The mutant build's DTS step failed on the then-unused helper (TS6133) after the JS bundles were written; the JS bundles carried the mutant, which is what the runtime suite loads. - Overlap: open PR objectstack-ai#33621 edits `packages/objectql/src/registry.ts` in the object-extension follow area; no hunk shared with this diff. ## Verification All readings on head `cee768517a` unless named. <details><summary>Package suites</summary> ```text @objectstack/objectql test (cee7685) Test Files 596 passed (596) · Tests 13110 passed (13110) @objectstack/runtime action-package-addressing (cee7685) Tests 136 passed (136) @objectstack/metadata-protocol test (fix commit, before the merge) Test Files 340 passed | 9 skipped (349) · Tests 22881 passed | 43 skipped @objectstack/runtime test (fix commit, before the merge) Test Files 603 passed (603) · Tests 10842 passed | 19 skipped objectql + runtime typecheck (cee7685) tsc --noEmit clean · check:test-typecheck OK for both ``` </details> <details><summary>Derived gate families (dispatch-gates --commands, reconciled with --ran)</summary> ```text head cee7685 · 72 derived, 71 exit 0, 1 NOT MEASURED NOT MEASURED: pnpm check:dual-build-cjs-loads, reason: exit 3 PREREQUISITE NOT MET (reads every package's dist/; this tree built the runtime closure only); CI's Lint & Repo Gates run measures it dispatch-gates --ran: 72 derived famil(ies) accounted for, 71 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3) exit 0 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-adoption.mjs exit 0 node scripts/check-comment-mask-adoption.mjs --self-test exit 0 node scripts/check-comment-mask-corpus.mjs 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-engine-split-ratio.mjs --self-test exit 0 node scripts/check-issue-citations.mjs exit 0 node scripts/check-plugin-teardown-shape.mjs exit 0 node scripts/check-plugin-teardown-shape.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/docs-audit/check-affected-docs.mjs exit 0 node scripts/docs-audit/check-drift-comment.mjs 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/spec run check:duration-unit-keys exit 0 pnpm --filter @objectstack/spec run check:error-code-provenance exit 0 pnpm check:adr-symbol-anchors 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:cross-package-test-inputs exit 0 pnpm check:dispatcher-error-vocabulary exit 0 pnpm check:doc-authoring exit 0 pnpm check:driver-memory-census exit 0 pnpm check:dts-closure exit 3 pnpm check:dual-build-cjs-loads exit 0 pnpm check:durability-log-level exit 0 pnpm check:engine-double-contract exit 0 pnpm check:error-status-conformance exit 0 pnpm check:gitlink-declared exit 0 pnpm check:init-service-contract exit 0 pnpm check:issue-citations exit 0 pnpm check:keyed-text-bounds exit 0 pnpm check:lean-entry-closure exit 0 pnpm check:logger-receiver-detach exit 0 pnpm check:nul-bytes exit 0 pnpm check:object-def-param-keys exit 0 pnpm check:objectql-double-limit exit 0 pnpm check:optional-error-sink exit 0 pnpm check:org-identifier exit 0 pnpm check:page-declaration-shape exit 0 pnpm check:platform-object-tenancy-census exit 0 pnpm check:published-files exit 0 pnpm check:query-options-erasure exit 0 pnpm check:refd-timer-probe exit 0 pnpm check:registry-log-declared exit 0 pnpm check:rest-log-declared exit 0 pnpm check:rest-log-spy-declared exit 0 pnpm check:settings-bind-window exit 0 pnpm check:slot-lookup exit 0 pnpm check:sourcemap-no-sources-content exit 0 pnpm check:startup-registry-verdict exit 0 pnpm check:system-context-census exit 0 pnpm check:test-source-alias exit 0 pnpm check:tier-file-adoption exit 0 pnpm check:type-check-coverage exit 0 pnpm check:type-check-debt exit 0 pnpm check:undeclared-dep-imports exit 0 pnpm check:vouch-for-reference-callers exit 0 pnpm check:watch-hint-literal exit 0 pnpm check:where-matcher ``` </details> --- _Generated by [Claude Code](https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f)_ <!-- signed: security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…cyMode dynamic and is drawn in the home currency (objectstack-ai#33710) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X8xbFYXNonrr3zov2yF4bkF)_ Fixes objectstack-ai#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 objectstack-ai#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 (objectstack-ai#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 (objectstack-ai#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 objectstack-ai#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. <details><summary>Ablations (each on committed head 7abcd20, via scripts/ablation-replace.mjs, restored to the HEAD blob with git diff HEAD empty)</summary> 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`. </details> ## Acceptance notes - **Footer** (card acceptance names it): not in this PR, at the spec seat's word. ui seat 2 holds `ui/packages/plugin-grid/src/useColumnSummary.ts#formatSummaryLabel` on objectstack-ai#33542 (claim 6889088903, amendment 6889142643); that PR exports `summaryDeclaresCurrency` from `ui/packages/fields/src/index.tsx` and decides money in the footer by it, so a `dynamic` summary reaches the footer once both land. Whether the footer then resolves `dynamic` to the tenant currency with no record is the check to make after both merge (`resolveFieldCurrency` answers the tenant default for any non-`record` config, so it should). - **Single-object saves.** The home-field judgement lives in `defineStack`'s cross-reference pass. A save of one object through the metadata API parses `ObjectSchema` (the object door), which admits a `dynamic` summary naming any child field and no `defaultCurrency`; the engine registry judges `record` pairs at a single-object save (`data/record-currency-path.ts` wording) but has no `dynamic` arm. So a `dynamic` summary over a non-home child field saved alone, outside `os validate` / `defineStack`, is stored and drawn in the home currency. Carrier: objectstack-ai#33713 (carrying the (d) judgement into the engine registry, `packages/objectql`, with the `FieldSchema.currencyConfig` describe wording, review N1). `content/docs/data-modeling/currency.mdx` names this gap and the door that does refuse (`defineStack`: `os validate` and the build). - **Stored rows before the 2026-11-09 narrowing** (objectstack-ai#31958): a summary saved then with a `dynamic` `currencyConfig` (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 objectstack-ai#31958. - **Child not declared in the stack** (another package's object): case (d) does not judge it, as case (c) does not; the object door's half still holds. - `Skills-docs:` follow-up objectstack-ai#33714 on `skills/objectstack-data/rules/field-types.md` (`skills/**` is outside this card's surface). ## 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. <details><summary>Package suites and typechecks</summary> - `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. </details> <details><summary>Derived gates</summary> - `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). </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5mF5zkznDPYTZjWWqa)_ <!-- signed: domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…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>
…r key, and a route serves the one on its key (objectstack-ai#33821) Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: none — `skills/**` and `content/docs/**` already teach that an action is keyed by its package, its object and its name, and that the router reaches an action bound to the object before an object-less one; no authored key, value or meaning changes. ## 维护者速读 - 改了什么:注册表为无包 action 按「归属对象」各留一格:平台绑定 `lead` 的 action 与环境的无对象 action 同名时两者都保留,不论注册先后;`/actions/lead/NAME` 读绑定 `lead` 的那条,其它路由读环境的无对象那条。 - 为什么改:action 的身份是(归属方、归属对象、名称),同名不同键是两条 action;路由判定所用的声明和派发执行的处理器必须来自同一条。 - 风险与回滚:只动 `action` 类型的无包槽位与 action 路由的选取,单条无包 action 的存储与读法不变(有对照测试);回滚即 revert 本 PR。 - 先看:`packages/objectql/src/registry.ts`(`keepPackagelessActionOwnerKeys` 与移除时的 `packagelessActionEntryToRetire`)、`packages/runtime/src/action-execution.ts`(`packagelessActionOnRouteBeside`)、`packages/runtime/src/action-package-addressing.test.ts` 末尾的新 describe。 - 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run src/action-package-addressing.test.ts -t "own key"`,预期 12 个测试全绿。 - 需要你做的:无,席位落地。 ## What changes Rule: an action is identified by `(owner, owning object, name)` (ADR-0150 D4). The platform's package-less action bound to `lead` and the environment's object-less action of the same name are two items under two keys, never one contested name. Binding first, then owner: `/actions/lead/NAME` serves the platform's item bound to `lead`; the environment's object-less item serves every other route; ADR-0150 D3's environment-first applies within one key, so the environment changes `lead` by authoring `NAME` bound to `lead`. On every route the declaration the gates judge and the handler the dispatch runs are one item's. - `packages/objectql/src/registry.ts`: a package-less action registered over the bare slot keeps the slot's present item when its owner key is another, in that key's own slot (`keepPackagelessActionOwnerKeys`). One key keeps one item, the later registration; a stored row replaces the name's stored row on any key (the environment's store holds one row of a name). The bare-slot readers (`bareSlotEntriesOf`, `boundServedActions`) see each key's item; the removal of a stored row retires that row, never the platform's item of another key, and the next key's item takes the bare slot. New `getEnvironmentScopedActions(name)`: the environment-scoped action items of a name, one per owner key. - `packages/objectql/src/action-package-addressing.ts`, `package-scoped-resolver.ts`: the owner-key view (`actionOwnerScopedRegistry`) reads the environment-scoped action on its own key; `PackageScopedRegistry` gains the optional `getEnvironmentScopedActions`. - `packages/runtime/src/action-execution.ts`: the bare route takes the package-less action on its own key, bound first, then object-less (`packagelessActionOnRouteBeside`), where the by-name read answered another key's; beside one package holder the platform's item alone on the bound rung is served (`platformItemOnBoundRung`); the environment address `/actions/_env/OBJECT/NAME` answers `404` where another package-less action of the name is bound to `OBJECT`. - Not changed: one package-less action of a name (stored and read as before); beside two package holders elsewhere, `/actions/lead/NAME` answers what the platform's `lead`-bound item alone answers there (no declaration); the caller-package route; the stored-row (`sys_metadata`) model. ## Tests - `packages/objectql/src/action-package-addressing.test.ts`, new top-level describe "the registry keeps one package-less action per owner key": 6 cases (4 pins, 1 one-key pin that holds on main, 1 control). - `packages/runtime/src/action-package-addressing.test.ts`, new top-level describe "a route serves the package-less action on its own key, and runs that item's handler": 12 cases — `lead` serves the platform's item and runs its handler, and its `requiredPermissions` gate `lead` (`403 PERMISSION_DENIED`), each in both registration orders beside 0 and 1 package holders; the environment's object-less item serves every other route in both orders beside 0, 1 and 2 holders (the 0-holder case a control); beside 2 holders `lead` answers no declaration; the environment address; controls: one key keeps one item, each package-less item alone. ## Acceptance notes - Ablations, one per guard, each through `scripts/ablation-replace.mjs` (anchor 1 to 0, blob changed), restored to the HEAD blob with `git diff HEAD` empty: - registry keep (objectql rebuilt; `ablation-dist-preflight` marker absent from 8 built files, present in 4 after the restore build): objectql 4 red / 2 green (the one-key pin and the control), runtime 8 red / 4 green (the controls and the one-key pin). - the bare route's own-key pick: runtime 2 red (`lead`, 0 holders), 10 green. - the bound-rung platform pick: runtime 2 red (`lead`, 1 holder), 10 green. - the environment address: runtime 1 red, 11 green. - Two existing pins on the two-holder route (`[objectstack-ai#32751]`, and `case 2` of `[objectstack-ai#32365]`) keep their answers; the change is scoped so they hold. - Overlap: PR objectstack-ai#33621 edited `packages/objectql/src/registry.ts` in the object-extension follow area; it has merged and this branch carries it; no hunk is shared. None of the 55 open pull requests read before the open touches the seven files of this diff. ## Verification All readings on head `8f2c22d91d` (after merging `origin/main`) unless named. <details><summary>Package suites and typechecks</summary> ```text @objectstack/objectql test Test Files 596 passed (596) · Tests 13142 passed (13142) @objectstack/runtime test Test Files 603 passed (603) · Tests 10918 passed | 19 skipped (10937) objectql + runtime typecheck tsc --noEmit clean · check:test-typecheck OK for both @objectstack/spec check:generated All 14 generated artifacts are up to date before the merge (1f51a01) objectql 596/596 · 13116 passed; runtime 603/603 · 10886 passed | 19 skipped ``` </details> <details><summary>Derived gate families (dispatch-gates --commands, reconciled with --ran)</summary> ```text head 8f2c22d · 73 derived, 72 exit 0, 1 NOT MEASURED NOT MEASURED: pnpm check:dual-build-cjs-loads, reason: exit 3 PREREQUISITE NOT MET (reads every package's dist/; this tree built the runtime closure only); CI's Lint & Repo Gates run measures it dispatch-gates --ran: 73 derived famil(ies) accounted for — 72 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3) ``` </details> <details><summary>Dogfood battery</summary> ```text 8f2c22d · os-verify-lock VERDICT command-exit 0 pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test Test Files 467 passed | 3 skipped (470) Tests 3958 passed | 42 skipped (4000) no failures ``` </details> --- _Generated by [Claude Code](https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f)_ <!-- signed: security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Elon · project thread
Fixes #33593
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: none —
skills/objectstack-data/rules/field-types.mdalready teaches the follow pair with no extension exemption; an extension now meets that same rule, so the docs do not move.维护者速读
objectExtensions/object_extension)新增的 record 币种金额字段,现在按"对象实际对外服务的样子"(基础层 + 已启用扩展 + 本次正文)判定其跟随的父对象币种字段;运行结束、批量写入、单条保存三处同一规则。object_extension单条保存现在同时经过 D6 汇总门(两个方向),此前存下后只告警的币种汇总改为 422。packages/objectql/src/registry.ts的recordCurrencyFollowRefusalOf/servedFoldWithLayer(折叠与"之前"对比);packages/objectql/src/record-currency-aggregate-door.ts的recordCurrencyFollowRefusal(差分判定);packages/metadata-protocol/src/protocol-save.ts新增的object_extension单条保存提问。pnpm --filter @objectstack/objectql exec vitest run --project local src/manifest-service-artifact-refusal-restores.test.ts src/protocol-batch-object-registration.test.ts,预期全绿,其中[#33593]两个 describe 覆盖 R1–R7。Metadata-protocol: narrowed)一次;R7 范围已由席位 5 裁定为 A(只管 install/upgrade/reload 这类 run)。What changes
The record-currency follow door (ADR-0144 D2 and D6, amended) asked an
extendlayer withpartial: true, judged only its own roll-ups, and returned before the following-amount half and the other-ends half. An extension-only package could therefore add a record-mode amount following a parent field with no ISO 4217 code, a missing field, or a field reached through its own new master_detail, and it was admitted and served; a later no-change upgrade of the parent's owner was then refused 422 over the extension's field.Implementing the seat ruling (A, amended), R1–R7:
SchemaRegistry.recordCurrencyFollowRefusalOfnow builds the object asresolveObjectwould serve it with the incoming layer in its slot (servedFoldWithLayer: one owner, one overlay, one extension per package; a disabled package's extension withheld, as the served fold withholds it) and hands that fold to the door. The door'spartialandextensionFieldsOfare gone: the fold already holds every enabled extension's fields, so the own-body loop and the other-ends loop both read them.'PARENT' does not hold the code a registered amount follows: 'CHILD.FIELD', which package 'PKG' adds to 'CHILD'.followed by the door's own words. New view memberextensionPackageOf.beforereading (the object served with what the layer's slot held before) and refuses only a refusal that reading does not already hold. At run endbeforeis the contributor the run replaced (RunRegisteredObject.replaced, captured inregisterObject, the earliest kept when a run writes one slot twice); on single save and in the batch writer it is the slot left empty, so a pair the layer itself completes is still refused. The two readings are compared by PAIR, not by sentence: the key is the kind, the declaring object and field, and the target (for a following amount the object its master_detail reaches plus the pointer; for a roll-up the child object and field), so an upgrade that re-points the master_detail onto another parent lacking the code makes a new pair and is refused: for the child's owner as onmain; for an extension package re-pointing its own master_detail this moves FROM installed (mainnever asked an extension layer's following half) TO refused 422.object_extensionitem never asked the follow door (measured on this branch before the hunk: the published save answered 200 and served the bad amount).protocol-save.tsnow asksobjectRegistrationRefusal(..., 'extend', { againstRegistry: true })for a publishedobject_extensionsave on an against-registry face (saveRegistryQuestion), the same faces that ask it of anobjectbody.registered record-currency-follow-extension-judged-as-served, a new semantic ledger entry.Clause-② table (each moved answer FROM → TO)
Orders: A = owner and parent installed first, extension after; B = extension first (no verdict while nothing owns the object), owner after.
recordroll-up a cold boot admittedmainnever asked an extension layer's following half) → refused 422 (the pair key names the followed object)object_extensionadding asum/avg/min/maxroll-up of a child amount declaredcurrencyMode: 'record'(in each row's own currency, or following a parent's code but not read on that parent through the master_detail it follows), or adding such an amount that a registered parent's roll-up reads (D6's roll-up door, both directions)FROM readings: run end measured on
mainby the area's earlier report (M1–M3 admitted, C2 refused) and by the two pins this PR flips; single save measured on this branch before theprotocol-save.tshunk; batch writer FROM read frommain's door (partialreturns before the following half), not separately measured.CONTROLs (unchanged, pinned): the same amount in an own object body is refused 422; a package that owns the parent and extends the child in one install is refused 422; an extension following the parent's code installs and is served.
Tests
New top-level describes:
manifest-service-artifact-refusal-restores.test.ts—[#33593] an extension's record-mode amount is judged against its object as served, at the end of the run: the three bad shapes (refused 422 + nothing left), CONTROL good extension, CONTROL own body, CONTROL parent + extension together, R3 both orders, R4, R5 missing / disabled / same artifact, R6 removal and de-code (sentence names the package and field), R6 an extension upgrade re-pointing its own master_detail onto another bad parent (refused), R7 no-change upgrades of both owners.protocol-batch-object-registration.test.ts—[#33593] an extension's record-mode amount on a single save and in the batch writer: publishedobject_extensionsave onmeta-enveloperefused 422 and nothing stored (plus CONTROL), the owner's single-save question in order B, and the batch writer's registered-row question asked of both ends (plus CONTROL).Moved pins (Clause-② evidence, both renamed with the ruling id):
a package that holds only the parent ... upgrade that changes nothinganda package that holds only the child installs an unchanged child under a record roll-upnow install (R7); a new CONTROL pins that the child's upgrade that CHANGES the pair under that roll-up is still refused, and another that a child upgrade re-pointing its master_detail onto another bad parent (same pointer string) is still refused. The extension package's own re-point (manifest-service-artifact-refusal-restores.test.ts:982, not a CONTROL) is a moved answer: installed onmain, refused 422 here.Acceptance notes
Review Implement ObjectStack protocol specification with Zod schemas and TypeScript interfaces #3 delta-2 (comment 6889470504) fixes, at
31e745afc, text only: M1: the changeset's re-point sentence now scopes "as before" to the child's owner and says the same re-point upgrade of an extension package moves FROM installed (mainnever asked an extension layer's following half) TO refused 422; this table splits that row in two and the R7 bullet says the same. The TO is held by the existing pinmanifest-service-artifact-refusal-restores.test.ts:982. N1: the changeset's R7 parenthetical now gives the key for a following amount and for a roll-up (the declaring object and field, and the child object and field it reads). No code changed;check:adr-0087-registration,check:spec-changes,check:upgrade-guide,check:empty-changeset,check:changeset-fixed,check:nul-bytes: exit 0.Review Implement ObjectStack protocol specification with Zod schemas and TypeScript interfaces #3 delta (comment 6888891782) fixes, at
c29899531: M1 (text): the changeset's D6 line, this table's last row and the entry'ssurfacenow say the child amount is declaredcurrencyMode: 'record'(in each row's own currency, or following a parent's code but not read on that parent through the master_detail it follows), and name D6's second direction (a registered parent's roll-up over an amount the extension adds); theregistry-question.tsheader says the same. M2 (code + pin): thefollowpair key now carries the object the pointer's master_detail reaches (record-currency-aggregate-door.ts:596,:615); pinned atmanifest-service-artifact-refusal-restores.test.ts:601(child upgrade re-pointinginvoicefromsuite_invoicetosuite_other, refused 422, Billing stays at 1.0.0) and:982(the extension's owninv2re-pointed, refused 422). Ablation of the own-loop key back to the bare pointer turns exactly those two pins red, restored to HEAD. S1: the BREAKING paragraph names the roll-up author, and the fix sentence and the entry'sreplacementcarry D6's remedies. Nits: N1 (below), N2 ("the first four lines") and N3 (single save 200, batch writer "saved" in its own result) fixed; round-1 nits N1-N3 left.Review Implement ObjectStack protocol specification with Zod schemas and TypeScript interfaces #3 (comment 6888559585) fixes, at
f1f49b351: M1 declared (option a): theprotocol-save.tshunk asks D6's roll-up door as well as the follow door, as the batch writer's extension row already did; the changeset, this table, the entry'ssurfaceand theregistry-question.tssentence now say so, and a pin holds it (422, nothing stored). M2: R7 compares the refused pair (kind, object, field, pointer or roll-up target), not the sentence, which lists the parent's code fields; pinned: a parent upgrade that only addsccinstalls. M3: pinned: the extension package's own no-change upgrade installs (ablation of the extend arm'sreplacedcapture turns exactly that pin red, restored to HEAD). M4: the changeset scopes R7 to runs and adds the unchanged-extension re-publish line for single save and the batch writer.Verification at
f1f49b351:pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql testunderos-verify-lock: Test Files 595 passed (595), Tests 13099 passed (13099), VERDICT command-exit 0. The two touched test files: 65/65.check:adr-0087-registration,check:spec-changes,check:upgrade-guide,check:nul-bytes,check:doc-authoringand eslint over the 7 touched source files: exit 0.Main merge:
origin/main(with E1's fix(objectql,metadata-protocol)!: a stored row bound to a package lives in that package's own registry slot, so each address serves its own row in every order (ADR-0150 D3/D4) #33513) merged atfb22e7bd1, clean, no conflict inregistry.ts; the PR's hunks were byte-identical before and after (review Implement ObjectStack protocol specification with Zod schemas and TypeScript interfaces #3 checked the same).Follow-up: objectql: uninstallPackage, disablePackage and enablePackage never ask the record-currency follow door, so a disabled supplier extension or a re-enabled bad extension can leave a following amount served without judgment #33628 (R5 / enable): whether uninstalling or disabling a supplier extension, and enabling a package, ask the follow door is NOT pinned here. By reading:
disablePackage/enablePackage/uninstallPackageare not registration runs (restoringOnRefusalis not entered), so none asks the door; a disable that withholds a supplier's code field leaves a following amount served against a parent that no longer holds the code.Batch writer face is pinned at the registry question the writer asks of a registered row (
objectRegistrationRefusal(..., { againstRegistry: true }), asbatch-object-registration.tsasks it), not by driving a protocol batch face end to end with anobject_extensionrow.Decided (seat 5): A. R7 covers runs (install, upgrade, reload). Single save and the batch writer are unchanged: they judge against the slot left empty,
main's answer, so a single save that re-saves an own body unchanged over a pair a cold boot admitted is still refused.Environment-overlay reading (
followRefusalAsServed): an extension layer's own fold uses the served base (the overlay when there is one); only the OTHER objects are re-read through their package definitions.Older ledger entry:
18.record-currency-follow-pair-refused-on-install-and-reload.tsis not edited (a registered entry). The new entry18.record-currency-follow-extension-judged-as-served.tsnames it and says that, for runs, it supersedes that entry's sentence "although nothing in that package is wrong": such a run is now refused only when it changes the pair.packages/metadata-protocol/src/registry-question.ts(E1's file, edited here with E1's OK): one header sentence, comment-only: "Anobject_extensionitem published on the same faces asks both record-currency doors too — D6's roll-up half (the roll-ups it adds, and a registered parent's roll-up over an amount it adds), and the follow door of the extension judged as its object will be served."Verification
Review #3 delta fixes at `c29899531` — objectql full suite + typecheck green, ablation 2 red, gates 0
pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql testunderos-verify-lock, afterpnpm --filter '@objectstack/objectql^...' build:The two touched test files: 67/67.
packages/specmigrations tests (migrations,semantic-relevance,spec-changes-surface-scope): 187/187.Ablation:
node scripts/ablation-replace.mjs --file packages/objectql/src/record-currency-aggregate-door.tsreplacing the own-loop key's target with the bare pointer, then the two test files:Gates:
pnpm check:adr-0087-registrationexit 0;pnpm --filter @objectstack/spec check:spec-changesexit 0;check:upgrade-guideexit 0;check:nul-bytesexit 0;eslint --no-inline-configover the four touched source/test files exit 0. Dogfood battery and dependents: not run in this round (ordered after the delta review).Readings below the first two blocks were taken at
bb54e3a54(merge basec32bb6ccb). The branch then mergedorigin/mainatfb22e7bd1(E1's #33513 had landed): the merge was clean, with no conflict inregistry.ts. Afterpnpm install --frozen-lockfileand a rebuild of objectql's dependency closure, objectqltsc --noEmitpassed, the two touched test files ran 62/62, and the full objectql suite was cut off by a container restart (NOT MEASURED atfb22e7bd1).objectql: full suite + typecheck — green
pnpm --filter @objectstack/objectql test && pnpm --filter @objectstack/objectql typecheck(underos-verify-lock, at56474fc2f; the source has not changed since except the JSDoc commit)metadata-protocol: full suite + typecheck — green
pnpm --filter @objectstack/metadata-protocol test && pnpm --filter @objectstack/metadata-protocol typecheckAblation (one, the behaviour the new pins hold) — 8 red, restored
node scripts/ablation-replace.mjs --file packages/objectql/src/registry.ts --anchor "if (served === undefined) return undefined;" --replacement "if (served === undefined || ownership === 'extend') return undefined;"(anextendlayer judged by nothing, the shapemainhad for the following half), then the two test files. objectql's tests import the registry fromsrcby relative path, so no build sits between the mutation and the run.Direction as expected: the R3 cases (owner after the extension) stay green under this mutation, because the owner's own layer folds the extension in.
Lint and gates
npx eslint --no-inline-configover the six changed files: exit 0.pnpm check:adr-0087-registration: exit 0,registered record-currency-follow-extension-judged-as-served (new here).node scripts/pm/dispatch-gates.mjs --commands, 95 commands for 7 paths vsc32bb6ccb): run locally as of this body, all exit 0 except the ones below; the rest are left to CI'sLint & Repo Gates/TypeScript Type Check.pnpm --filter @objectstack/spec build:check:api-surface(unchanged ✓),check:exported-any,check:browser-reachable-entries,check:dual-source-exports,check:entry-nameability: exit 0.check:dual-build-cjs-loads,check:lean-entry-closure: exit 3 (PREREQUISITE NOT MET: no whole-repo build here, nothing measured), NOT MEASURED locally; CI runs them.--ran: 95 derived, 93 run, 2 UNRUN (these two).registry-question.tssentence and the new entry's supersede sentence): the derivation over 8 paths gives the same 95 commands.check:adr-0087-registration,check:spec-changes,check:upgrade-guide,check:liveness,check:nul-bytes,check:doc-authoring,check:issue-citations,check:cross-package-test-inputsand eslint over both files: exit 0.test:repo(vitestrepoproject, incl.packages/runtime/src/metadata-registry-question-producers.test.ts): NOT MEASURED locally, declared to CI'sTest Core. The newsaveRegistryQuestioncall inprotocol-save.tsadds nosaveMetaItem/promoteDraftForPublishproducer.!): NOT MEASURED locally, declared to the queue'sDogfood Regression Gate.Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
🤖 Generated with Claude Code