Skip to content

Commit d159ac9

Browse files
committed
fix(lint): object-field-ref-unknown's index message says the skip is an error that drift reports
The SQL driver now logs a skipped declared index at error and os migrate plan reports it, so the message tail and the rule's docblock, which said warning and dropped, would have been false in the same release. Text only: the rule, severity, id and prescription are unchanged; the one pinned string in the rule's test follows the new wording. Claude-Session: https://claude.ai/code/session_01N8TPEsoJxPsdSdNKGnNGEN Co-authored-by: Claude <noreply@anthropic.com>
1 parent cef89b8 commit d159ac9

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎.changeset/20432-skipped-index-durability.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
'@objectstack/driver-sql': minor
33
'@objectstack/spec': patch
44
'@objectstack/platform-objects': patch
5+
'@objectstack/lint': patch
56
---
67

78
fix(driver-sql): a declared index that can never be built is logged at `error` and reported in drift
@@ -52,6 +53,11 @@ to handle.
5253
said the skip left "a warning in the server log". It now says an error, in English and in the
5354
zh-CN, ja-JP and es-ES translations. Nothing else in the text changes.
5455

56+
**The lint message follows too.** `object-field-ref-unknown`, on a misspelt `indexes[].fields`
57+
name, said the SQL driver skips the index "with only a warning, and drift drops it too". It now
58+
says the skip is logged at error and `os migrate plan` reports the index as unbuildable. The rule,
59+
its severity and its prescription are unchanged.
60+
5561
**Upgrade note:** on a database that already carries such an index, `os migrate plan` now
5662
reports one entry per index, and so does the boot's drift warning. That entry clears only when
5763
the metadata names stored fields or drops the index.

‎packages/lint/src/validate-object-field-refs.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ describe('validateObjectFieldRefs — indexes[].fields (verbatim physical column
603603
});
604604
expect(findings[0]!.message).toContain('"totl" is not a field on object "crm_invoice"');
605605
expect(findings[0]!.message).toContain('Did you mean "total"?');
606-
expect(findings[0]!.message).toContain('`unique` index is then silently unenforced');
606+
expect(findings[0]!.message).toContain('`unique` index is then unenforced');
607607
expect(findings[0]!.hint).toContain('Fields on "crm_invoice":');
608608
});
609609

‎packages/lint/src/validate-object-field-refs.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,11 @@
163163
* still skips the index at sync. `indexes[].fields[]` used to sit in this
164164
* list whole, as a storage question for the registration path answered
165165
* against the physical column set. That left a MISSPELLING with no door at
166-
* all: the sync's skip is a `warn` and drift drops the index, so nothing
167-
* anywhere refused a name that is not a field. Existence is therefore
166+
* all: the sync's skip was a `warn` and drift dropped the index, so nothing
167+
* anywhere refused a name that is not a field. (Since #20432 step 2 the
168+
* skip is logged at `error` through `logDurabilityFailure` and `os migrate
169+
* plan` reports the unbuildable index, but both still come after the
170+
* authoring doors.) Existence is therefore
168171
* judged here, against the authored field map plus the injected columns —
169172
* exactly the physical set a correct name can land in — and only the
170173
* materialization question stays with the sync (#20432 step 2, the
@@ -322,9 +325,9 @@ const LIST_POSITIONS: readonly ListPosition[] = [
322325
*/
323326
const INDEX_POSITION = {
324327
consequence:
325-
'The SQL driver skips the WHOLE index at sync with only a warning, and drift drops it too, '
326-
+ 'so `os migrate plan` never reports it: a `unique` index is then silently unenforced '
327-
+ 'while everything looks normal.',
328+
'The SQL driver skips the WHOLE index at sync. It logs the skip at error and `os migrate plan` '
329+
+ 'reports the index as unbuildable, but the object keeps serving: a `unique` index is then '
330+
+ 'unenforced until the name is fixed.',
328331
prescription:
329332
'Fix the column name. An index column is a field of this object, or a column the platform '
330333
+ 'injects on it (`created_at`, `organization_id`, …), spelled exactly — never a dotted path.',

0 commit comments

Comments
 (0)