Skip to content

Data API query refusal: a where of the wrong type answers three identical bare "Invalid input" entries and no cause #35500

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

Adjacent finding from the #35433 decision analysis (project file objectstack-seat5/area-ux/data-2/decision-35433.md, readings at main f6902e950, scratch probe). Filed on seat 5's word. Parent: #35433.

What the caller sees

A data-API query whose where has the wrong type (query.where: 42) is refused with three identical entries in fields[], each { field: 'query.where', code: 'invalid_shape', message: 'Invalid input' }, and nothing else. No entry names the cause (that where must be a filter object or a filter AST array). Under #35433's recommended rule (drop a bare head only when a later entry explains it) two of the three would remain, because nothing explains them. The repeat is its own defect, not #35433's.

A nearby case from the same probe: query.where: [['status','=','open'],'and'] gives five entries, four of them Invalid input.

Where

  • Producer: packages/spec/src/api/zod-issues-to-fields.ts (zodIssuesToFields, the union head push ~:214), which runs once per nested union layer of the where schema.
  • Door: the data API query route (packages/rest/src/crud-routes.ts / batch-routes.ts callers listed in the analysis).

Done when

A where of the wrong type is refused with one entry that names the accepted shapes (filter object or AST array), with no duplicate Invalid input entries. Pins cover 42, a string and a malformed AST, and a CONTROL shows a valid where is still served. Because this removes entries from a published response, it is declared Clause-②: yes (narrowing) or no (narrowing) as the diff shows, with BREAKING, an ADR-0087 marker, dogfood and a contract-tier review. Build it after #35433's ruling, since it touches the same producer.

Grade

p2 · area:data · domain:server. The query door's main caller is an AI agent writing through the data API. A refused query with no stated cause leaves the agent guessing and retrying.


Generated by Claude Code

