Skip to content

feat(service-analytics): list_datasets and query_dataset, the dataset AI tools (ADR-0149 D2–D4) - #31772

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-ehwi7d
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-ehwi7d

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #31589

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:在 service-analytics 里实现两个 AI 工具 list_datasets(列出调用者能查的数据集、指标与维度、业务说明和同义词,并标出提问用词命中了哪个指标)和 query_dataset(按数据集查数,答案附带 provenance 来源块);一份定义、一个执行器;数据集成员的业务说明写进 Cube,/analytics/meta 可见。
  • 为什么改:ADR-0149 要求 AI 按已定义的指标口径取数,而不是按关键词猜对象字段;这是 D7 的第 2 张子卡。
  • 风险与回滚:工具只调用现有 queryDataset 并带调用者上下文,不加门也不绕门;未经 AnalyticsServicePlugin 装配权限钩子的服务一律拒绝(503)。纯新增,回滚即 revert 本 PR。
  • 先看:packages/services/service-analytics/src/dataset-tools.ts(执行器与 provenance)、analytics-service.ts 的 admitDatasetCatalogEntry(目录复用查询的同一套门)、packages/rest/src/analytics-dataset-ai-tools-parity.test.ts(三个入口同行同拒)。
  • 两分钟验证:pnpm --filter @objectstack/service-analytics build && pnpm --filter @objectstack/rest exec vitest run src/analytics-dataset-ai-tools-parity.test.ts,应见 6 个测试全过。
  • 需要你做的:无,席位落地。

What changes

The tools (ADR-0149 D2). New packages/services/service-analytics/src/dataset-tools.ts:

  • getDatasetToolDefinitions(): the two AIToolDefinitions, list_datasets then query_dataset. parameters and outputSchema are the spec's getDatasetToolJsonSchemas() projections (by reference, no copy); the descriptions carry the D3 selection rule (one match wins, several ask, none falls back labelled 非指标口径, the recommended dataset-hint line, a dimension match alone is no answer).
  • createDatasetTools(deps) and AnalyticsService.datasetTools(deps) (seat ruling C on the bridge seam: the bridge hosts cannot import this package, so they reach the tools through the kernel's analytics service). deps: loadDatasets(ctx) (the saved dataset items of the caller's environment, localized at the metadata boundary like the REST door), maxQueryLimit? (default 50), diagnoseDelegation?(object, ctx). The answer: { definitions, execute({ toolName, input }, ctx), listDatasets(input, ctx), queryDataset(input, ctx) }. Refusals throw an ADR-0112-shaped error (code + status).
  • D4 caveat (seat ruling 2). Both tools refuse SERVICE_UNAVAILABLE / 503 unless the service is an AnalyticsService whose four admission hooks are wired (hasPluginWiredAdmission(): getObjectDeclaration, admitObjectRead, getReadableFields, getQueryableFields, all always wired by AnalyticsServicePlugin). Without them the exposure gate warns once and passes and the read admission returns silently.

The catalogue (seat ruling 1). AnalyticsService.admitDatasetCatalogEntry(dataset, ctx) asks the gates a query of the dataset passes, through the service's own private methods (no copy):

  • dataset level: assertDatasetFieldsJudgeable and compile, then assertQueryObjectsExposed and assertReadAdmitted over the base object and every include target (cubeObjects). Refused: the dataset is absent, the CUBE_NOT_FOUND / cube-visibility.ts shape.
  • member level, as the one-member query DatasetExecutor would issue (a derived measure as its base measures via expandSelectedMeasures), with the dataset filter and the measure filter on the dataset-scope channel: assertStoredMetadataBodyNotQueried and assertNoInternalFieldsQueried refuse for every caller, so the member is omitted unstated and logged once at warn (reportDatasetCatalogDefect); assertFieldsReadable (field-read-admission.ts) refuses for this caller, so the member is omitted and membersWithheld: true is set.
  • A gate that could not answer (5xx or no status) is never read as a verdict: the item is left out and the answer is partial with a warning.

