Repository navigation
fix(spec)!: a query where of the wrong kind answers one fields[] entry that names the shapes it takes - #37205
Conversation
…thing, so a wrong-typed where answers one entry Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
…k and the cross-package parity corpus Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
…ere-refusal-one-cause
…ere-refusal-one-cause
…ere-refusal-one-cause
📓 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:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 176 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 e1428038e0f0823ff4b65c36a2a712b96cabbebc && git checkout e1428038e0f0823ff4b65c36a2a712b96cabbebc
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bc3ec37a669f1b80c393e31393caea49fb4f7b09 ecc795b19056a140f2a97f837d3621aaa7044546 && git checkout -B drift-repro bc3ec37a669f1b80c393e31393caea49fb4f7b09 && git merge --no-ff ecc795b19056a140f2a97f837d3621aaa7044546
node scripts/docs-audit/affected-docs.mjs --json bc3ec37a669f1b80c393e31393caea49fb4f7b09
|
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Contract-review-claim: session_011y7As5bdhV5T4N9vpjmZzH · head 16f479c · 2026-11-25T03:42Z |
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Contract reviewServed-tier: 2026-11-25T04:05Z · isolated one-shot reviewer, not the drafter. Inputs: the diff ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implementing files: Findings:
Two nits, recorded and accepted as they stand. First, the out-ranking consequence above has no pin of its own for a sibling with two or more located causes; the control pins the one-cause tie, and rules 1 and 2 are each pinned separately. Second, Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 席位核对 — REWORK · head 16f479c2026-11-25T04:06Z · L1 (one-shot reviewer), checked against GitHub and Verdict in one line: the code is right and well pinned, and the contract review passes it. The REWORK is for the changeset only: three statements in it are false or incomplete about what a released client saw and what narrows. All three fixes are prose, so the contract record can carry to the next head. CI on this head: 58 Must-fix (all in
|
…metadata lists it narrows Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 席位核对 — ACCEPT · head ecc795bDelta from REWORK 7152541028 (head
|
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Contract reviewServed-tier: 2026-11-25 · isolated one-shot reviewer, not the drafter. This is the delta reading on the record 7152531147 (PASS at ① Derived judgments
② Semver levelUnchanged: ③ Boundary flags
④ Design judgmentNo Findings:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 维护者速读
Review request — declared narrowing (
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH
Fixes #35500
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skills/ page names the
query.whererefusal or itsInvalid inputentries, or readsfields[]/issues[]by position or count维护者速读
What changes
A query's
whereon the data API isz.union([FilterArraySchema, DataEngineFilterSchema]), and both members are unions themselves. Handed42, a string ornull, each member failed only because the value was the wrong kind, but the shared branch selection did not read a member that is a union as a kind mismatch. So it selected both members, and each emitted its own unexplained{ field: 'query.where', code: 'invalid_shape', message: 'Invalid input' }. The caller got two identical entries and no cause. Measured atmain236c8044acb, after #37083 had already dropped the explained outer head. #37083 is not released yet and ships in the same release as this, so a released client's before is the card's reading atf6902e950: three identical entries forwhere: 42, and five entries (four bare) for the malformed AST. The changeset's FROM lines are written against that.packages/spec/src/shared/union-branch-policy.ts):isKindMismatchOnlynow also counts a branch-rootinvalid_unionwith zod's bare default message whose every branch is itself kind-mismatch-only, by the same rule, so depth does not matter. A nested union that declares its ownerrorsentence stays informative. A nested union witherrors: []keeps its old reading.ZOD_UNION_DEFAULT_MESSAGEmoves into this module, because the selection now reads it; the mapper re-exports it unchanged for its pin, and it stays package-internal.@objectstack/metadata-protocol's copy (protocol-metadata-issues.ts), so the data API'sfields[], the terminal renderer and the four listszodIssuesToMetadataIssuesfeeds reach one verdict. Those four are a refused save'sissues[](422 INVALID_METADATA), a stored item's_diagnostics.errors, the seed-request refusal'sissues, and the unmanaged-import400. This is what ruling record 7010280743 requires: the two machine lists say the same thing.packages/spec/src/data/data-engine.zod.ts,TransportFilterValueSchema): a value of the wrong kind (not an object or array) gets one sentence naming both accepted shapes, a condition object such as{ "status": "open" }or a filter array such as["status", "=", "open"]. An array or an object keeps zod's default, so its located causes speak and the bare head is still dropped in their favour. It covers every spelling of the slot (where,$filter,filter,filters) for a number, a string or a boolean.nullis refused with it only onwhere; the other three spellings are.nullable()and acceptnullas no filter.@objectstack/specand@objectstack/metadata-protocolpatch,fix(spec)!, BREAKING banner, FROM / TO, one ADR-0087 marker (not-required (no-migration-prescription)).The claim's file surface was widened to the policy layer before this was built (seat decision, option A of os-dev-report 7146729179; the amendment is on the card).
Tests
All readings below are from the shared verify lock on a shared box.
New pins
packages/spec/src/api/zod-issues-to-fields.test.ts, new describe: through the realFindDataRequestSchema,42, a string,nulland a boolean each answer exactly one entry,[['query.where', 'invalid_shape']], whose message is not zod's default and names both shapes.$filteranswers the same entry atquery.$filter. The malformed AST[['status','=','open'],'and']answers exactly[query.where min_items, query.where.1 invalid_shape 'Invalid input']. CONTROL: a filter object, a filter array and a logical filter array still parse. Plus a synthetic union of bare-kind unions answering one entry.packages/spec/src/shared/union-branch-policy.parity.test.ts: a new corpus fixture (renderer and wire agree pair for pair), the recursion, a sentence-carrying nested union staying informative, anderrors: []keeping its reading.ZOD_UNION_DEFAULT_MESSAGEwas added to the package-internal roster.packages/metadata-protocol/src/union-branch-policy.cross-package-parity.test.ts: two section-2 fixtures, a synthetic nested bare-kinds union and the real query door withwhere: 42. All three walks give the same paths and messages.ZOD_UNION_DEFAULT_MESSAGEwas added to the section-1 symbol roster.packages/metadata-protocol/src/protocol.save-union-issues.test.ts: the envelope walk says the nested bare-kinds union once, a sentence-carrying member is still heard, and a CONTROL member with a located cause is still expanded.packages/rest/src/zod-union-fields.test.ts, new top-level describe, which runs the realPOST /api/v1/data/:object/queryroute over ObjectQL, SqlDriver (sqlite) and the metadata protocol. For42, a string andnull:400,code: 'VALIDATION_FAILED', exactly[['query.where', 'invalid_shape']]with the shape sentence, and the driver is never read. For the malformed AST:400 VALIDATION_FAILEDwithfieldsequal to the two entries above, and no read. CONTROL: a filter object and a filter array are served200with the right rows.The new pins assert the
field,code, status and entry count exactly. They check the sentence by the two shapes it names (condition object,filter array), not by its full wording.Package suites (head 2af665d, before the merge of origin/main)
pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2: Test Files 983 passed (983); Tests 29875 passed, 1 todo. VERDICT command-exit 0.pnpm --filter @objectstack/metadata-protocol test: Test Files 369 passed, 9 skipped (378); Tests 23394 passed, 45 skipped. VERDICT command-exit 0.pnpm --filter @objectstack/rest test: Test Files 429 passed (429); Tests 8823 passed, 351 skipped. VERDICT command-exit 0. The first attempt got exit 99 (no lock turn, NOT MEASURED) and was re-run on the same slot.typecheckfor spec, metadata-protocol and rest: VERDICT command-exit 0.Final head 16f479c (merges of origin/main up to 3b4f0b9; the branch's delta against main is exactly the 10 files above)
pnpm --filter '@objectstack/dogfood^...' build, VERDICT command-exit 0).pnpm --filter @objectstack/spec check:generated: exit 0, no artifact moved.Ablation (one time, not kept)
scripts/ablation-replace.mjsinunion-branch-policy.ts: the anchor|| isKindMismatchOnlyUnion(issue)),was replaced by a marker comment, which turns the nested rule off. Anchor 1 to 0, marker 0 to 1, blob8f72bb114a75toc2e73abc2818.zod-issues-to-fields.test.tsandunion-branch-policy.parity.test.ts: Test Files 2 failed (2); Tests 10 failed, 46 passed (56). The failures were every door case (42, string,null, boolean,$filter, malformed AST), the synthetic nested union, the new parity fixture, "both walks say the union once" and "the rule recurses". The sentence-carrying anderrors: []pins stay green under the mutation, as expected: they pin the rule's edges, not the rule.8f72bb114a75, andgit diff HEADis empty. Restored leg: 2 files, 56/56 passed.srcrelatively, so they need no rebuild. The metadata-protocol and rest pins resolve@objectstack/specthroughdist/and were not ablated.Acceptance notes
formatZodError/ the CLI take the same rule, because they share the policy. A wrong-kindwhereprints one line, not one per member.readDeclaredQueryNumber(rest-server.ts) readsfields[0]?.message. A declared number schema has no nested bare-kinds union, so it does not move.content/docs/api/error-handling-server.mdxalready says a bare union entry is "kept only when nothing does", and that stays true, so it is not edited.query.$filter: { "$and": 42 }answersfield: 'query.where.$and',code: 'required'. The value is present, and the field names the folded slot, not the one the caller sent. Reported to the seat for filing.packages/spec/src/shared/union-branch-policy.ts(isKindMismatchOnlyUnion), thenTransportFilterValueSchemaindata-engine.zod.ts, thenunion-branch-policy.cross-package-parity.test.tssection 2.pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/api/zod-issues-to-fields.test.ts. Every test should be green, including the describe "a wrong-typed query where answers one entry that names the shapes".Verification
Rework round (changeset prose only), head ecc795b
nullis scoped towhere, the four metadata lists and their readers are named in the BREAKING banner, and the out-ranking effect is stated. The contract review PASS 7152531147 at16f479c57d6read no code finding, and this round changes no code: the delta from that head is.changeset/where-wrong-kind-one-entry.mdalone. No generated reference reads a changeset, so noRegen-provenance:line is needed.node scripts/check-adr-0087-registration.mjs: exit 0.ecc795b1905:dispatch-gates --commands --repo objectstack-ai/objectstackderived 89 families;--rangave 88 run, 1 NOT-MEASURED (pnpm check:dual-build-cjs-loads, exit 3, PREREQUISITE NOT MET: this fresh worktree built only the dogfood closure; CI runs it inBuild Core), 0 UNRUN.ecc795b1905, because the seat's L1 checklist pinsdogfood_batteryto the PR head, whatever the delta.pnpm --filter @objectstack/dogfood testran as its own command under the verify lock:VERDICT command-exit 0 · held the lock 2403s, Test Files 487 passed, 3 skipped (490); Tests 4128 passed, 68 skipped (4196); 0 failed.Gate sweep: dispatch-gates --commands, 89 families, head 16f479c
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 89 families. Each was run with its exit code recorded before any pipe.--ran: 89 derived, 89 run, 0 NOT-MEASURED, 0 UNRUN, exit 0.pnpm check:error-code-casingexit 0 andnode scripts/check-adr-0087-registration.mjsexit 0 (one declared-breaking changeset, dispositionnot-required (no-migration-prescription)).test:repowas not run locally; CI owns it.Dogfood battery (narrowing arm), head 16f479c
pnpm --filter @objectstack/dogfood testas its own command under the shared verify lock: full battery, no shard, no path, run after building the dogfood closure.os-verify-lock: VERDICT command-exit 0 · held the lock 2197s. Test Files 487 passed, 3 skipped (490); Tests 4128 passed, 68 skipped (4196); 0 failed.Generated by Claude Code