Commit b72226f
* fix(driver-sql): declare the `indexes` key `initObjects` / `registerObjectMetadata` already read
Both entry points took `Array<{ name; fields?; tenancy? }>` with no `indexes`,
while `registerManagedObjectMetadata` read the key out of those very objects
through an `(obj as any)` cast and filled `managedObjectIndexes` from it — the
map `syncDeclaredIndexes` renders every declared UNIQUE from. The sibling
`detectManagedDrift` on the same class already declared `indexes?: any[]`, so
the two halves of one class disagreed about the shape of the same input. This
is the shape #4311 fixed for `tenancy`, one key over.
Nothing tripped over it because TypeScript's excess-property check fires on a
fresh object literal and not on one bound to a variable first, and every caller
in the package happened to bind first — a green that held for a reason
unrelated to correctness.
- Add `indexes?: any[]` to `registerObjectMetadata`, `initObjects` and the
shared `registerManagedObjectMetadata` helper, spelled as
`detectManagedDrift` spells it.
- Delete the `as any` at the `managedObjectIndexes.set` read site: the cast was
the evidence that the declaration and the read disagreed.
- Pin the fresh-object-literal form, which is the only form that can go red on
this defect; a variable-bound call measures nothing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADLdAs2pVcH17h9tZKWMBg
* fix(driver-sql): drop the two now-dead `as any` casts on the `indexes` parameter
Contract-review finding 4. Both sites read `indexes` off the same `initObjects`
parameter this change types, so once the signature declares the key the casts
state a disagreement that no longer exists — and the changeset's "path closed"
sentence is only true with them gone.
Both lines sit inside this card's declared region and no other in-flight claim
holds them. The remaining casts are deliberate: `ensureShardTable` reads through
its own narrow parameter type outside the region, and the `lifecycle` read is the
third-key class carried by a separate card.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADLdAs2pVcH17h9tZKWMBg
* chore(changeset): grade the driver-sql accept-set widening `minor`, and state the narrowing
Contract-review findings 1, 2 and 7.
Level: the governing text is the WHICH LEVEL maintainer ruling in
.github/workflows/pr-automation.yml — "A purely additive widening of a published
package's public surface (a new exported symbol on an index, a new accepted key
or value) takes at least `minor` ... a `fix(` that widens an index is therefore
`minor`" — mechanized by check-changeset-no-major.mjs, which reads a declared
clause-② plus a `patch` grade as a self-contradiction inside one PR. The
AGENTS.md sentence previously cited is the floor against `none`, not a ceiling,
and the historical `patch` precedents are named pre-rule by that same ruling.
Text: the previous "no call that compiles today stops compiling" was measured
false. The accept set moves both ways — widened for fresh object literals,
narrowed for variable-bound `indexes` spelled as a record, a readonly tuple or
null, all three of which compiled before and now fail TS2322. Measured in both
directions on this package's own tsc. No migration is owed: no caller here is
affected, and every newly rejected shape was already discarded at run time by
the Array.isArray guard.
Scope: names @objectstack/driver-sqlite-wasm, whose SqliteWasmDriver extends
SqlDriver and overrides neither method, so both signatures land in its published
.d.ts. Same fixed version group, so this is a CHANGELOG effect only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADLdAs2pVcH17h9tZKWMBg
* docs(changeset): correct the run-time claim — an `as const` tuple compiled AND worked
Re-review F1. The changeset said every shape newly rejected at compile time was
already discarded at run time by the `Array.isArray` guard. That is false for one
of the three shapes it names: `as const` is type-only, so at run time the value
is a plain array, `Array.isArray` returns true, and the index WAS synced.
Measured against the real driver rather than reasoned about: all three shapes
passed through `registerObjectMetadata` with the argument cast to `any`, so the
value reaching the driver is exactly what a pre-fix caller passed (the read path
is unchanged by this PR — the cast removal is type-only). Result: the `as const`
tuple is recorded in `managedObjectIndexes`; the record and `null` are deleted.
So the three are now stated apart: a record and `null` never survived the guard
and got no index and no diagnostic, while the `readonly` tuple compiled and
worked and is now rejected on the type surface alone. No banner and no ADR-0087
disposition are owed, on the two grounds that survive the correction: zero
affected callers, and `any[]` already published on `detectManagedDrift` for the
same key on the same class.
Also pins the narrowing axis, which nothing on the tree covered: two
`@ts-expect-error` lines in the existing pin file. They are the assertion — if
either stops erroring, tsc fails it as TS2578.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADLdAs2pVcH17h9tZKWMBg
* docs(changeset): state the readonly-tuple narrowing truthfully (#16570)
Re-review F1. The changeset's run-time sentence was false for one of the three
shapes it names: `as const` is type-only, so the value is a plain array at run
time, `Array.isArray` returns true, and the index WAS synced. The three shapes
are stated apart — a record and `null` were discarded at run time by the guard
and got no index and no diagnostic; the `readonly` tuple compiled and worked and
is now rejected on the type surface alone (`TS2322`), with no in-repo caller and
no way to have reached `detectManagedDrift` on the same class, which already
publishes `any[]` for the same key.
This commit records the seat's disposition on that corrected ground, which the
restatement had left unstated: no `BREAKING` banner and no ADR-0087 disposition,
resting on grounds (i) zero affected callers and (iii) the sibling's already
published `any[]` spelling — never on the run-time ground, which is false for
the `readonly` tuple.
No code change. Gates at this head, verbatim:
node scripts/check-changeset-no-major.mjs --base origin/main EXIT=0
node scripts/check-adr-0087-registration.mjs --base origin/main EXIT=0
node scripts/check-empty-changeset.mjs --base origin/main EXIT=0
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TezFG8ZMrNH6n5VTNpPpdH
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent b38821d commit b72226f
3 files changed
Lines changed: 205 additions & 7 deletions
File tree
- .changeset
- packages/drivers/driver-sql/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 149 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9735 | 9735 | | |
9736 | 9736 | | |
9737 | 9737 | | |
9738 | | - | |
| 9738 | + | |
9739 | 9739 | | |
9740 | 9740 | | |
9741 | 9741 | | |
| |||
9744 | 9744 | | |
9745 | 9745 | | |
9746 | 9746 | | |
9747 | | - | |
9748 | | - | |
| 9747 | + | |
| 9748 | + | |
9749 | 9749 | | |
9750 | 9750 | | |
9751 | 9751 | | |
| |||
9865 | 9865 | | |
9866 | 9866 | | |
9867 | 9867 | | |
9868 | | - | |
| 9868 | + | |
9869 | 9869 | | |
9870 | 9870 | | |
9871 | 9871 | | |
| |||
9876 | 9876 | | |
9877 | 9877 | | |
9878 | 9878 | | |
9879 | | - | |
| 9879 | + | |
| 9880 | + | |
| 9881 | + | |
| 9882 | + | |
| 9883 | + | |
| 9884 | + | |
| 9885 | + | |
| 9886 | + | |
| 9887 | + | |
| 9888 | + | |
| 9889 | + | |
| 9890 | + | |
| 9891 | + | |
| 9892 | + | |
| 9893 | + | |
| 9894 | + | |
9880 | 9895 | | |
9881 | 9896 | | |
9882 | 9897 | | |
| |||
9974 | 9989 | | |
9975 | 9990 | | |
9976 | 9991 | | |
9977 | | - | |
| 9992 | + | |
9978 | 9993 | | |
9979 | 9994 | | |
9980 | 9995 | | |
| |||
10049 | 10064 | | |
10050 | 10065 | | |
10051 | 10066 | | |
10052 | | - | |
| 10067 | + | |
10053 | 10068 | | |
10054 | 10069 | | |
10055 | 10070 | | |
| |||
0 commit comments