Repository navigation
Commit abb40ae
docs(skills): the ask skill teaches withheldFields, the database top-N cut and totalGroups (#35268)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg1XdbbGasMNVx41tq3hZKV4)_
Fixes #35191
Fixes #35203
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:问数技能 `objectstack-ask`
多教三件事:字段被字段级权限隐藏(`withheldFields`)时说「你看不到」而不是「为空」;排名(前 N / 后 N)让数据库用
`orderBy` + `limit` 排好再截;结果被截断时引用 `totalGroups`
作为截断前一共多少组;`query_dataset` 没有 `totalGroups` 时说总数未知(`query_records` 分页自带
`total`,不受影响)。
- 为什么改:服务端已经返回 `withheldFields`、`totalGroups`
和数据库排名截断,但技能还没教,模型可能把隐藏字段说成空值,或把返回的行数当成总数。
- 风险与回滚:只改技能文字和由它生成的 `GET /mcp/skill` 页面,不改任何代码路径;回滚即 revert 本 PR。技能
token 天花板 1779 → 1877(+98),按常设裁决先删重复、余额按实测提高。
- 先看:`skills/objectstack-ask/SKILL.md`(第 4 步两条新句、第 6 步合并后的 `truncated`
句);`scripts/check-skills-token-ratchet.mjs` 的 ask
行注释;`skills/objectstack-ask/evals/metric-selection-fallback.json` 新增的
12、13 两例。
- 两分钟验证:`node scripts/check-skills-token-ratchet.mjs && node
scripts/gen-mcp-ask-skill.mjs --check`,预期 ask 行 `1877 / 1877` 且生成模块
current。
- 需要你做的:本 PR 含 ratchet 行与 `packages/mcp` 生成模块,属 Tier H:需授权账号 APPROVED
审核,之后由席位落地。
## What changes
`skills/objectstack-ask/SKILL.md`, and
`packages/mcp/src/ask-skill.generated.ts` regenerated from it:
- **Step 4, `withheldFields` (#35191, line 1, card wording verbatim):**
"`withheldFields` on a `query_records` or `get_record` answer names
fields that exist but are hidden from you: say they are not visible to
you, never that they are empty." It stays inside #35137's ruling A
(comment 6977609191): the bullet speaks only of a field the answer
names, and the server names only a field the caller's own served schema
shows.
- **Step 4, top or bottom N (#35191, line 2):** "For a top or bottom N,
pass `orderBy` (an aggregation alias or a group key) and `limit: N`, so
the database ranks and cuts the groups." The card's closing clause
("cite `totalGroups` as how many groups existed before the cut") moved,
in those words, into the shared sentence below, as #35203 asks ("use one
shared sentence for both").
- **Step 6, one shared `truncated` bullet (#35203):** "`truncated:
true`: more rows or groups existed than came back; say the result is
partial, and cite `totalGroups` as how many groups existed before the
cut. Without it, say a `query_dataset` total is unknown, not
`rowCount`." Source text: scope note 6982266158 and the `totalGroups`
describe in `packages/spec/src/ai/dataset-tools.zod.ts` (present on both
the pushed-down and the in-memory window, absent only where the count is
not provable). It covers `query_dataset` and `aggregate_records` in one
place, because step 6 is read on both the governed path (step 3) and the
fallback (step 4). "Unknown" is scoped to `query_dataset`:
`aggregate_records` always answers `totalGroups`, and a capped
`query_records` page or `get_record` related list states its own `total`
(contract review 6997032414, M1).
- **Cut, the restatements the shared bullet replaces:** step 3's
"`truncated: true`: more rows existed than came back. Say the result is
partial." and step 4's "`truncated: true` on its answer means groups
were cut off: say so." Step 3 keeps its `warning` sentence.
- **Evals:** four cases in
`skills/objectstack-ask/evals/metric-selection-fallback.json`: #12 (a
`query_records` answer with `withheldFields: ['probability']` → "not
visible", never "is empty" or "is blank"), #13 (a top-5 `query_dataset`
answer with `truncated: true` and no `totalGroups` → "partial", total
"unknown", never 5), #14 (an `aggregate_records` top-3 with
`totalGroups: 41` → cites 41, never "unknown") and #15 (a capped
`query_records` page with `total: 240` → says 240, never "unknown").
Evals are unpriced by the ratchet (ruling record 6513306068, part 1).
- **Ratchet:** the `skills/objectstack-ask/SKILL.md` row moves 1779 →
1873 → 1877, each measurement written into its note. The raise path is
the standing maintainer ruling 「A:先削重复,余额按实测提高」 (2026-10-27), which
ruling record 6513306068 (letter B) made the gate-recognised path: the
restatements above are cut in the same file first (-151 bytes), and the
row moves by the measured remainder only. Text net +377 bytes: 7135 →
7512, less the 20-byte stamp line, `ceil(7492 / 4)` = 1873 (+94); the M1
fix then took the step-6 bullet from 215 to 230 bytes: 7512 → 7527,
`ceil(7507 / 4)` = 1877 (+4). Pinned AT the measurement with zero
headroom. No other row moves.
- **Changeset:** `.changeset/35191-ask-skill-withheld-totalgroups.md`,
`patch` on `@objectstack/skills` and `@objectstack/mcp` (the generated
module ships in `@objectstack/mcp`).
`content/docs/ai/skills-reference.mdx` and `skills/README.md` were
regenerated (`gen:skill-docs`) and came out byte-identical: they render
the frontmatter only, which is unchanged.
### Skills size readings (`skills/**` touched)
| Reading | Before (`origin/main` e8a78c4) | After (this head) |
|:--|--:|--:|
| `skills/objectstack-ask/SKILL.md` lines | 120 | 125 (+5) |
| `skills/objectstack-ask/SKILL.md` ratchet tokens | 1779 | 1877 (+98) |
| Bundle, all 13 `skills/*/SKILL.md`, lines | 4830 | 4835 (+5) |
| Bundle, all 13 `skills/*/SKILL.md`, bytes | 253765 | 254157 (+392) |
No re-wrap is counted as payment: the one re-flowed line (step 3's
`warning` sentence, now on one line) moves 2 bytes and is inside the net
figure.
## Tests
<details><summary>Ask-skill single source and the mcp package</summary>
- `pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2
src/skill-single-source-34686.test.ts` → `Tests 3 passed (3)` (the
generated module and the served `/mcp/skill` section equal the skill's
data loop).
- `pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2` →
`Test Files 77 passed (77)`, `Tests 1400 passed (1400)`.
- `pnpm --filter @objectstack/mcp typecheck` → exit 0;
`check:test-typecheck: OK`.
- Built first: `pnpm --workspace-concurrency=2 --filter
'@objectstack/mcp...' build` → lock `VERDICT command-exit 0`.
- All of the above re-run on head `f7e199c4` with the same results (one
lock run, `VERDICT command-exit 0`).
</details>
No ablation: the diff changes served text and a ratchet row, no tested
behaviour.
## Acceptance notes
- The dispatch asked the lines to pay for themselves in the file.
Cutting restatement covered 151 of 528 added bytes; the rest of the file
outside step 1/2 (held by #35158) carries no further restatement, so the
row moves by the measured remainder under ruling 6513306068 letter B,
quoted above. The seat's contract review checks the deletion and the
quote.
- The shared sentence's "say the result is partial" half is general to
`truncated: true` and true on all four answers that carry it. Its count
half reaches only the analytics answers: it cites `totalGroups` where
the answer has one, and says the total is unknown only for a
`query_dataset` answer without it. A capped `query_records` page and a
`get_record` related list carry no `totalGroups` and state their own
`total`, which the bullet leaves alone (eval #15 pins it).
## Verification
<details><summary>Local gate subset (dispatch-gates --commands, narrowed
to this diff)</summary>
Derived by `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at ef142a1 and again at f7e199c (the same
88 commands); the readings below are from f7e199c. 85 exit 0, including
`node scripts/check-skills-token-ratchet.mjs`
(`skills/objectstack-ask/SKILL.md is 1877 tokens (ceiling 1877; headroom
0)`), `pnpm --filter @objectstack/spec run check:skill-docs`, `pnpm
check:nul-bytes`, `pnpm check:doc-authoring`, `node
scripts/check-adr-0087-registration.mjs --base origin/main`, `node
scripts/check-empty-changeset.mjs --base origin/main`. `node
scripts/gen-mcp-ask-skill.mjs --check` → current.
NOT MEASURED locally (exit 3, PREREQUISITE NOT MET, CI runs them): `node
scripts/check-plugin-teardown-shape.mjs --self-test` (shallow clone
cannot reach its pinned fixture commit) and `pnpm
check:dual-build-cjs-loads` (needs every package's `dist/`; only the mcp
closure was built).
`pnpm check:pm-dispatch-gates` (run outside the 88 above, in the
background with a foreground wait): `✓ dispatch-gates self-test (fast
tier): 2249 cases pass`, exit 0.
Reconciliation: `node scripts/pm/dispatch-gates.mjs --ran` with exit
codes recorded → `88 derived famil(ies) accounted for — 86 run, 2
NOT-MEASURED (2 DERIVED from a recorded exit 3)`.
The gate union ran on head `f7e199c4`.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7
<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbUb7TcZK1XUAddUmQ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f848e37 commit abb40ae
5 files changed
Lines changed: 100 additions & 11 deletions
File tree
- .changeset
- packages/mcp/src
- scripts
- skills/objectstack-ask
- evals
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 71 | + | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
| |||
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
85 | | - | |
86 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
105 | 110 | | |
106 | 111 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1923 | 1923 | | |
1924 | 1924 | | |
1925 | 1925 | | |
1926 | | - | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
1927 | 1953 | | |
1928 | 1954 | | |
1929 | 1955 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
| 86 | + | |
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
| |||
97 | 95 | | |
98 | 96 | | |
99 | 97 | | |
100 | | - | |
101 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
120 | 125 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
113 | 153 | | |
114 | 154 | | |
115 | 155 | | |
0 commit comments