You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
analytics: POST /analytics/dataset/query silently ignores unknown top-level body keys — a misplaced runtimeFilter answers 200 with the unfiltered aggregate #29156
area:reportsBusiness reporting — dashboards, reports, the numbers a manager readsdomain:serverDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3
立卡门: ① 产品缺陷,具名落点 + 复现(reach: HTTP,POST /api/v1/analytics/dataset/query,实测)
业务理由: 写报表或仪表盘查询的作者,把 runtimeFilter 放在请求体外层而不是 selection 里,得到的是 200 和全表聚合,数字看起来合理却是错的,会被当成过滤后的结果用于决策;同族的 /analytics/query 与本接口的 selection 都会拒收未知键,只有外层不判,属于「静默丢谓词、结果变宽」的危险方向。
动手的读者: 拥有 packages/rest 分析路由的车道:在 analytics-routes.ts 的 dataset 查询入口给外层请求体加严格校验(未知键 400 VALIDATION_FAILED,带「是否想写 selection.runtimeFilter」提示),并决定同时给 dataset 与 datasetName 时怎么答。
查重: dataset/query top-level runtimeFilter ignored 6 命中(#20080#20040 是别的过滤下推问题,#29002#28942 是运行记录)、dataset/query unknown key 72(前 8 条为运行记录或无关,#27074#27974)、"dataset/query" body keys ignored 4(运行记录),含已关;无近邻。
Batch-of: release-18.3.0-w4-l2 — 10 cards from QA run #29151 (subject 7fa9873f; the implementer re-checks the landing site on current main).
QA-source: #29151 · dashboards.analytics-exposure-gate-and-measure-aggregate · observed beside the clauses
What happens
As admin on a stock showcase, POST /api/v1/analytics/dataset/query with {"datasetName":"showcase_task_metrics","runtimeFilter":{"done":true},"selection":{"measures":["task_count"]}} answers 200rows [{task_count:10}]; the SQL is SELECT COUNT(*) … FROM "showcase_task" with no WHERE. The same filter inside selection answers 2. A body with "bogus":1 beside selection also answers 200.
The sibling door refuses the same mistake: POST /api/v1/analytics/query {cube, measures, bogus:1} → 400 VALIDATION_FAILED "Unrecognized key(s) on this analytics query: bogus", and selection.filter on the dataset door → 400 "… Did you mean filter → runtimeFilter?". Row scope and permissions still apply; the caller just gets a wider answer than asked.
Measured at framework 7fa9873f (main, 2026-11-02).
Reproduction
Boot the showcase, sign in as admin.
POST /api/v1/analytics/dataset/query with the body above.
Expected: 400 VALIDATION_FAILED naming runtimeFilter as an unrecognized top-level key (ideally pointing at selection.runtimeFilter).
packages/rest/src/analytics-routes.ts (~L126-218) reads body.selection (judged by datasetSelectionRefusal), body.dataset and body.datasetName; nothing judges the remaining keys. Related: a body naming both dataset and datasetName runs the inline dataset with no word (L182). Landing: @objectstack/rest (the body schema may belong beside DatasetSelectionSchema in @objectstack/spec).
Read fresh. POST /analytics/dataset/query ignores unknown top-level body keys. A misplaced runtimeFilter answers 200 with the unfiltered aggregate: a predicate silently dropped, a wider result. Its sibling doors (/analytics/query, and this door's own selection) refuse unknown keys. Make the outer body strict in packages/rest (analytics-routes.ts), with a remedy naming selection.runtimeFilter. domain:server, p2.
Claim: PM loop round 1 · card thread · 2026-11-02T09:19Z
Session: session_01ADHkmQxwoGb5fSnrFkpxmt (the seat); the card thread is session_01ADHkmQ6M1P18JzkN4aDNPb
Account: os-steve (the seat's linked user; the card's assignee)
Branch: claude/project-thread-9bs2fu (the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)
Worktree: the card thread's own container checkout
Domain: domain:server
Seat: domain:server#2
Ruling-ref: the maintainer, verbatim: 「开 server 2、3、5 号席位, 前任已经下班,接手所有开发,包括跟进之前未完成的开发落地。」 Card: none from the maintainer on this card; triage graded p2 (6572603151).
File surface: packages/rest/src/analytics-routes.ts (outer-body judgment on the dataset query door, plus a helper beside it if needed); tests; one dogfood pin; changeset; the analytics API doc page only if it states the body shape. ⛔ No ui/**, no packages/spec/**.
Container & model: M, mode:thread, model: opus (TIER_DEFAULT; --tier names no path mandate: PM's call), effort: high
Clause-②: no (expected: a REST door refusal; no published spec accept set moves)
Metadata-protocol: none (expected)
Responsibility: the code is the dataset query door of @objectstack/rest · the platform path is a report or dashboard query whose misplaced runtimeFilter answers 200 with the unfiltered aggregate · reached by every author or integration that sends the filter outside selection
Thread-read: 6572603151
Premise: holds (the named seam read on the card at 7fa9873f; the dev re-measures red first on current origin/main)
Serial constraints cleared: none — no open PR touches analytics-routes.ts and no open claim on a domain:serverpm:dispatched card names it (read this act)
Resume-from: none — fresh from origin/main
State: pm:queue → pm:dispatched, assigned to os-steve, recorded by this claim.
{
"issue": 29156,
"status": "done",
"branch": "claude/project-thread-9bs2fu",
"pr": "https://github.com/objectstack-ai/objectstack/pull/29251",
"session": "session_01ADHkmQ6M1P18JzkN4aDNPb",
"premise_still_valid": true,
"summary": "POST /analytics/dataset/query now judges its outer body against the closed set the handler reads (dataset, datasetName, previewDrafts, selection; new packages/rest/src/analytics-dataset-body-door.ts, one call in analytics-routes.ts before the selection checks). An unknown key answers 400 VALIDATION_FAILED 'Unrecognized key(s) on this dataset query: ...' with details.fields[] (unknown_field); runtimeFilter/filter/filters/where point at selection.runtimeFilter and any other selection member (read off DatasetSelectionSchema.shape) at selection.KEY. dataset (truthy) beside a supplied datasetName answers 400 naming both; a null dataset beside a name still runs the saved one. Premise re-measured red on main 692e0dc8: top-level runtimeFilter and bogus answered 200 with the query run.",
"tests": "Red first: e7b0ead3 (test alone on 692e0dc8) rest pin Tests 10 failed | 7 passed (17), every refusal 'expected 200 to be 400'. Fix 1d599e3e: 17/17; dogfood pin analytics-dataset-body-door.dogfood.test.ts 4/4. Ablation (ablation-replace.mjs, 'if (bodyRefusal) {' -> 'if (bodyRefusal && false) {', anchor 1->0, rest rebuilt --force, dist-preflight marker present in dist/index.cjs + index.js): rest pin 10 red/7 green; dogfood pin 2 red/2 green, top-level runtimeFilter answered 200 rows [{project_count:5}] (unfiltered) where selection.runtimeFilter answers 0. Restore: blob == HEAD, git diff HEAD empty, rebuilt, --absent marker absent from 6 dist files, tree clean, pins 17/17 + 4/4. pnpm --filter @objectstack/rest test: Test Files 368 passed (368), Tests 6980 passed | 332 skipped, exit 0 (6b02dae7; merge brought no rest/analytics path). rest typecheck exit 0.",
"gates": "dbf091e2: dispatch-gates --commands --repo objectstack-ai/objectstack -> 90 commands, all exit 0 (check-plugin-teardown-shape --self-test exit 3 prerequisite first, green 48 cases after git fetch --depth=1 of pinned 621a4876). --ran reconciliation: 90 derived, 90 run, 0 NOT-MEASURED, 0 UNRUN (DERIVED zero), exit 0. eslint packages/rest packages/qa/dogfood --no-inline-config exit 0. check-changeset-no-major --event (PR body) exit 0: no (narrowing) + none at patch. check-adr-0087-registration: not-required (no-migration-prescription). CI check-runs: in_progress at report time (not waited on).",
"dogfood_battery": "dbf091e2 · os-verify-lock VERDICT command-exit 0 (held 26m35s) · Test Files 389 passed | 3 skipped (392) · Tests 3212 passed | 28 skipped (3240) · no failures",
"line_budget": "+516 / -0 over 6 files vs merge base (helper 166, rest pin 239, dogfood pin 72, changeset 19, analytics.mdx +7, analytics-routes.ts +13); under the 3000 human-merge threshold",
"files_changed": [
"packages/rest/src/analytics-dataset-body-door.ts (new)",
"packages/rest/src/analytics-routes.ts",
"packages/rest/src/analytics-dataset-body-door.test.ts (new)",
"packages/qa/dogfood/test/analytics-dataset-body-door.dogfood.test.ts (new)",
".changeset/29156-dataset-query-body-unknown-keys.md (new)",
"content/docs/data-modeling/analytics.mdx"
],
"deviations": [
"Claim line 'Clause-②: no' copied as 'Clause-②: no (narrowing)' in PR body and changeset: the card refuses bodies that answered 200 (delta: narrowing rules apply); the seat may amend the claim.",
"No forced test edits: no existing test changed.",
"Envelope: the refusal uses this door's own flat body-refusal frame ({code, message, details.fields}, as an unknown selection key already answers here), with the sibling door's message opening; not the nested {error:{...}} the dispatcher door writes. Recorded as an implementation reading of 'the sibling door's frame'.",
"Session-context PR attribution asks for MCP issue_write/update_pull_request to set assignee/reviewer; not done, the standard order forbids MCP writes and os-dev forbids PR assignees."
],
"mcp_calls": "2 — mcp__github__issue_read get_comments x2 (claim check); no MCP write",
"api_writes": "2 — relay pr_create (fleet-write run 41427947373, PR #29251, 10213 bytes sent = stored); post-stamped comment on #29156 (this report). Plus git push (not REST).",
"open_questions": [
{
"question": "The filter near-miss table (filter/filters/where -> selection.runtimeFilter) is three entries written in packages/rest; DatasetSelectionSchema curates the same three as aliases one level down but does not export its alias map. Keep the rest-side table, or export the alias map from spec so both levels read one list?",
"options": [
"A keep the three-entry table in rest (this PR)",
"B export the selection alias map from packages/spec and read it here (a spec card)"
],
"recommendation": "A, because the three answer a misplaced key (one level up), not a misspelled one, and the delta forbids spec edits on this card; B only if more surfaces start reading those aliases."
}
],
"out_of_scope_findings": [
"class: none (observation) · reach: none · the same route's query string is not a closed set (it reads `preview` through refuseRepeatedQueryParams only) · noted in PR Acceptance notes · dedupe words: dataset query closed query params, refuseUnknownQueryParams analytics",
"carrier: none · noted, not filed"
]
}
Claim amendment to 6573479102 · 2026-11-02T10:21Z · declaration corrected
Clause-②: no (narrowing)
The claim wrote a bare Clause-②: no; the change refuses bodies that answered 200 before on a REST door, which the delta already treats as a narrowing (! title, BREAKING banner, adr-0087: marker, dogfood). PR #29251 declares no (narrowing); this line aligns the claim. File surface unchanged (packages/rest/src/analytics-dataset-body-door.ts is the new helper beside analytics-routes.ts the delta allowed). A CONTRACT_REVIEW_TIER review runs on the PR head.
area:reportsBusiness reporting — dashboards, reports, the numbers a manager readsdomain:serverDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Nov 2, 2026
triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U
Path: none
Triage: p2 ·
domain:server·area:reports·pm:queue· 2026-11-02T08:30Z⛔ Not a claim.
POST /analytics/dataset/queryignores unknown top-level body keys. A misplacedruntimeFilteranswers 200 with the unfiltered aggregate: a predicate silently dropped, a wider result. Its sibling doors (/analytics/query, and this door's ownselection) refuse unknown keys. Make the outer body strict inpackages/rest(analytics-routes.ts), with a remedy namingselection.runtimeFilter.domain:server, p2.Generated by Claude Code
objectstack-fleet commentedon Nov 2, 2026
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt
Claim: PM loop round 1 · card thread · 2026-11-02T09:19Z
Session:
session_01ADHkmQxwoGb5fSnrFkpxmt(the seat); the card thread issession_01ADHkmQ6M1P18JzkN4aDNPbAccount:
os-steve(the seat's linked user; the card's assignee)Branch:
claude/project-thread-9bs2fu(the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)Worktree: the card thread's own container checkout
Domain:
domain:serverSeat:
domain:server#2Ruling-ref: the maintainer, verbatim: 「开 server 2、3、5 号席位, 前任已经下班,接手所有开发,包括跟进之前未完成的开发落地。」 Card: none from the maintainer on this card; triage graded p2 (6572603151).
File surface:
packages/rest/src/analytics-routes.ts(outer-body judgment on the dataset query door, plus a helper beside it if needed); tests; one dogfood pin; changeset; the analytics API doc page only if it states the body shape. ⛔ Noui/**, nopackages/spec/**.Container & model:
M,mode:thread,model: opus(TIER_DEFAULT;--tiernames no path mandate: PM's call),effort: highClause-②: no (expected: a REST door refusal; no published spec accept set moves)
Metadata-protocol: none (expected)
Responsibility: the code is the dataset query door of
@objectstack/rest· the platform path is a report or dashboard query whose misplacedruntimeFilteranswers 200 with the unfiltered aggregate · reached by every author or integration that sends the filter outsideselectionThread-read: 6572603151
Premise: holds (the named seam read on the card at
7fa9873f; the dev re-measures red first on currentorigin/main)Serial constraints cleared: none — no open PR touches
analytics-routes.tsand no open claim on adomain:serverpm:dispatchedcard names it (read this act)Resume-from: none — fresh from
origin/mainState:
pm:queue→pm:dispatched, assigned toos-steve, recorded by this claim.Generated by Claude Code
objectstack-fleet commentedon Nov 2, 2026
domain:server#2 · os-steve · session_01ADHkmQ6M1P18JzkN4aDNPb
os-dev-report
{ "issue": 29156, "status": "done", "branch": "claude/project-thread-9bs2fu", "pr": "https://github.com/objectstack-ai/objectstack/pull/29251", "session": "session_01ADHkmQ6M1P18JzkN4aDNPb", "premise_still_valid": true, "summary": "POST /analytics/dataset/query now judges its outer body against the closed set the handler reads (dataset, datasetName, previewDrafts, selection; new packages/rest/src/analytics-dataset-body-door.ts, one call in analytics-routes.ts before the selection checks). An unknown key answers 400 VALIDATION_FAILED 'Unrecognized key(s) on this dataset query: ...' with details.fields[] (unknown_field); runtimeFilter/filter/filters/where point at selection.runtimeFilter and any other selection member (read off DatasetSelectionSchema.shape) at selection.KEY. dataset (truthy) beside a supplied datasetName answers 400 naming both; a null dataset beside a name still runs the saved one. Premise re-measured red on main 692e0dc8: top-level runtimeFilter and bogus answered 200 with the query run.", "tests": "Red first: e7b0ead3 (test alone on 692e0dc8) rest pin Tests 10 failed | 7 passed (17), every refusal 'expected 200 to be 400'. Fix 1d599e3e: 17/17; dogfood pin analytics-dataset-body-door.dogfood.test.ts 4/4. Ablation (ablation-replace.mjs, 'if (bodyRefusal) {' -> 'if (bodyRefusal && false) {', anchor 1->0, rest rebuilt --force, dist-preflight marker present in dist/index.cjs + index.js): rest pin 10 red/7 green; dogfood pin 2 red/2 green, top-level runtimeFilter answered 200 rows [{project_count:5}] (unfiltered) where selection.runtimeFilter answers 0. Restore: blob == HEAD, git diff HEAD empty, rebuilt, --absent marker absent from 6 dist files, tree clean, pins 17/17 + 4/4. pnpm --filter @objectstack/rest test: Test Files 368 passed (368), Tests 6980 passed | 332 skipped, exit 0 (6b02dae7; merge brought no rest/analytics path). rest typecheck exit 0.", "gates": "dbf091e2: dispatch-gates --commands --repo objectstack-ai/objectstack -> 90 commands, all exit 0 (check-plugin-teardown-shape --self-test exit 3 prerequisite first, green 48 cases after git fetch --depth=1 of pinned 621a4876). --ran reconciliation: 90 derived, 90 run, 0 NOT-MEASURED, 0 UNRUN (DERIVED zero), exit 0. eslint packages/rest packages/qa/dogfood --no-inline-config exit 0. check-changeset-no-major --event (PR body) exit 0: no (narrowing) + none at patch. check-adr-0087-registration: not-required (no-migration-prescription). CI check-runs: in_progress at report time (not waited on).", "dogfood_battery": "dbf091e2 · os-verify-lock VERDICT command-exit 0 (held 26m35s) · Test Files 389 passed | 3 skipped (392) · Tests 3212 passed | 28 skipped (3240) · no failures", "line_budget": "+516 / -0 over 6 files vs merge base (helper 166, rest pin 239, dogfood pin 72, changeset 19, analytics.mdx +7, analytics-routes.ts +13); under the 3000 human-merge threshold", "files_changed": [ "packages/rest/src/analytics-dataset-body-door.ts (new)", "packages/rest/src/analytics-routes.ts", "packages/rest/src/analytics-dataset-body-door.test.ts (new)", "packages/qa/dogfood/test/analytics-dataset-body-door.dogfood.test.ts (new)", ".changeset/29156-dataset-query-body-unknown-keys.md (new)", "content/docs/data-modeling/analytics.mdx" ], "deviations": [ "Claim line 'Clause-②: no' copied as 'Clause-②: no (narrowing)' in PR body and changeset: the card refuses bodies that answered 200 (delta: narrowing rules apply); the seat may amend the claim.", "No forced test edits: no existing test changed.", "Envelope: the refusal uses this door's own flat body-refusal frame ({code, message, details.fields}, as an unknown selection key already answers here), with the sibling door's message opening; not the nested {error:{...}} the dispatcher door writes. Recorded as an implementation reading of 'the sibling door's frame'.", "Session-context PR attribution asks for MCP issue_write/update_pull_request to set assignee/reviewer; not done, the standard order forbids MCP writes and os-dev forbids PR assignees." ], "mcp_calls": "2 — mcp__github__issue_read get_comments x2 (claim check); no MCP write", "api_writes": "2 — relay pr_create (fleet-write run 41427947373, PR #29251, 10213 bytes sent = stored); post-stamped comment on #29156 (this report). Plus git push (not REST).", "open_questions": [ { "question": "The filter near-miss table (filter/filters/where -> selection.runtimeFilter) is three entries written in packages/rest; DatasetSelectionSchema curates the same three as aliases one level down but does not export its alias map. Keep the rest-side table, or export the alias map from spec so both levels read one list?", "options": [ "A keep the three-entry table in rest (this PR)", "B export the selection alias map from packages/spec and read it here (a spec card)" ], "recommendation": "A, because the three answer a misplaced key (one level up), not a misspelled one, and the delta forbids spec edits on this card; B only if more surfaces start reading those aliases." } ], "out_of_scope_findings": [ "class: none (observation) · reach: none · the same route's query string is not a closed set (it reads `preview` through refuseRepeatedQueryParams only) · noted in PR Acceptance notes · dedupe words: dataset query closed query params, refuseUnknownQueryParams analytics", "carrier: none · noted, not filed" ] }Stamped 2026-11-02T10:21Z.
Generated by Claude Code
objectstack-fleet commentedon Nov 2, 2026
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt
Claim amendment to
6573479102· 2026-11-02T10:21Z · declaration correctedClause-②: no (narrowing)
The claim wrote a bare
Clause-②: no; the change refuses bodies that answered 200 before on a REST door, which the delta already treats as a narrowing (!title, BREAKING banner,adr-0087:marker, dogfood). PR #29251 declaresno (narrowing); this line aligns the claim. File surface unchanged (packages/rest/src/analytics-dataset-body-door.tsis the new helper besideanalytics-routes.tsthe delta allowed). A CONTRACT_REVIEW_TIER review runs on the PR head.Generated by Claude Code