Commit 2866d5f
feat(cli):
Three migrations replace a declared UNIQUE index with the NULL-safe — and
sometimes active-rows-only — form it was always meant to have, at `kernel:ready`
on a serving boot: `ensureMetadataOverlayIndexes` (`sys_metadata`, one index per
overlay state), `ensureViewDefinitionActiveIndex` (`sys_view_definition`) and
`ensureSysSettingIdentityIndex` (`sys_setting`). Each is a tightening, so rows
an installation already holds can block it; the migration then refuses under
ADR-0120 D4 — previous index kept, no row touched, boot continues — and reports
at `error` on the boot channel.
That channel was the only one, and not by omission. These indexes are invisible
to the drift differ by construction, twice over: after the tightening
`isRuntimeManagedIndex` excludes the index (without that exclusion a boot would
propose rebuilding away the guarantee it had just created), and before it each
migration deliberately reuses the DECLARED index's name, so the reconciler's
name-matched slot reads as filled whichever physical form is really there. A
prior round measured it with a matched control — one database carrying the same
duplicate damage under a declared organization-unique index and under
`sys_view_definition`'s runtime one — and `os migrate plan` named the declared
one in full while saying nothing whatsoever about the runtime one.
Maintainer ruling, 2026-08-22: the reporting path is `os migrate duplicates`,
which already boots read-only and owns the "inventory, never repair" contract,
keeping `os migrate plan`'s drift contract untouched. `plan` describes work
`os migrate apply` will do; this work is applied by the next SERVING boot, by a
different applier.
What lands:
* `@objectstack/metadata-protocol` gains `runtime-index-preflight.ts` —
`runtimeIndexProbes()` and `collectRuntimeIndexPreflight()`. The descriptors
read each migration's OWN exported builders rather than restating the keys,
so the pre-flight and the boot report cannot describe different duplicates,
and the `sys_setting` probe uses the migration's MySQL spelling on MySQL,
where the bare form is ERROR 1064 on the reserved word `key`.
* The report gains `runtimeIndexPreflight` (one entry per index:
blocked/clear/table-absent/unreadable, a blocked one naming every colliding
key group and its row count) plus `summary.runtimeIndexesBlocked` and
`summary.runtimeIndexBlockingRows`. `reportVersion` moves 1 → 2: every
version-1 field keeps its name, shape and meaning, and the bump says there is
more in the document for a consumer that validates it strictly.
* `collectDuplicateIdentifierReport`'s new option is REQUIRED rather than
optional. An optional section defaults to `[]`, and `[]` is also what a clean
database produces, so a caller that forgot to wire it would ship a clean bill
of health from a probe that never ran — the #10677 failure, one section over.
Required moves that mistake to a compile error.
* Liveness is keyed on whether the seam returns a RESULT SET, reusing the
sibling migration's `isResultSet` rather than copying it. A no-op seam would
otherwise report all four tightenings as `table-absent`, which is that same
failure again wearing a different status.
* Nine referral sites repointed, not deleted (the ruling is explicit): three
conflict-error strings that told the operator to "run `os migrate plan`" — an
instruction the measurement proved false — and the six doc comments that state
the same referral as part of the D4 disposition. Their pins now assert both
that the new command is named and that the false one is gone.
Nothing about a migration's behaviour changes: no tightening is armed, deferred
or altered, and `plan` is untouched. The pre-flight only makes the refusal's
evidence readable one command before the restart.
Read-only is pinned LOGICALLY — schema plus every row, ordered — in both the new
unit suite and the CLI integration test, never by a file hash: a raw hash over a
SQLite file moves on any read-write open and would accuse this command of
mutating the install it exists to describe.
Fixes #8725
Claude-Session: https://claude.ai/code/session_019bmVFqoQPq63zhKrxdYG1r
Co-authored-by: Claude <noreply@anthropic.com>os migrate duplicates reports the rows blocking the kernel:ready index tightenings (#11031)1 parent cec9d23 commit 2866d5f
17 files changed
Lines changed: 1071 additions & 42 deletions
File tree
- .changeset
- content/docs/deployment
- docs/qa/platform-checklist/areas
- packages
- cli/src/commands/migrate
- metadata-protocol/src
- migrations
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
680 | | - | |
| 680 | + | |
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| |||
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1014 | 1065 | | |
1015 | 1066 | | |
1016 | 1067 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1047 | 1047 | | |
1048 | 1048 | | |
1049 | 1049 | | |
1050 | | - | |
| 1050 | + | |
1051 | 1051 | | |
1052 | 1052 | | |
1053 | 1053 | | |
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
1069 | | - | |
| 1069 | + | |
| 1070 | + | |
1070 | 1071 | | |
1071 | 1072 | | |
1072 | 1073 | | |
1073 | 1074 | | |
1074 | 1075 | | |
1075 | 1076 | | |
1076 | 1077 | | |
1077 | | - | |
| 1078 | + | |
1078 | 1079 | | |
1079 | 1080 | | |
1080 | 1081 | | |
| |||
1091 | 1092 | | |
1092 | 1093 | | |
1093 | 1094 | | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
1094 | 1101 | | |
1095 | 1102 | | |
1096 | 1103 | | |
| |||
Lines changed: 46 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
123 | | - | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
137 | 155 | | |
138 | 156 | | |
139 | 157 | | |
140 | 158 | | |
141 | | - | |
| 159 | + | |
| 160 | + | |
142 | 161 | | |
143 | 162 | | |
144 | 163 | | |
| |||
212 | 231 | | |
213 | 232 | | |
214 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
215 | 244 | | |
216 | 245 | | |
217 | 246 | | |
218 | 247 | | |
219 | 248 | | |
220 | 249 | | |
| 250 | + | |
| 251 | + | |
221 | 252 | | |
222 | 253 | | |
223 | 254 | | |
224 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
225 | 268 | | |
226 | 269 | | |
227 | 270 | | |
| |||
248 | 291 | | |
249 | 292 | | |
250 | 293 | | |
| 294 | + | |
251 | 295 | | |
252 | 296 | | |
253 | 297 | | |
| |||
0 commit comments