Skip to content

Commit 3fd3b16

Browse files
committed
docs(spec): say what the optional master did to the cbp-master-detail-required-defaulted notes
The protocol-18 conversion and the builder-force docblock still said an explicit `required: false` master is refused by the builder and the parse, and that a live author meets the parse's refusal. After #30940 (ruling A of #30905) the only `master_detail` declared `required: false` is the optional master, kept by the builder and admitted by the parse, and a raw parse reads an omitted `required` as that optional master. Comments only; the conversion's apply and fixture shapes are unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzpwEPquNhPcgrrjew
1 parent 81deb54 commit 3fd3b16

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎packages/spec/src/conversions/entries/18/cbp-master-detail-required-defaulted.ts‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import { type Dict, isDict } from '../shared.js';
2323
* Ruling B made the parse refuse a `controlled_by_parent` object without
2424
* exactly one `master_detail` declared `required: true`, and retired the
2525
* security runtime's second tier, which derived the master from ANY
26-
* `master_detail`. One shape inside that refusal has a producer at rest:
27-
* objectui's Studio adds a field as `{ type, label }` and its Required toggle
26+
* `master_detail`. (Ruling A of #30905 later amended ADR-0055 §1 to admit an
27+
* only `master_detail` declared `required: false` as an optional master; the
28+
* omitted key this entry converts is unchanged by it.) One shape inside that
29+
* refusal has a producer at rest: objectui's Studio adds a field as
30+
* `{ type, label }` and its Required toggle
2831
* writes `required: true` or nothing, and the object's Settings tab offers
2932
* `controlled_by_parent`. So a Studio-authored detail can be stored with its
3033
* one master reference carrying no `required` key at all. Before protocol 18
@@ -53,9 +56,11 @@ import { type Dict, isDict } from '../shared.js';
5356
* authored object.
5457
*
5558
* **Deliberately narrow — exactly one shape, nothing else.**
56-
* - An explicit `required: false` is NOT converted. The builder refuses it
57-
* loudly rather than forcing it (an authored contradiction, ADR-0032), so the
58-
* stored pass does not overrule an author the builder would have stopped.
59+
* - An explicit `required: false` is NOT converted. On the object's only
60+
* `master_detail` it is the OPTIONAL master (ADR-0055 §1 as amended, #30905
61+
* ruling A): the builder keeps it as written and the parse admits it, so the
62+
* stored pass keeps it too. Beside another `master_detail` there is no one
63+
* master to default (below), and the builder refuses it there.
5964
* - An object with two or more `master_detail` fields is NOT converted. Choosing
6065
* which reference becomes the master is exactly the pick ADR-0055 §1 refuses.
6166
* - A required `lookup` (the retired third tier) is NOT converted. Turning it
@@ -64,9 +69,12 @@ import { type Dict, isDict } from '../shared.js';
6469
* rule only.
6570
*
6671
* **Retired from the load path, from day one.** The authoring funnel does not
67-
* replay it, so a live author still meets the parse's refusal and its
68-
* prescription. A stored row, a built artifact inside its declared-floor window
69-
* and `os migrate meta --from 17` all replay it. Idempotent by construction: a
72+
* replay it: a live author meets the builder's own force through
73+
* `ObjectSchema.create()` and `os lint`'s `relationship/master-detail-required`
74+
* at `error`. A raw parse cannot see the omission (the field default writes
75+
* `false` first), so there the omitted key reads as the optional master. A
76+
* stored row, a built artifact inside its declared-floor window and
77+
* `os migrate meta --from 17` all replay it. Idempotent by construction: a
7078
* converted field carries `required`, which this transform never touches again.
7179
*/
7280
const cbpMasterDetailRequiredDefaulted: MetadataConversion = {
@@ -107,7 +115,7 @@ const cbpMasterDetailRequiredDefaulted: MetadataConversion = {
107115
},
108116
},
109117
{
110-
// An explicit `required: false` — refused by the builder, not converted here.
118+
// An explicit `required: false` — the optional master, kept as written; not converted.
111119
name: 'cbpd_explicit',
112120
label: 'Explicit',
113121
sharingModel: 'controlled_by_parent',

‎packages/spec/src/data/object.zod.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4492,12 +4492,13 @@ function assertReferenceViaSiblingDeclared(objectName: unknown, fields: unknown)
44924492
* {@link assertSystemDataIsWritable}, and deliberately NOT in raw
44934493
* `.parse()`/`.safeParse()`: a parse must not rewrite what it reads. The force
44944494
* is the builder's convenience, not the rule: the RULE — exactly one required
4495-
* `master_detail` under this sharing model — is judged on the parse itself by
4496-
* {@link refuseControlledByParentWithoutOneMaster} (#23100, maintainer ruling
4497-
* B), so a raw parse of a `master_detail` without `required: true` is refused
4498-
* rather than forced, and the security gate's fallbacks this paragraph used to
4499-
* call "runtime tolerance" (any `master_detail`, then a required `lookup`) are
4500-
* retired.
4495+
* `master_detail` under this sharing model, or (ADR-0055 §1 as amended,
4496+
* #30905 ruling A) its only `master_detail` as the optional master — is judged
4497+
* on the parse itself by {@link refuseControlledByParentWithoutOneMaster}
4498+
* (#23100, maintainer ruling B), so a raw parse is never forced (it reads an
4499+
* omitted `required` after its `false` default), and the security gate's
4500+
* fallbacks this paragraph used to call "runtime tolerance" (any
4501+
* `master_detail`, then a required `lookup`) are retired.
45014502
*
45024503
* Alias spellings (`isRequired` / `mandatory` / `notNull`) need no handling
45034504
* here: `FieldSchema` is a `strictObject`, so those keys are refused at parse

0 commit comments

Comments
 (0)