Repository navigation
docs(spec): the optional-master entry and docblock name the raw-parse door's reading of an omitted required - #31523
Conversation
… door's reading of an omitted required The semantic entry cbp-optional-master-admitted and the controlledByParentMasterOf docblock described an omitted required on the only master_detail of a controlled_by_parent object as the required master, naming only ObjectSchema.create() and stored rows. Through a raw parse (ObjectSchema.safeParse, defineStack over a plain literal, a save door) the field default writes false first, so the omission is the optional master, as the maintainer ruled on the optional master. Name that door in both texts and pin the three doors side by side in one test. No behaviour change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2diS4EEKVj8TfNEQAs
📓 Docs Drift Check1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 171 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 6e84da946833cbf35fcff6cf94e0aeb5e32d5ad6 && git checkout 6e84da946833cbf35fcff6cf94e0aeb5e32d5ad6
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f4b1f9ee0865544d0a404a2ceb0b02b4d77cb69c 5e9d2802a6cb2c07c1cda4a707e4fef82afdf3bb && git checkout -B drift-repro f4b1f9ee0865544d0a404a2ceb0b02b4d77cb69c && git merge --no-ff 5e9d2802a6cb2c07c1cda4a707e4fef82afdf3bb
node scripts/docs-audit/affected-docs.mjs --json f4b1f9ee0865544d0a404a2ceb0b02b4d77cb69c |
|
domain:spec#4 · marchtian · session_017ihL2eAG5J8aqAyPZif4BJ Contract reviewServed-tier: ① Derived judgmentsThe dev's open question (do the save doors really read the omission as optional?) was MEASURED, not taken from the ruling record. Save door trace (true on head). The object save door is Sentence by sentence:
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
Requested by 田騏 · project thread
Fixes #31470
Clause-②: no
Metadata-protocol: none
维护者速读
cbp-optional-master-admitted的replacement和acceptanceCriteria、以及controlledByParentMasterOf的 docblock,补上「原始解析入口」的读法;另加一个测试把三个入口并排钉住。master_detail不写required时,ObjectSchema.create()读成必填主字段,而ObjectSchema.safeParse/defineStack/ 保存入口读成可选主字段。这个分歧是你在 controlled_by_parent admits an optional master (1/3): spec, lint and the read owner branch: a null-master detail row is readable by its owner only #30905 裁定的(ruling record 6687830530,选 A「放行为可选主字段」),但条目和 docblock 只写了create()和存储行,读者会以为省略永远等于必填。座位据此对本卡选 B(只改文字),不是 A(A 会推翻现行裁决)。@objectstack/spec的./migrations发布(os migrate会读),所以带 patch changeset。回滚即还原这三个文件和 changeset。packages/spec/src/migrations/entries/semantic/18.cbp-optional-master-admitted.ts里replacement末句和acceptanceCriteria末句。pnpm --filter @objectstack/spec exec vitest run --project local src/data/controlled-by-parent-master.test.ts,看新测试「the three doors on an omitted required」:create()给必填主字段,safeParse与defineStack给可选主字段。What changes
Card #31470 asked to pick A (refuse an omitted
requiredat the raw parse and indefineStack) or B (keep the reading and say so). The seat picked B: maintainer ruling A on #30905 (ruling record 6687830530) already decided that at the raw parse doors (an object written directly indefineStack, the save doors) an omittedrequiredon acontrolled_by_parentobject's onlymaster_detailis read as the optional master, and it explicitly did not take "refuse the omission at every door". Option A on this card would reverse that ruling. What was wrong is the prose, which named only the doors that see the omission.18.cbp-optional-master-admitted.ts(semantic migration entry).replacement: after "an omittedrequiredkeeps meaning required throughObjectSchema.create()and on stored rows", it now says that through a raw parse (an object written directly indefineStack, or saved through a save door)requireddefaults tofalsebefore the object is judged, so the omission is read as the optional master, as the maintainer ruled rather than refusing it at every door.os lintstill reports the omission aterror.acceptanceCriteria: the last sentence gains the same clause: throughObjectSchema.safeParse,defineStackor a save door, the omission is admitted as the optional master, its field parsed asrequired: false.id,surfaceandreasonare unchanged.controlledByParentMasterOf(JSDoc). "One whoserequiredis not written names no master" holds only on a map read as written (an authored or stored body no parse has touched). On a parsed map the omission has already defaulted tofalse, so through a raw parse that field is the optional master; the builder forces it totruefirst. "Readsrequiredas written" is kept.Tests
One new
itinpackages/spec/src/data/controlled-by-parent-master.test.ts, citing the ruling record, pins the three doors on one omittedrequired:ObjectSchema.create():required: true,controlledByParentMasterOfgives{ field: 'order', optional: false };ObjectSchema.safeParse: success,required: false,{ field: 'order', optional: true };defineStack:required: false,{ field: 'order', optional: true }.Measured first: no existing test pinned all three in one place.
controlled-by-parent-master.test.ts(the omitted-required case) pinscreate()andsafeParse;defineStackis pinned separately inconversions/cbp-master-detail-required-defaulted.test.tsanddata/object.test.ts.Acceptance notes
skip-changeset: the entry ships.@objectstack/specexports./migrationsfromdist, andos migrateprints the entry'sreplacement. Patch changeset.changeset/31470-cbp-omitted-required-raw-parse-door.md.conversions/entries/18/cbp-master-detail-required-defaulted.ts) was already fixed onmainby docs(spec): say what the optional master did to the cbp-master-detail-required-defaulted notes #31055 (f1206610a9): it says a raw parse reads the omitted key as the optional master. Nothing owed here.requiredkeeps meaning required where the omission is visible" bullet); not touched.Verification
Before the merge of
origin/main(head425cef8315):node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 85 commands for this 4-file diff; all 85 ran and exit 0.NODE_OPTIONS=--max-old-space-size=6144 pnpm --filter @objectstack/spec run typecheck:: exit 0 (the default heap OOMs incheck:test-typecheck).pnpm --filter @objectstack/spec exec eslinton the three touched source/test files :: exit 0.vitest run --project localoncontrolled-by-parent-master.test.ts,cbp-master-detail-required-defaulted.test.tsandsrc/migrations:: 7 files, 252 tests passed.After
git merge origin/main(merge commit5e9d2802a6, the PR head):gen:schema && gen:docs:: exit 0, no tree change.pnpm --filter @objectstack/spec run check:generated:: exit 0 (14 artifacts current, after a spec rebuild; the first run read a pre-mergedist).dispatch-gates --commandsderived the same 85 commands; after apackages/*build all 85 ran and exit 0.dispatch-gates --ran:85 derived famil(ies) accounted for — 85 run, 0 NOT-MEASURED, exit 0.🤖 Generated with Claude Code
https://claude.ai/code/session_017ihL2diS4EEKVj8TfNEQAs