Commit d138a6e
committed
docs(cli): correct the reason the driver constants are transcribed
CORRECTING THE RECORD. Three commit messages on this branch, and three sites in
the code, give as their FIRST reason for transcribing the driver's constants
that those members reach no exported surface. That is false, and this queue
composes the squash body from the branch's commit messages, so the sentences
below would land in `main` as written:
* 9cc1a76 -- "The transcription is still necessary, for two other
reasons: the constant is `protected static`, and #5726 forbids a CLI
production module any static value import of a driver package."
* 11d0e8d -- "`MAX_VARCHAR_CHARS`, `MAX_KEYABLE_VARCHAR_CHARS`,
`keyableTextLength`, `declaredVarcharLength` and `computeTenantField` are
`protected` and reach no exported surface".
* 722880a -- "Replaced with the real reasons: `MAX_VARCHAR_CHARS` is
`protected static` and reaches no exported surface, and #5726 leaves a CLI
production module only `await import()`".
`protected` is a COMPILE-TIME visibility modifier. It removes a member from
neither the exported class nor the published types. Measured on this worktree's
built `packages/drivers/driver-sql/dist`:
index.d.ts:5593 protected static readonly MAX_VARCHAR_CHARS = 16383;
index.d.ts:5536 protected static readonly MAX_KEYABLE_VARCHAR_CHARS = 768;
index.d.ts:5625 protected declaredVarcharLength(field: any): number | null;
index.d.ts:5626 protected keyableTextLength(field: any): number | null;
index.d.ts:3501 protected computeTenantField(schema: ...);
require('.../driver-sql/dist/index.js').SqlDriver.MAX_VARCHAR_CHARS -> 16383
hasOwnProperty.call(SqlDriver, 'MAX_VARCHAR_CHARS') -> true
All five are on the exported `SqlDriver`. The pin test already depends on this:
it reaches the driver's own `protected` judgments by subclassing, which it could
not do if they were absent from the published types.
THE REAL CONSTRAINT, AND IT IS A CHOICE
#5726 forbids a CLI production module any static value import of an
`@objectstack/driver-*` package -- `schema-migrate.lazy-driver-import.test.ts`
scans every non-test `.ts` under `packages/cli/src` -- and what it leaves open
is `await import()` at the point of use. These generators are SYNCHRONOUS, so
they cannot take it. That is the whole reason, and it is a property of how this
package is written rather than of the constants: make the generators async and
the transcription can go.
This is the THIRD round on the same claim. Round 3's review flagged it, round 4
retracted it in the PR body and left it standing at three sites in the code,
which is what produced this round. The PR body is not what the next author
reads; the comment beside the constant is.
WHAT MOVES -- comments and docblocks only. No behaviour, no test, no pin, no
count, no changeset:
* `generate.ts`, `MAX_VARCHAR_CHARS`'s docblock: the "protected static, so
not on the driver package's exported surface at all" bullet is gone. The
reason is now #5726 plus the synchronous generators, and the retracted
claim is kept as a banned one beside the "does not depend on the driver at
runtime" ban that preceded it, so nobody restates it a fourth time.
* `generate.ts`, `isOrganizationScopedUnique`'s docblock: it drew a contrast
-- "Unlike {@link MAX_VARCHAR_CHARS}, this one IS on `driver-sql`'s
exported surface" -- that the measurement above dissolves. Both reach the
exported surface, and both are spelled here for the one reason. Its tail
also named the LEAF differential as what makes the spelling safe; the
authority since 722880a is `SqlDriver.initObjects` read back with
`PRAGMA table_info`, with the leaf differential kept beneath it and
explicitly not the authority.
* `generate.ts`, `indexKeyColumns`: the same stale attribution -- "the
differential ... which now recomputes this whole set from the driver's own
exported builders" -- now names the real chain and marks the leaf as not
the authority.
* `generate-string-family-width.pin.test.ts`: the restatement 722880a
put there is retracted in place, beside the earlier false reason that
comment already bans.
`MAX_KEYABLE_VARCHAR_CHARS`'s docblock inherits by reference -- "Transcribed and
pinned for exactly the reasons {@link MAX_VARCHAR_CHARS} gives" -- so it is
corrected by the block it cites and needed no edit.
Verified: `pnpm --filter @objectstack/cli typecheck` exit 0; the four pin files
`Test Files 4 passed (4)` / `Tests 81 passed (81)`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D47qPfEWVPmhguWgBZCi5N1 parent fd79a12 commit d138a6e
2 files changed
Lines changed: 47 additions & 22 deletions
Lines changed: 12 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
740 | 745 | | |
741 | 746 | | |
742 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1201 | 1201 | | |
1202 | 1202 | | |
1203 | 1203 | | |
1204 | | - | |
1205 | | - | |
| 1204 | + | |
| 1205 | + | |
1206 | 1206 | | |
1207 | | - | |
1208 | | - | |
1209 | 1207 | | |
1210 | 1208 | | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1214 | 1215 | | |
1215 | 1216 | | |
1216 | 1217 | | |
1217 | 1218 | | |
1218 | 1219 | | |
1219 | 1220 | | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1220 | 1232 | | |
1221 | 1233 | | |
1222 | 1234 | | |
| |||
1343 | 1355 | | |
1344 | 1356 | | |
1345 | 1357 | | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
1349 | 1362 | | |
1350 | 1363 | | |
1351 | 1364 | | |
1352 | 1365 | | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
1356 | 1373 | | |
1357 | 1374 | | |
1358 | 1375 | | |
| |||
1443 | 1460 | | |
1444 | 1461 | | |
1445 | 1462 | | |
1446 | | - | |
1447 | | - | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
1448 | 1468 | | |
1449 | 1469 | | |
1450 | 1470 | | |
| |||
0 commit comments