diff --git a/tests/integration/analytics-engine-clickhouse.integration.test.ts b/tests/integration/analytics-engine-clickhouse.integration.test.ts index d798ca9..69052bb 100644 --- a/tests/integration/analytics-engine-clickhouse.integration.test.ts +++ b/tests/integration/analytics-engine-clickhouse.integration.test.ts @@ -17,6 +17,15 @@ import { ClickHouseAnalyticsEngine } from "@/src/analytics/engine/clickhouse-eng import { ANALYTICS_MATERIALIZED_VIEWS, ANALYTICS_TABLES } from "@/src/analytics/engine/schema"; import type { AnalyticsIdentity } from "@/src/analytics/engine/siax-analytics-engine"; + +/** + * Raw events carry a 30-day TTL (src/analytics/engine/schema.ts). Fixed + * historical timestamps silently expire and make live-ClickHouse suites read + * 0 rows, so seed rows are stamped relative to now (UTC, ClickHouse + * DateTime64(3) text form). + */ +const SEED_EVENT_TIME = new Date(Date.now() - 2 * 3600_000).toISOString().replace("T", " ").replace("Z", ""); + const CLICKHOUSE_URL = process.env.CLICKHOUSE_URL; const CLICKHOUSE_AUTH = process.env.CLICKHOUSE_AUTH; const run = CLICKHOUSE_URL ? describe : describe.skip; @@ -113,7 +122,7 @@ run("BI-P009/BI-P010 ClickHouse provider against a LIVE server", () => { dataset_id: "ds_mv", metric: "mv_metric", event_id: `mv${i}`, - event_time: "2026-09-03 12:00:00.000", + event_time: SEED_EVENT_TIME, value: 2, dim_names: [], dim_values: [], @@ -140,7 +149,7 @@ run("BI-P009/BI-P010 ClickHouse provider against a LIVE server", () => { dataset_id: "ds_g", metric: "grouped", event_id: `g${i}`, - event_time: "2026-09-04 09:00:00.000", + event_time: SEED_EVENT_TIME, value: 5, dim_names: ["severity"], dim_values: [sev], diff --git a/tests/integration/analytics-resource-governance.integration.test.ts b/tests/integration/analytics-resource-governance.integration.test.ts index a0b5094..3a7c99e 100644 --- a/tests/integration/analytics-resource-governance.integration.test.ts +++ b/tests/integration/analytics-resource-governance.integration.test.ts @@ -19,6 +19,15 @@ import { ClickHouseAnalyticsEngine } from "@/src/analytics/engine/clickhouse-eng import { DEFAULT_BUDGETS } from "@/src/analytics/engine/resource-governance"; import type { AnalyticsIdentity } from "@/src/analytics/engine/siax-analytics-engine"; + +/** + * Raw events carry a 30-day TTL (src/analytics/engine/schema.ts). Fixed + * historical timestamps silently expire and make live-ClickHouse suites read + * 0 rows, so seed rows are stamped relative to now (UTC, ClickHouse + * DateTime64(3) text form). + */ +const SEED_EVENT_TIME = new Date(Date.now() - 2 * 3600_000).toISOString().replace("T", " ").replace("Z", ""); + const CLICKHOUSE_URL = process.env.CLICKHOUSE_URL; const CLICKHOUSE_AUTH = process.env.CLICKHOUSE_AUTH; const run = CLICKHOUSE_URL ? describe : describe.skip; @@ -75,7 +84,7 @@ run("BI-P012 resource governance against a LIVE ClickHouse", () => { dataset_id: "ds_v", metric: "victim_metric", event_id: `v${i}`, - event_time: "2026-09-05 08:00:00.000", + event_time: SEED_EVENT_TIME, value: 1, dim_names: ["severity"], dim_values: ["warning"], diff --git a/tests/integration/analytics-tenant-isolation.integration.test.ts b/tests/integration/analytics-tenant-isolation.integration.test.ts index 3a1f9c9..9a261be 100644 --- a/tests/integration/analytics-tenant-isolation.integration.test.ts +++ b/tests/integration/analytics-tenant-isolation.integration.test.ts @@ -37,6 +37,15 @@ import { ANALYTICS_TABLES, sortingKeySql } from "@/src/analytics/engine/schema"; import { DEFAULT_BUDGETS } from "@/src/analytics/engine/resource-governance"; import type { AnalyticsIdentity } from "@/src/analytics/engine/siax-analytics-engine"; + +/** + * Raw events carry a 30-day TTL (src/analytics/engine/schema.ts). Fixed + * historical timestamps silently expire and make live-ClickHouse suites read + * 0 rows, so seed rows are stamped relative to now (UTC, ClickHouse + * DateTime64(3) text form). + */ +const SEED_EVENT_TIME = new Date(Date.now() - 2 * 3600_000).toISOString().replace("T", " ").replace("Z", ""); + const CLICKHOUSE_URL = process.env.CLICKHOUSE_URL; const CLICKHOUSE_AUTH = process.env.CLICKHOUSE_AUTH; const run = CLICKHOUSE_URL ? describe : describe.skip; @@ -100,7 +109,7 @@ run("BI-P011 tenant isolation against a LIVE ClickHouse", () => { dataset_id: "ds_shared", metric: "rows_ingested", event_id: `a${i}`, - event_time: "2026-09-01 10:00:00.000", + event_time: SEED_EVENT_TIME, value: 1, dim_names: ["severity"], dim_values: [i % 2 === 0 ? "warning" : "critical"], @@ -113,7 +122,7 @@ run("BI-P011 tenant isolation against a LIVE ClickHouse", () => { dataset_id: "ds_shared", metric: "rows_ingested", event_id: `b${i}`, - event_time: "2026-09-01 10:00:00.000", + event_time: SEED_EVENT_TIME, value: 1000, dim_names: ["severity"], dim_values: ["critical"], @@ -275,7 +284,7 @@ run("BI-P011 tenant isolation against a LIVE ClickHouse", () => { restrictedAuth, {}, {}, - JSON.stringify({ tenant_id: "t_beta", project_id: "p", dataset_id: "d", metric: "m", event_id: "x", event_time: "2026-09-01 00:00:00.000", value: 1, dim_names: [], dim_values: [] }), + JSON.stringify({ tenant_id: "t_beta", project_id: "p", dataset_id: "d", metric: "m", event_id: "x", event_time: SEED_EVENT_TIME, value: 1, dim_names: [], dim_values: [] }), ); expect(write.ok).toBe(false); diff --git a/tests/integration/semantic-parity.integration.test.ts b/tests/integration/semantic-parity.integration.test.ts index 067ee60..a5ea01a 100644 --- a/tests/integration/semantic-parity.integration.test.ts +++ b/tests/integration/semantic-parity.integration.test.ts @@ -60,6 +60,15 @@ import { } from '@/src/analytics/metrics/semantic-registry'; import type { MetricSpec } from '@/src/analytics/metrics/metric-model'; + +/** + * Raw events carry a 30-day TTL (src/analytics/engine/schema.ts). Fixed + * historical timestamps silently expire and make live-ClickHouse suites read + * 0 rows, so seed rows are stamped relative to now (UTC, ClickHouse + * DateTime64(3) text form). + */ +const SEED_EVENT_TIME = new Date(Date.now() - 2 * 3600_000).toISOString().replace("T", " ").replace("Z", ""); + const CLICKHOUSE_URL = process.env.CLICKHOUSE_URL; const CLICKHOUSE_AUTH = process.env.CLICKHOUSE_AUTH; // Collection-time, never inside a hook: `describe.skipIf(flagSetInBeforeAll)` @@ -280,7 +289,7 @@ run('BI-P029 — one golden metric, two independent compilers, one live ClickHou dataset_id: 'ds_sales', metric: 'amount_sek', event_id: `e${i}`, - event_time: '2026-09-03 12:00:00.000', + event_time: SEED_EVENT_TIME, value: r.amount, dim_names: ['country_code', 'sales_channel'], dim_values: [r.country, r.channel],