Repository navigation
Commit dc138a5
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBWMEECkfNfe2VjW9rMJG3n7)_
Part of #30147 (phase 2c of 2a-2d: the readers that sliced
`sql-driver.ts` by path read the facade form, so the codemod moves the
five path-reader members. 2d and the phase 3 measurement stay open on
the card.)
## 维护者速读
- 改了什么:新增 `scripts/sql-driver-split-source.mjs`,把 `SqlDriver`
重新读成一份文本(每个 codemod stub 的方法体换成它所调用的 facet 方法体,leaf 放回类前);cli 的 5 个
generate-* pin 和 `check-keyed-text-bounds.mjs` 改用它。codemod 因此清空 2 个 pin
和 10 个 needle,`createColumn` 写出返回类型 `void`,重新生成后 5 个成员变成委托,登记表 73 → 68。
- 为什么改:这些读者只认 `sql-driver.ts` 本文件的文字,codemod 只好把这 5 个方法留在类上(#30147,裁决
6597555122 第 3 条:读者与模块同一个 PR 里跟上)。
- 风险与回滚:方法体逐字节不变(180/180),公开 `.d.ts` 与 base 相同;5 个 pin
断言一条未改,只换了读取来源。回滚即 revert。
- 先看:`sql-driver-split-source.mjs`(约 160 行,只认 codemod 写的 stub
形态,认不出就抛错而不是读 stub);`cross-package-test-inputs.mjs` 与 `turbo.json` 里为
cli 新增的声明。
- 两分钟验证:`node scripts/codemod-split-sql-driver.mjs --self-test`(新电池
"split readers (#30147)" 8 例)和 `node scripts/check-keyed-text-bounds.mjs
--self-test`(新增 3 例),都退出 0。
- 需要你做的:无,席位审阅并落地。
Clause-②: no
Metadata-protocol: none
## What changes
Five members stayed on `SqlDriver` because readers sliced
`sql-driver.ts` by path: `createColumn`, `createAuditTimestampColumn`,
`varcharColumnChars`, `ensureShardTable` and `initObjects`. Each reader
now reads `SqlDriver` as one text, and the codemod tables that held the
five go.
**`scripts/sql-driver-split-source.mjs` (new, with its `.d.mts`).**
`readSqlDriverSource(srcDir)` returns `sql-driver.ts` with the body of
every codemod stub replaced by the body of the facet method it calls,
and the leaf (`sql-driver-top-level.ts`) put back ahead of the class. A
method's own signature on the class is then followed by its own body, as
before the split. It follows exactly the stub the codemod writes: one
statement, carrying the `[#29520 codemod]` marker, returning
`<X>Facet.<m>(…)` or `<X>Facet.<m>.call(<x>Host.of(this), …)` (or the
generic spelling), with the module named in the marker. A marked body of
any other shape, a missing module, or a facet without that static member
throws. The reader never hands back the stub text. Unmarked bodies (the
hand-series delegations) stay as they are. It is a reading, not an undo:
imports, a private docblock and the stub-side spellings stay as the
split has them. `--verify` remains the byte-for-byte proof.
**Readers.**
- The five `packages/cli` generate-* pins (`builtin-id-column`,
`field-type-vocabulary`, `file-reference-width`, `multiple-json-column`,
`string-family-width`) build `SQL_DRIVER_SOURCE` from
`readSqlDriverSource(DRIVER_SQL_SRC).text` instead of
`readFileSync(…/sql-driver.ts)`. No assertion, anchor or message
changes.
- `scripts/check-keyed-text-bounds.mjs` reads its emitter the same way.
A reader refusal becomes the gate's existing `{ error }` refusal.
**Codemod (`scripts/codemod-split-sql-driver.mjs`).**
- `PATH_READER_PINS` (2 rows) and `PATH_READER_NEEDLES` (10 rows) are
emptied. Both tables stay, with a note on why they are empty.
- `EXPLICIT_RETURN_TYPES` gains `createColumn: 'void'`, copied from the
base `dist/index.d.ts` (`protected createColumn(…): void;`).
- Regenerated from `21510bba`: `createColumn`,
`createAuditTimestampColumn` and `varcharColumnChars` move to
`sql-driver-column-creation.ts`; `ensureShardTable` and `initObjects`
move to `sql-driver-rotation.ts`; two top-level declarations move to the
leaf. `sql-driver.ts` goes from 10,624 to 9,741 lines.
**Declarations.** The pins now read every `sql-driver-*.ts` module a
stub names, through paths the cross-package scan cannot name.
`scripts/cross-package-test-inputs.mjs` gives `@objectstack/cli` the
glob `packages/drivers/driver-sql/src/sql-driver-*.ts` plus the reader
and its `.d.mts`, with `heldBy` witnesses naming the five pins (and one
for `sql-driver.ts`, which no literal names any more). `turbo.json`
`@objectstack/cli#test` carries the same three inputs. The glob also
matches the package's tests; that adds no re-run, because `cli#test`
already depends on `build` → `^build`, and driver-sql's `build` hashes
`$TURBO_DEFAULT$`.
**Registry.** The five rows are deleted, so 73 rows become 68 (the base
has 73: #30264 added four `engine.ts` rows after 2b's count of 69).
| card | before | after |
|:--|--:|--:|
| #30020 | 19 | 19 |
| #30054 | 16 | 16 |
| #30055 | 6 | 6 |
| #30147 | 32 | 27 (sql-driver.ts 8 → 3) |
| total | 73 | 68 |
The three `sql-driver.ts` rows left on #30147 are `applyFilterCondition`
(2d), `get supports` and `static DIALECT_CONNECT_TIMEOUT` (phase 3 names
both).
## Tests
- Codemod `--self-test` gains a seventh battery, "split readers
(#30147)", with 8 cases, driven over a split the script generates and
lays out on disk:
- every stub is followed;
- each followed stub reads its base body byte for byte after the
signature the class keeps;
- no stub text survives;
- the leaf stands ahead of the class;
- an unsplit file is read as it stands;
- a missing module, a facet without the static, and a marked stub of
another shape each refuse.
106 cases in 7 batteries (98 in 6 before); the battery floor goes 6 → 7.
- `check-keyed-text-bounds --self-test` gains 3 cases in "the
emitter-derived family" (floor 3 → 6): the family is read through a stub
from the facet module, and a stub naming an undeclared facet or of
another shape refuses.
- No assertion in any of the five pins changes. Before the reader
change, the regenerated tree reds 28 of their cases and
`check-keyed-text-bounds` exits 2 ("could not find the keyed-text arm").
Measured.
- The suites below ran at base `bfca0efb` and at head; the counts are
equal.
| suite | base | head |
|:--|:--|:--|
| driver-sql (`vitest run`) | 238 files passed, 12 skipped; 3,859
passed, 216 skipped | the same |
| driver-turso (subclasses `SqlDriver`) | 97 files; 2,514 passed, 34
skipped | the same |
| driver-sqlite-wasm (subclasses `SqlDriver`) | 40 files; 750 passed |
the same |
| cli by-path pins (9 files, the five generate-* pins among them) | 9
files; 116 passed | the same |
| types / metadata / metadata-protocol by-path tests, spec
`check-liveness.test` | 53 / 11 / 33 / 74 passed | the same |
## Acceptance notes
- The facade gate script and its self-test are untouched.
`check-keyed-text-bounds.mjs` and the cli pins are by-path readers.
- No changeset, as #30139, #30249 and #30306 (`skip-changeset`): no
published behaviour or surface changes.
## Verification
Head `d67df0b5`, base `origin/main` `bfca0efb`.
<details><summary>Proof readings</summary>
- Byte-identity: `node scripts/codemod-split-sql-driver.mjs --verify
--base 21510bb` exit 0, "180/180 moved bodies identical to base (body,
parameters, return type, async); 129/129 moved top-level declarations
identical to base (leading comments included); sql-driver.ts 18334 ->
9741 lines; undoing the split does rebuild the base byte-for-byte".
- Determinism: two `--write` runs from the unsplit input give output
tree sha256
`0d2ba8a299610def947cd879cee7e7c36aae58aecfca0f8acacc395339f7bf16` both
times (input sha256 `2d2ebebd…`), and the tree on disk is unchanged by
either.
- Public `.d.ts`: `dts-public.mjs` over the base and head `dist` exit 0,
`pass: true`, both files raw-equal (`index.d.ts` sha256 `92e2cfb2…` on
both sides, as at 2a and 2b).
- Typecheck: `pnpm --filter @objectstack/driver-sql typecheck` and `pnpm
--filter @objectstack/cli typecheck` (which includes
`check:test-typecheck`, so the pins' import of the `.d.mts`) exit 0.
- `check-tenant-chokepoint`: 24/21/3/4/0 across 39 files at base and
head; `--self-test` exit 0.
- Durability gate `--list` at base and head: 52 durability seams with
the same verdicts (103 read seams); the only change is the line of the
two `runWideningAlters()` seams inside `sql-driver-rotation.ts`
(`:321`/`:367` → `:661`/`:707`), because `ensureShardTable` and
`initObjects` moved in above them.
- `check-keyed-text-bounds`: exit 0 over the tree, the family read
through the stub is the same 8 types; `--self-test` exit 0.
- `check-cross-package-test-inputs` and `check-ci-filter-parity` exit 0.
- Facade gate exit 0, "5 facade class(es) in 3 file(s) hold delegations
only, 68 named exception(s)"; `--self-test` exit 0 (gate script and its
cases untouched).
- `node scripts/pm/dispatch-gates.mjs --commands`: 79 derived commands,
each run, all exit 0; `--ran` reconciles 79 derived, 79 run, 0
NOT-MEASURED. Also run: the codemod, `check-keyed-text-bounds`,
durability, `check-tenant-chokepoint` and facade gate `--self-test`s,
`check:lean-entry-closure`, eslint over the changed files (0 errors),
all exit 0.
- Changed lines 2,417 (+1,407 / -1,010), under the 3,000 threshold.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzj4B2cbnRLVdgtLcDZ)_
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 29702d5 commit dc138a5
17 files changed
Lines changed: 1407 additions & 1010 deletions
File tree
- packages
- cli/src/commands
- drivers/driver-sql/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
102 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
321 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
322 | 325 | | |
323 | 326 | | |
324 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
380 | | - | |
| 381 | + | |
| 382 | + | |
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| |||
0 commit comments