The term matcher (D3). New dataset-term-matcher.ts, matchDatasetTerms(terms, members): equality after the spec's own normalizeDatasetTerm, over the member's name, every locale of its label, and each synonym; never a substring. Only admitted members are matched.

query_dataset. Validates the input with the spec's strict QueryDatasetInputSchema (validation only; the caller's own selection reaches the service, as on the REST door). Resolves the saved dataset as list_datasets would: missing and hidden are one NOT_FOUND / 404. Then queryDataset(dataset, selection, ctx) with the caller's context, nothing added and nothing skipped. Row cap: the caller's limit when under the cap, else the cap; one row more is asked so truncated is a fact. The answer drops sql and adds rowCount, truncated, the delegation statement when the probe reports one, and provenance (seat ruling 3) composed after the query from the resolved dataset: dataset name and label, the selected measures with label and description, the selected dimensions, and the caller's runtimeFilter as sent. The dataset's own filter is never echoed. A provenance key in the input, at the top or inside selection, is refused VALIDATION_FAILED / 400 by the strict parse.

Member descriptions on the Cube (D1, M1 ruled A). compileDataset resolves a dimension's and a measure's description like their labels and writes it onto the Cube member, so getMeta publishes it for a registered dataset cube. dimensionType is now exported from dataset-compiler.ts (not from the package index) so the catalogue names the same dimension type the cube carries.

Liveness ledger (seat ruling on this card: these rows only). packages/spec/liveness/dataset.json: the four synonyms / description rows on dimensions and measures move planned → live, citing their readers. packages/spec/liveness/analytics_cube.json: the two member description notes now say a compiled dataset cube carries one (carry note 6726684547). packages/spec/liveness/state-counts/dataset.md is regenerated by gen:liveness-counts (check:liveness refuses a stale count shard; generator output, not a hand edit).

Four-face parity (seat ruling 4). The MCP face is #31590's (bridge members and registerDatasetTools), in flight beside this card. This PR lands the REST, chat-tool and direct-service faces; #31590 adds the MCP row to packages/rest/src/analytics-dataset-ai-tools-parity.test.ts. No packages/mcp edit here.

Tests

  • packages/services/service-analytics/src/__tests__/dataset-tools.test.ts (new, 15 tests): definitions; D4 unwired refused (both tools, nothing loaded, nothing read) and plugin-wired served; absent / withheld / internal-omitted catalogue for two callers; matches; input refusal and partial reads; one NOT_FOUND for missing, read-denied and not-exposed datasets with nothing read; queryDataset called with the caller's context and provenance composed; the provenance forgery refused at both levels; a field refusal carrying the service's own envelope; row cap, truncated and the delegation statement; 503 on a failed read; execute dispatch.
  • packages/services/service-analytics/src/__tests__/dataset-term-matcher.test.ts (new, 5 tests).
  • packages/services/service-analytics/src/__tests__/cube-meta-description-format.test.ts: one new case in the existing describe (a declared member description is published, synonyms are not). Forced test edit: the neighbouring case's title and comment said a dataset member "has no description key to copy"; that is no longer true, so they now say these members declare none. The assertions are unchanged.
  • packages/rest/src/analytics-dataset-ai-tools-parity.test.ts (new, 6 tests): a real ObjectQL engine over SQLite, the service AnalyticsServicePlugin registers, a security double whose read filter folds tenant ∧ (owner ∨ sharing grant). For three callers the REST door, the chat tool and queryDataset return the same rows; a field the caller may not read is refused 403 PERMISSION_DENIED on all three; an object the caller may not read is refused on all three (403 on REST and direct, 404 on the tool, by the one-answer contract); list_datasets lists exactly what is served.
Red first and ablations (7 legs, each restored to HEAD, git diff HEAD empty)

Red on main: the three new test files import modules that do not exist on origin/main; the Cube description case is A1, which is main's compiler line.

