Repository navigation
Commit 2c86039
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XEYwDcE3TbthGXa5Y8ze43D)_
Part of #25467
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6270097840
Cut 10 of the `protocol.ts` split (#24586 ruling A, recorded in
`6270097840`). Cuts 1–9 landed as #25494, #25518, #25538, #25589,
#25601, #25623, #25642, #25719 and #25731. The claim is `6392807595`;
the scope is the lock-state group the cut 9 report (`6392271625`)
proposed from Release `6385903828`, as the server seat approved it.
Six `ObjectStackProtocolImplementation` members move unedited into a new
module, `packages/metadata-protocol/src/protocol-lock-state.ts` (#23050
shape B; no getter). `protocol.ts` loses 4 net lines (29,795 to 29,791).
The cut is move-only, and the card stays open for later cuts.
Branch `claude/project-thread-5tpuo2` is the harness-pinned branch for
this thread. It names no issue, so the claim comment is the identity
record. It holds one commit, `3ebaea97`, on `main` `ec4ef94ead`.
**Why this group alone.** The order allowed adding registry
materialize/strip if this group was too small to stand alone. It is the
size of cut 9 (451 body tokens against cut 9's 496; 242 changed lines
against 299), it is one closed group (the six call only one another and
four class members that stay), and the claim's file surface names one
module for it. So this cut carries the group alone, and registry
materialize/strip is proposed as cut 11 in the report.
**Serial with the file's in-flight PRs.** Measured just before this PR
was opened: of the 17 open PRs, only #25737 touches
`packages/metadata-protocol/src/`, in
`protocol.runtime-authoring-gate.test.ts`, a test that reads no source
by path and names no moved member, outside this cut's file surface. The
release PR #25640 touches the package's `CHANGELOG.md` and
`package.json` only. #25718's 9,211-file list was read by `git diff
--name-only` against its merge base: 0 paths under
`packages/metadata-protocol/src/`. `origin/main` moved to `e2b40a264b`
after the base; `git log ec4ef94..origin/main --
packages/metadata-protocol` is empty, and `git merge-tree` of this head
with `origin/main` is clean.
## What moves
| Member | Base line | Visibility | Tokens (params + return + body) |
|---|---|---|---|
| `servedLockState` | `:15893` | private | 214 |
| `isShippedFlowName` | `:15972` | public | 58 |
| `isStoredFlowEntryOfShippedName` | `:15987` | private | 43 |
| `declinesStoredRow` | `:16048` | public | 59 |
| `isUnservedSealedOverlay` | `:16070` | private | 34 |
| `isStoredEntryOfDeclinedName` | `:16084` | private | 43 |
## The shape (#23050 shape B, as cuts 1–9 apply it)
- **The class keeps every member** with its name, docblock, signature
and position. Each body is now one host literal plus `fn.call(host, …)`,
marked `[#25467 cut 10]`. `servedLockState` keeps its `storedRowServed =
false` default in the class signature and in the module function's
parameter list, and the stub passes the parameter through.
- **Typing.** `LockStateHost` types every member as the class member
itself (`ObjectStackProtocolImplementation['m']`). Each moved function
types its `this` as the `Pick` of the host over exactly the members its
body reads. Each stub annotates its literal as `ThisParameterType` of
`typeof fn`. No cast, and no member changes visibility.
- **Members read**, all as late-bound closures: `packagedBaseRefusal`,
`packagedArtifactOwner`, `isDeclaredCodeDatasource` and
`isSealedManagedItem` (which stay in the class), and
`isShippedFlowName`, `isUnservedSealedOverlay` and `declinesStoredRow`
(moved bodies calling one another through the protocol). No field is
read, so the host has no getter.
- **Every other caller still calls the class method**: the reads in
`protocol.ts` (`getMetaItem`, `readFlattenedMetaItems`,
`getMetaItemLayered`, `restoreArtifactRegistryView`, `loadMetaFromDb`
and others), cut 2's `MetaDiagnosticsHost` (its `servedLockState`
closure), and the published doors in
`packages/rest/src/meta-item-history-routes.ts` and
`packages/runtime/src/domains/meta.ts`, which ask `declinesStoredRow` on
the protocol instance.
## Module-level declarations, by reader
- **None moves, and none gains `export`.** The one module-level
declaration of `protocol.ts` the bodies read is `canonicalMetaType` (in
`isUnservedSealedOverlay`), already exported; the new module imports it
from `protocol.js` as cut 5's `protocol-lock-version-gates.ts` does. The
cycle is evaluation-safe: it is read only inside a function body.
- **Everything else** the bodies read is imported from the module
`protocol.ts` imports it from: `@objectstack/spec/kernel`
(`extractProtection`, `evaluateLockForWrite`, `evaluateLockForDelete`,
`MetadataLockSchema`, and `resolveLockState` as a type),
`./packaged-base-regime.js` (`isOriginGatedType`),
`@objectstack/metadata-core` (`isCodeArtifactBody`),
`@objectstack/spec/shared` (`PLURAL_TO_SINGULAR`), `./item-lock.js`
(`ItemLock`, type).
- **Imports in `protocol.ts`.** `extractProtection`,
`evaluateLockForWrite`, `evaluateLockForDelete` and `MetadataLockSchema`
lose their last reader and leave the `@objectstack/spec/kernel` import
list; `resolveLockState` keeps a reader (the class signature of
`servedLockState`) and stays. `isOriginGatedType`, `isCodeArtifactBody`,
`PLURAL_TO_SINGULAR` and `canonicalMetaType` keep other readers. The one
new statement is the import of the new module.
## The published `.d.ts`
The series bar is ruling `6348891160`, sorted-union identity, measured
first. Base `ec4ef94ead` and head `3ebaea97` were built with `pnpm
--filter @objectstack/metadata-protocol build` against one dependency
tree (the closure built once at head, then the package's `src/` swapped
tree-only to base for the base build and restored from `HEAD` under a
trap; `git diff HEAD` empty and `git status` clean after, `protocol.ts`
blob equal to `HEAD`'s).
- **Raw sha256**:
`325970c1661efaa6a3762ce7de9e6bb205ea16099784f2b6c5950d62d175b331` at
base and at head, on both `dist/index.d.ts` and `dist/index.d.cts`,
772,838 bytes each (the hash cuts 8 and 9 reported). `cmp` exits 0 on
both pairs. **Raw identity holds**, so sorted-union identity holds too.
The two public members keep their declared `boolean` return type, so
their declarations do not move (`declinesStoredRow(type: string, name:
unknown): boolean;`), and the four private ones stay `private NAME;`
lines.
- **Normalised sha256**:
`9562749edf7b8bba67ed2f1779799a68b3d6934a8605074934572d9507c55ba6` at
both ends, both files (109 string-literal union runs sorted). This run's
normaliser is its own script; its figure happens to equal cut 9's.
- **The two builds differ** where they should: `index.js` hashes
`a41e81cf2349514e…` at base (cut 9's head hash) and `b99c5148b08d3fc5…`
at head; `servedLockState.call` and `declinesStoredRow.call` each occur
0 times in the base bundle and once in the head bundle (ESM and CJS
alike).
- **Positive control** on a copy of the head `index.d.ts`,
`declinesStoredRow(type: string, name: unknown)` changed to `name:
string`: raw `c74ae751a3cb7a09…`, normalised `fd072bd9d1ab499a…`. Both
move.
- **Export tables.** The ESM and CJS bundles, loaded at runtime from the
package, each export the same 78 names at base and head; the sorted list
hashes to `9f18a0177ac736ed…` on all four. None of the moved functions
or the host type appears.
No changeset: `skip-changeset`, per ruling `6348891160`.
## Proof of move-only
- **Bodies, by AST token** (the TypeScript compiler's AST leaf tokens
over parameters less the added `this`, return type and body): 451 tokens
compared, **0 differ**. Leaf tokens rather than the raw scanner because
the scanner, run without template rescanning, swallows the rest of
`servedLockState`'s body into one template-tail token after its error
message's first `${…}`, which would compare whitespace. The parameter,
return type and body text, comments included, is also equal with
whitespace collapsed, for all six. Negative control: one changed token
in `isUnservedSealedOverlay`'s body (`=== 'permission'` to `!==`, on a
copy) makes the check report `differ=1`.
- **Class side.** 299 members at base and at head, in the same order.
The 293 that did not move are byte-identical to base, leading comments
included. Each of the 6 stubs sits at its base position and keeps its
docblock and signature byte-identical.
- **Top level of `protocol.ts`.** 236 of the 237 base statements other
than the class are byte-identical, leading comments included. The other
one is the `@objectstack/spec/kernel` import that loses four names. Head
adds one statement, the new module's import.
- **Size.** +198 / −44 over 3 files, 242 changed lines.
`protocol-lock-state.ts` has 155 lines.
## Readers of the moved lines
Every test and script that reads `protocol.ts` by path was grepped for
each moved member's name and for the calls their bodies make
(`packagedBaseRefusal`, `packagedArtifactOwner`,
`isDeclaredCodeDatasource`, `isSealedManagedItem`, `isCodeArtifactBody`,
`isOriginGatedType`, `evaluateLockFor*`, `extractProtection`,
`MetadataLockSchema`, the error message).
- **The six test files the order named** call the method on a protocol
instance or name it in prose; none reads its body in `protocol.ts` by
path. **The hypothesis holds**, and every member moves:
- `protocol.code-defined-datasource-door.test.ts`: `declinesStoredRow`
named in a comment only.
- `protocol.declines-stored-row-published.test.ts`: calls
`protocol.isShippedFlowName(…)` and `protocol.declinesStoredRow(…)`.
- `protocol.reads-environment-only.test.ts`: calls
`protocol.declinesStoredRow(…)`.
- `packages/plugins/plugin-security/src/security-catalog-echo.test.ts`:
`servedLockState` named in a comment only. 19/19 pass at head.
- `packages/rest/src/meta-published-overlay.test.ts`: calls
`protocol.isShippedFlowName(…)` and hides `declinesStoredRow` behind a
`Proxy` to pin that the door asks that one predicate. The stub's
closures call through `this`, the method stays on the class, and 16/16
pass at head.
- `packages/runtime/src/domains/meta-published-runtime-publish.test.ts`:
the same two shapes as the REST test. 12/12 pass at head.
- **Other name hits**, all prose or calls:
`protocol.flow-by-name-shipped-name.test.ts` and
`protocol.flow-layered-shipped-name.test.ts` (docblocks),
`packages/qa/dogfood/test/flow-shipped-name-published-door.dogfood.test.ts`
(a comment), `protocol-meta-diagnostics.ts` (the cut 2 host type and its
call), `item-lock.ts` (a comment).
- **Bracketed-refusal pin** (`PRODUCERS`): `servedLockState`'s
unreachable-state `throw new Error(` moves with its body, so the new
module gets a row, `'protocol-lock-state.ts': 1`, the module's own `new
Error(` count, beside the rows cuts 1, 3, 5, 6 and 7 added.
`protocol.ts` goes from 75 to 74 such sites, still above its floor of 5.
Control: with the module's throw changed to `new TypeError(` (on disk,
restored from `HEAD` under a trap, hash equal to `HEAD`'s after), the
new row fails with "protocol-lock-state.ts no longer constructs errors
here … expected 0 to be greater than or equal to 1" (1 failed, 12
passed); restored, 13/13 pass.
- **`protocol.read-verb-canonical-fold.test.ts`** lists the members
whose body folds through `canonicalizeMetaRequestType(request)`. None of
the six does; the list is unchanged and green.
- **`docs/qa/platform-checklist/areas/studio-authoring.json`** cites
"protocol.ts servedLockState". The method keeps its name in
`protocol.ts`; `check-platform-checklist --changed-from origin/main`:
OK, 29 anchors judged, 0 lost.
- **ADR anchors and decision letters.** `check:adr-anchors` exits 0 at
both ends: 85 anchored files, 52,570 citations, **1,846 → 1,846**
decision-letter citations; the only difference in its output is the file
count, 6,623 → 6,624. The `protocol.ts` anchor entry's ADR-0126 §2 / §3
paragraph names `isShippedFlowName` / `isStoredFlowEntryOfShippedName`,
but the mechanism it describes, `hydrateOverlayIntoRegistry` registering
a stored flow row without the envelope and `readFlattenedMetaItems`
serving the loader's entries alone, stays in `protocol.ts`, and both
names stay there as class members. So the new module gets no entry (see
Acceptance notes).
- **Durability checker** (`check-durability-degradation-log-level
--list`): identical at both ends once `[@:][0-9]+` is stripped (159
lines). The gate exits 0 at both ends with identical output.
- **Engine-double contract** (`check-engine-double-contract`): exits 0
at both ends. The `updateData`/`deleteData` seams keep their entries at
new line numbers (14039 → 14044, 14064 → 14069). `productionFiles` is
3,686 at base and 3,688 at head: +1 is the new file, +1 is the
gitignored `packages/spec/src/migrations/registry.ts`, which the spec
build writes in the head tree and the base tree had not built.
- **Identical output at both ends:** `check-adr-symbol-anchors`,
`check-system-context-census`, `check-tenant-audit-census`,
`check-query-options-erasure-ratchet`, `check-filter-alias-parity`.
`check-nul-bytes` differs only in the scanned file count, +1. The
base-end readings were taken in a clean detached worktree at
`ec4ef94ead`.
- **Governed surface.** `check-governed-merges --branch
claude/project-thread-5tpuo2`: 0 of 3 paths hit the register, NOT
governed; 242 changed lines, under the 3,000-line human-merge bar.
## Verification
All at head `3ebaea97`.
- `pnpm --filter @objectstack/metadata-protocol typecheck` exits 0.
`pnpm exec eslint --no-inline-config packages/metadata-protocol` exits
0, no output.
- **`packages/metadata-protocol` suite**, base and head, compared per
test name and status (vitest `--maxWorkers=2`, JSON reporter, each run
under the shared verify lock, `VERDICT command-exit 0` both legs):
- Base `ec4ef94ead`: 21,504 tests (21,485 passed, 0 failed, 19 skipped),
266 files.
- Head `3ebaea97`: 21,505 tests (21,486 passed, 0 failed, 19 skipped),
266 files.
- None lost, none changed status, one added: the new `PRODUCERS` row's
case. The base leg is the package `src/` swapped tree-only from
`ec4ef94ead` (the new module removed from the tree) and restored from
`HEAD` under a trap; `git diff HEAD` empty and `git status` clean after.
- **Derived gates.** `dispatch-gates --commands --repo
objectstack-ai/objectstack` derives 59 gates on 3 changed paths; all 59
exit 0. `check-plugin-teardown-shape --self-test`,
`check:dual-build-cjs-loads` and `check:lean-entry-closure` first
answered PREREQUISITE NOT MET (exit 3: a pinned fixture commit outside
the shallow clone; unbuilt `dist/`) and exit 0 once the commit was
fetched and `pnpm build` ran. `dispatch-gates --ran`: 59 derived, 59
run, 0 NOT-MEASURED, 0 UNRUN, exit 0.
## Acceptance notes
- No new ADR anchor entry: the moved bodies are the predicates the
ADR-0126 paragraph names, and the read and hydration paths that
paragraph describes stay in `protocol.ts`. If the seat reads the
predicates themselves as the mechanism, the fix is a
`packages__metadata-protocol__src__protocol-lock-state.ts.json` entry
citing ADR-0126; the letter count does not move either way.
- `origin/main` moved to `e2b40a264b` after the base (8 commits, none in
`packages/metadata-protocol`, merge-tree clean); not merged before this
PR, so the suite and gates measured `ec4ef94ead`-based trees. The merge
queue rebuilds on current `main`.
## Carry-forward
Unchanged from cut 9: public members whose return type is inferred, the
bodies kept by a reader (`probeRecord`, `getMetaItemCached`,
`findReferencesToMeta`, `packagelessAddress`,
`refuseUnmintableMetaType`, `metaTypeNamespaceExists`,
`viewContainerNameCollisionRefusal` with
`overlaidShippedContainerViewNames`, `reportPageRequiresAbsentAtLoad`,
the 7 `applyRegistryWriteThrough` callers,
`readCodeLayerForCarryForward`), and the private-static readers stay in
`protocol.ts`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01RobcokwdH6frowqrsE1fRc)_
Co-authored-by: Claude <noreply@anthropic.com>
1 parent c1bb4b5 commit 2c86039
3 files changed
Lines changed: 198 additions & 44 deletions
File tree
- packages/metadata-protocol/src
| 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 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | 198 | | |
202 | | - | |
203 | 199 | | |
204 | 200 | | |
205 | 201 | | |
| |||
381 | 377 | | |
382 | 378 | | |
383 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
| |||
15898 | 15903 | | |
15899 | 15904 | | |
15900 | 15905 | | |
15901 | | - | |
15902 | | - | |
15903 | | - | |
15904 | | - | |
15905 | | - | |
15906 | | - | |
15907 | | - | |
15908 | | - | |
15909 | | - | |
15910 | | - | |
15911 | | - | |
15912 | | - | |
15913 | | - | |
15914 | | - | |
15915 | | - | |
15916 | | - | |
15917 | | - | |
15918 | | - | |
15919 | | - | |
15920 | | - | |
15921 | | - | |
15922 | | - | |
15923 | | - | |
15924 | | - | |
15925 | | - | |
15926 | | - | |
15927 | | - | |
15928 | | - | |
| 15906 | + | |
| 15907 | + | |
| 15908 | + | |
15929 | 15909 | | |
| 15910 | + | |
15930 | 15911 | | |
15931 | 15912 | | |
15932 | 15913 | | |
| |||
15970 | 15951 | | |
15971 | 15952 | | |
15972 | 15953 | | |
15973 | | - | |
15974 | | - | |
15975 | | - | |
| 15954 | + | |
| 15955 | + | |
| 15956 | + | |
| 15957 | + | |
| 15958 | + | |
15976 | 15959 | | |
15977 | 15960 | | |
15978 | 15961 | | |
| |||
15985 | 15968 | | |
15986 | 15969 | | |
15987 | 15970 | | |
15988 | | - | |
15989 | | - | |
| 15971 | + | |
| 15972 | + | |
| 15973 | + | |
| 15974 | + | |
| 15975 | + | |
15990 | 15976 | | |
15991 | 15977 | | |
15992 | 15978 | | |
| |||
16046 | 16032 | | |
16047 | 16033 | | |
16048 | 16034 | | |
16049 | | - | |
16050 | | - | |
16051 | | - | |
| 16035 | + | |
| 16036 | + | |
| 16037 | + | |
| 16038 | + | |
| 16039 | + | |
| 16040 | + | |
| 16041 | + | |
16052 | 16042 | | |
16053 | 16043 | | |
16054 | 16044 | | |
| |||
16068 | 16058 | | |
16069 | 16059 | | |
16070 | 16060 | | |
16071 | | - | |
16072 | | - | |
| 16061 | + | |
| 16062 | + | |
| 16063 | + | |
| 16064 | + | |
| 16065 | + | |
16073 | 16066 | | |
16074 | 16067 | | |
16075 | 16068 | | |
| |||
16082 | 16075 | | |
16083 | 16076 | | |
16084 | 16077 | | |
16085 | | - | |
16086 | | - | |
| 16078 | + | |
| 16079 | + | |
| 16080 | + | |
| 16081 | + | |
| 16082 | + | |
16087 | 16083 | | |
16088 | 16084 | | |
16089 | 16085 | | |
| |||
0 commit comments