Repository navigation
Commit 0c666c3
refactor(objectql): move the last 28 hand-series private docblocks out of engine.ts with the codemod's third pass (slice 2 of 2) (#30415)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg1KEKUvnWZ8oYQ388cWv3dF)_
Fixes #30053
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:第二片,也是最后一片。用 #30341 里加的 `--hand-docs`(不带 `--modules`)在 `main`
`38717d34` 上生成:其余 10 个手写模块的 28 块私有 docblock(858 行)从 `engine.ts`
搬到函数上。`engine.ts` 12,618 → 11,752 行。生成物未手改,脚本本片未改。另把 liveness 台账
`query.groupBy` 一行的证据改指 `engine-delete-and-aggregate.ts#aggregate`。
- 为什么改:维护者在 #30012 上说「我觉得文件还是太长,还有进一步的拆分优化空间吗」「可以后续立卡处理」「合并之后再继续」。两片合计搬走
64 块 1,787 行,`engine.ts` 从 13,550 行降到 11,752 行。
- 风险与回滚:只搬注释。撤销证明逐字节还原 base;公有 `.d.ts` 相等;objectql 测试 base 550 文件 /
10,967 = head;回滚就是 revert。
- 先看:① `engine.ts` 顶部被剪掉的 4 个 import 绑定;② `query.json` 的 `groupBy`
一行(第一片时 `searchFields` 的同类问题见 #30367 / #30368,这次 `check:liveness`
进了门禁清单,推前已过)。
- 两分钟验证:`node scripts/codemod-split-engine.mjs --hand-docs --verify
--base 38717d3`,应看到 `28 moved (858 lines) across 10 module(s), 36
already moved at base`、`12618 -> 11752 lines`,退出码 0;`pnpm --filter
@objectstack/spec check:liveness` 退出码 0。
- 需要你做的:改动共 1,875 行(未超 3,000 行线),本 PR 保持草稿,按席位安排落地。
## What changes
- **The generated slice.** `node scripts/codemod-split-engine.mjs
--hand-docs --write` on `main` `38717d34`, unedited. With no `--modules`
it moves every remaining private hand-series docblock; the 36 the first
slice moved are skipped as already moved. The script is unchanged since
#30341.
- **Four import bindings pruned** from `engine.ts`, because a moved
docblock's `{@link}` was their only reader (`noUnusedLocals` counts a
link): `RELATION_FILTER_ID_CAP` (its whole `import { type … }` goes),
`resolveFilterTokens`, and `collectInternalReadFields` /
`collectCredentialFields` (their whole import goes).
- **`packages/spec/liveness/query.json`, row `query.groupBy`.** The
third leg cited `engine.ts#aggregate`; the body has lived in
`engine-delete-and-aggregate.ts` since the codemod split, and the last
mention of `groupBy` in `engine.ts`, a private docblock, moved in this
slice. The leg now cites `engine-delete-and-aggregate.ts#aggregate`, and
the note gains one dated sentence. Without it `check:liveness` reds
exactly as it did after the first slice (#30367).
- **Changeset.** `patch` on `@objectstack/objectql` and
`@objectstack/spec` (the ledger ships in the spec package).
### What moved in this slice (10 modules, 28 docblocks, 858 lines)
| Hand module | Docblocks | Lines | Before → after |
|:--|--:|--:|--:|
| `engine-driver-options.ts` | 6 | 148 | 403 → 550 |
| `engine-hook-dispatch.ts` | 4 | 147 | 240 → 388 |
| `engine-file-reference-hydration.ts` | 5 | 128 | 453 → 581 |
| `engine-referential-integrity.ts` | 2 | 123 | 232 → 358 |
| `engine-execute-transactions.ts` | 2 | 73 | 204 → 280 |
| `engine-query-lowering.ts` | 3 | 69 | 178 → 249 |
| `engine-realtime-publish.ts` | 2 | 66 | 518 → 587 |
| `engine-count-aggregate.ts` | 1 | 41 | 209 → 254 |
| `engine-validation-messages.ts` | 2 | 40 | 193 → 236 |
| `engine-reference-name-visible.ts` | 1 | 23 | 238 → 265 |
`packages/objectql/src/engine.ts`: 12,618 → 11,752 lines.
### After both slices
All 64 private hand-series stubs that had a docblock now keep it beside
their body. On the class stay: the 20 public stubs (their docblock is
the contract), `validationMessageContext` (its function already carries
a richer docblock; merging two is an edit, not a move) and
`noteAdmittedValueShapeViolation` (no docblock). `--hand-docs` on this
head plans 0 moves.
## Verification
All at head `cc44c59f` unless stated.
- **Proof.** `--hand-docs --verify --base 38717d3`: exit 0. `28 moved
(858 lines) across 10 module(s), 36 already moved at base; engine.ts
12618 -> 11752 lines; undoing every move rebuilds the base, undone the
same way, for engine.ts and its 21 hand module(s) byte-for-byte, once
the 4 import binding(s) only a moved docblock linked are pruned`.
- **Determinism.** The same `--write` on a stale checkout of `main`
(`f672e0dc`, the same `engine.ts` and hand modules) printed the same
output tree sha256 `6c71d47c…7b38` as the run on `38717d34`.
- **`.d.ts`.** `packages/objectql/dist` built at base `38717d34` twice
and at head twice. Base 1 = base 2 and head 1 = head 2, byte for byte.
Base against head: `core` and `index` (`.d.ts` and `.d.mts`) are
byte-identical; `util-HASH` has 193/193 statements and 334/334 private
members, and its public surface is **EQUAL**. The raw difference is the
858 lines of moved private docblocks.
- **Ablation (on the real tree).** Through
`scripts/ablation-replace.mjs`, each restored to the HEAD blob: one
character changed in a moved docblock (`inAfterAbortUnit`'s, in
`engine-hook-dispatch.ts`) → `--verify` exits 1 naming the line; one
character changed in a docblock that stays on the class
(`checkDriversHealth`) → exits 1 naming the line. The battery's own
ablations ran on #30341 and the script is unchanged; `--self-test` 105
cases pass.
- **Suites.** objectql `test`: base `38717d34` 550 files / 10,967
passed, head 550 / 10,967. objectql `typecheck`: exit 0.
- **Liveness.** `pnpm --filter @objectstack/spec check:liveness`: exit 1
before the `groupBy` repoint (only that row), exit 0 after. Separately,
all 36 ledger rows that cite `engine.ts` were read: each one's key
(camelCase or snake_case) is still named in `engine.ts` on this head.
- **Gates.** `dispatch-gates --commands` derived 62 commands
(`check:liveness` among them), each run after a full `turbo run build
--filter='!@objectstack/docs'` (exit 0). All 62 exit 0; `--ran`: 62
derived, 62 run, 0 NOT-MEASURED.
## Acceptance notes
- As in the first slice, `{@link}`s inside a moved docblock now sit in
the hand module and are not rewritten.
- The `protocol.ts` half of #30053 (157 stubs, about 4,000 lines) is not
in this card's claim. The seat files it separately once its own serial
constraints clear.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(a ledger row only)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request. (the designated thread branch, recreated from `main`; second of
two slices)
- [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. (a liveness row; nothing generated reads it)
- [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_01Utp6CYHBS7P5hkUQrNHkHZ
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8fa738f commit 0c666c3
13 files changed
Lines changed: 951 additions & 924 deletions
File tree
- .changeset
- packages
- objectql/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 | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
165 | | - | |
| 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 | + | |
166 | 211 | | |
167 | 212 | | |
168 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
189 | 194 | | |
190 | 195 | | |
191 | 196 | | |
192 | | - | |
| 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 | + | |
| 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 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
193 | 287 | | |
194 | 288 | | |
195 | 289 | | |
| |||
315 | 409 | | |
316 | 410 | | |
317 | 411 | | |
318 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
319 | 422 | | |
320 | 423 | | |
321 | 424 | | |
| |||
339 | 442 | | |
340 | 443 | | |
341 | 444 | | |
342 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
343 | 450 | | |
344 | 451 | | |
345 | 452 | | |
| |||
362 | 469 | | |
363 | 470 | | |
364 | 471 | | |
365 | | - | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
366 | 488 | | |
367 | 489 | | |
368 | 490 | | |
| |||
378 | 500 | | |
379 | 501 | | |
380 | 502 | | |
381 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
382 | 509 | | |
383 | 510 | | |
384 | 511 | | |
| |||
389 | 516 | | |
390 | 517 | | |
391 | 518 | | |
392 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
393 | 540 | | |
394 | 541 | | |
395 | 542 | | |
| |||
0 commit comments