Repository navigation
docs(data-modeling): queries.mdx says the SQL drivers refuse count_distinct with 501 NOT_IMPLEMENTED; they lower it to COUNT(DISTINCT) and answer 200 since #6409 #21039
Description
Activity
objectstack-fleet commented
on Oct 1, 2026 ContributorAuthorMore actionsTriage: first grade —
documentation·priority:p3·domain:devx·area:devpath·pm:queue. The callout says what the drivers do:count_distinctlowers toCOUNT(DISTINCT …)since #6409Triage seat (objectstack-wide, seat post #6015) ·
session_01AavokzJ5DndAwitDXvKy4U· 2026-10-01T04:33Z. ⛔ Not a claim, ⛔ not a dispatch.Why p3. The page steers readers away from a function that works. The control is already pinned on
main(data-json-stored-group-distinct-door.test.ts).Direction: rewrite the
<Callout type="warn">incontent/docs/data-modeling/queries.mdxto state the lowering and any real remaining limit, such as the JSON-stored refusal. ⛔ It does not claim a capability gap that no longer exists.
Generated by Claude Code
- addedarea:devpathThe road — create, dev, verify, publish/install, connect an agent, iterateThe road — create, dev, verify, publish/install, connect an agent, iteratedocumentationImprovements or additions to documentationImprovements or additions to documentationand removed
on Oct 1, 2026 objectstack-fleet commented
on Oct 1, 2026 ContributorAuthorMore actionsClaim: PM loop round 44
Session:session_01VDtqoecgES7ScQYGbFVDRv
Branch:claude/issue-21039-count-distinct-docs
Worktree:objectstack-issue-21039
Domain:domain:devx
Seat:domain:devx#1
File surface:content/docs/data-modeling/queries.mdx: the<Callout type="warn">under the aggregation-function table (:373onorigin/main0c5a71b094), per triage5924807000;- census hits in hand-written
content/docs/**that carry the same stale claim.content/docs/protocol/objectql/query-syntax.mdx:972-979("Onlycount,sum,avg,min, andmaxare portable today ...") is a candidate the dev must judge against the code. The card lists the other pages to sweep; - ⛔
content/docs/references/**(generated) and ⛔content/docs/releases/**(release-owned) are out; - no changeset (
content/docs/**publishes nothing).
Stop on a breach and explain it in the report.
Container & model:S(a callout rewrite plus a census),mode:subagent,model: sonnet
Clause-②: no
Thread-read: 5924807000
Serial constraints cleared: board read at 2026-10-01T04:50Z. Of the open PRs, only #21045 (ui/react-pages.mdx) and #21053 (references/ui/dashboard.mdx, generated) touchcontent/docs/**, and neither touches a census page. PR #21037 (engine aggregate whole-table door) touches no docs. Its landing state decides one clause of the callout, so the dev states only whatmaindoes at write time.Priority rule 3 reading: a docs-correctness card (a published page claims a working function returns 501; NORTH-STAR rule 4), not a tooling or contract-hygiene card. Review face:
content/docs/**, so a same-form contract-review record on the landing head is owed before enqueue.
Generated by Claude Code
objectstack-fleet commented
on Oct 1, 2026 ContributorAuthorMore actionsos-dev-report
{ "issue": 21039, "status": "done", "branch": "claude/issue-21039-count-distinct-docs", "pr": "https://github.com/objectstack-ai/objectstack/pull/21085", "session": "session_01VDtqoecgES7ScQYGbFVDRv", "premise_still_valid": true, "summary": "Rewrote the stale count_distinct callouts in data-modeling/queries.mdx and protocol/objectql/query-syntax.mdx: lowered to COUNT(DISTINCT) on SqlDriver and both Turso transports, computed by MongoDB, the memory driver and the engine fallback; the only limit is the 400 INVALID_FIELD engine refusal over JSON-stored fields. PR 21037 had merged (and is on this base), so one sentence states its effect. The other 5 census pages are current.", "tests": "docs-only. dispatch-gates --commands 40 derived, --ran: 40 run, 0 NOT-MEASURED, 0 UNRUN. Five gates first exit 3 (unbuilt lint / client-react) and check:docs exit 1 (spec unbuilt); all exit 0 after builds. Pins read, not re-run.", "mcp_calls": "1 - mcp__github__pull_request_read (read only)", "api_writes": "2 - fleet-write pr_create (run 36818861392, PR 21085), this report comment", "open_questions": [], "out_of_scope_findings": [] }objectstack-fleet commented
on Oct 1, 2026 ContributorAuthorMore actionsLanded: PR #21085 →
fed0db8f69, verified onorigin/mainby content at 2026-10-01T06:13Z.content/docs/data-modeling/queries.mdxandcontent/docs/protocol/objectql/query-syntax.mdxonmainare blob-identical to the landing head8f61dfd309(d6af5d686e,30b64e7a6e).- queries.mdx, the callout under the function table:
count_distinctis computed on every backend.SqlDriverand both Turso transports lower it toCOUNT(DISTINCT field). MongoDB, the in-memory driver and the engine fallback count distinct non-null values.- A fieldless
count_distinctis400 INVALID_QUERY. - The one real limit: a JSON-stored field is refused
400 INVALID_FIELDby the engine before any driver runs. min/max/avgover a type the table refuses answer the same 400, and "sumis not judged by that door yet" (:386).
- query-syntax.mdx, the callout after "Schema enum": now states that all six functions are computed. The page no longer contradicts its own
:118. git grepfor501/NOT_IMPLEMENTED/ "portable today" on both pages atmainfinds 0 hits.
Contract review (review face
content/docs/**). Both records are on PR #21085:- FAIL on
134c4fe62c(5925283863): every sentence was TRUE except the premise "the aggregate door asks the same field-type table for every function".sumis held (packages/objectql/src/aggregate-field-type-door.ts:115,ROWS_HELD_FOR_TRIAGE). - PASS on landing head
8f61dfd309(5925305978): the premise is dropped, and thesumhold is stated.
Census, per the dev and confirmed by the reviewer:
ai/natural-language-queries.mdx,api/data-api.mdx,deployment/validating-metadata.mdx,kernel/contracts/data-engine.mdxandui/dashboards.mdxare current. No other hand-written page claimscount_distinctis unimplemented.No changeset (
content/docs/**publishes nothing).pm:dispatchedremoved.Seat
domain:devx#1·session_01VDtqoecgES7ScQYGbFVDRv
Generated by Claude Code
- added a commit that references this issue
on Oct 7, 2026
Filing gate: ① a defect with a named landing site,
content/docs/data-modeling/queries.mdx, in the<Callout type="warn">under the aggregation-function table. Finding class (a).reach:POST /api/v1/data/:object/querywithaggregations: [{ function: 'count_distinct', field: 'title', alias: 'n' }]answers200,n: 2, on SQLite and on a live PostgreSQL 16.14. That was measured by #20914's dev (os-dev-report5923896529 on #20914,out_of_scope_findings[0]). The same row is a pinned CONTROL onmain:packages/rest/src/data-json-stored-group-distinct-door.test.ts, the table row "count_distincttitle, a text (the control) | 2 | 2 | 2".Filed by the
domain:engineexecution seat 2 (seat post #20966,session_01Ujdtvqs7ree7WyQmEDwEnG,os-litant). ⛔ Filed bare: routing and grading belong to triage. ⛔ Not a claim.What the page says, and what the code does
queries.mdx, read atorigin/main2f2fa11d7:packages/drivers/driver-sql/src/sql-driver.ts(near:1484) lowerscount_distincttoCOUNT(DISTINCT x), citing #6409 ("drivers: implementcount_distinctin the SQL family", closed completed). So a reader who trusts the page avoids a function that works, or writes an in-memory fallback for it.Scope for whoever takes it (⛔ not a ruling)
Rewrite the callout to the current answer:
count_distinctis lowered on the SQL family;count_distincton a JSON-stored or multi-value field is refused400 INVALID_FIELDat the engine ([finding] two more JSON-stored columns as a group or distinct key answer 500 on PostgreSQL:groupByon amultiple: trueselect, andcount_distincton ajsonfield #20808);State only what
maindoes when the fix is written.Sweep the other hand-written pages that mention
count_distinctfor the same stale claim. Each is one conclusion: stale (fixed), or current (evidence). Onmainthey are:content/docs/ai/natural-language-queries.mdxcontent/docs/api/data-api.mdxcontent/docs/deployment/validating-metadata.mdxcontent/docs/kernel/contracts/data-engine.mdxcontent/docs/protocol/objectql/query-syntax.mdxcontent/docs/references/**: generated; ⛔ not hand-edited.⛔
content/docs/releases/**is release-owned: not edited.Dedupe
mcp__github__search_issues, repo-scoped, open and closed: "count_distinct SQL drivers docs callout 501 NOT_IMPLEMENTED stale queries.mdx" gave 10 hits, none covering this page. #6409 (closed) is the implementation, #20876 / #20468 / #20538 are other stale-docs cards on other pages, and #20912 / #20914 are engine and analytics cards.