Activity

  1. added
    priority:p2
    pm:queue
    domain:server
    on Nov 19, 2026
  2. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server · pm:queue; rationale: area:data · Bug · Impeded (a wrong-typed where is refused with three identical bare "Invalid input" entries and no cause) · builders, often (AI agents query through the data API) → p2 as set, the grade of #35433.

  3. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

    Parked · area data-2 · 2026-11-19T13:19Z

    Blocked-by: #35433

    Same producer (zodIssuesToFields); the maintainer ordered it after #35433 (ruling record on #35433).

  4. added
    pm:blocked
    and removed
    pm:queue
    on Nov 19, 2026
  5. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: unblocked 2026-11-24T22:37Z

  6. added
    pm:queue
    and removed
    pm:blocked
    on Nov 24, 2026
  7. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

    Claim: PM loop (seat-run dev)
    Session: session_011y7As5bdhV5T4N9vpjmZzH
    Account: os-alice
    Branch: claude/issue-35500-where-refusal-one-cause
    Worktree: objectstack-issue-35500
    Domain: domain:server
    Seat: repo:objectstack#7
    File surface: packages/spec/src/api/zod-issues-to-fields.ts and its tests, the where schema's union error text in packages/spec/src/** if the cause sentence belongs there, packages/rest/src/** query-door tests, generated spec artifacts, .changeset/** (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default opus (dispatch-gates --tier: "no path-derived mandate"), effort: high
    Clause-②: no (narrowing)
    Metadata-protocol: none
    Responsibility: objectstack (packages/spec zodIssuesToFields, data API query door) | #35433 (PR #37083, same producer, merged) | an AI agent or caller sending a wrong-typed query.where through the data API
    Thread-read: 7146461863
    Premise: holds (blocker #35433 closed; PR #37083 merged)
    Serial constraints cleared: no seat PR in flight on zod-issues-to-fields.ts (#37083 merged); #35653 touches packages/lint and packages/cli only.

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 24, 2026
  9. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH
    os-dev-report

    {
      "issue": 35500,
      "status": "blocked",
      "branch": "claude/issue-35500-where-refusal-one-cause",
      "pr": null,
      "session": "session_011y7As5bdhV5T4N9vpjmZzH",
      "premise_still_valid": true,
      "summary": "Stopped before any edit: the fix the Done-when needs breaches the claimed file surface, which the dispatch says to stop and explain. Premise re-read at origin/main 236c8044acb (after PR #37083): FindDataRequestSchema with query.where 42, a string or null now answers TWO identical {field: 'query.where', code: 'invalid_shape', message: 'Invalid input'} entries (not three, because #37083 dropped the explained outer head), and a malformed AST [['status','=','open'],'and'] answers three entries, two of them bare 'Invalid input' (query.where.1 and query.where). The root cause is the branch-selection verdict, not the mapper's head rule. TransportFilterValueSchema = union[FilterArraySchema, DataEngineFilterSchema], and both are unions themselves. A branch made of one root invalid_union whose own branches are all kind mismatches is not seen as a kind mismatch by isKindMismatchOnly, so it is selected, expanded, and emits its own unexplained bare head, once per such branch. That verdict lives in packages/spec/src/shared/union-branch-policy.ts, which both spec walks share, and in metadata-protocol's own copy (protocol-metadata-issues.ts). The cross-package parity test exists to keep those copies equal, and ruling record 7010280743 says the two machine lists say the same thing. Neither file is in the claim's surface. A scratch simulation (copies of the two spec files in the scratchpad, nothing in the worktree) confirms the fix: with a recursive kind-mismatch rule plus an error sentence on TransportFilterValueSchema, 42, a string and null each give exactly one entry carrying the sentence; the malformed AST gives [sentence@query.where, min_items@query.where, bare@query.where.1] with no duplicate; a valid object where and a valid AST still parse.",
      "tests": "No repo test run: no code was written. Readings at origin/main 236c8044acb (worktree tree, packages/spec/src through tsx): door probe FindDataRequestSchema.safeParse + zodIssuesToFields: num 42 -> [{query.where,invalid_shape,Invalid input} x2]; str -> same x2; null -> same x2; [['status','=','open'],'and'] -> [{query.where,min_items,'Too small: expected array to have >=3 items'},{query.where.1,invalid_shape,Invalid input},{query.where,invalid_shape,Invalid input}]; {status:'open'} OK; ['status','=','open'] OK. Scratch simulation (patched copies of isKindMismatchOnly + mapper, sentence union built in the probe): door 42/str/null -> one entry {query.where,invalid_shape,Invalid input}; with the sentence -> one entry {where,invalid_shape,SENTENCE}; malformed AST -> [SENTENCE@where, min_items@where, Invalid input@where.1]; valid controls OK.",
      "gates": "NOT MEASURED: no diff exists (the branch equals origin/main 236c8044acb), so dispatch-gates --commands derives nothing to run and there are no PR check-runs.",
      "dogfood_battery": "n/a — no diff and no PR; the battery is owed on the final head of the re-dispatched work (narrowing arm)",
      "mcp_calls": "0",
      "api_writes": "1 — POST /repos/objectstack-ai/objectstack/issues/35500/comments (this os-dev-report, via post-stamped.mjs); plus one git push of the empty branch (not a REST write)",
      "open_questions": [
        {
          "question": "Amend #35500's claimed file surface so the fix can land at the policy layer and keep the metadata envelope equal?",
          "options": [
            "A: Add packages/spec/src/shared/union-branch-policy.ts (isKindMismatchOnly: a root-path invalid_union carrying zod's default message, whose every branch is kind-mismatch-only, counts as a kind mismatch) and its parity test union-branch-policy.parity.test.ts; packages/spec/src/data/data-engine.zod.ts TransportFilterValueSchema (an error sentence naming the filter object and the filter array shapes; arguably already covered by the claim's 'where schema's union error text'); packages/metadata-protocol/src/protocol-metadata-issues.ts (the same change to its copy) and union-branch-policy.cross-package-parity.test.ts (a nested bare-kinds fixture in the section-2 corpus) plus protocol.save-union-issues.test.ts; renderer pins that move under packages/spec/src/shared/** and packages/spec/src/ui/view-union-*.test.ts; content/docs/api/error-handling-server.mdx if its walk text moves. The changeset adds an @objectstack/metadata-protocol patch. Cost: one PR, about two packages of source and pins plus the dogfood battery; all three walks (renderer, data API, metadata envelope) stay one verdict.",
            "B: Keep the claimed surface. Put a mapper-local rule in zod-issues-to-fields.ts (a bare head explained only by same-slot bare heads counts as unexplained) plus the sentence. It goes against the mapper header's rule that this file must not re-declare which branch explains a failure, and it makes the data API and the metadata envelope differ on nested bare-kinds unions, contrary to 7010280743 ('two places say the same thing'). The declared asymmetry would still need a pin in metadata-protocol's parity test, which is also outside the surface. Cheaper by one package, but it reopens what that ruling closed."
          ],
          "recommendation": "A, because the duplicate comes from the selection verdict, which by design lives in one shared module plus one pinned copy. Fixing it there removes the duplicate for every walk and keeps the parity test meaningful. Declarations unchanged: Clause-②: no (narrowing) (entries removed from published refusals; the metadata envelope's issues[] narrows the same way for nested bare-kinds unions), Metadata-protocol: none (no authorable key or value changes)."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  10. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

    Claim amendment · Branch: claude/issue-35500-where-refusal-one-cause
    Clause-②: no (narrowing)
    Metadata-protocol: none
    File surface (amended, option A of os-dev-report 7146729179): adds packages/spec/src/shared/union-branch-policy.ts + union-branch-policy.parity.test.ts, packages/spec/src/data/data-engine.zod.ts (TransportFilterValueSchema error sentence), packages/metadata-protocol/src/protocol-metadata-issues.ts (its copy of the verdict) + union-branch-policy.cross-package-parity.test.ts + protocol.save-union-issues.test.ts, renderer pins under packages/spec/src/shared/** and packages/spec/src/ui/view-union-*.test.ts, and content/docs/api/error-handling-server.mdx if its walk text moves. Changeset gains an @objectstack/metadata-protocol patch.
    Why: the duplicate comes from the shared branch-selection verdict (isKindMismatchOnly), not the mapper's head rule. Fixing it at the policy layer keeps all three walks one verdict, as ruling 7010280743 requires ("two places say the same thing"); a mapper-local rule (option B) would reopen that ruling.

  11. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

    Progress · 2026-11-25T00:24Z · claim held, work paused · Branch: claude/issue-35500-where-refusal-one-cause
    Paused on the account usage limit (maintainer's instruction via the project coordinator; resets at about 01:10 UTC). The dev stopped mid-round; pushed head e664ade9fc1, worktree kept. The seat resumes it on the same claim and branch after the reset. ⛔ Not released — please don't reclaim.

  12. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

    Paused under the concurrency cap · 2026-11-25T01:42Z

    Claim held, not released. Resume point: claude/issue-35500-where-refusal-one-cause@25128a5288e1cd18eb713b63b1baf57ca083e5c5 (pushed; worktree objectstack-issue-35500 kept). No PR is open.

    Done on the branch (option A surface, per the claim amendment):

    • The policy rule: a member that is itself a bare union of kinds counts as a kind mismatch. It is in union-branch-policy.ts (spec) and in metadata-protocol's copy, plus the wrong-kind sentence on TransportFilterValueSchema.
    • Pins: spec mapper door cases (42, a string, null, a boolean, $filter, the malformed AST, valid controls); spec parity; the cross-package parity fixtures; the metadata envelope walk; and the rest HTTP door (400 VALIDATION_FAILED, exact field/code, no read; controls served).
    • Changeset with BREAKING, FROM / TO and an ADR-0087 marker; check-adr-0087-registration exits 0.
    • Readings on pre-merge head 2af665dfa50: spec 983/983 files, metadata-protocol 369 passed / 9 skipped, rest 429/429, typecheck exit 0 for all three.
    • Ablation, run once: mutated leg 10 failed; restored by blob, then 56/56.
    • Gate sweep on 2af665dfa50: 89 derived, 88 run, 1 NOT MEASURED (check:dual-build-cjs-loads, exit 3), 0 unrun.
    • On 25128a5288e, after merging main: dogfood closure rebuilt and check:generated exit 0.

    What remains:

    • Re-run the affected test files on 25128a5288e.
    • Re-run the full dispatch-gates --commands sweep with --ran on the final head.
    • Run the full dogfood battery on the final head as its own lock command. It was started and stopped for this pause, so it is NOT MEASURED.
    • Open the draft PR Fixes #35500 through the relay (the body is drafted), then post the os-dev-report.
  13. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH
    os-dev-report

    {
      "issue": 35500,
      "status": "done",
      "branch": "claude/issue-35500-where-refusal-one-cause",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37205",
      "session": "session_011y7As5bdhV5T4N9vpjmZzH",
      "premise_still_valid": true,
      "summary": "A query where of the wrong kind (42, a string, null, a boolean, on every spelling of the slot) is now refused with exactly one fields[] entry, query.where invalid_shape, carrying a sentence that names both accepted shapes: a condition object or a filter array. There are no duplicate Invalid input entries. The cause was the shared branch-selection verdict: isKindMismatchOnly did not read a member that is itself a bare union of kinds as a kind mismatch, so each such member emitted its own unexplained head. The rule is fixed in packages/spec/src/shared/union-branch-policy.ts (both spec walks) and in @objectstack/metadata-protocol's copy (claim-amended surface, option A), so the data API, the metadata envelope and the renderer keep one verdict, as ruling 7010280743 requires. The wrong-kind sentence is on TransportFilterValueSchema. A malformed AST now answers [query.where min_items, query.where.1 invalid_shape] with no duplicate. Premise held: at 236c8044acb the door answered two identical bare entries (three at the card's measurement, before #37083).",
      "tests": "Final head 16f479c57d6374dae090293322233f904ea2c9e6: affected files spec 2 files 56/56, metadata-protocol 2 files 64/64, rest 1 file 23/23 (VERDICT command-exit 0); spec check:generated exit 0. Package suites on 2af665dfa50 (pre-merge, same diff): spec 983/983 files, 29875 tests; metadata-protocol 369 passed + 9 skipped files, 23394 tests; rest 429/429 files, 8823 tests (one exit-99 attempt re-run on the same slot); typecheck exit 0 for all three. Ablation once (ablation-replace.mjs on union-branch-policy.ts, anchor 1->0, blob 8f72bb114a75->c2e73abc2818): mutated leg 10 failed / 46 passed; restored blob equals HEAD and git diff HEAD is empty; restored leg 56/56. Rest door pins assert 400 + VALIDATION_FAILED + exact field/code list + no driver read. The sentence is asserted by the two shapes it names, not its full wording, per the no-prose-pin rule.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 16f479c57d6: 89 derived; --ran 89 run, 0 NOT-MEASURED, 0 UNRUN, exit 0. Extra: check:error-code-casing exit 0, check-adr-0087-registration exit 0. PR check-runs at report time: in_progress (Lint, Type Check, Check Changeset, Governed Surface Queue Guard and others; 5 skipped by selector), so not yet concluded.",
      "dogfood_battery": "16f479c57d6374dae090293322233f904ea2c9e6 · 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",
      "mcp_calls": "0",
      "api_writes": "4 — POST issues/35500/comments x3 (os-dev-report 7146729179, pause note 7149868862, this report) via post-stamped.mjs; POST pulls (pr_create #37205, draft, assignee os-alice) via the fleet-write relay; plus git pushes (not REST)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: a · reach: FindDataRequestSchema.safeParse on the findInput that POST /api/v1/data/:object/query builds, with $filter: { $and: 42 }, answers fields [{ field: 'query.where.$and', code: 'required' }]. The value is present (where answers invalid_type correctly), and the field names the folded slot, not $filter. · evidence: scratch probe at 236c8044acb and on this branch · dedupe words: transport alias fold, $filter, required code, fields path, valueAtPath"
      ]
    }
  14. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH
    os-dev-report

    {
      "issue": 35500,
      "status": "done",
      "branch": "claude/issue-35500-where-refusal-one-cause",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37205",
      "session": "session_011y7As5bdhV5T4N9vpjmZzH",
      "premise_still_valid": true,
      "summary": "Rework round (prose only) for seat REWORK 7152541028, at new head ecc795b19056a140f2a97f837d3621aaa7044546. The delta from 16f479c57d6 is .changeset/where-wrong-kind-one-entry.md alone. (1) The FROM lines now state the released behaviour: three identical Invalid input entries for where: 42, and five entries (four bare) for the malformed AST, the card's readings at f6902e950. The changeset says #37083's explained-head drop ships in the same release and accounts for part of the difference. (2) null is scoped to where; $filter, filter and filters are nullable and accept null. (3) The changeset now names the four lists zodIssuesToMetadataIssues feeds: the 422 save issues[], a stored item's _diagnostics.errors, the seed-request refusal issues, and the unmanaged-import 400. The BREAKING banner now addresses their readers and terminal line counts. (4) It now says a sibling member with several located causes can now be selected, so in that case a list gains located entries. The ADR-0087 marker reason was adjusted to cover diagnostics reads. The PR body was refreshed to match through post-stamped --body with --ack-through=7152541028; signature is on line 1 and Fixes #35500 on line 2. No code changed, so contract review PASS 7152531147 carries; no generated reference reads a changeset, so no Regen-provenance line is needed. No merge of origin/main: the PR reads mergeable, clean.",
      "tests": "No code delta, so no package test re-run. check-adr-0087-registration exit 0 on the edited changeset (one declared-breaking changeset, not-required (no-migration-prescription)). Code readings of the previous round stand at 16f479c57d6.",
      "gates": "Local, ecc795b1905: dispatch-gates --commands --repo objectstack-ai/objectstack derived 89; --ran: 88 run, 1 NOT-MEASURED (pnpm check:dual-build-cjs-loads exit 3, PREREQUISITE NOT MET: the fresh worktree built only the dogfood closure), 0 UNRUN. CI on ecc795b1905 at report time: 58 success, 13 skipped, 0 failed. Lint & Repo Gates, TypeScript Type Check, Build Core (runs check:dual-build-cjs-loads), Test Core 10/10, Governed Surface Queue Guard and Dogfood Regression Gate are success. Check Changeset has one success and one re-run in_progress after the body edit. PR-body guards are in_progress.",
      "dogfood_battery": "ecc795b19056a140f2a97f837d3621aaa7044546 · os-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. Re-pinned because the L1 checklist pins dogfood_battery to the PR head whatever the delta; no gate itself requires it for a changeset-only push.",
      "mcp_calls": "0",
      "api_writes": "2 this round — PATCH pulls/37205 body via post-stamped --body (relay issue_patch, read back identical, 12725 bytes); POST issues/35500/comments (this os-dev-report) via post-stamped; plus one git push",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  15. removed
    pm:dispatched
    on Nov 26, 2026
  16. github-actions commented on Nov 26, 2026

    @github-actions
    Contributor

    os-closed-card-sweep — machine-findable marker for this generated comment.

    Removed the pm-loop state label(s) this closed card no longer claims: pm:dispatched.

    A state label claims work is in flight. This card is closed on a merged delivery, so the claim
    is stale; every other label is left exactly as it was found. Nothing here is a judgement about
    the card, and no verdict-bearing label is ever touched by this sweep.

    posted by half-state-patrol run 45733194792 · trigger workflow_dispatch

    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions