CI (SIAX Cloud) / security (push) Successful in 41s
Security Scan (SIAX Cloud) / security (push) Successful in 40s
CI (SIAX Cloud) / integration (push) Successful in 52s
CI (SIAX Cloud) / quality (push) Successful in 1m5s
CI (SIAX Cloud) / security (pull_request) Successful in 31s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 29s
CI (SIAX Cloud) / integration (pull_request) Successful in 45s
CI (SIAX Cloud) / quality (pull_request) Successful in 53s
Implements the eight BI program prompts that make 0pt the canonical SIAX
analytics capability. Every file is NEW: not one existing file is modified,
and src/analytics/clickhouse-analytics.ts is byte-identical to main.
BI-P002 — the nineteen canonical entities, verbatim, with tenant_id +
project_id on every tenant-owned record. sql/008 gives each one a table.
The four version entities BI-P002 names as immutable are enforced by BEFORE
UPDATE/DELETE triggers, not by a TypeScript `readonly` — proven by direct SQL
against a live Postgres.
BI-P003 — RAW/NORMALIZED/CURATED/SERVING with the read rule enforced:
assertReadableByBiSurface refuses a RAW dataset to a dashboard unless a
recorded exception exists. All eight required declarations are NOT NULL.
BI-P004 — DatasetContract and a fail-closed compatibility gate. Fifteen
breaking-change classes are each tested twice: refused under a minor bump,
accepted under a major one.
BI-P005 — Arrow IPC alongside JSON, with a hand-written FlatBuffers writer so
no npm dependency (or CVE surface) is added. Conformance comes from three
independent implementations, not from self-agreement: pyarrow 25.0.1 and
DuckDB 1.5.5 read identical values from both ClickHouse's Arrow and ours, and
ClickHouse's own Arrow C++ ingests our 20,000-row batch with exact aggregates.
BI-P009 — SiaxAnalyticsEngine with all eight capabilities. The existing
ClickHouseAnalytics is COMPOSED, never replaced. executeQuery (analyst SQL) is
declared and deliberately refused with CAPABILITY_UNAVAILABLE until BI-P017 and
BI-P033 land, rather than opening the raw-SQL hole BI-P011 enumerates.
BI-P010 — four purpose-built tables, not one giant one, and the difference is
measured against the counterfactual: 48.8ms/40,960 rows vs 174.4ms/5,400,000
rows for the same question; 5/660 granules vs 660/1149.
BI-P011 — layered isolation, each layer proven with the layer above removed.
Without the forced predicate the same statement returns 50,050 (both tenants);
with it, t_alpha gets 50. Without a row policy an unrestricted user sees 2
tenants; the restricted user running the IDENTICAL statement sees 1.
BI-P012 — every named limit, fired individually and identified by ClickHouse
error code, plus the half usually skipped: an unrelated tenant is timed while
a real CPU bomb is in flight and must still return the CORRECT answer.
Three defects found by writing tests that can fail:
* `CHECK (array_length(purposes,1) >= 1)` can NEVER fail — array_length is
NULL for '{}' and a NULL CHECK passes. Fixed with coalesce(); the test
that caught it is pinned.
* EXPLAIN ESTIMATE run under the caller's own max_rows_to_read fails with
code 158 exactly when the estimate would be over budget. Planner calls now
use a narrower envelope.
* result_overflow_mode=break returns HTTP 200 with 65,409 of 100,000 rows
and no indication it is short. Every SELECT ships `throw`.
Verified rather than assumed: server7's ClickHouse holds `opt_scraped` (51
tables, 407,793,471 rows, `persons`/`cz_owners` included) — the b0ts plane this
module is prohibited from touching — has no `opt_analytics` database, zero
tenant_id columns and zero row policies. Nothing there was modified; every
proof ran against disposable containers.
Evidence: evidence/bi-p002-p012/{test-transcript.txt,bi-p010-benchmark.json,
bi-p005-arrow-roundtrip.json,server7-clickhouse-probe.md}
Docs: docs/analytics/BI_ANALYTICS_CORE.md
Co-Authored-By: Claude Opus 5 <[email protected]>
150 lines
3.9 KiB
JSON
150 lines
3.9 KiB
JSON
{
|
|
"generated_at": "2026-09-06T20:44:16.335Z",
|
|
"clickhouse_version": "24.8.14.39",
|
|
"database": "opt_bench_mtqa56j3",
|
|
"fixtures": {
|
|
"saas": {
|
|
"events": 5400000,
|
|
"tenants": 200,
|
|
"metrics": 12,
|
|
"days": 90,
|
|
"seed_ms": 22912
|
|
},
|
|
"vehiq": {
|
|
"vehicles_under_test": 2000000,
|
|
"decoy_vehicles": 2000000,
|
|
"seed_ms": 31960
|
|
},
|
|
"on_disk": [
|
|
{
|
|
"table": "giant_everything",
|
|
"rows": 9400000,
|
|
"bytes": 84015753
|
|
},
|
|
{
|
|
"table": "opt_analytics_event",
|
|
"rows": 5400000,
|
|
"bytes": 60158827
|
|
},
|
|
{
|
|
"table": "opt_dataset_projection",
|
|
"rows": 4000000,
|
|
"bytes": 48936260
|
|
},
|
|
{
|
|
"table": "opt_metric_daily",
|
|
"rows": 37800,
|
|
"bytes": 86181
|
|
}
|
|
]
|
|
},
|
|
"measurements": [
|
|
{
|
|
"label": "SaaS dashboard panel: 90-day metric total for ONE tenant (purpose-built event table)",
|
|
"runs": 12,
|
|
"p50_ms": 48.8,
|
|
"p95_ms": 72.24,
|
|
"min_ms": 31.36,
|
|
"max_ms": 72.24,
|
|
"rows_read": 40960,
|
|
"bytes_read": 75216
|
|
},
|
|
{
|
|
"label": "SAME question against ONE GIANT TABLE (time-leading sort key)",
|
|
"runs": 12,
|
|
"p50_ms": 174.38,
|
|
"p95_ms": 320.61,
|
|
"min_ms": 142.41,
|
|
"max_ms": 320.61,
|
|
"rows_read": 5400000,
|
|
"bytes_read": 165330000
|
|
},
|
|
{
|
|
"label": "SaaS time series: daily series for ONE tenant from the AggregatingMergeTree rollup",
|
|
"runs": 12,
|
|
"p50_ms": 37.98,
|
|
"p95_ms": 60.34,
|
|
"min_ms": 22.25,
|
|
"max_ms": 60.34,
|
|
"rows_read": 21416,
|
|
"bytes_read": 42832
|
|
},
|
|
{
|
|
"label": "SAME time series computed from raw events instead of the rollup",
|
|
"runs": 12,
|
|
"p50_ms": 32.55,
|
|
"p95_ms": 85.96,
|
|
"min_ms": 22.03,
|
|
"max_ms": 85.96,
|
|
"rows_read": 40960,
|
|
"bytes_read": 75216
|
|
},
|
|
{
|
|
"label": "SaaS group-by: one tenant sliced by a dimension",
|
|
"runs": 12,
|
|
"p50_ms": 44.45,
|
|
"p95_ms": 317.18,
|
|
"min_ms": 22.92,
|
|
"max_ms": 317.18,
|
|
"rows_read": 40960,
|
|
"bytes_read": 75216
|
|
},
|
|
{
|
|
"label": "VehIQ point lookup: one vehicle by key, tenant-scoped (purpose-built projection)",
|
|
"runs": 12,
|
|
"p50_ms": 49.25,
|
|
"p95_ms": 89.99,
|
|
"min_ms": 28.31,
|
|
"max_ms": 89.99,
|
|
"rows_read": 8192,
|
|
"bytes_read": 761856
|
|
},
|
|
{
|
|
"label": "SAME point lookup against ONE GIANT TABLE",
|
|
"runs": 12,
|
|
"p50_ms": 236.6,
|
|
"p95_ms": 1227.93,
|
|
"min_ms": 174.21,
|
|
"max_ms": 1227.93,
|
|
"rows_read": 7401152,
|
|
"bytes_read": 196760496
|
|
},
|
|
{
|
|
"label": "VehIQ aggregate: average asking price by make for ONE tenant across 2M vehicles",
|
|
"runs": 8,
|
|
"p50_ms": 389.57,
|
|
"p95_ms": 16748.19,
|
|
"min_ms": 189.51,
|
|
"max_ms": 16748.19,
|
|
"rows_read": 2000000,
|
|
"bytes_read": 256400000
|
|
},
|
|
{
|
|
"label": "SAME aggregate against ONE GIANT TABLE",
|
|
"runs": 8,
|
|
"p50_ms": 680.82,
|
|
"p95_ms": 756.4,
|
|
"min_ms": 410.57,
|
|
"max_ms": 756.4,
|
|
"rows_read": 7401152,
|
|
"bytes_read": 447184368
|
|
}
|
|
],
|
|
"notes": [
|
|
"Fixtures are synthetic and generated in-server with numbers(); no production or b0ts data was read or written.",
|
|
"Each timing is the p50/p95 of repeated runs after one warm-up, measured client-side over HTTP on the same host.",
|
|
"The 'ONE GIANT TABLE' rows are the counterfactual BI-P010 warns against, measured rather than asserted."
|
|
],
|
|
"index_pruning": {
|
|
"purpose_built_event_table": {
|
|
"read": 5,
|
|
"total": 660
|
|
},
|
|
"one_giant_table": {
|
|
"read": 660,
|
|
"total": 1149
|
|
},
|
|
"note": "Granules read/total for the SAME question. The tenant-leading ORDER BY is what turns the forced tenant predicate (BI-P011) into a primary-key range scan instead of a full scan."
|
|
}
|
|
}
|