Repository navigation
Commit 4013e30
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9AVUcBf9iiSFW8k3r6KcyAL)_
Refs #30020
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6687865760
## 维护者速读
- 改了什么:把 `ScopedContext` 上最后两个"把自己交出去"的方法体(`transaction` 与按符号键的授权补种步骤)搬进
`engine-scoped-context.ts`,方法留在类上做一行转发;拆分脚本新增对应的搬运模式。
- 为什么改:#30020 第 S1 项。按裁决 A,状态仍归类本身,facet 通过 `facade`
端口拿到实例本身;注册表里这两行豁免随之删除(11 → 9)。
- 风险与回滚:纯搬运,撤销证明逐字节还原基线,对外 `.d.ts` 与基线逐字节相同;回滚即 revert 本
PR。`transaction` 在每条事务路径上,已跑 objectql 全量与 dogfood。
- 先看:`packages/objectql/src/engine-scoped-context.ts`(新增两个静态成员与 `facade`
端口)、`packages/objectql/src/engine.ts` 末尾的 install
块、`scripts/codemod-split-engine.mjs` 新增的 members 模式一节。
- 两分钟验证:`node scripts/codemod-split-engine.mjs --scoped --members
--verify --base origin/main`,预期输出 "does rebuild the base engine.ts and
its scoped modules byte-for-byte"、退出码 0。
- 需要你做的:无,席位落地。
## What changes
S1 of the approved §5 order on #30020 (E1, E2 and E3 are on `main`).
Rule A (ruling 6687865760): the facade stays the sole state owner; a
moved body reads the instance itself through its host's `facade` port.
- `scripts/codemod-split-engine.mjs` gains the second pass's **members
mode**, `--scoped --members Class#member,…` (and `--scoped --members
--verify --base REF`). Step 0 measured why it was needed: on `main`
`06060c61c`, `--members` is `ObjectQL`-only (`--members names
[SEED_USER_GRANTS], which ObjectQL declares as no method`, exit 2) and
`--scoped` refuses a split file (exit 2). The mode moves a named scoped
method onto the split class into its written facet, exactly as the
second pass would have, with:
- **R1 on an instance host**: a bare `this` the body hands on reads
`this.facade`; the class's install block fills it with `facade:
instance`, and the host interface types it `readonly facade:
ScopedContext`.
- **R9, a symbol key** (the design's symbol-keyed-member rule): a method
keyed `[NAME]`, NAME a module-scope binding spelled SCREAMING_SNAKE,
moves into the facet member NAME in camelCase. `[SEED_USER_GRANTS]`
becomes `ScopedContextFacet.seedUserGrants`, the same spelling the hand
move of `[APP_AUTHORED_HOOK_API]` took (`appAuthoredHookApi`). The stub
keeps the key.
- The facet module's header sentence is rewritten for the new names
only; the hand-written words after it (the #30975 note) are kept byte
for byte.
- Shared pieces were factored rather than copied: the fourth pass's
import-growth step is now `moduleImportEdits`, the install lines
`scopedInstallLines`, the header sentence `scopedHeaderSentence`. Every
earlier battery of the self-test still passes unchanged.
- Applied: `node scripts/codemod-split-engine.mjs --scoped --members
'ScopedContext#[SEED_USER_GRANTS],ScopedContext#transaction' --write` on
`06060c61c`. Both stubs keep their docblock and signature (`async`
dropped, as every stub of the series). `return this` (twice) and
`callback(this, { owned: false })` read `this.facade`. `engine.ts`
10,740 → 10,647 lines; four import bindings only the moved bodies read
leave it (`driverSupportsTransactions`, `redactPropagatedDriverFault`,
`resolveUserAuthzGrants`, `rolledBackRefusal`) and arrive in the facet
module.
- `scripts/facade-delegation-registry.json`: the two `ScopedContext`
rows (`[SEED_USER_GRANTS]`, `transaction`) are removed. No other row.
`check:facade-delegation-only`: 11 named exceptions on base, 9 on head.
- Changeset `.changeset/30020-scoped-context-facet-bodies.md`,
`@objectstack/objectql` patch: the published JS moves even though the
`.d.ts` does not, and AGENTS.md reserves `skip-changeset` for a diff
that publishes nothing (the delta allowed `skip-changeset`; AGENTS.md
wins, declared in the report).
No forced test edits.
## Tests
- objectql typecheck exit 0; `pnpm --filter @objectstack/objectql test`:
**Test Files 572 passed (572), Tests 11616 passed (11616)** on head; the
same command on base `06060c61c`: **572 / 11616**. Base counts held.
- Codemod self-test: **211 cases in 13 batteries** (base: 186 in 12).
The new battery, `scoped members, instance identity port and symbol keys
(second pass, #30020 S1)`, floor 25: the plan, the proof, determinism,
stub / facet / interface / install / header / import shapes, a hand tail
kept, seven tampered heads that must fail, and refusals
(foreign-private, a key R9 does not take, an unqualified name, an
already-moved method, a class declaring `facade`, a non-scoped class).
- Ablations (each through `scripts/ablation-replace.mjs`, restored with
blob == HEAD and `git diff HEAD` empty):
- R9 off: self-test exit 2, `ScopedContext#[SEED_KEY] stays on the class
…: not-identifier-name`.
- R1 on the instance host off: self-test exit 2, `… bare-this`.
- The undo's R1 inverse off: `--scoped --members --verify --base
origin/main` exit 1, `undoing the moves does not rebuild the base
engine.ts (first difference at line 10436)`.
- Dogfood battery (`ScopedContext.transaction` is on every transactional
path), under the verify lock: `pnpm turbo run build
--filter='@objectstack/dogfood^...' && pnpm --filter
@objectstack/dogfood test` exit 0: **Test Files 440 passed | 3 skipped
(443), Tests 3652 passed | 41 skipped (3693)** on head. Not run on base
(the skips are the battery's own gated cases, not this diff's).
## Acceptance notes
- `ScopedContextFacet`'s module header says each static method is "the
body of the `ScopedContext` method of the same name"; `seedUserGrants`
(like the earlier hand-moved `appAuthoredHookApi`) is named by R9, and
its placeholder docblock names the method by its key
(`ScopedContext#[SEED_USER_GRANTS]`).
- The second pass's own `--scoped --verify` was already not re-runnable
on `main` (the #30975 hand moves); this mode carries its own undo proof
and does not depend on it.
- Overlap re-check (20:12Z, before opening): of the 40 most recently
updated open PRs, the four code PRs near this file set (#31637, #31653,
#31655, #31631) touch none of `engine.ts`, `engine-scoped-*.ts`, the
registry or the codemod. The WIP branch push (20:05Z) went out before
this re-check; the seat's 19:55Z read covered it.
## Verification
<details><summary>Undo proof (byte-exact)</summary>
```
node scripts/codemod-split-engine.mjs --scoped --members --verify --base origin/main (exit 0, head 9ffb6d5)
undo proof (scoped members): 2 moved method(s) (ScopedContext#[SEED_USER_GRANTS], ScopedContext#transaction); engine.ts 10740 -> 10647 lines; undoing the moves does rebuild the base engine.ts and its scoped modules byte-for-byte once the 4 import binding(s) only moved bodies read are pruned from the base (driverSupportsTransactions, redactPropagatedDriverFault, resolveUserAuthzGrants, rolledBackRefusal)
```
Plan run on base: input sha256
d92396f28793cb03c54e0841bca886fc699a553c61faf2856a8e769298841cfc, output
tree sha256
2e795a10241977a8d0f249f059876245c80c2fd12e2bf09aa7c55285fe3b4a25.
</details>
<details><summary>Public .d.ts (base 06060c6 vs head)</summary>
`diff -r` of `packages/objectql/dist/*.d.ts` and `*.d.mts` (core, index,
util-iFatUShh) between a base build and a head build: empty, exit 0.
sha256 identical on both sides (core.d.ts 20b3e4bb…, index.d.ts
42a71dbc…, util-iFatUShh.d.ts 25e56780…). Positive control:
`ScopedContextFacet.seedUserGrants` occurs 0 times in base
`dist/index.mjs`, once in head's.
</details>
<details><summary>Gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands` on head `9ffb6d5e08`: 80
derived commands, all exit 0. `--ran` reconciliation: 80 derived, 80
run, 0 NOT-MEASURED, 0 UNRUN.
Two first runs exited 3 on container prerequisites, not the diff, and
were re-run green: the teardown self-test (shallow clone; fetched its
fixture commit) and `check:dual-build-cjs-loads` (needs a full `pnpm
build`, run under the lock).
Outside the derived set: `pnpm check:facade-delegation-only` exit 0 (9
named exceptions); eslint over `packages/objectql` and the codemod exit
0.
```
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-adoption.mjs :: exit 0
node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs --self-test :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-engine-split-ratio.mjs --self-test :: exit 0
node scripts/check-issue-citations.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0
node scripts/check-self-test-wired.mjs :: exit 0
node scripts/check-self-test-wired.mjs --self-test :: exit 0
node scripts/check-self-test-workflow-commands.mjs :: exit 0
node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0
node scripts/check-whole-set-label-write.mjs :: exit 0
node scripts/check-whole-set-label-write.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/docs-audit/check-affected-docs.mjs :: exit 0
node scripts/docs-audit/check-drift-comment.mjs :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
pnpm check:adr-symbol-anchors :: exit 0
pnpm check:agent-test-spelling :: exit 0
pnpm check:bash32-floor :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-command-ids :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 0
pnpm check:durability-log-level :: exit 0
pnpm check:entry-guard :: exit 0
pnpm check:error-status-conformance :: exit 0
pnpm check:facade-delegation-only :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:issue-citations :: exit 0
pnpm check:keyed-text-bounds :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:logger-receiver-detach :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:object-def-param-keys :: exit 0
pnpm check:optional-error-sink :: exit 0
pnpm check:org-identifier :: exit 0
pnpm check:page-declaration-shape :: exit 0
pnpm check:parse-guard :: exit 0
pnpm check:platform-object-tenancy-census :: exit 0
pnpm check:pnpm-filter-targets :: exit 0
pnpm check:pnpm-flag-spellings :: exit 0
pnpm check:published-files :: exit 0
pnpm check:ratchet-remedy-authority :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:scripts-symbol-anchors :: exit 0
pnpm check:settings-bind-window :: exit 0
pnpm check:slot-lookup :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:swallow-census-controls :: exit 0
pnpm check:system-context-census :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:vouch-for-reference-callers :: exit 0
pnpm check:watch-hint-literal :: exit 0
```
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmSfdZ9zS9bzZR31tpB)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent f2abd47 commit 4013e30
5 files changed
Lines changed: 903 additions & 206 deletions
File tree
- .changeset
- packages/objectql/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 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 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
| |||
121 | 128 | | |
122 | 129 | | |
123 | 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 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
124 | 236 | | |
125 | 237 | | |
126 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | 144 | | |
146 | 145 | | |
147 | | - | |
| 146 | + | |
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
| |||
196 | 195 | | |
197 | 196 | | |
198 | 197 | | |
199 | | - | |
| 198 | + | |
200 | 199 | | |
201 | 200 | | |
202 | 201 | | |
| |||
10432 | 10431 | | |
10433 | 10432 | | |
10434 | 10433 | | |
10435 | | - | |
10436 | | - | |
10437 | | - | |
10438 | | - | |
10439 | | - | |
10440 | | - | |
10441 | | - | |
10442 | | - | |
10443 | | - | |
10444 | | - | |
10445 | | - | |
10446 | | - | |
10447 | | - | |
10448 | | - | |
10449 | | - | |
10450 | | - | |
10451 | | - | |
10452 | | - | |
| 10434 | + | |
| 10435 | + | |
| 10436 | + | |
10453 | 10437 | | |
10454 | 10438 | | |
10455 | 10439 | | |
| |||
10504 | 10488 | | |
10505 | 10489 | | |
10506 | 10490 | | |
10507 | | - | |
| 10491 | + | |
10508 | 10492 | | |
10509 | 10493 | | |
10510 | 10494 | | |
10511 | | - | |
10512 | | - | |
10513 | | - | |
10514 | | - | |
10515 | | - | |
10516 | | - | |
10517 | | - | |
10518 | | - | |
10519 | | - | |
10520 | | - | |
10521 | | - | |
10522 | | - | |
10523 | | - | |
10524 | | - | |
10525 | | - | |
10526 | | - | |
10527 | | - | |
10528 | | - | |
10529 | | - | |
10530 | | - | |
10531 | | - | |
10532 | | - | |
10533 | | - | |
10534 | | - | |
10535 | | - | |
10536 | | - | |
10537 | | - | |
10538 | | - | |
10539 | | - | |
10540 | | - | |
10541 | | - | |
10542 | | - | |
10543 | | - | |
10544 | | - | |
10545 | | - | |
10546 | | - | |
10547 | | - | |
10548 | | - | |
10549 | | - | |
10550 | | - | |
10551 | | - | |
10552 | | - | |
10553 | | - | |
10554 | | - | |
10555 | | - | |
10556 | | - | |
10557 | | - | |
10558 | | - | |
10559 | | - | |
10560 | | - | |
10561 | | - | |
10562 | | - | |
10563 | | - | |
10564 | | - | |
10565 | | - | |
10566 | | - | |
10567 | | - | |
10568 | | - | |
10569 | | - | |
10570 | | - | |
10571 | | - | |
10572 | | - | |
10573 | | - | |
10574 | | - | |
10575 | | - | |
10576 | | - | |
10577 | | - | |
10578 | | - | |
10579 | | - | |
10580 | | - | |
10581 | | - | |
10582 | | - | |
10583 | | - | |
10584 | | - | |
10585 | | - | |
10586 | | - | |
10587 | | - | |
10588 | | - | |
10589 | | - | |
10590 | | - | |
| 10495 | + | |
| 10496 | + | |
10591 | 10497 | | |
10592 | 10498 | | |
10593 | 10499 | | |
| |||
10732 | 10638 | | |
10733 | 10639 | | |
10734 | 10640 | | |
| 10641 | + | |
10735 | 10642 | | |
10736 | 10643 | | |
10737 | 10644 | | |
| |||
0 commit comments