Every leg through scripts/ablation-replace.mjs (anchor must hit, replacement marker counted on disk, restore verified against the HEAD blob):

  • A1 dataset-compiler.ts: drop the measure description write → cube-meta-description-format.test.ts 1 failed / 5 passed.
  • A2 dataset-tools.ts: drop hasPluginWiredAdmission() from the wired check → "REFUSES both tools on a hand-built service" red, 1 failed / 14 passed.
  • A3 analytics-service.ts: skip assertFieldsReadable in the catalogue → withheld and match cases red, 2 failed / 13 passed.
  • A4 dataset-tools.ts: skip the query_dataset input refusal → provenance-forgery case red, 1 failed / 14 passed.
  • A5 dataset-tools.ts: skip the dataset-level admission in query_dataset → one-NOT_FOUND case red, 1 failed / 14 passed.
  • A6 dataset-term-matcher.ts: synonym match by substring → "does not hit on a substring" red, 1 failed / 4 passed.
  • A7 dataset-tools.ts: call queryDataset without the caller's context, rebuilt, ablation-dist-preflight.mjs saw the marker in dist/ → parity 4 failed / 2 passed. Restore leg: rebuilt, preflight --absent, 6 passed.

The first A2 and A3 attempts were refused by the tool (the replacement text already occurred in the file, so no rise could be counted); nothing ran. Re-run with a marker comment.

Acceptance notes

  • query_dataset asks the dataset-level gates (exposure, object read) once to resolve the dataset, so a hidden dataset answers NOT_FOUND like a missing one (spec QueryDatasetInputSchema.datasetName and ADR-0149 D2), then queryDataset asks them again in callCtx. Same gate, same methods, asked twice; no rule of its own.
  • A dataset read that throws answers query_dataset with 503 SERVICE_UNAVAILABLE, not NOT_FOUND; list_datasets answers partial with the reason. The REST door's own .catch(() => null) on the same read answers 404 for a failed read; noted, not changed here.
  • Input refusals use VALIDATION_FAILED / 400 with details.fields, the REST dataset door's code for the same parse.

Verification

Head 7aaedcd2 (origin/main merged at f65c36fcc):

  • pnpm turbo run build --filter='@objectstack/service-analytics...' --filter=@objectstack/rest · pnpm --filter @objectstack/service-analytics test → Test Files 214 passed, Tests 5119 passed / 330 skipped · pnpm --filter @objectstack/service-analytics typecheck and pnpm --filter @objectstack/rest typecheck → exit 0 · rest analytics-dataset-ai-tools-parity, analytics-dataset-refusal-envelope, analytics-routes → 3 files, 29 passed. Lock VERDICT command-exit 0.
  • eslint --no-inline-config over the nine changed source and test files → exit 0.
  • pnpm --filter @objectstack/spec check:liveness → exit 0.
  • node scripts/pm/dispatch-gates.mjs --ran → 78 derived, 78 run, 0 NOT-MEASURED, 0 UNRUN, every exit 0. Three first ran red on container prerequisites, not the diff, and were rerun green: check-plugin-teardown-shape --self-test (shallow clone; fetched the pinned fixture commit), spec check:generated (tsc for check:test-typecheck died without diagnostics under the parallel sweep; green alone at a 6 GB heap, no artifact regenerated), check:dual-build-cjs-loads (needs every dist/; full pnpm build, 119 tasks, under the verify lock, then 122 entries load).

Generated by Claude Code

…ataset)

createDatasetTools / getDatasetToolDefinitions, the term matcher, the
catalogue admission on AnalyticsService and member descriptions on the
compiled Cube. Tests follow.

Claude-Session: https://claude.ai/code/session_01ADHkmRZxiPAWdpf7vuSUcH
Co-authored-by: Claude <noreply@anthropic.com>
…et tools to itself

The bridge hosts reach the tools through the kernel's analytics service, so
neither imports this package.

Claude-Session: https://claude.ai/code/session_01ADHkmRZxiPAWdpf7vuSUcH
Co-authored-by: Claude <noreply@anthropic.com>
…compiled member descriptions

Claude-Session: https://claude.ai/code/session_01ADHkmRZxiPAWdpf7vuSUcH
Co-authored-by: Claude <noreply@anthropic.com>
…dd the changeset

