Skip to content

Commit c8ec0f6

Browse files
committed
test(service-analytics): supersede the one-entry point-degeneration pin with the refusal
`objectql-daterange.test.ts`'s 'narrows rather than vanishes on a one-entry dateRange array' pinned exactly the branch this card retires. It chose the narrower of two wrong answers because the alternative on the table was the native-SQL face's silent drop to all of history; a refusal satisfies #3650's intent strictly better, and the replacement keeps that card's own invariant by asserting no unfiltered query reaches the engine. The retirement is the one the neighbouring test declares deferred. Claude-Session: https://claude.ai/code/session_01ToDPcx9AESFubJkDiFMtKW Co-authored-by: Claude <noreply@anthropic.com>
1 parent b000e84 commit c8ec0f6

1 file changed

Lines changed: 34 additions & 14 deletions

File tree

packages/services/service-analytics/src/__tests__/objectql-daterange.test.ts

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,41 @@ describe('ObjectQLStrategy — timeDimensions[].dateRange (#3650)', () => {
196196
expect(result.rows).toEqual([{ stage: 'lost', revenue: 200 }]);
197197
});
198198

199-
it('narrows rather than vanishes on a one-entry dateRange array', async () => {
199+
// [#17124] SUCCEEDS 'narrows rather than vanishes on a one-entry dateRange
200+
// array', which pinned the point degeneration this card retired. ⛔ Not a
201+
// weakening of #3650: that card's complaint was 「no error, just every row
202+
// ever recorded」, and the old pin chose the narrower of two WRONG answers
203+
// because the alternative on the table was the native-SQL face's silent drop
204+
// to all of history. A refusal satisfies the same intent strictly better — it
205+
// is the error #3650 wanted — and the drop it was defending against is gone
206+
// from the sibling face in the same change. The retirement itself is the one
207+
// the test above declares deferred: 「Retiring this test, together with the
208+
// strategy's degeneration, belongs to #16322」.
209+
it('REFUSES a one-entry dateRange array, and still does not plot all of history', async () => {
200210
const seen: AggOpts[] = [];
201-
await makeService(seen).query(
202-
{
203-
cube: 'sales',
204-
dimensions: ['stage'],
205-
measures: ['revenue'],
206-
// The schema types `dateRange` as a plain `string[]`, so this parses.
207-
// `NativeSQLStrategy` drops such a window — but "drop the window" means
208-
// "plot all of history", the very failure #3650 is about.
209-
timeDimensions: [{ dimension: 'close_date', dateRange: ['2026-01-20'] }],
210-
},
211-
ctx,
212-
);
213-
expect(seen[0].filter).toEqual({ close_date: { $gte: '2026-01-20', $lte: '2026-01-20' } });
211+
let thrown: (Error & { code?: string; status?: number }) | undefined;
212+
try {
213+
await makeService(seen).query(
214+
{
215+
cube: 'sales',
216+
dimensions: ['stage'],
217+
measures: ['revenue'],
218+
// The schema types `dateRange` as a plain `string[]`, so this parses
219+
// and reaches the face past the door.
220+
timeDimensions: [{ dimension: 'close_date', dateRange: ['2026-01-20'] }],
221+
},
222+
ctx,
223+
);
224+
} catch (e) {
225+
thrown = e as Error & { code?: string; status?: number };
226+
}
227+
// ⛔ On the ENVELOPE, not on `toThrow()` — an unfixed face throwing a bare
228+
// `Error` would satisfy that.
229+
expect(thrown?.code).toBe('ANALYTICS_DATE_RANGE_UNRECOGNIZED');
230+
expect(thrown?.status).toBe(400);
231+
// #3650's own invariant, kept: the window did not VANISH into an unfiltered
232+
// query. The refusal lands before the engine is asked anything at all.
233+
expect(seen).toEqual([]);
214234
});
215235

216236
it('ANDs the read scope around the window rather than replacing it', async () => {

0 commit comments

Comments
 (0)