Repository navigation
Commit bf03ebb
fix(spec): connector docs locate an undeclared key's refusal at the entry (#29306)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9S7KaP2SFvaTnEFHUw1gUB7)_
Fixes #28821
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:connector 两处 TSDoc 原说未声明键的拒收"定位在该键",实际 zod 只在条目根报一条
`unrecognized_keys`,键名在 `keys` 里;现照实写。同句也改在尚未发布的 protocol-18 升级说明 reason
和测试文件头注释里。
- 为什么改:作者或 agent 照文档去键的路径找错误会找不到;升级说明还没发布,现在改掉就不会把错话写进发布说明。
- 风险与回滚:只改文字,不动 schema、错误码、路径和消息;回滚就是 revert 这一个提交。
- 先看:`packages/spec/src/integration/connector.zod.ts`(两段
docblock)、`packages/spec/src/migrations/entries/semantic/18.connector-entry-undeclared-key-refused.ts`(reason
一句)。
- 两分钟验证:`pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2
src/integration/connector-entry-undeclared-keys.test.ts`,预期全绿,用例本身就钉着
path 为空、`connectors.0`、`keys` 列出每个键。
- 需要你做的:无,席位落地。
## What changes
- `packages/spec/src/integration/connector.zod.ts`, the
`DeclarativeConnectorEntryBaseSchema` docblock: "refuses it by name,
located at the key" now says the refusal is ONE zod `unrecognized_keys`
issue located at the entry, not at the key: its path is the entry's own
(empty when the entry is parsed alone, `connectors.N` inside a stack),
and it names every undeclared key in `keys` and in its message.
- Same file, the `defineConnector()` docblock: "refused by name, located
at the key" now says one `unrecognized_keys` issue at the root (path
`[]`, not the key's) lists every such key in `keys`. The prescription
clause is kept.
- Bounded in-place fix, same sentence in two more places (declared as a
deviation; the claim's file surface named only the two docblocks):
-
`packages/spec/src/migrations/entries/semantic/18.connector-entry-undeclared-key-refused.ts`,
`reason`: "refused now, by name and located at the key" now says one
`unrecognized_keys` issue located at the entry lists every undeclared
key. This entry is not released yet (its changesets
`harden-connector-undeclared-keys.md` and
`28738-define-connector-closed.md` are still pending), so the false
sentence would otherwise ship in the protocol-18 upgrade guide.
-
`packages/spec/src/integration/connector-entry-undeclared-keys.test.ts`,
the file-header comment only ("located at the key" → "in one issue
located at the entry root"). No assertion changes; the cases already pin
path `''`, `connectors.0` and `keys`.
- `.changeset/28821-connector-refusal-location-prose.md`:
`@objectstack/spec` patch.
No forced test edits. Nothing generated moved: both docblocks are JSDoc,
not `.describe()`, and `check:generated` reports all 14 artifacts up to
date.
## Why
The phrase came from #28688 and PR #28815 carried it into
`defineConnector()`. Measured on the built spec at `cdbde723`
(`DeclarativeConnectorEntrySchema` / `defineConnector` /
`ObjectStackDefinitionSchema`, issues as `[code, path, keys]`):
```text
entry, two undeclared keys [["unrecognized_keys","",["token","vendorRegion"]]]
stack door [["unrecognized_keys","connectors.0",["apiKey"]]]
defineConnector, timeout [["unrecognized_keys","",["timeout"]]]
entry, retired key only [["invalid_type","triggers",null]]
entry, retired + undeclared [["invalid_type","triggers",null],["unrecognized_keys","",["vendorRegion"]]]
```
No `.superRefine` adds a located issue for an undeclared key: the
refusal is terminal (`strictObject`), so the ADR-0097 refinements do not
run. The only issue located at a key is a retired key's (`triggers`),
which is declared as a tombstone and so is not an undeclared key.
## Tests
- `pnpm --filter @objectstack/spec test` (under os-verify-lock, at
`cdbde723`): Test Files 790 passed (790), Tests 23370 passed, 1 todo.
VERDICT command-exit 0.
- `pnpm --filter @objectstack/spec typecheck`: VERDICT command-exit 0.
- `pnpm --filter @objectstack/spec check:generated` after `pnpm --filter
@objectstack/spec build`: all 14 generated artifacts up to date, VERDICT
command-exit 0.
- No ablation: no tested behaviour changes (prose only).
## Acceptance notes
- Prose only. The refusal, its code, its path, its message and the
accept set are unchanged. No consumer tests are owed (no contract face
moves); the claim names none.
## Verification
Local gate subset, derived by `node scripts/pm/dispatch-gates.mjs
--commands --repo objectstack-ai/objectstack` at `cdbde723` (4 paths vs
merge base `f6a04e3af`), each run with stdin closed and its exit
captured before any pipe.
<details><summary>82 derived, 82 run, 0 non-zero; --ran reconcile: 82
run, 0 NOT-MEASURED, 0 UNRUN (a DERIVED zero)</summary>
- First pass: 78 exit 0, 4 exit 3 (PREREQUISITE NOT MET):
`check-plugin-teardown-shape --self-test` (pinned commit outside the
shallow clone), `@objectstack/lint check:doc-formula-expressions`
(formula dist), `check:dual-build-cjs-loads` and
`check:lean-entry-closure` (package dists).
- Prerequisites met: `git fetch --depth=1 origin 621a487…` and `pnpm
turbo run build --concurrency=2 --filter='./packages/**'` under
os-verify-lock (78/78 tasks, VERDICT command-exit 0).
- Second pass on the built tree: the 4 above plus the 10 gates whose
first run overlapped the build (`check:published-files` through
`check:spec-parsed-alias`), all 14 exit 0.
- Changeset declaration lines checked offline: `node
scripts/check-changeset-no-major.mjs --base origin/main --event FILE`
with this body: exit 0, `LEVEL AXIS: … clause-② no and metadata-protocol
none … a non-protocol change at patch`.
</details>
CI families outside the derived total (lint, the type-check lanes, Test
Core and the rest) are read from this PR's check-runs; none was re-run
here.
## 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-owned and not run locally
(comment and string-literal text only).
- [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: its generated artifacts are
regenerated and committed.
- [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 with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmQnpb1NhsSxWTHrV3q
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmQnpb1NhsSxWTHrV3q)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4771869 commit bf03ebb
4 files changed
Lines changed: 31 additions & 9 deletions
File tree
- .changeset
- packages/spec/src
- integration
- migrations/entries/semantic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1133 | 1133 | | |
1134 | 1134 | | |
1135 | 1135 | | |
1136 | | - | |
| 1136 | + | |
1137 | 1137 | | |
1138 | | - | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1139 | 1143 | | |
1140 | 1144 | | |
1141 | 1145 | | |
| |||
1229 | 1233 | | |
1230 | 1234 | | |
1231 | 1235 | | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
1235 | 1241 | | |
1236 | 1242 | | |
1237 | 1243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
0 commit comments