The four dataset member rows (synonyms and description on dimensions and
measures) move planned -> live now that their readers landed; the two Cube
member-description notes say a compiled dataset cube carries one.

Claude-Session: https://claude.ai/code/session_01ADHkmRZxiPAWdpf7vuSUcH
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/service-analytics, @objectstack/spec, touching 46 documentable anchor(s). ⚠️ 4 changed file(s) yielded no anchor (packages/services/service-analytics/src/index.ts, packages/spec/liveness/analytics_cube.json, packages/spec/liveness/dataset.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/api/error-catalog.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/api/index.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/automation/webhooks.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/deployment/self-hosting.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/frontend/plugins/plugin-chatbot.mdx (via toolName (symbol, a field of interface DatasetToolCall))
  • content/docs/kernel/runtime-services/sharing-service.mdx (via NOT_FOUND (literal, a string literal in createDatasetTools))
  • content/docs/permissions/authentication.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/permissions/authorization.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/permissions/sharing-rules.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/protocol/kernel/error-handling.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/ui/print-pages.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))

⛔ 9 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v16.mdx (via queryDataset (symbol, a method of interface DatasetTools))
  • content/docs/releases/v17/17-0.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/releases/v17/17-3.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/releases/v17/17-4.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/releases/v17/17-5.mdx (via AnalyticsService (symbol, a top-level class))
  • content/docs/releases/v17/17-6.mdx (via AnalyticsService (symbol, a top-level class), compileDataset (symbol, a top-level function), /api/v1/analytics/dataset/query (route, the route ledger binds it to client method analytics.queryDataset))
  • content/docs/releases/v17/17-7.mdx (via AnalyticsService (symbol, a top-level class), SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/releases/v18/18-2.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in createDatasetTools; a string literal in wiredService))
  • content/docs/releases/v9.mdx (via queryDataset (symbol, a method of interface DatasetTools))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 4 changed file(s) yielded no anchor (packages/services/service-analytics/src/index.ts, packages/spec/liveness/analytics_cube.json, packages/spec/liveness/dataset.json, …) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_FAILED (literal, 45 pages)
  • 17 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 107 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 171 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json c2bb879fe71c16bd1d0b42708109efb7f6543d5d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e7c2f98f85e203691e2a0cc6af89af0f41ad97a2 — the merge of head 7aaedcd2d662a86138ad32955e47f79a03859a9a into base c2bb879fe71c16bd1d0b42708109efb7f6543d5d, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e7c2f98f85e203691e2a0cc6af89af0f41ad97a2 && git checkout e7c2f98f85e203691e2a0cc6af89af0f41ad97a2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c2bb879fe71c16bd1d0b42708109efb7f6543d5d 7aaedcd2d662a86138ad32955e47f79a03859a9a && git checkout -B drift-repro c2bb879fe71c16bd1d0b42708109efb7f6543d5d && git merge --no-ff 7aaedcd2d662a86138ad32955e47f79a03859a9a

node scripts/docs-audit/affected-docs.mjs --json c2bb879fe71c16bd1d0b42708109efb7f6543d5d

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs c2bb879fe71c16bd1d0b42708109efb7f6543d5d → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQKZzp4DLtqiCkZZRM

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 7aaedcd2d662a86138ad32955e47f79a03859a9a
Local-runs: none

① Derived judgments

  • New public surface (@objectstack/service-analytics exports) is right: createDatasetTools, getDatasetToolDefinitions, DATASET_TOOL_DEFAULT_MAX_ROWS, matchDatasetTerms, DatasetCatalogAdmission, and the AnalyticsService methods datasetTools, hasPluginWiredAdmission, admitDatasetCatalogEntry, reportDatasetCatalogDefect. It is additive only.
  • Accept sets are right: the tool inputs are the spec's D2 schemas (getDatasetToolJsonSchemas), not a second shape, and no existing input or output changed.
  • Cube metadata is right: member descriptions now reach the Cube. This is additive, and the existing description-format test is extended, not loosened.
  • Liveness ledgers are right: the dataset.json / analytics_cube.json rows flip to live with this reader (seat ruling A), and state-counts/dataset.md is regenerated as check:liveness requires.

