Query editor
-- Final consumer-side preflight for Tycho and Turbine.---- This query deliberately re-reads both physical receipts and the physical-- facts protected by those receipts. A passing receipt is not sufficient if-- a fact has changed since the receipt was minted. The recurring driver must-- receive exactly two passing rows before downstream dashboard/Metrix reads.WITHtycho_current AS (SELECT(SELECT COUNT(*)FROM dune.propeller_heads.result_tycho_router_call_fact_v3_live)AS router_call_row_count,(SELECT MAX(block_time)FROM dune.propeller_heads.result_tycho_router_call_fact_v3_live)AS router_call_max_block_time,(SELECT COUNT(*)FROM dune.propeller_heads.result_tycho_fee_recipient_fact_v3_live)AS fee_recipient_row_count,(SELECT MAX(block_time)FROM dune.propeller_heads.result_tycho_fee_recipient_fact_v3_live)AS fee_recipient_max_block_time,(SELECT COUNT(*)FROM dune.propeller_heads.result_tycho_executor_leg_fact_v3_live)AS executor_leg_row_count,(SELECT MAX(block_time)FROM dune.propeller_heads.result_tycho_executor_leg_fact_v3_live)AS executor_leg_max_block_time),tycho AS (SELECT'tycho' AS product,COUNT(*) AS receipt_row_count,COUNT_IF(COALESCE(r.receipt_status, 'fail') <> 'pass')AS failed_receipt_rows,COUNT_IF(COALESCE(r.pipeline_revision, '')<> 'tycho_v3_daily_receipt_v1') AS wrong_revision_rows,COUNT_IF(r.router_integrity_check_count <> 8OR r.router_integrity_failure_count <> 0OR r.fee_integrity_check_count <> 10OR r.fee_integrity_failure_count <> 0OR r.executor_integrity_failure_count <> 0OR r.executor_watermark_check_count <> 1OR r.executor_watermark_failure_count <> 0) AS bad_integrity_rows,COUNT_IF(r.indexing_check_count <> 8OR r.indexing_failure_count <> 0OR COALESCE(r.coverage_status, '') NOT IN ('complete', 'provisional')OR (r.coverage_status = 'provisional'AND COALESCE(r.incomplete_chain, '') <> 'robinhood')OR (r.coverage_status = 'complete' AND r.incomplete_chain IS NOT NULL)OR r.supported_chain_indexed_through IS NULL) AS bad_indexing_rows,COUNT_IF(r.live_physical_fact_count <> 3OR r.unexpected_empty_fact_count <> 0) AS bad_fact_summary_rows,COUNT_IF(r.refresh_due_at<> date_add('hour', 168, r.checkpoint_completed_at))AS bad_due_window_rows,COUNT_IF(r.checkpoint_expires_at<> date_add('hour', 180, r.checkpoint_completed_at))AS bad_expiry_window_rows,