From e8d64c3057377383a7b363314b9d05d2ef8d34a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 07:50:38 +0000 Subject: [PATCH] test(cli): move the nightly-tier failure-warnings fixtures off the bare declared-index unique The two `--json` failure-warnings e2e suites planted their authoring-rule advisory as a bare `unique: true` on a declared index. Protocol 18 refuses that spelling at the schema parse (ADR-0120 D7), so every fixture stopped at the parse exit and the payloads carried none of the fields the tests read. Each fixture now raises `unique/double-declaration` instead: field-level `unique: true` beside a declared index `unique: 'global'` on the same column, the shape the sibling parity suites already moved to. It is a warning-severity author-time rule, so it still rides `ruleAdvisories`. No assertion changes, and no test is skipped, renamed or moved between tiers. Claude-Session: https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU Co-authored-by: Claude --- .../build-json-failure-warnings.e2e.test.ts | 18 ++++++++++++------ .../validate-json-failure-warnings.e2e.test.ts | 16 +++++++++++----- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/cli/test/build-json-failure-warnings.e2e.test.ts b/packages/cli/test/build-json-failure-warnings.e2e.test.ts index d37d58eb60d..7dfddae7a5c 100644 --- a/packages/cli/test/build-json-failure-warnings.e2e.test.ts +++ b/packages/cli/test/build-json-failure-warnings.e2e.test.ts @@ -140,11 +140,16 @@ const PLANTED_KEY = 'zzzUndeclaredProbeKey'; /** * A stack raising ONE advisory of each of the four classes while parsing - * cleanly: a bare `unique: true` index (authoring-RULE advisory), an unknown - * `requires` token (#3366 capability hint), an undeclared key inside + * cleanly: `title` unique twice — per organization on the field, `'global'` on + * a declared index (authoring-RULE advisory, `unique/double-declaration`), an + * unknown `requires` token (#3366 capability hint), an undeclared key inside * `visibleWhen` (#3786 finding), plus — via `plantDocs` — a doc whose `tags:` * scalar the reader cannot parse (ADR-0046 doc advisory). * + * The rule advisory was a bare declared `unique: true` until protocol 18 refused + * that spelling at the parse (ADR-0120 D7, PR #22103), which then stopped every + * run at step 3, before the gate under test. + * * The key sits inside `visibleWhen` rather than on the object or field itself: * an undeclared key in either of those positions has been a hard PARSE error * since #4001, which would stop the run at 3 and never reach the gate under @@ -162,11 +167,12 @@ export default defineStack({ name: '${ns}_ticket', label: 'Ticket', sharingModel: 'private', - indexes: [{ name: '${ns}_title_idx', fields: ['title'], unique: true }], + indexes: [{ name: '${ns}_title_idx', fields: ['title'], unique: 'global' }], fields: { title: { type: 'text', label: 'Title', + unique: true, visibleWhen: { dialect: 'cel', source: 'true', ${PLANTED_KEY}: 1 }, }, }, @@ -289,7 +295,7 @@ export default defineStack({ `); // 3b — an author-time rule ERROR (a `record.` that does not resolve), - // raised alongside the bare-`unique` advisory. + // raised alongside the `unique/double-declaration` advisory. make('rulefail', ` import { defineStack } from '@objectstack/spec'; @@ -297,8 +303,8 @@ export default defineStack({ manifest: { id: 'com.example.rfail', name: 'rfail', version: '1.0.0', type: 'app', namespace: 'rfail' }, requires: ['${PLANTED_TOKEN}'], objects: [{ name: 'rf_ticket', label: 'Ticket', sharingModel: 'private', - indexes: [{ name: 'rf_title_idx', fields: ['title'], unique: true }], - fields: { title: { type: 'text', label: 'Title', + indexes: [{ name: 'rf_title_idx', fields: ['title'], unique: 'global' }], + fields: { title: { type: 'text', label: 'Title', unique: true, visibleWhen: { dialect: 'cel', source: 'record.zzz_no_such_field' } } } }], }, { strict: false }); `); diff --git a/packages/cli/test/validate-json-failure-warnings.e2e.test.ts b/packages/cli/test/validate-json-failure-warnings.e2e.test.ts index 6b06604113e..130379c2391 100644 --- a/packages/cli/test/validate-json-failure-warnings.e2e.test.ts +++ b/packages/cli/test/validate-json-failure-warnings.e2e.test.ts @@ -166,12 +166,17 @@ function payloadOf(run: Run, label: string): Record { } /** - * A stack raising ONE advisory of each class while parsing cleanly: a bare - * `unique: true` index (authoring-RULE advisory), an unknown `requires` token - * (#3366 capability hint), an undeclared key inside `visibleWhen` (#3786 + * A stack raising ONE advisory of each class while parsing cleanly: `title` + * unique twice — per organization on the field, `'global'` on a declared index + * (authoring-RULE advisory, `unique/double-declaration`), an unknown `requires` + * token (#3366 capability hint), an undeclared key inside `visibleWhen` (#3786 * finding), and — by declaring neither `apps` nor `plugins` — the structural * advisory that must NOT appear on any failure exit. * + * The rule advisory was a bare declared `unique: true` until protocol 18 refused + * that spelling at the parse (ADR-0120 D7, PR #22103), which then stopped every + * run at the parse gate, before the gate under test. + * * The key sits inside `visibleWhen` rather than on the object or field itself: * an undeclared key in either of those positions has been a hard PARSE error * since #4001, which would stop the run at the parse gate and never reach the @@ -189,11 +194,12 @@ export default defineStack({ name: '${ns}_ticket', label: 'Ticket', sharingModel: 'private', - indexes: [{ name: '${ns}_title_idx', fields: ['title'], unique: true }], + indexes: [{ name: '${ns}_title_idx', fields: ['title'], unique: 'global' }], fields: { title: { type: 'text', label: 'Title', + unique: true, visibleWhen: { dialect: 'cel', source: 'true', ${PLANTED_KEY}: 1 }, },${extraFields} }, @@ -293,7 +299,7 @@ beforeAll(() => { broken: { type: 'this_is_not_a_field_type', label: 'Broken' },`)); // rule errors — an expression naming a field that does not resolve, raised - // alongside the bare-`unique` advisory. + // alongside the `unique/double-declaration` advisory. make('rulefail', stack('rfail', [PLANTED_TOKEN], ` subject: { type: 'text', label: 'Subject', visibleWhen: { dialect: 'cel', source: 'record.zzz_no_such_field' } },`));