② Semver level

Clause-②: yes (widening) matches the diff, which adds tools and exports and removes nothing. The changeset level matches the additive surface.

③ Boundary flags

The os-dev-report's open questions (6731447318) are all answered in the seat ACCEPT: names kept, Fixes #31589, VALIDATION_FAILED kept, 503 on a degraded read. The REST door's catch→404 is carried to #31774. The deviation (regenerated state-counts) is accepted.

Implemented-by: claude/project-thread-ehwi7d
Reviewed-by: session_01ADHkmQKZzp4DLtqiCkZZRM

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQKZzp4DLtqiCkZZRM

维护者速读

  • 改了什么: 分析服务新增两个 AI 工具:list_datasets(列出调用者能查的数据集)和 query_dataset(按数据集指标取数)。两个工具共用一份定义、一个执行器,权限沿用数据集查询现有的同一套检查,不新增门,也不绕过(ADR-0149 D2–D4)。
  • 为什么改: 让 AI 按业务口径取数,答案附带 provenance(来源:哪个数据集、哪些指标)。这个字段由执行器根据实际运行生成,模型伪造会被拒绝。
  • 风险与回滚: 只新增工具,现有行为不变。分析服务没有接上插件权限钩子时,两个工具直接拒绝(503),不会静默放行。回滚即还原本 PR。
  • 先看: packages/services/service-analytics/src/dataset-tools.ts,以及 AnalyticsService.datasetTools。
  • 需要你做的: 无,由席位落地。
  • 席位意见: ACCEPT。MCP 一侧由 mcp: register the dataset tools on McpDataBridge under data:read (ADR-0149 D2) #31590(PR feat(mcp): serve list_datasets and query_dataset over MCP under data:read #31773)在本 PR 之后落地。

席位核对 — ACCEPT · domain:server#2 · Head-sha 7aaedcd2d662a86138ad32955e47f79a03859a9a · 2026-11-09T03:49Z

  1. Shape: draft to main, Fixes #31589, Clause-②: yes (widening) (new tools, new exports), Metadata-protocol: none, with a changeset. The diff: dataset-tools.ts (+469), dataset-term-matcher.ts (+79), analytics-service.ts (+187), and dataset-compiler.ts, which puts member descriptions on the Cube. Tests are in service-analytics plus one parity test in packages/rest. The ledger rows were ruled in (A): liveness/dataset.json and analytics_cube.json, plus the regenerated state-counts/dataset.md, which check:liveness forces.
  2. Read of the diff:
    • One executor. It runs over queryDataset with the caller's context, and the catalogue goes through admitDatasetCatalogEntry (the service's own gates). No second permission check, no bypass.
    • Unwired service. Both tools refuse 503 when the service is not plugin-wired (the D4 caveat). Both outcomes are pinned.
    • provenance. Composed from the run after the query; forged provenance in the input is refused 400.
    • Row cap. The cap is the tool layer's, with limit + 1 for truncated.
    • Seam. AnalyticsService.datasetTools(deps) binds the executor to the service (ruling C), so the MCP bridges reach it without a package dependency.
  3. Gates:
    • Dev: 78/78 derived gates exit 0. Three first ran red on container prerequisites (shallow clone, tsc heap, missing dist) and reran green.
    • Tests: service-analytics 5119 passed; REST/chat-tool/direct parity 6/6 across three callers.
    • Ablations: A1–A7 each red, then restored.
    • Check-runs on this head: 55 success, 11 skipped, 0 failed.
  4. Open questions, ruled:
  5. Landing: Clause-② widening with no governed path. The TIER_DEFAULT contract review record on this head is posted beside this ACCEPT. pr_ready + automerge_enable. feat(mcp): serve list_datasets and query_dataset over MCP under data:read #31773 (mcp: register the dataset tools on McpDataBridge under data:read (ADR-0149 D2) #31590) merges main after this lands.

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

Labels

documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

service-analytics: list_datasets / query_dataset AI tools with the D3 selection rule and provenance (ADR-0149 D2-D4)

1 participant