Unconfirmed observation from the QA run — recorded for triage; the injection site was located but the fix (strip _draft before computing _diagnostics, or whitelist the read-decoration keys in the diagnostics validation) is the natural next step to confirm.
Symptom
Reading a metadata item with ?preview=draft returns a response whose own diagnostics call the item invalid because of a key the read itself injected.
- Observed: the response carries
_diagnostics.valid:false with "Unrecognized key(s) … _draft". - Expected:
_diagnostics.valid:true for an otherwise-valid draft — the preview marker must not be validated against the item's strict schema.
Root cause (as located, unconfirmed)
The draft-preview read injects _draft:true onto the item and then validates the item with that key still present. In packages/metadata-protocol/src/protocol.ts the single-item draft read stamps (draftItem as any)._draft = true (around protocol.ts:4441, and the list overlay at :4261) and then decorates/validates it; the item schema is strict, so _draft is rejected by name. stripReadDecorations exists to remove exactly these stamped keys before a strict re-parse, but it is not applied on the path that computes _diagnostics for the draft read. Mechanism still present on origin/main.
Related but distinct: #6810 (closed) was the same class of defect for the indexed key at a different injection site — see the module header in packages/metadata-core/src/injected-system-columns.ts. This one is the _draft preview marker.
Reproduction
- Create a draft of a valid metadata item (e.g. an object).
GET /api/v1/meta/<type>/<name>?preview=draft.- Inspect
_diagnostics in the response → valid:false, "Unrecognized key(s) … _draft".
Source
Extracted from the QA run #7627 (framework 92f26f7, console 6314e87f).
Unconfirmed observation from the QA run — recorded for triage; the injection site was located but the fix (strip
_draftbefore computing_diagnostics, or whitelist the read-decoration keys in the diagnostics validation) is the natural next step to confirm.Symptom
Reading a metadata item with
?preview=draftreturns a response whose own diagnostics call the item invalid because of a key the read itself injected._diagnostics.valid:falsewith "Unrecognized key(s) …_draft"._diagnostics.valid:truefor an otherwise-valid draft — the preview marker must not be validated against the item's strict schema.Root cause (as located, unconfirmed)
The draft-preview read injects
_draft:trueonto the item and then validates the item with that key still present. Inpackages/metadata-protocol/src/protocol.tsthe single-item draft read stamps(draftItem as any)._draft = true(aroundprotocol.ts:4441, and the list overlay at:4261) and then decorates/validates it; the item schema is strict, so_draftis rejected by name.stripReadDecorationsexists to remove exactly these stamped keys before a strict re-parse, but it is not applied on the path that computes_diagnosticsfor the draft read. Mechanism still present onorigin/main.Related but distinct: #6810 (closed) was the same class of defect for the
indexedkey at a different injection site — see the module header inpackages/metadata-core/src/injected-system-columns.ts. This one is the_draftpreview marker.Reproduction
GET /api/v1/meta/<type>/<name>?preview=draft._diagnosticsin the response →valid:false, "Unrecognized key(s) …_draft".Source
Extracted from the QA run #7627 (framework 92f26f7, console 6314e87f).