Repository navigation
Commit ea025d3
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9UmbUGPtw5rdRcd3UpYXs5N)_
Part of #25467
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:把 `protocol.ts` 类定义之上的整段前言(183 条顶层声明,约 6,300 行)原样搬进 22
个按主题命名的 `protocol-*.ts` 模块;`protocol.ts` 照旧导出原来导出的每个名字。没有任何逻辑改动。
- **为什么改**:`protocol.ts` 是 server 车道的热文件,每个改它的 PR 都要排队;这是 #25467 裁决 E
的第一步 E0(E1、E2 之后另派),按字母 A 的 `.d.ts` 新判据落地。
- **风险与回滚**:低。工具逐条证明 190/190 条语句逐字搬移、无改动无多余;对外 `index.d.ts`
声明集合、顺序、ESM/CJS 导出名单都不变,原始字节只差空行、一条 import 内的名字顺序、一个字面量联合的成员顺序。另把 QA 清单和
spec liveness 账本里 3 处指向被搬符号的引用改指新模块。回滚即整体 revert 本 PR。
- **先看**:`packages/metadata-protocol/src/protocol.ts`(文件头的 import/export
名单);`packages/metadata-protocol/src/protocol.read-verb-canonical-fold.test.ts`(迁移后的按路径
pin);`packages/metadata-protocol/src/protocol.lookup-artifact-item-call-sites.test.ts`。
- **两分钟验证**:`pnpm --filter @objectstack/metadata-protocol exec vitest
run src/protocol.read-verb-canonical-fold.test.ts
src/protocol.lookup-artifact-item-call-sites.test.ts`,预期 2 个文件全绿(main
上的搬移前形态同样绿;搬移后不迁移则红 2 条)。
- **需要你做的**:审批合并(改动约 13,200 行,超过 3,000 行人工合并线);另请确认
`packages/spec/liveness/query.json` 两处证据引用改指新模块可以留在本 PR(不留则
`check:liveness` 红)。
## What changes
Step **E0** of ruling E (6537939895, folded onto #25467 in 6537947529),
landed under letter A (6545252863). Move-only.
- Every top-level statement above `export class
ObjectStackProtocolImplementation` in
`packages/metadata-protocol/src/protocol.ts` that is not an import or an
export list (183 declarations) moves **verbatim, with its leading
comments**, into one of 22 new themed modules:
`protocol-meta-type-schema`, `protocol-authoring-refusals`,
`protocol-metadata-issues`, `protocol-publish-backfill-request`,
`protocol-data-request-shapes`, `protocol-view-normalization`,
`protocol-package-bindings`, `protocol-bundle-members`,
`protocol-overlay-merge`, `protocol-version-tokens`,
`protocol-write-constants`, `protocol-client-failures`,
`protocol-list-query-params`, `protocol-discovery-services`,
`protocol-reference-hits`, `protocol-write-face`,
`protocol-package-lifecycle-types`, `protocol-mutation-events`,
`protocol-authoring-channel`, `protocol-audit-entry`,
`protocol-stored-overlay-types`, `protocol-door-requests`.
- The theming is the predecessor trial's
(`claude/project-thread-6aibsn@4a35157`, seat 4's report 6542958324),
redone by tool on fresh `main`. The three statements added since that
trial follow the statement before them:
`isActionWithheldByDisabledPackage` → `protocol-authoring-refusals`,
`perPackageLayerEnvelope` → `protocol-package-bindings`,
`storedEntryRow` → `protocol-stored-overlay-types`.
- The only new text is import lists, export lists (`export { … }` at a
module's foot for a name that was module-private and is now shared;
`export { … } from` in `protocol.ts` for every name it exported before)
and a module header comment per module. The three preamble export lists
that re-export imports (`FormFieldInput`, `recordNotFoundError`,
`stripReadDecorations`) stay in `protocol.ts` with their comments.
`protocol.ts` imports the modules in the order that keeps the rolled-up
`.d.ts` declaration order equal to the base's.
- `protocol.ts`: 30,912 → 24,892 lines (on `main` `f125ce40da`). No
class-body member is touched (that is E1/E2).
- Three citations that named a moved symbol at `protocol.ts` and no
longer resolve there are re-pointed at the module it moved to:
`docs/qa/platform-checklist/areas/studio-authoring.json` (`diffShallow`
→ `protocol-write-face.ts`, twice; `protectionBlockRefusal` →
`protocol-authoring-refusals.ts`) and
`packages/spec/liveness/query.json` (`QUERY_AST_KEYS`,
`WIRE_DOLLAR_ALIASES` → `protocol-list-query-params.ts`; red in
`check:platform-checklist --changed-from` and `check:liveness` before).
Citations that still resolve through `protocol.ts`'s re-exports
(`ConcurrentUpdateError`, `servedViewExpansion`,
`specValidationFindings`, and the ADR texts) are left as they are;
`check:adr-symbol-anchors` is green.
- Changeset `.changeset/25467-e0-protocol-preamble-modules.md`: `patch`
on `@objectstack/metadata-protocol`, and `patch` on `@objectstack/spec`
because `liveness/` ships in its tarball; both declaration lines.
## Tests
Forced edits, all because a reader names a moved symbol by its file
path: two tests and two data files that are not tests.
Two by-path pins read preamble symbols out of `protocol.ts` and are
migrated in this PR (forced test edits, both in
`packages/metadata-protocol/src/`):
- **`protocol.lookup-artifact-item-call-sites.test.ts`**:
`envelopePackageId`'s one definition is read from
`protocol-package-bindings.ts`; two assertions are added so the pin
keeps its reach: `protocol.ts` defines no copy of its own, and it
imports `envelopePackageId` from that module.
- **`protocol.read-verb-canonical-fold.test.ts`**: the four door request
aliases (`SaveMetaItemRequest` … `DeleteMetaItemRequest`) are read from
`protocol-door-requests.ts`, only when `protocol.ts` imports them from
that module, so the signature judged is still the one the class names.
Two by-path citations in data files are re-pointed (forced, not tests):
`docs/qa/platform-checklist/areas/studio-authoring.json` and
`packages/spec/liveness/query.json`, as listed under What changes.
Before the migration the package suite was 2 failed / 298 passed files,
the failures exactly these two pins (13 of 17 verbs found; `function
envelopePackageId` not in `protocol.ts`).
<details><summary>Ablations (one-off, each from committed HEAD through
scripts/ablation-replace.mjs, restored to the HEAD blob with git diff
HEAD empty)</summary>
- **read-verb fold:** `saveMetaItemUnaudited`'s `request =
canonicalizeMetaRequestType(request);` replaced by `request = {
...request };` (anchor 1 → 0, blob `a0a204da0761` → `6d869851bc31`). The
pin goes red: `Tests 1 failed | 17 passed (18)`, received `[
"saveMetaItem" ]` against `[]`, the verb whose request type now comes
from the moved alias.
- **lookup, definition home:** the bindings module's `envelopePackageId`
signature changed (`served: unknown` → `served?: unknown`; blob
`e062a10a8f3e` → `47d2d431def2`). Red: `Tests 1 failed | 4 passed (5)`,
`expected '// Copyright …' to match /\nfunction
envelopePackageId\(request…/`.
- **lookup, no second copy:** a local `function envelopePackageId(…)`
put back into `protocol.ts` (blob `a0a204da0761` → `cb2f4764a1cf`). Red:
`Tests 1 failed | 4 passed (5)`, `expected '// Copyright …' not to match
/\nfunction envelopePackageId\(/`.
</details>
## Acceptance notes
- **Move-only, by tool** (a verifier separate from the move tool): every
non-import top-level statement of base `protocol.ts` (190, the class and
the three trailer statements included), leading comments included and
blank lines before it excluded, appears verbatim exactly once across
head `protocol.ts` and the 22 modules: verbatim 190, missing 0, changed
0, surplus 0, duplicated 0. Head adds import statements (109 → 183), 47
export lists and 165 module-header comment lines. **Negative control:**
one operator changed in `protocol-version-tokens.ts` (`hash = hash &
hash` → `hash = hash | hash`) → verbatim 189, changed 1, surplus 1
(`simpleHash`), exit 1; restored, blob equals HEAD.
- **`.d.ts`, normaliser 2 (letter A).** Read-only, not a gate (the card
adds no gate). Normalised: drop blank lines; sort the names inside each
import brace list; sort each run of consecutive string/number literal
members of a union. Everything else survives.
| `dist/index.d.ts` (= `index.d.cts` byte for byte, both sides) | base
`main` `f125ce40da` | head `20d8c2c813` |
|---|---|---|
| raw sha256 |
`65a4356b2efed1dd5d25e5d80a55fccfef2adfd4a6c098c686d85f1a4749b0ab` |
`d939f04a7ae66bbf19398a1f7ff4d905748fe9de667b8092105cffae3deec955` |
| normaliser 2 sha256 |
`7dea44d6d7660b9c7412af3cd0c6aa0382e3ab11dc52505431372f8185ecd97d` |
`7dea44d6d7660b9c7412af3cd0c6aa0382e3ab11dc52505431372f8185ecd97d` |
An earlier reading, base `74a19dd857` against head `c1d3b9dec3`, gave
equal normaliser 2 hashes the same way (`ff357c33…`).
Raw diff: 11 added blank lines, 1 line pair (the `@objectstack/spec/api`
import brace list, `MetadataAuthoringSurface, MetadataAuthoringClient`
first) and 2 line pairs (`columns?:` in `getMetaTypes()`'s inferred
return type, members permuted). Declaration sequence (182 top-level
statements) identical but for that import line; the final export-list
line identical.
**Positive controls** (each applied to head, each must differ from base
and does): a class's `private engine;` made public; one name dropped
from the export list; `MetadataWriteFace` moved to the end; one union
literal dropped; one `readonly` removed; and a real one, an earlier
layout of this head whose `.d.ts` carried a leaked JSDoc comment
(below). **Negative controls** (each allowed kind alone, applied to
base, must equal base and does): blank lines inserted; the import brace
list reversed; the literal union permuted. The controls assert each edit
landed (raw text changed).
- **A declaration-emit trap met on the way, noted (not filed: it changes
no published meaning and is TypeScript's behaviour, not this
package's).** The first layout of this move published `description? /**
[#27842] The list's disabledActions … */: string | undefined;` inside
`getMetaTypes()`'s inferred return type: the emitter printed a comment
that sits in `protocol.ts` at the byte offset of a node reused from
another file. One line more in the `protocol.ts` header comment moved
the offset and the comment left the `.d.ts`. It struck again after
merging `main` with #29093 (class-body lines shifted); two more lines in
the E0 note (now 5 lines, which also tells the next editor to read the
raw `.d.ts` diff) cleared it, and the final reading above has no comment
in the raw diff. Normaliser 2 does not tolerate it (positive control
P6). Any edit of `protocol.ts` on `main` can trip it the same way while
`getMetaTypes()` has an inferred return type; E1/E2 will meet it again
and should read their raw diffs for it.
- **In flight on the same files, re-read just before opening**
(`origin/main` `5780fa49df`; 30 commits past this branch's last merge,
none touching `protocol.ts` or any file of this PR, `git merge-tree`
clean, so not merged again). #29093 (#28990) has merged and is in this
branch. Open PRs that touch `protocol.ts`, each against this head by
`git merge-tree`:
- #28731 (draft, head `8372e0a1`): hunks at base line 3330
(`ConcurrentUpdateError`'s doc comment, which this PR moves to
`protocol-version-tokens.ts`) and in the class body. **Conflicts**:
whichever lands second carries that doc-comment edit to the other side.
- #29270 (draft), #29307: add names to `protocol.ts`'s own import lists,
which stay in `protocol.ts`, plus class-body hunks. Clean.
- #29290, #29295: class-body hunks only. Clean.
- #29317 touches `studio-authoring.json` in another item (revision 11 of
the object designer item). Clean.
Any of them landing shifts `protocol.ts` offsets, so the comment leak
above can come back on its own; it is not this PR's to guard.
- E0 is one step of a series; `Part of #25467` keeps the card open for
E1 and E2.
## Verification
Readings in this container under `scripts/pm/os-verify-lock.sh`, on head
`20d8c2c813` unless named.
- `@objectstack/metadata-protocol` build, `typecheck`, `test`: VERDICT
command-exit 0 · Test Files 301 passed | 4 skipped (305) · Tests 22127
passed | 26 skipped (22153).
- Direct dependents typecheck (`pnpm turbo run typecheck` on the 11
packages that depend on `@objectstack/metadata-protocol`: cli, client,
cloud-connection, objectql, plugin-approvals, plugin-security, rest,
runtime, service-automation, service-messaging, service-package), on
`6b1dd49e2b`: VERDICT command-exit 0 · Tasks 72 successful, 72 total,
every typecheck a cache miss. The two commits after it change the
changeset and two comment lines in `protocol.ts`; the published `.d.ts`
normaliser 2 hash is the same.
- Gates that read `protocol.ts` or a moved symbol by path:
`check:filter-alias-parity`, `check:system-context-census`,
`check:durability-log-level`, `check:query-options-erasure`,
`check:engine-double-contract`, `check:objectql-double-limit`,
`check:platform-checklist` (in the battery below), plus
`check:adr-anchors`, `check:adr-symbol-anchors`,
`check:scripts-symbol-anchors` and `pnpm --filter @objectstack/spec
check:liveness`, each exit 0. `gen:liveness-counts` leaves the tree
clean.
- Derived gate battery (`dispatch-gates --commands`, 71 commands): 71
exit 0. `dispatch-gates --ran`: 71 derived, 71 run, 0 NOT-MEASURED, 0
UNRUN.
- Lint: root `eslint packages/metadata-protocol --no-inline-config` (the
package has no `lint` script) exit 0.
- `test:repo` (Test Core) and the full farm are CI's.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(the one `packages/spec` edit is two evidence citations in
`liveness/query.json`; no schema, type or logic)
- [x] 2. Every name I added uses the casing for its kind. (no name
added; module files are kebab-case like their siblings)
- [x] 3. No formatter ran; `pnpm lint` passes. (scoped to the package)
- [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. (`liveness/query.json` only;
`gen:liveness-counts` regenerates nothing from it, tree clean)
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmR4MjTzeUv5x6tNkbk)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent b5e7ba5 commit ea025d3
28 files changed
Lines changed: 6917 additions & 6296 deletions
File tree
- .changeset
- docs/qa/platform-checklist/areas
- packages
- metadata-protocol/src
- spec/liveness
| 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 | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
| 493 | + | |
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| |||
1996 | 1996 | | |
1997 | 1997 | | |
1998 | 1998 | | |
1999 | | - | |
| 1999 | + | |
2000 | 2000 | | |
2001 | 2001 | | |
2002 | 2002 | | |
| |||
| 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 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 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 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
0 commit comments