Skip to content

Action-Outcome Live SQL Replay Experiment 007

Date: 2026-06-18

Experiment 006 proved the Action-Outcome replay contract with a local SQL executor. Experiment 007 runs the generated SQL seed through a live ZeptoDB HTTP SQL endpoint to identify the first real engine integration boundary.

This experiment checks:

  • whether the generated DDL and INSERT statements are accepted by POST /;
  • whether live table row counts match the SQL-backed control;
  • whether value-level replay queries can recover top actions and guardrail audit rows from live ZeptoDB tables.

Start a local ZeptoDB server:

Terminal window
build/zepto_http_server --port 19125 --no-auth --log-level error

Run the live replay validator:

Terminal window
python3 docs/research/tools/action_outcome_live_sql_replay.py \
--url http://127.0.0.1:19125/ \
--sql-file docs/research/results/action_outcome_sql_replay_006.sql \
--output docs/research/results/action_outcome_live_sql_replay_007.md

The validator counts expected rows from the generated INSERT statements, loads the full seed into the live endpoint, queries row counts back from ZeptoDB, and then attempts value-level top-action replay checks.

Live parser, ingest, row-count, projection, and WHERE compatibility passed:

CheckResult
SQL statements attempted203
SQL statements succeeded203
SQL statements failed0
Row-count verificationpass
Semantic top-action replaypass
Failed-action avoidance WHERE querypass

Live row counts matched the Experiment 006 control:

TableLive Rows
action_outcome_episodes32
action_outcome_episode_metrics101
action_outcome_retrieval_quality_labels26
action_outcome_replay_recommendations18
action_outcome_gate_suppressions21

The semantic query recovered the expected top actions:

SELECT query_id, action_class
FROM action_outcome_replay_recommendations
WHERE top_action = 1
ORDER BY query_id;
QueryExpected Top ActionLive Top Action
aoe_checkout_002rollbackrollback
aoe_payment_002traffic_draintraffic_drain
aoe_inventory_002config_revertconfig_revert
aoe_cache_002cache_purgecache_purge
aoe_queue_003scale_outscale_out
aoe_search_003rollbackrollback

The live guardrail query also returned six rows where top actions avoided repeating failed prior actions:

SELECT count(*)
FROM action_outcome_replay_recommendations
WHERE top_action = 1 AND avoids_failed_repeat = 1;

Experiment 007 now validates the Action-Outcome SQL seed as a live ZeptoDB acceptance harness. Generic table INSERT materialization lets declared STRING, DOUBLE/FLOAT64, and integer columns remain queryable through the HTTP SQL endpoint, so the research schema no longer needs a tick-shaped projection just to support replay queries.

This closes the Experiment 007 integration boundary found before devlog 186: row counts, projection, and WHERE semantics now agree with the local SQL-backed control from Experiment 006.

Devlog 185 added the active red C++ regression test: ActionOutcomeSQLReplay.GenericInsertProjectionMaterializesDeclaredColumns. Devlog 186 implements the generic INSERT path and the test now passes. The test captures this minimal arbitrary schema INSERT projection case:

CREATE TABLE action_outcome_projection (
query_id STRING,
action_class STRING,
top_action INT64,
score_micros INT64,
timestamp_ns INT64
);
INSERT INTO action_outcome_projection
(query_id, action_class, top_action, score_micros, timestamp_ns)
VALUES
('aoe_payment_002', 'traffic_drain', 1, 670031, 1781748536000000000);
SELECT query_id, action_class
FROM action_outcome_projection
WHERE top_action = 1;

Expected and current product behavior: one row with score_micros = 670031.

Add a distributed two-node replay run that exercises ClusterNodeBase::ingest_typed_row() routing with symbol-less Action-Outcome tables. After that, extend the acceptance contract with JOIN/window queries over replay recommendations and episode metadata.