Files
sentiment-engine/prod/clickhouse/uv/03_exec_journal.sql

31 lines
1.4 KiB
SQL

-- dolphin_uv.exec_journal — Promotion bridge journal
-- Records every bridged and SUPPRESSED intent from the PRIME promotion bridge.
-- T12: promotion bridge (PRIME decision → KernelIntent → T9 seam)
CREATE TABLE IF NOT EXISTS dolphin_uv.exec_journal
(
kind String, -- 'BRIDGE'
suppressed UInt8, -- 0=bridged, 1=suppressed (shadow mode)
timestamp DateTime64(3), -- UTC 'YYYY-MM-DD HH:MM:SS.fff'
scan_number UInt64,
intent_id String,
trade_id String,
slot_id UInt32,
asset String,
side String,
action String, -- ENTER/EXIT
reference_price Float64,
target_size Float64,
leverage Float64,
has_uv_prefix UInt8, -- always 1 (u- prefix)
u_prefix_client_id String, -- u- prefixed clientOrderId
suppress_reason String, -- reason if suppressed
promo_metadata String -- JSON metadata from promotion bridge
)
ENGINE = MergeTree()
ORDER BY (scan_number, timestamp)
-- NO TTL: exec_journal is the audit trail matching venue orders to journaled
-- intents (arming checklist §3.6). Retention doctrine: audit surfaces never
-- auto-expire (same ruling as prime_decisions / prime_scans at T2P1 merge).
SETTINGS index_granularity = 8192