Skip to content

Commit 989ae42

Browse files
refactor(driver-sql): the codemod writes applyFilterCondition's return type, so it moves (#30147 phase 2d) (#30441)
<!-- 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 2d, the last of 2a-2d: the codemod writes `applyFilterCondition`'s return type, so it moves. The phase 3 measurement is posted on the card.) ## 维护者速读 - 改了什么:codemod 的 `EXPLICIT_RETURN_TYPES` 新增 `applyFilterCondition: 'void'`(取自 base 构建出的 `dist/index.d.ts`),重新生成后它的方法体移到 `sql-driver-filter-helpers.ts`,登记表删去这一条(68 → 67)。 - 为什么改:它留在类上只因为 base 没写返回类型(#30147 第 2d 步,2a 已为同类成员建好这张表)。 - 风险与回滚:方法体逐字节不变(181/181),公开 `.d.ts` 与 base 逐字节相同;回滚即 revert。 - 先看:codemod 里新增的那一行,以及 `sql-driver.ts` 上 `applyFilterCondition` 的 stub。 - 两分钟验证:`node scripts/codemod-split-sql-driver.mjs --verify --base 21510bb`(`181/181`,退出 0)和 `node scripts/check-facade-delegation-only.mjs`(67 条具名例外,退出 0)。 - 需要你做的:无,席位审阅并落地。 Clause-②: no Metadata-protocol: none ## What changes - **Codemod (`scripts/codemod-split-sql-driver.mjs`).** `EXPLICIT_RETURN_TYPES` gains `applyFilterCondition: 'void'`. The type is copied from the base `dist/index.d.ts` (`protected applyFilterCondition(builder: Knex.QueryBuilder, condition: any, logicalOp?: 'and' | 'or', tableHint?: string | null, rootFilter?: unknown, options?: DriverOptions): void;`). - **Regenerated from `21510bba`.** The body of `applyFilterCondition` moves to `sql-driver-filter-helpers.ts`, and the class keeps its signature with `: void` written as a one-call stub. `sql-driver.ts` goes from 9,741 to 9,354 lines. No generated file is edited by hand. - **Registry.** The row is deleted, so 68 rows become 67. | card | before | after | |:--|--:|--:| | #30020 | 19 | 19 | | #30054 | 16 | 16 | | #30055 | 6 | 6 | | #30147 | 27 | 26 (sql-driver.ts 3 → 2) | | total | 68 | 67 | The two `sql-driver.ts` rows left on #30147 are `get supports` and `static DIALECT_CONNECT_TIMEOUT`. The phase 3 report on #30147 recommends that both stay as accepted exceptions. ## Tests - No test file changes. The codemod's `--self-test` already pins the `EXPLICIT_RETURN_TYPES` mechanism (battery "codemod-limit retirements (#30147)" from #30249). All 106 cases in 7 batteries pass. - The suites below ran at base `d3f23d20` 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) | 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. - No changeset, as #30139, #30249, #30306 and #30363 (`skip-changeset`): no published behaviour or surface changes (the public `.d.ts` is byte-identical). ## Verification Head `322898a6`, base `origin/main` `d3f23d20`. <details><summary>Proof readings</summary> - Byte-identity: `node scripts/codemod-split-sql-driver.mjs --verify --base 21510bb` exit 0: "181/181 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 -> 9354 lines; undoing the split does rebuild the base byte-for-byte". - Determinism: two `--write` runs from the unsplit input give output tree sha256 `b8a840238252ab67a7a7ae782a0870e03200f1da9d55cc75f4f07f16f9ac0272` 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). - Typecheck: `pnpm --filter @objectstack/driver-sql typecheck` exit 0. - `check-tenant-chokepoint`: 24/21/3/4/0 across 39 files at base and head; `--self-test` exit 0. - Durability gate `--list`: byte-identical output at base and head (52 seams). - Facade gate exit 0, "5 facade class(es) in 3 file(s) hold delegations only, 67 named exception(s)"; `--self-test` exit 0. - `node scripts/pm/dispatch-gates.mjs --commands`: 65 derived commands, each run, all exit 0; `--ran` reconciles 65 derived, 65 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, all exit 0. - Changed lines 873 (+456 / -417), under the 3,000 threshold. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzj4B2cbnRLVdgtLcDZ)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0005fec commit 989ae42

4 files changed

Lines changed: 456 additions & 417 deletions

File tree

0 commit comments

Comments
 (0)