Repository navigation
Commit 45b4922
feat(spec): the package export manifest declares withheldMaps, classified door for the unmanaged import (#29521)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi93WJttNHMw9kPDPtpWDpXEq)_
Fixes #29373
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — an export response key the runtime writes; no
metadata author writes it, so no skill or authoring doc teaches it
## 维护者速读
- 改了什么:包导出清单(`GET /packages/:id/export` 的契约)新增可选键
`withheldMaps`,逐条列出导出时被整张扣下的连接器请求头 /
环境变量表的位置(只列位置,不列任何头名或变量名);非托管导入的键分类表把它记为 `door`。导出一直声明的 `label`
在该表里也从未分类,同 PR 一并记为 `door`。
- 为什么改:导出读的是脱敏后的条目,连接器的四张凭据表在导出里直接缺席,导入方分不清"被扣下"还是"本来就没有"。这是 #28640 裁决
③A 的 spec 半边,server 半边 #29342 等它落地后再写导出和两道安装门。
- 风险与回滚:纯 spec 声明加一行分类,无运行时改动,导出暂不写该键。实测:改动前,带 `label` 或 `withheldMaps`
的导出被非托管导入整包拒收;改动后两者都被接受、新基座清单不带它们。回滚即 revert 本 PR。
- 先看:`packages/spec/src/api/package-lifecycle.zod.ts`(新键与
describe)、`packages/spec/src/kernel/unmanaged-install.ts`(两行 `door`
及注释)、`packages/spec/src/kernel/unmanaged-install.test.ts`(全量性测试改为同时读导出清单的固定键)。
- 两分钟验证:`pnpm --filter @objectstack/spec exec vitest run
src/api/package-lifecycle.test.ts
src/kernel/unmanaged-install.test.ts`,预期 2 个文件全部通过,含「refuses a list of
the withheld header names」与「classifies every fixed key of the package
export」两条新用例。
- 需要你做的:无,席位落地。
## New names (proposed; the seat's call)
- `PackageExportManifestSchema.withheldMaps`: a new fixed key on a
published contract.
- Its entry's sub-keys: `type` (the literal `connector`), `name`, `path`
(closed set: `providerConfig.headers`, `providerConfig.defaultHeaders`,
`providerConfig.transport.headers`, `providerConfig.transport.env`).
- No new export: the entry is declared inline, so `api-surface` does not
move.
- Alternatives considered: `withheld` (shorter, but reads as a boolean),
`incompleteMaps` (names the import's reading rather than the export's
act), `redactedMaps` (collides with the redactor's internal
`redactedKeys`, which is deliberately never put on the wire).
## What changes
- `packages/spec/src/api/package-lifecycle.zod.ts`:
`PackageExportManifestSchema` gains the optional fixed key
`withheldMaps`, an array of strict `{ type: 'connector', name, path }`
entries. The docblock now says five fixed keys and explains the key
(#28640 ruling ③A). `PackageExportManifestSchema` stays the same
exported constant, so the bundle schema in draft #29100 composes it by
identity as before.
- `packages/spec/src/kernel/unmanaged-install.ts`:
`UNMANAGED_INSTALL_KEY_DISPOSITIONS` gains `withheldMaps: 'door'` and
`label: 'door'`. The module note and the table's docblock now name the
export's fixed keys as the third schema a package body is read with; the
`door` definition says the door may set a key aside (the export's
`label`).
- Regenerated: `content/docs/references/api/package-lifecycle.mdx` (the
key and its nested shape), `packages/spec/authorable-surface/api.json`
(one row: `api/PackageExportManifest:withheldMaps`),
`docs/audits/2026-07-unknown-key-strictness-ledger.counts/api.md`
(`api/` sites 487 to 488, the new `.strict()` entry).
- `.changeset/29373-export-withheld-maps.md`: `@objectstack/spec` minor,
with the two declaration lines copied from the claim as the seat amended
it (`Metadata-protocol: added`).
- Not touched: runtime. The export does not write the key yet, and the
install doors do not read it yet; that is the server half, #29342.
### The path vocabulary, measured
The card spells three of the four maps without their root
(`defaultHeaders`, `transport.headers`, `transport.env`). On main the
connector redactor's `CONNECTOR_CREDENTIAL_MAP_PATHS`
(`packages/spec/src/integration/connector-credential-redaction.ts`)
holds all four under `providerConfig`, and `redactConnectorItem` reports
them in `redactedKeys` as `providerConfig.headers`,
`providerConfig.defaultHeaders`, `providerConfig.transport.headers`,
`providerConfig.transport.env`. The closed enum uses that spelling, so
the export can copy the redactor's own report. A closed set of four is
right for this card: it is exactly the set the redactor withholds whole
as maps. The redactor's other positions (undeclared `auth` keys,
`authentication` keys, credential URL parts) are single values, not
maps, and webhook `headers` is out of scope by the seat ruling. A test
holds the enum equal to the redactor's list and to its `redactedKeys` on
a real redaction, so the two cannot drift.
### `label`, measured
The card noted (not measured) that the export's top-level `label` is not
classified. Measured on this branch's base (`04e0c2c0`):
`PackageExportManifestSchema` declares `label`;
`UNMANAGED_INSTALL_KEY_DISPOSITIONS` has no row for it; the import
planner's default arm refuses an unclassified key. A probe calling
`planUnmanagedImport` with `{ id, name, version, label: 'Example CRM'
}`, run against a spec build with the two rows removed, answered
`UNMANAGED_INSTALL_UNCOPYABLE` "`label` — not a key a package body
declares, so the import cannot place it" (and the same for
`withheldMaps`); against this PR's build both are accepted and the base
manifest is `{ name, version, id, namespace }`. So it is a real gap,
classified here and declared as a deviation. It is `door`, not
`identity`: the base is installed through the closed
`PackageInstallManifestSchema`, which has no `label`, so carrying it
would refuse the base. Reach: the export writes `label` only from
`pkg.manifest.label ?? pkg.label`, and no schema in this tree declares
either (`ManifestSchema` and `PackageInstallManifestSchema` are closed
without `label`), so no declared producer here emits it today; the gap
is between two spec contracts.
## Tests
New:
- `package-lifecycle.test.ts`: an export carrying `withheldMaps` parses
and is preserved; the key is optional; the path enum equals
`CONNECTOR_CREDENTIAL_MAP_PATHS` and the redactor's `redactedKeys`; five
refusals (a position outside the four, a position without its
`providerConfig` root, a non-connector type, an entry carrying a list of
header names, an entry with no name).
- `unmanaged-install.test.ts`: "classifies every fixed key of the
package export", and a pin that `withheldMaps` and `label` are `door`.
Forced edits (named):
- `unmanaged-install.test.ts` "classifies nothing neither schema
declares": renamed "classifies nothing no schema declares", and its
declared set now includes the export's fixed keys. Without this, the new
`withheldMaps` row would red it as a stale row.
- `unmanaged-install.test.ts` and `package-lifecycle.test.ts` describe
titles: "both schemas" to "the three schemas"; "four fixed keys" to
"five fixed keys"; "requires exactly the four fixed keys" to "requires
only the three identity keys" (the old title was already loose: `label`
was optional).
Reverse check (each table row deleted with `ablation-replace.mjs`, then
`unmanaged-install.test.ts`): deleting `withheldMaps: 'door'` reds
"classifies every fixed key of the package export" and the door pin;
deleting `label: 'door'` reds the same two. Tree restored to HEAD each
time (`git diff HEAD` empty).
## Acceptance notes
- `Check Changeset` level axis: the claim first read `Metadata-protocol:
none`; the gate refuses it because the regenerated
`packages/spec/authorable-surface/api.json` shard moved, and refuses
`added` with a `patch` changeset. The seat amended the claim to `added`,
matching main's precedent for API response keys
(`.changeset/28737-record-page-timeline-count.md`,
`28722-customizations-contributions.md`), and the changeset is now
`@objectstack/spec: minor` (commit `27e2a7a5`). Measured offline on head
`27e2a7a5` with this body: `check-changeset-no-major.mjs --base
origin/main --event FILE` exits 0 (LEVEL AXIS passes).
- Opened on base `04e0c2c0`, not merged with main: main is 20 commits
ahead, none touching these 8 files or the `api` shards they regenerate
(`git diff HEAD...origin/main` on spec touches
ui/contracts/conversions/migrations only), and `git merge-tree` is
clean. Whichever of this PR and #29100 lands second merges main.
- Webhook `headers` (the same whole-map case) stays out of scope by the
seat ruling on #29342; widening `type` to a union later is a widening.
## Verification
Readings on head `bb1718cc` (base `04e0c2c0`), all under
`os-verify-lock.sh` (VERDICT command-exit 0 each). Head `27e2a7a5` adds
one commit that edits only the changeset's level and declaration line
(no package source, no generated artifact), so these readings carry to
it; the changeset gate was re-run on `27e2a7a5`.
<details><summary>Spec and consumer suites</summary>
- `turbo run build --filter='./packages/**'`: 78/78 tasks, 0 cached.
- `pnpm --filter @objectstack/spec test`: Test Files 792 passed (792),
Tests 23529 passed, 1 todo.
- `pnpm --filter @objectstack/spec typecheck`: exit 0.
- `pnpm --filter @objectstack/spec check:generated`: 2 of 14 stale
before `--fix` (`check:docs`, `check:strictness-ledger`), both
regenerated and committed; `api-surface` not stale (no new export).
- `@objectstack/metadata-protocol` `package-unmanaged-install.test.ts` +
`protocol.duplicate-package-install-refusal.test.ts`: 2 files, 68 tests
passed.
- `pnpm --filter @objectstack/client test`: 54 files, 693 tests passed;
`typecheck` exit 0 (`PackageExportManifest` is the client's
`packages.export` return type).
- `@objectstack/runtime` `packages-export-override-declaration`,
`packages-export-per-package-layer`,
`packages-seed-apply-read-decorations`, `packages-vetted-org-source`: 4
files, 114 tests passed.
- `@objectstack/cloud-connection`
`marketplace-install-local-install-modes.test.ts`: 23 tests passed.
- Planner probe (temporary test file, deleted): before (rows removed,
spec rebuilt, dist preflight `--absent` passed) `label` and
`withheldMaps` each refused `UNMANAGED_INSTALL_UNCOPYABLE`; after, both
accepted.
</details>
<details><summary>Derived gates (dispatch-gates --commands)</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 103 families at `bb1718cc`; each ran
with stdin closed, all 103 exit 0. Reconciliation: "103 derived, 103
run, 0 NOT-MEASURED, 0 UNRUN" (a DERIVED zero). Changed lines 161 (+144
/ -17) against the 3000 threshold.
</details>
<!-- signed: domain:spec#1 · os-steve · session_01ADHkmPi3pqv7Vkx4kymD87
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7fc4d23 commit 45b4922
8 files changed
Lines changed: 182 additions & 18 deletions
File tree
- .changeset
- content/docs/references/api
- docs/audits/2026-07-unknown-key-strictness-ledger.counts
- packages/spec
- authorable-surface
- src
- api
- kernel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
| |||
316 | 323 | | |
317 | 324 | | |
318 | 325 | | |
319 | | - | |
| 326 | + | |
320 | 327 | | |
321 | 328 | | |
322 | 329 | | |
| |||
326 | 333 | | |
327 | 334 | | |
328 | 335 | | |
| 336 | + | |
329 | 337 | | |
330 | 338 | | |
331 | 339 | | |
| |||
340 | 348 | | |
341 | 349 | | |
342 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
343 | 360 | | |
344 | 361 | | |
345 | 362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1306 | 1306 | | |
1307 | 1307 | | |
1308 | 1308 | | |
| 1309 | + | |
1309 | 1310 | | |
1310 | 1311 | | |
1311 | 1312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
200 | | - | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
217 | | - | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
| |||
224 | 225 | | |
225 | 226 | | |
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 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
227 | 279 | | |
228 | 280 | | |
229 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| |||
175 | 182 | | |
176 | 183 | | |
177 | 184 | | |
178 | | - | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
182 | 209 | | |
183 | 210 | | |
184 | 211 | | |
185 | 212 | | |
186 | 213 | | |
187 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
188 | 235 | | |
189 | 236 | | |
190 | 237 | | |
| |||
0 commit comments