Repository navigation
Commit 7971d24
docs(skills): objectstack-ai names the save refusal of a knowledge_source whose adapter is not mounted (#38224)
Fixes #38158
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:给 AI
编程助手看的知识源技能文档里,「存储」那一行多了一句:保存时指定了本部署没挂载的存储会被当场拒绝,以及两种修法;升级说明里「不写存储」那句补上了限定条件。运行行为不变。
- 为什么做:属于「知识检索」这条线的收尾,替写知识源的作者和 AI 助手解决「照文档写却被拒绝」的问题。
- 出错会怎样:只是文档措辞和测试,最坏是这句话写得不准;可以直接撤回,不影响任何已保存的数据。
- 要你做的:这个改动碰了对外发布的技能文档,需要按规定的审核流程放行落地。
## What changes
1. `skills/objectstack-ai/SKILL.md` § Knowledge Sources, the `adapter`
row. It named the refusal of an omitted adapter only. It now also says
that a run-time save naming an adapter the deployment does not mount is
refused (`400 VALIDATION_ERROR`, nothing written), naming the source,
the adapter and the mounted ones, with the two remedies that always
hold: name a mounted one, or mount the store and save again. Worded from
`unmountedAdapterSaveText` in
`packages/services/service-knowledge/src/knowledge-service.ts`.
2. Pins, no behaviour change:
- `knowledge-source-admission.test.ts`: the "leave `adapter` out" remedy
is offered with one adapter mounted and with the deployment's adapter
mounted; it is withheld with two mounted and none marked, with a
deployment adapter that is not itself mounted, and with none mounted. A
control asserts what the clause promises: the omitted adapter is
admitted where the remedy is offered and refused where it is withheld.
- `packages-knowledge-source-gate.test.ts`: the package-duplicate door
answers this refusal `400` with `error.code` `VALIDATION_ERROR` and the
save's own sentence, and copies nothing.
3. Migration entry `knowledge-source-unmounted-adapter-refused-at-save`:
its `replacement` now qualifies "no `adapter` at all": on a host that
mounts several adapters and marks none the deployment's, a source with
no `adapter` is itself refused, so name one there.
4. `scripts/check-skills-token-ratchet.mjs`: the
`skills/objectstack-ai/SKILL.md` row moves 7148 to 7200, pinned at the
measurement taken on this head, which carries `main` 333e6f3 (with PR
#38292, which moved the same row 6906 to 7148).
5. Changeset: `@objectstack/skills` patch and `@objectstack/spec` patch
(the entry's text ships in the upgrade guide). The two test files
publish nothing, so `@objectstack/service-knowledge` and
`@objectstack/runtime` take none.
### Skill size readings
Raise path: the standing ruling 「A:先削重复,余额按实测提高」 (ruling record
6513306068, letter B). Paid down first, in the same file: the row's
"Optional" (its "Omitted:" clause already says the key may be left out).
| Reading | Before (`main` 333e6f3) | After (head e3e2fab) |
|:---|---:|---:|
| `skills/objectstack-ai/SKILL.md`, lines | 505 | 505 |
| `skills/objectstack-ai/SKILL.md`, bytes | 28617 | 28827 |
| `skills/objectstack-ai/SKILL.md`, tokens (priced bytes, stamp line
excluded: 28590 to 28800) | 7148 | 7200 |
| All `skills/*/SKILL.md`, lines | 4956 | 4956 |
| Ratcheted bundle, tokens | 200068 | 200120 |
The row moves +52, the measured remainder only: `ceil(28800 / 4) =
7200`. The merge of `main` 333e6f3 conflicted on this row only; it
was resolved by keeping `main`'s 7148 note and adding this PR's note
above the re-measured row.
## Why
PR #38060 added the save refusal and the migration entry. Its contract
review left three follow-ups: the published skill did not teach the
refusal, the remedy branches of the refusal text and the duplicate
door's answer had no pin, and the entry's `replacement` offered a remedy
that is itself refused on one kind of host.
## Tests
Read first, by risk:
1. `skills/objectstack-ai/SKILL.md`, the `adapter` row: published text;
check it against `unmountedAdapterSaveText`.
2.
`packages/spec/src/migrations/entries/semantic/19.knowledge-source-unmounted-adapter-refused-at-save.ts`,
`replacement`: shipped upgrade-guide text.
3. `scripts/check-skills-token-ratchet.mjs`, the new note above the row:
the arithmetic.
Two-minute check: `pnpm --filter @objectstack/service-knowledge exec
vitest run src/__tests__/knowledge-source-admission.test.ts -t 'offers
leaving'` prints 1 passed.
The two edited test files, `check-skills-token-ratchet` (gate and
self-test) and `check:skill-docs` were re-run on head `92cc3cd391` (the
first head, the row re-pin, and merges of `main` up to bd5407e).
Heads `f75d35a017` and `f2f00af325` add clean merges of `main`
(98bd8de, which lowers the `objectstack-ui` row, then f19350b),
and head `e3e2fab53f` merges `main` 333e6f3 with the one ratchet-row
conflict resolved as above. The second carries #38208 (898b056),
which edits
`packages/runtime/src/domains/packages-knowledge-source-gate.test.ts`
(also edited here, in other hunks; git merged them without a hand) and
`packages/runtime/src/domains/packages.ts` and
`packages/metadata-core/src/knowledge-source-save-admission.ts`, which
this PR's duplicate-door pin exercises. On `f2f00af325` and `e3e2fab53f`
only the ratchet gate and its self-test were re-run locally (exit 0);
the edited tests on the merged tree are read from this head's `Test
Core`. The ablation, the 121-family gate list and the package-wide runs
below were read on the first head `d9c88726c4`, before those merges.
<details><summary>Edited test files</summary>
```
pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/knowledge-source-admission.test.ts
Test Files 1 passed (1)
Tests 89 passed (89)
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/packages-knowledge-source-gate.test.ts
Test Files 1 passed (1)
Tests 75 passed (75)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Ablation: the pins go red when the branch or the
mapping is reverted</summary>
Each mutation was applied with `scripts/ablation-replace.mjs` (anchor
hit once, restore verified as blob equal to HEAD and an empty `git diff
HEAD`). Both subjects are imported from `src`, so no `dist` leg applies.
| Mutation | Result |
|:---|:---|
| `placeable = true` (always offer the remedy) | 1 failed: expected the
message not to contain "leave `adapter` out" |
| `placeable = false` (never offer it) | 1 failed: expected the message
to contain "leave `adapter` out" |
| `placeable = deployment !== undefined OR mounted.length === 1` (drop
the "deployment's adapter is mounted" test) | 1 failed: expected the
message not to contain "leave `adapter` out" |
| `packages.ts`: the duplicate door answers a fixed `403` in place of
`refused.status` | 1 failed: expected 403 to be 400 |
</details>
## Acceptance notes
- The skill row omits the third remedy the runtime may print ("leave
`adapter` out"): it is conditional, and the row's own "Omitted:" clause
already states where an omitted adapter is placed and where it is
refused.
- The duplicate door passes the refusal's status and sentence; the
`VALIDATION_ERROR` code on its answer is derived from the `400`, not
copied from the refusal's own `code`. The two agree for every refusal
the predicate answers today. Noted, not filed.
## Verification
- Derived gate list (`node scripts/pm/dispatch-gates.mjs --commands`,
121 families) run on `d9c88726c4`: 119 exit 0. Among them
`check-skills-token-ratchet` ("61 authored bundle file(s) within their
ceilings"), `check:skill-docs`, `check:skill-refs`, `check:skill-links`,
`check:skill-identifier-liveness`, `check:spec-changes`,
`check:upgrade-guide`, `check:doc-authoring`, `check:nul-bytes`,
`check:cross-package-test-inputs`.
- NOT MEASURED locally, both a missing prerequisite and not a red:
`check:dual-build-cjs-loads` (exit 3, "PREREQUISITE NOT MET", it needs
every package built) and the CLI file
`test/migrate-meta-engine-guidance.test.ts` (its global setup could not
load the unbuilt CLI closure). CI reads both.
- Under the verify lock on `d9c88726c4`, `VERDICT command-exit 0`: `pnpm
--filter @objectstack/service-knowledge test` (Test Files 19 passed,
Tests 683 passed), `typecheck` of `@objectstack/service-knowledge`,
`@objectstack/runtime` and `@objectstack/spec`, and the spec migration
suites (`vitest run src/migrations`: Test Files 5 passed, Tests 207
passed).
- Declared narrowing: the runtime and spec packages ran the files this
diff touches or feeds, not their whole suites; `test:repo` was not run.
CI's `Test Core` carries those.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` is CI's reading.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: `check:generated` families ran green;
nothing to regenerate.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP)_
<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cwPhGV4g9p1BGQaZbP -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent e9002d6 commit 7971d24
6 files changed
Lines changed: 97 additions & 3 deletions
File tree
- .changeset
- packages
- runtime/src/domains
- services/service-knowledge/src/__tests__
- spec/src/migrations/entries/semantic
- scripts
- skills/objectstack-ai
| 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 | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
256 | 276 | | |
257 | 277 | | |
258 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1066 | 1113 | | |
1067 | 1114 | | |
1068 | 1115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
536 | 548 | | |
537 | 549 | | |
538 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
0 commit comments