Repository navigation
fix(spec): ObjectSchema.fields refuses constructor / prototype at the offending key, not at the fields slot - #21070
Conversation
…ffending key One single-name bannedKeys refine per reserved name, each carrying its name as a static path, so the refusal reads fields.constructor / fields.prototype instead of fields. The banned-keys projection still publishes the ban (one propertyNames clause per name); message and custom code are unchanged. Claude-Session: https://claude.ai/code/session_01Sfe5YjBLwB9J3y8fvm2xq1 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: What this run could not see
Coarse fallback — 137 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 5546ca5347367a769bcf6b1df950935c0b80e984 && git checkout 5546ca5347367a769bcf6b1df950935c0b80e984
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4f83db5a73cf636cff2bbc3bc1a379a88feb09d2 0ba0c93c56ce2c40e8dcc08a8898487c052b684b && git checkout -B drift-repro 4f83db5a73cf636cff2bbc3bc1a379a88feb09d2 && git merge --no-ff 0ba0c93c56ce2c40e8dcc08a8898487c052b684b
node scripts/docs-audit/affected-docs.mjs --json 4f83db5a73cf636cff2bbc3bc1a379a88feb09d2
|
Contract reviewServed-tier: Reviewed: PR #21070 (card #20997), branch ① Derived judgmentsA. Accept set — unchanged in both directions. Right.
B. Every issue the parse now emits, with path, code and message (read off zod
C. Consumers of the old
D. The dev's claim that a E. The other F. Would the new pins go red if the per-name path were dropped — yes (read, not run). The it.each G. Every sentence the diff adds, against the tree.
② Semver level
③ Boundary flagsDev report
Dev report Dev report Seat ruling Claim Reviewer notes for the seat, neither a blocker: (i) the derived-layer sentence in ①C/①G — the changeset could name the envelope Check-runs on Implemented-by: VERDICT: PASS Adopted and posted by
Generated by Claude Code |
Closes #20997
Clause-②: no (no key is added and the accept set does not move: only the issue path of an existing refusal changes, read against
scripts/pm/clause2-line.mjs)What changes
ObjectSchema.fieldsstill refuses a field namedconstructororprototype. The issue is now reported at the key (fields.constructor,fields.prototype) instead of atfields, as__proto__and the key grammar'sinvalid_keyalready were. A document with both names gets two issues instead of one. The issue code (custom) and the message are unchanged.How
One
.refine(bannedKeys([name]), { path: [name] })per reserved name replaces the single two-name refine. A.superRefine()with a computed path was not used: it has no readable predicate, so the published JSON Schema would lose the ban (#19346). The publishedfieldsnode now carries onepropertyNamesclause per name in the sameallOf.bannedKeys(shared/refinement-projection.ts) is not edited. Its other caller,system/tracing.zod.ts(bannedKeys(['dialect']),abort: true), keeps its slot-level refusal on purpose, as its own comment says.record-proto-key-guard.tschanges only in its docblock.Tests
In
object.test.ts:fields.NAME, with no slot-level issue left;Bad Namecontrol;The local runs and ablations are in the
os-dev-reporton #20997.dispatch-gates.mjs --commandswas not run locally, so CI on this head is the measurement.The consumer half is objectui#11302 (the designer page that drops the issue detail). It is not addressed here.
Generated by Claude Code