Repository navigation
Commit 0ad4f48
test(mcp,runtime): pin the dataset tools' degraded read when the i18n service's reads throw (#35029)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX
Closes #34876
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:只加测试。在 stdio 与 HTTP 两个 MCP 入口各加一组用例,钉住"i18n 服务能解析到、但 getLocales /
getTranslations 抛错"时数据集工具的现有回答。
- 为什么改:这个降级路径此前没有任何测试,后续改动可能把它悄悄变成别的回答。席位裁决 A:现有回答(目录清空并标 partial、查询
503)就是要钉住的回答。
- 风险与回滚:零运行时风险,不改任何源码,发布产物不含测试文件。回滚即还原这两个测试文件。
- 先看:packages/runtime/src/mcp-dataset-tools-bridge.test.ts 末尾新增的
describe;packages/mcp/src/stdio-data-bridge.dataset-locale.test.ts 末尾新增的
describe。
- 两分钟验证:pnpm --filter @objectstack/mcp exec vitest run
src/stdio-data-bridge.dataset-locale.test.ts,预期 9 个用例全绿(其中 5 个为本 PR 新增)。
- 需要你做的:无,席位落地。
## Premise correction
The card said a resolved i18n service whose `getLocales` /
`getTranslations` throws makes the dataset catalogue fall back to
untranslated text. Measured, it does not (premise report on the card,
comment 6962311179; claim amendment 6962350323). `translationBundleOf`
calls both reads with no guard, so `translateMetaList` rejects with the
i18n error. `loadDatasets` does not catch that on either transport, and
the dataset executor answers the throw as a degraded read:
`list_datasets` returns `datasets: []`, `partial: true` and the warning
"The dataset catalogue could not be read: MSG"; `query_dataset` refuses
503 `SERVICE_UNAVAILABLE`. Seat ruling A: pin that answer. A follow-up
(B: serve the untranslated text on a translation fault, inside the
shared translator) would flip these pins on purpose. Re-measured on
`origin/main` 4443014, the base of this branch: the answer has not
changed since db1a05c, and none of the source files involved changed
between the two commits.
## What changes
Tests only. No source file is edited.
- `packages/mcp/src/stdio-data-bridge.dataset-locale.test.ts` (the
shared harness for this seam): a new top-level `describe` that drives
`createStdioDataBridge` over the REAL executor. That executor is the
analytics service `AnalyticsServicePlugin` registers, with admission
wired, over an open security double and an engine double that declares
the dataset's object.
- `packages/runtime/src/mcp-dataset-tools-bridge.test.ts` (the harness
of the real HTTP door, `packages/runtime/src/domains/mcp.ts`): the same
`describe` through `buildMcpBridge`, with the i18n service resolved
through the request's `resolveService`, over the same real executor.
Each `describe` has:
- a control case: when the i18n reads answer, the same harness lists the
dataset in its bundle label. This shows that an empty catalogue in the
throwing cases comes from the failed read, not from the harness;
- for `getLocales` throwing and for `getTranslations` throwing:
`list_datasets` equals `{ datasets: [], partial: true, warning }`, where
the warning starts "The dataset catalogue could not be read: " and names
the i18n error;
- for the same two throws: `query_dataset` refuses with `code:
'SERVICE_UNAVAILABLE'`, `status: 503`, and a message that names the
failed read and the i18n error ("the dataset read failed (MSG)"). That
message tells it apart from the executor's other 503, "not available on
this deployment".
The comment on each `describe` says the answer is pinned on purpose
under seat ruling A, and that follow-up B would flip it deliberately.
## Tests
All at head 0cdcef6.
- `pnpm --filter @objectstack/mcp test`: Test Files 71 passed (71),
Tests 1257 passed (1257), exit 0.
- `pnpm --filter @objectstack/runtime test`: Test Files 618 passed
(618), Tests 11459 passed, 23 skipped (11482), exit 0.
- `pnpm --filter @objectstack/mcp typecheck` and `pnpm --filter
@objectstack/runtime typecheck`: lock VERDICT command-exit 0. Both
packages' `check:test-typecheck` compile the two edited test files, and
the debt ledgers are unchanged.
### Ablation (one per pin, then restored)
The ablation is the one the claim named: catch `translateMetaList` in
`loadDatasets` and fall back to the untranslated items. It was applied
through `node scripts/ablation-replace.mjs` (wrap mode: the anchor must
hit exactly once, the mutation is proven on disk, and the restore is
proven by `blob == HEAD` and an empty `git diff HEAD`). Both test files
import the door under test by relative path (`./stdio-data-bridge.js`,
`./domains/mcp.js`), so the tests read `src/` and no `dist/` rebuild
sits between mutation and run.
<details><summary>stdio: packages/mcp/src/stdio-data-bridge.ts, 4 failed
/ 5 passed (9), then restored</summary>
```text
ablation-replace: ok mutation landed: anchor 1 -> 0, blob f4f5d63 -> e3a455986ba4
❯ src/stdio-data-bridge.dataset-locale.test.ts (9 tests | 4 failed)
× 'getLocales' throwing: list_datasets lists nothing, says partial and names the i18n error
× 'getTranslations' throwing: list_datasets lists nothing, says partial and names the i18n error
× 'getLocales' throwing: query_dataset refuses 503 SERVICE_UNAVAILABLE, naming the failed read
× 'getTranslations' throwing: query_dataset refuses 503 SERVICE_UNAVAILABLE, naming the failed read
AssertionError: expected { datasets: [ { …(6) } ] } to deeply equal { datasets: [], partial: true, …(1) }
- "datasets": [],
- "partial": true,
- "warning": StringContaining "locales exploded",
+ "datasets": [ { "name": "opp_metrics", "label": "Opportunity Metrics", ... } ],
AssertionError: expected undefined to match object { code: 'SERVICE_UNAVAILABLE', …(1) }
os-verify-lock: VERDICT command-exit 1
ablation-replace: ok restored: blob == HEAD (f4f5d63) and `git diff HEAD` is empty
```
</details>
<details><summary>HTTP door: packages/runtime/src/domains/mcp.ts, 4
failed / 7 passed (11), then restored</summary>
```text
ablation-replace: ok mutation landed: anchor 1 -> 0, blob b4a8eb6 -> dd2d96eb1cb2
❯ |local| src/mcp-dataset-tools-bridge.test.ts (11 tests | 4 failed)
× 'getLocales' throwing: list_datasets lists nothing, says partial and names the i18n error
× 'getTranslations' throwing: list_datasets lists nothing, says partial and names the i18n error
× 'getLocales' throwing: query_dataset refuses 503 SERVICE_UNAVAILABLE, naming the failed read
× 'getTranslations' throwing: query_dataset refuses 503 SERVICE_UNAVAILABLE, naming the failed read
AssertionError: expected { datasets: [ { …(5) } ] } to deeply equal { datasets: [], partial: true, …(1) }
- "datasets": [],
- "partial": true,
- "warning": StringContaining "locales exploded",
+ "datasets": [ { "name": "sales_analysis", "label": "Sales analysis", ... } ],
AssertionError: expected undefined to match object { code: 'SERVICE_UNAVAILABLE', …(1) }
os-verify-lock: VERDICT command-exit 1
ablation-replace: ok restored: blob == HEAD (b4a8eb6) and `git diff HEAD` is empty
```
</details>
Under the ablation, the catalogue lists the dataset untranslated and
`query_dataset` resolves with no refusal: that is answer B, so every
throwing case goes red. After the restore, `git status --porcelain` is
empty.
## Acceptance notes
- An earlier draft of the stdio pins ran over the executor with no
security or engine double. Under the ablation it still answered
`datasets: []` (permissions could not be resolved), so only the warning
told the two apart. The final harness admits the dataset (see the
control case), so under the ablation `datasets` really does carry the
untranslated entry.
- Changeset: none. The diff edits two `*.test.ts` files; both packages
publish `files: ["dist", "README.md", "CHANGELOG.md"]`. After building
both packages, a search of `dist/` for a test-only symbol
(`i18nWhoseReadThrows` / `locales exploded`) found 0 files in each, and
the positive control (`translateMetaList`) found 2 files in mcp and 3 in
runtime. Declared `skip-changeset`.
- The object tools (`list_objects` / `describe`) call the same unguarded
translator on both transports. That is read from the code, not driven,
and stays outside this card; follow-up B covers it.
## Verification
<details><summary>Derived gate families (dispatch-gates --commands at
0cdcef6): 50 derived, 49 run green, 1 NOT MEASURED</summary>
- `node scripts/pm/dispatch-gates.mjs --ran` (with per-command exit
codes): "50 derived famil(ies) accounted for — 49 run, 1 NOT-MEASURED".
- 49 commands exited 0. They include `check:cross-package-test-inputs`,
`check:test-source-alias`, `check:engine-double-contract`,
`check:nul-bytes`, `check:issue-citations`, `check:doc-authoring`,
`check:type-check-coverage`, `check:type-check-debt`,
`check:undeclared-dep-imports` and `check:published-files`.
- NOT MEASURED: `pnpm check:dual-build-cjs-loads` exited 3, PREREQUISITE
NOT MET (it reads every package's built `dist/`, and this worktree built
only the mcp/runtime closure). CI runs it.
- `node scripts/pm/overlap-check.mjs`: "VERDICT clean exit 0"
(origin/main merges cleanly, 0 open PRs share a file).
- The full CI farm (Lint and Repo Gates, Test Core, Build Core and the
rest) is CI's to run. This report cites no CI verdict because CI had not
finished when it was written.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzg2evNa1V3zxrQq3KX -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4df62e6 commit 0ad4f48
2 files changed
Lines changed: 248 additions & 2 deletions
File tree
- packages
- mcp/src
- runtime/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
141 | 149 | | |
142 | 150 | | |
143 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
108 | 112 | | |
109 | 113 | | |
110 | 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 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
0 commit comments