Repository navigation
fix(mcp): render the /mcp/skill data loop from the published objectstack-ask skill - #34881
Conversation
…ack-ask skill The served page's dataset procedure was hand-written and had drifted from skills/objectstack-ask/SKILL.md. scripts/gen-mcp-ask-skill.mjs now writes packages/mcp/src/ask-skill.generated.ts from the skill's body, renderSkillMarkdown serves it under "Answering a business question" behind the unchanged dataset gate, and skill-single-source-34686.test.ts pins both equal to the skill. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…nputs The pin reads skills/objectstack-ask/SKILL.md and names the generator in its failure text; check:cross-package-test-inputs requires both declared and mirrored into the @objectstack/mcp#test turbo inputs. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
📓 Docs Drift Check7 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 12 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 fe932dc92d80d4d4f6efaefbb4ed28697e4ecd2b && git checkout fe932dc92d80d4d4f6efaefbb4ed28697e4ecd2b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e05445e4f5c5ca2dad6aabbb9226a3dc564e55d7 1042a83e9e3edb280c82f4ae1995e2abc57bdabf && git checkout -B drift-repro e05445e4f5c5ca2dad6aabbb9226a3dc564e55d7 && git merge --no-ff 1042a83e9e3edb280c82f4ae1995e2abc57bdabf
node scripts/docs-audit/affected-docs.mjs --json e05445e4f5c5ca2dad6aabbb9226a3dc564e55d7 |
…LOOR scripts/gen-mcp-ask-skill.mjs reads skills/objectstack-ask/SKILL.md, a governed path, so the dispatch-gates census finds a new structural read and the floor must classify it. The generator has no self-test and spells the path in its module body, so the row is declared: false, the shape of the check-skill-top-level-keys row. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
|
repo:objectstack#3 · os-support-ai · session_01WGufzfWpJ96QY9T7d8DvFg L1: ACCEPT · 2026-11-17T16:12ZHead-sha: 4a78d86 席位核对PR shape. Draft, base Scope vs claim. 10 paths. Each is inside the claim as amended, or is listed under the body's "Outside the claimed surface" with the reason a gate required it:
Declaration. Governed / size. Check-runs at 4a78d86. 72 runs, every one Single source. The generator copies the SKILL.md body after the H1 into Console mirror. Must-fixNone. Should-fixNone. Notes
Next: o3-E lands. No seat L2 is owed. A later push owes an L1-c delta read. |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
|
repo:objectstack#3 · os-support-ai · session_01WGufzfR33NbV51QQU6R6bm Landing · 2026-11-17T16:15Z
State: ready + auto-merge armed. Fixes #34686 (PR1 #34790 landed as |
Requested by Yibo Wang · project thread
Fixes #34686
This is the second half of the card: the data-loop text of
GET /mcp/skillis now rendered from the published ask-data skill (skills/objectstack-ask/SKILL.md, landed by #34685 as581c9165), and a test pins the two equal. The first half (the HTTPinitializeinstructions) landed as #34790 (c513d62a).Clause-②: no
Metadata-protocol: none
维护者速读
/mcp/skill页面里"问数"那段流程不再手写,改为由脚本从已发布的objectstack-ask技能正文生成进packages/mcp/src/ask-skill.generated.ts,页面在新小节 "Answering a business question" 下原样输出;两个数据集工具条目只留签名和返回内容一句话。membersWithheld的说法、松散词要先反问、两个词各命中一个指标要都算)。卡片要求单一来源,并用测试钉住两者相等。data:read(或无 scope)的页面,其他宿主和凭据的页面逐字节不变。全量宿主页面从 16,623 增至 20,272 字节。回滚就是 revert 本 PR。范围外文件:turbo.json加两行测试输入(门禁强制);修复轮 1 在scripts/pm/dispatch-gates.data.mjs加一行分类(修 CI 的 PM dispatch-gates 自测)。packages/mcp/src/skill-md.ts(datasetToolsTaught门与renderAskSection插入位置)、scripts/gen-mcp-ask-skill.mjs(截取规则:技能 H1 标题之后的全部正文)、packages/mcp/src/skill-single-source-34686.test.ts。pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/skill-single-source-34686.test.ts,预期 3 个测试全绿;改技能里任意一个词再跑,预期 2 个转红。What changes
scripts/gen-mcp-ask-skill.mjswritespackages/mcp/src/ask-skill.generated.ts(ASK_SKILL_DATA_LOOP, one string) fromskills/objectstack-ask/SKILL.md.--checkexits 1 when the module is stale or missing, and writes nothing.@objectstack/mcpships onlydist, README and CHANGELOG (files[]), soskills/**is not on disk in an installed package; and@objectstack/skillsexports only./package.json, so a runtime dependency on it would mean a filesystem read of another package's build output on every host. Not chosen..md): turbo hashes@objectstack/mcp#buildfrom the package directory plus the root scriptsturbo.jsonlists (build.inputsis$TURBO_DEFAULT$plus those), andskills/**is not among them. A skill-only edit would replay a cacheddistcarrying the old text. It would also need a tsup config change, a*.mdmodule declaration fortsc, and a vitest loader. Not chosen.src/is hashed with the package, ships in itsdist(measured: the section heading and the skill's sentence "One near form is not a match either" are indist/index.jsanddist/index.cjsafterpnpm --filter @objectstack/mcp build), and the pin test goes red on any difference.# Answering a business question over an ObjectStack environment), with blank lines at either end dropped. That is the intro paragraph and steps 1 to 6 (lift the words, decide by the matches with the step 2 table, compute, fall back, when the data cannot answer, writing the answer). The frontmatter and the title stay with the skill. The served page gives the text its own heading,## Answering a business question(ASK_SECTION_HEADING), and copies the rest byte for byte, the skill's##step headings included.list_datasets({ terms? })andquery_dataset({ datasetName, selection }), keep a one-sentence description of what each answer carries and point to the section. Every rule (selection,membersWithheld, fallback, data that cannot answer) now comes only from the skill.datasetToolsTaughtis the conditionrenderDatasetToolLinesheld inline:datasetTools === trueAND (no scopes OR scopes includedata:read). Both the tool entries and the section render only under it. The section is placed after every other block of the tool list (file, dataset, federation, authoring, data-only) and before## Conventions & gotchas, so a render that does not teach the pair is byte-identical to before. The routepackages/runtime/src/domains/mcp.tsis unchanged.packages/mcp/src/mcp-server-runtime.ts: theDATASET_SELECTION_RULEdoc comment pointed atDATASET_TOOL_LINESas holding "the same thing". It now points atASK_SKILL_DATA_LOOPand states where the skill goes further. No code change there..changeset/34686-skill-single-source.md:@objectstack/mcppatch,Clause-②: no,Metadata-protocol: none.Old served text vs new (every divergence found)
Old =
DATASET_TOOL_LINESat7752cac7(packages/mcp/src/skill-md.ts:265-292). New = the skill, as now served.membersWithheld. Old: "some measures exist that you may not read: say so rather than saying the metric does not exist." New: "Say that it has members (measures or groupings) you may not read; the metric asked for may be among them. Do not say the metric does not exist."query_dataset." New: "Each word for a thing measured matches exactly one measure: compute. Two words with one measure each ("营收和赢单率") are two metrics, not a choice: compute both, with onequery_datasetper dataset."partial: true/warningon the catalogue are explained. Old had neither.query_dataset. Old namedmeasures,dimensions,runtimeFilter. New addsdateGranularity,order,limit, andtruncated/warninghandling. Provenance and description use are the same.query_records/aggregate_recordsand say the answer is not from a governed metric." New (step 4):list_objectsthendescribe_object, filter an option field by itsvalue, useaggregate_recordsand never add up pages ofquery_records, open with one line saying it is not from a governed metric (非指标口径) naming the object and fields, and add one line naming a listed dataset on that object (ADR-0149 D3 rule 4's recommended practice; the old page did not carry it).list_datasetsamong your tools: … Go to step 4" is served too. On this page it never applies, because the section renders only wherelist_datasetsis registered. It is kept so the copy stays exact./mcp/skillsize, bytes (UTF-8)In-process
renderSkillMarkdownwithmcpUrl: 'http://localhost:3000/api/v1/mcp', nograntedScopes(what the public route passes for every caller, admin included):7752cac7)e8dd0048)The first row is the card's
examples/app-crmreading. The card measured 16,625 with a five-digit port, which adds one byte to each of the URL's two occurrences. After, with grants:data:read19,031;data:write14,184;metadata:write12,943 (no dataset text in the last two).Tests
packages/mcp/src/skill-single-source-34686.test.ts, 3 tests. It readsskills/objectstack-ask/SKILL.mdand takes its data loop by the generator's rule. (1)ASK_SKILL_DATA_LOOPequals it. (2) The sectionrenderSkillMarkdownserves underASK_SECTION_HEADINGequals it, for four renders: unscoped, a full host with a URL,data:read, anddata:read+metadata:writewith an authoring tool. (3) The gate still drops it:data:write,metadata:write, an empty grant, nodatasetTools, anddatasetTools: falsewithdata:readeach render no section, no step heading and nolist_datasets. The failure text says to runnode scripts/gen-mcp-ask-skill.mjs.packages/mcp/src/mcp-dataset-tools.test.ts, two tests rewritten. "renders the rule…" asserted the old prose ('Choosing between a metric and an object query', 'nor draw a conclusion from one', 'Any figure you add comes from a tool answer; cite it.'). Those words are now the skill's, and the new file pins the whole section byte-equal to it. The two tests now assert the section heading is present, sits after**query_dataset(and before the conventions, and is absent without the pair. The third test (thedata:readgate onlist_datasets) is unchanged.skill-md.test.ts,renderObjectStackSkill(options) === renderSkillMarkdown(options)) and the native-surface drift guard (skill-md-surface-guard.test.ts) pass unchanged. The mirror renders no dataset text, so the Console copy (ui/apps/console/src/pages/developer/objectstack-skill.ts) needs no edit.Test runs (head e8dd004 unless stated)
pnpm --filter @objectstack/mcp test(under the shared verify lock):Test Files 70 passed (70),Tests 1244 passed (1244),VERDICT command-exit 0.pnpm --filter @objectstack/mcp typecheckat29cd2d0e(the second commit touches onlyturbo.jsonand the registry):tsc --noEmitexit 0, thencheck:test-typecheck: OK — @objectstack/mcp's test layer compiles under packages/mcp/tsconfig.test.json; 6 file(s) / 53 error(s) / 8 pinned signature(s) held(debt unchanged),VERDICT command-exit 0.node scripts/gen-mcp-ask-skill.mjs --check:packages/mcp/src/ask-skill.generated.ts is current with skills/objectstack-ask/SKILL.md., exit 0. Before the module existed, the same command printedis missing … Run: node scripts/gen-mcp-ask-skill.mjsand exited 1.pnpm --filter @objectstack/mcp build:check-dts-emitted: @objectstack/mcp - 2/2 declared declaration file(s) present.Ablation (one-shot, scripts/ablation-replace.mjs, at 29cd2d0)
One word of the skill, in the worktree only: anchor
outranks a number you work out yourselfwas replaced byoutranks a number you compute yourself. Output:anchor x1 -> x0,replace x0 -> x1,blob 482410fbd632 -> 7e726754f3fa. Then× the generated module equals the skill's data loop,× the served section equals the skill's data loop, for every grant that is taught the dataset pair,Tests 2 failed | 1 passed (3). Restore:ok restored: blob == HEAD (482410fbd632) and git diff HEAD is empty.git hash-objectof the file andHEAD:skills/objectstack-ask/SKILL.mdwere both482410fbd632e8e09f9e1d88017906f35d58fc4aafterwards. Nodist/is involved: the test imports the module from source and reads the skill from disk.Outside the claimed surface
The claim's PR2 surface is
packages/mcp/src/skill-md.ts, new modules and tests inpackages/mcp/src/,packages/runtime/src/domains/mcp.ts(not touched),scripts/cross-package-test-inputs.mjsand.changeset/. Outside it:scripts/gen-mcp-ask-skill.mjs: new, the generator. Nopackage.jsonscript was added. Agen:script would enter the generator ledger thatgit-merge-regen.mjsreconciles; the pin test already fails in CI on drift.turbo.json: two lines added to@objectstack/mcp#testinputs ($TURBO_ROOT$/skills/objectstack-ask/SKILL.md,$TURBO_ROOT$/scripts/gen-mcp-ask-skill.mjs).check:cross-package-test-inputsrequires every glob declared in the registry to be mirrored there. Without them it is red:turbo.json "@objectstack/mcp#test" inputs are missing the declared glob(s): $TURBO_ROOT$/skills/objectstack-ask/SKILL.md. The generator is declared because the test names it in its failure text, and the gate flagged it asnamed in packages/mcp/src/skill-single-source-34686.test.ts.packages/mcp/src/mcp-server-runtime.ts: doc comment only, see What changes.packages/mcp/src/mcp-dataset-tools.test.ts: an existing test file, see Tests.scripts/pm/dispatch-gates.data.mjs: oneGOVERNED_READ_FLOORrow and its doc paragraph (fix round 1, below).Acceptance notes
DATASET_SELECTION_RULEvs the skill. This is theinitializerule from feat(mcp): initialize instructions carry the governed-metric selection rule and the skills install line #34790, atpackages/mcp/src/mcp-server-runtime.ts:1813-1818on this head. Not changed here. It says "Several matches: ask the user which one they mean" and "No match: fall back to query_records / aggregate_records". The skill (skills/objectstack-ask/SKILL.md:48,:51) computes two metrics when two words each match one measure, and asks before falling back when a word with no match is a loose form of several listed measures. Thelist_datasetstool description (packages/services/service-analytics/src/dataset-tools.ts:85-96) carries the same text as the rule, and ADR-0149 D3's amendment names service-analytics: list_datasets fillscandidateswith near members (name, label, synonym) on a zero-match, only from what the caller may read #34763 as the carrier for the tool descriptions' question-before-fallback branch. Changing only the instructions here would make them disagree with the tool description instead. This is left to the seat (see the report).list_datasetsamong your tools … Go to step 4" on a page that only renders wherelist_datasetsis registered. It is inert there and kept for exactness.##, siblings of the page's own##sections. They are not demoted, because a transform would make the copy no longer the skill's bytes.Verification
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 84 families at29cd2d0eand 85 ate8dd0048(+ pnpm check:turbo-task-graphforturbo.json). All were run locally. Reconciliation--ranwith exit codes:85 derived famil(ies) accounted for — 84 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).pnpm check:cross-package-test-inputswas red at29cd2d0e(the two findings quoted above). After theturbo.jsonand registry commit:OK: 32 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.pnpm check:ci-filter-parityandpnpm check:turbo-task-graphwere re-run after that commit: both OK.check:dual-build-cjs-loads, reason:PREREQUISITE NOT MET — this gate reads built output, and some package has no dist/(48 unbuilt packages outside this diff's closure). It runs in CI's Lint & Repo Gates.node scripts/pm/check-governed-merges.mjs --branch claude/issue-34686-skill-single-source:0 of 9 path(s) hit the register … NOT governed, 465 changed lines.node scripts/pm/overlap-check.mjsone8dd0048:origin/main: merges cleanly,VERDICT clean exit 0.pnpm exec eslint --no-inline-configon the seven code files): exit 0. The repo-wide lint is CI's.Fix round 1
CI on
e8dd0048was red onLint · PM dispatch-gates(and so onLint & Repo Gates) with one self-test case:every structural read of a GOVERNED file under scripts/ is classified in GOVERNED_READ_FLOOR — unpinned: scripts/gen-mcp-ask-skill.mjs::skills/objectstack-ask/SKILL.md,1 of 2217 case(s) failed. Reproduced locally withpnpm check:pm-dispatch-gates: the same single failure.4a78d86b): one row inGOVERNED_READ_FLOOR(scripts/pm/dispatch-gates.data.mjs),{ script: 'scripts/gen-mcp-ask-skill.mjs', file: 'skills/objectstack-ask/SKILL.md', declared: false }, with an "eighth row" doc paragraph.declaredis false because the floor reads it off aself-test-readsline, and the generator has no self-test; it spells the skill path in its module body, the shape of thecheck-skill-top-level-keys.mjsrow. The caseeach pinned row's DECLARED flag still reads off the filepasses, so the flag is the live one.every governed read in the census is DERIVED for the file it readshas no family to place it under (it passes:none underived). Nothing new was declared. A change toskills/objectstack-ask/SKILL.mdalone derives 27 families (for examplecheck:skill-docs,check:cross-package-test-inputs,check-skills-token-ratchet.mjs), and none of them isgen-mcp-ask-skill.mjs --check. What re-runs on such a change is the@objectstack/mcptest suite (Test Core), through theturbo.jsoninput and thecross-package-test-inputsrow added earlier in this PR, and itsskill-single-source-34686.test.tsfails on drift and names the generator.pnpm check:pm-dispatch-gatesexit 0,✓ dispatch-gates self-test (fast tier): 2217 cases pass; 9 slow section(s) deferred.check-governed-merges --branch:0 of 10 path(s) hit the register … NOT governed, 482 changed lines. The branch merges cleanly withorigin/main(fc5913e1), so it was not merged.overlap-checkon4a78d86b:VERDICT clean exit 0(it sharesdispatch-gates.data.mjswith fix(dispatch-gates): a migration-entry change derives the cli guidance test that reads every entry #34893 and feat(scenarios): skill-evals runs the published skills' eval cases on a with-skill and a no-skill arm #34841, and both merge cleanly). A first run had answered exit 3 (files of #34837 unreadable) and the re-run answered clean.Gates for this round
The 63 families derived for
scripts/pm/dispatch-gates.data.mjswere run locally on4a78d86b: 62 exit 0, andpnpm check:i18n-coverageexit 3 (PREREQUISITE NOT MET: unbuiltdist/), so it is NOT MEASURED here.--ranover the whole branch:115 derived, 62 run, 1 NOT-MEASURED, 52 UNRUN. The 52 unrun are derived from this PR's earlier files, which this round did not change. One8dd0048every check-run but the two above was success or skipped.Generated by Claude Code