Repository navigation
fix(objectql, spec)!: a single-object save refuses a dynamic roll-up over a child field that is not a stored home amount, in defineStack's words - #33855
Conversation
…as defineStack's case (d) does Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nU2dZbC2HWMg47r4D
…e metadata API and defineStack Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nU2dZbC2HWMg47r4D
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nU2dZbC2HWMg47r4D
… names; regenerate spec artefacts Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nU2dZbC2HWMg47r4D
📓 Docs Drift CheckThis PR changes 2 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 174 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 c4977597e883eb2793c85d7073fdaa623b3c9dd0 && git checkout c4977597e883eb2793c85d7073fdaa623b3c9dd0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b005638268828ffdef8819f04b141a13296e7de4 c6d372dcbee640d17b49375e50ea8951ea54c678 && git checkout -B drift-repro b005638268828ffdef8819f04b141a13296e7de4 && git merge --no-ff c6d372dcbee640d17b49375e50ea8951ea54c678
node scripts/docs-audit/affected-docs.mjs --json b005638268828ffdef8819f04b141a13296e7de4
|
|
domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (maintainer routing 「review#1 正在入座,你这个账户后续的契约复审找他」, 2026-11-15T12:25Z) · head c6d372d |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head c6d372d · 2026-11-15T12:27:54Z |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract reviewServed-tier: First contract review of PR #33855 for card #33713, on the schema face and the declared narrowing. Read: the diff per file against merge base ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Finding S1 of the #33710 review (record ID: 6890873219) is answered by this diff as the card asked, with N1, N6 and N7 folded in. No must-fix, no should-fix. Nits (accepted deviations, prose only, no effect on correctness or the contract):
Implemented-by: VERDICT: PASS |
|
domain:spec#4 · os-project-manager · session_01FEkQ5mecqk8M5q9vjKj6aS ACCEPT · PR #33855 (#33713) · head
|
Requested by Leehom · project thread
domain:spec#4 · os-project-manager · session_01FEkQ5nU2dZbC2HWMg47r4D
Fixes #33713
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none —
skills/**teaches nodynamicroll-up yet (its home roll-up paragraph is owed by follow-up #33714), so no page states which door refuses the wrong one.维护者速读
defineStack一样,拒绝"声明currencyMode: 'dynamic'、却汇总的不是子对象本位币金额字段"的汇总字段,返回 422INVALID_METADATA,提示原文与defineStack完全一致(同一份拼写)。扩展(object_extension)加进来的汇总或子字段,按服务器实际提供的对象来判;子对象上的homeAmount只有在其声明本身合法时才算数,扩展无法把普通数字字段"冒充"成本位币字段。defineStack判子字段;单对象保存那道门只判record汇总,于是汇总固定 EUR 金额、普通数字或公式的 dynamic 汇总能被存下,页面用本位币符号显示其合计,币种是错的。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,[#33713]一组 5 项全过(三种错误字段 422、本位币汇总照常保存、扩展加汇总同样 422)。What changes
S1, the engine door.
recordCurrencyFollowRefusal(packages/objectql/src/record-currency-aggregate-door.ts) gains case (d) beside itsrecordcase (c). Asummarywithfunctionsum/min/max/avgthat declarescurrencyMode: 'dynamic', or acurrencyConfignaming 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 isRecordCurrencyFollowRefusedError, the code and status therecordrefusal 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 refusedrecorddeclaration to a refuseddynamicone is the run's own change (R7).One spelling of (d). The sentence moves from
stack.zod.tsintopackages/spec/src/data/record-currency-path.ts, which already shares (a) and (c), asrecordCurrencyDynamicRollupNotHomeError.defineStackand 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 inapi-surface/data.jsonandexport-origins/data.json.N7.
storedHomeAmountSourceOf(same file) replaceshomeAmountSourceOf, at both doors. AhomeAmountmakes itsfielda stored home amount only where it is valid as declared, which is the object door's reading inrefuseDishonestHomeAmount. It must sit on arecord-modecurrencyamount and name another field of the same map. That field must be acurrencyfield indynamicmode (an absent mode isdynamic),readonly: true, with noexpression, and claimed by that one amount. An authored object already guarantees this, sodefineStackanswers 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, afixedamount, 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.tsis untouched. Since #33621 the follow door is asked with the object as served (servedFoldWithLayer). That covers anextendlayer in its slot, and alookupthat 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.defineStackstill 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 "bydefineStackand 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.mdxhad two sentences from #33710 saying a single-object save "does not judge the child field yet (#33713)". This fix makes both false, so both now state the 422 at the metadata API, as therecordbullet beside them does.Liveness.
field/currencyConfiggains a datedNARROWED 2026-11-15 (#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 carriesadr-0087: registeredwith it. It is owed for the measurement below. The gate would also refusenot-required (no-migration-prescription)on anyMetadata-protocol: narrowedchangeset.Tests
packages/objectql/src/protocol-batch-object-registration.test.ts, new describe[#33713](real kernel, real registry,saveMetaItempublished on themeta-envelopeface):dynamicroll-up over afixedEUR amount, a plain number and a formula is refused 422INVALID_METADATA(RecordCurrencyFollowRefusedError). The message opens with the case (d) sentence, and nothing is stored or registered.dynamicroll-up ofamount_home, saves and is served.countroll-up and a roll-up declaring no currency save as before.recordroll-up over the fixed amount answers as before, 422 with (c)'s sentence.object_extensionitem 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:defineStack's finding for the same pair, so the wording is pinned at both doors.{}config andmin/max/avgare refused the same way.RecordCurrencySummaryRefusedError), pinned and not re-judged.fixedroll-ups are not judged.registerAppwhoseobjectExtensionsadd the roll-up is refused at the end of its run and leaves nothing of the package.homeAmountover a plain number does not admit the roll-up, and its message equalsdefineStack'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:defineStack: anobjectExtensionsentry forginghomeAmountover a writable amount, anumberfield, afixedamount, a computed field, or a doubly claimed home field is refused. A valid extension home amount is admitted.storedHomeAmountSourceOfover the parsed probe child answersamountforamount_homeand nothing for every other field.defineStack's finding equalsrecordCurrencyDynamicRollupNotHomeError(...)for four child fields.scripts/ablation-replace.mjs, restored to the HEAD blob each time,git diff HEADempty):declaresDynamicCurrencyforced false inrecord-currency-aggregate-door.ts. 9 tests red (2 metadata-API, 7 registry). All controls stayed green.storedHomeAmountSourceOfput back to the old any-homeAmountreading. Spec was rebuilt andablation-dist-preflightfound the marker in 2 dist files. 3 spec tests and 2 objectql tests went red. After the restore, spec was rebuilt and the preflight--absentread clean.Acceptance notes
@objectstack/spec, 18.4.0 (published 2026-11-13T12:30Z), does not carry feat(spec, fields): a roll-up of a stored home amount declares currencyMode dynamic and is drawn in the home currency #33710: none of its tarball's files hold the object door's new wording. Thenextsnapshot0.0.0-next-20261115100430(dist-tagnext, published 2026-11-15T10:32Z,gitHeadbd96ec9) 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 everydynamicsummary).before: null), as it already does for (a) and (c). So once a baddynamicroll-up is stored past this door (stored before this release and hydrated at boot), re-saving the child unchanged through/metais refused over it. A registration run compares the pair and does not refuse it. The test pins the run's half.rateDate/rateField. They say nothing about which currency the home field holds. The object door still judges them on an authored object.master_detail, D6 admits the roll-up and (d) refuses it indefineStack'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 therecordroll-up. It is outside the surface (registry.tswas granted for an N6 call site only, and none was needed). Noted, not edited.Verification
All readings on head
c6d372dc(baseb76df9a6;origin/mainis 19 commits ahead, none touching this diff's files).Package suites, typecheck, dogfood
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.(narrowing)arm),pnpm --filter @objectstack/dogfood testunder the lock after the closure build:VERDICT command-exit 0, Test Files 467 passed, 3 skipped (470), Tests 3958 passed, 42 skipped (4000).Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 121 commands. Each was run with its exit code captured before any pipe.check:dual-build-cjs-loadsandcheck:published-readme-exportsanswered exit 3 (PREREQUISITE NOT MET: six packages outside this diff had nodist/). 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 aftergen:api-surface,gen:export-origins,gen:schemaandgen:docs.pm-orders/spec/33713-gates-ran.txt. CI runs every other family.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses (CI).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code