Skip to content

math (clojure replay harness): the final full-stream cut consumes moderation after the last vote - #2861

Merged
colinmegill merged 1 commit into
edgefrom
fix/clojure-replay-moderation-tail
Sep 23, 2026
Merged

colinmegill merged 1 commit into
edgefrom
fix/clojure-replay-moderation-tail

Conversation

@colinmegill

Copy link
Copy Markdown
Member

This changes Clojure source

math/dev/replay.clj (the offline replay harness that drives the legacy engine for certification) and its tests. Nothing under math/src, the production engine, is touched. Merge awaits the owner's explicit ruling.

Why

The certification battery's run 18 receipt flagged the moderation-heavy recipe at its only checkpoint with moderation-list shape and meta-watermark mismatches and zero numeric outliers. Reproduced on a public one-cut stream: the harness bounded moderation events by the cut time of the last vote, so events arriving after a conversation's last vote were never delivered to the legacy engine. Production Clojure polls moderation on its own modified cursor (poller.clj:19-27, postgres.clj:158) and does see them; the Python full-stream replay already consumes them (schedule.py:330-334). The harness was the wrong side.

What

A fourth arity on the moderation partition takes the schedule coverage; on the last slot under full-stream coverage the upper bound is lifted. The lower bound (no duplicate delivery, tied cut times included), vote batches, prefix cuts, cut-slot resolution and the source-final-state computation are unchanged. Unknown coverage strings are rejected upstream by the Python certifier.

Checks

  • Cross-reviewed: authored by the second reviewer; independent Opus review reproduced red/green locally with the Clojure toolchain (old harness: 3 failures / 6 errors in the tail test; new: 71 tests / 5215 assertions, 0 failures) and confirmed the production poller's behaviour and Python parity.
  • Files: math/dev/replay.clj, math/test/replay_tail_test.clj (new), math/test/test_runner.clj (registration), delphi/tests/replay_harness/test_clj_moderation_tail.py (new). Rejected-word scans empty.

🤖 Generated with Claude Code

https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s

…eration after the last vote

This changes Clojure source: math/dev/replay.clj (the offline replay
harness that drives the legacy engine for certification) and its tests.
Nothing under math/src, the production engine, is touched.

The certification battery flagged moderation-heavy entries at the final
cut with moderation-list shape and meta-watermark mismatches and zero
numeric outliers. The harness bounded moderation events by the cut time
of the last vote, so events arriving after a conversation's last vote
were never delivered; production Clojure polls moderation on its own
modified cursor and does see them, and the Python full-stream replay
already consumes them. On the last slot under full-stream coverage the
upper bound is lifted; the lower bound, vote batches, prefix cuts and the
source-final-state computation are unchanged.

Tests: a Clojure tail test fails on the old harness (three failures, six
errors) and passes on the new; a Python parity test checks both engines
now see the same events at the final cut.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s
@github-actions

Copy link
Copy Markdown
Contributor

Delphi Coverage Report

File Stmts Miss Cover
init.py 2 0 100%
benchmarks/bench_pca.py 128 107 16%
benchmarks/bench_repness.py 81 65 20%
benchmarks/bench_update_votes.py 38 28 26%
benchmarks/benchmark_utils.py 34 0 100%
components/init.py 1 0 100%
components/config.py 165 70 58%
conversation/init.py 2 0 100%
conversation/conversation.py 1290 270 79%
conversation/manager.py 131 42 68%
database/init.py 1 0 100%
database/dynamodb.py 395 178 55%
database/postgres.py 323 109 66%
empty_output.py 29 2 93%
engine_adapter.py 316 264 16%
pca_kmeans_rep/init.py 5 0 100%
pca_kmeans_rep/clusters.py 257 38 85%
pca_kmeans_rep/corr.py 98 17 83%
pca_kmeans_rep/group_k_smoother.py 28 0 100%
pca_kmeans_rep/legacy_kmeans.py 176 6 97%
pca_kmeans_rep/pca.py 135 18 87%
pca_kmeans_rep/repness.py 226 5 98%
poller/init.py 4 0 100%
poller/coordinator_bridge.py 316 316 0%
poller/math_writer.py 105 2 98%
poller/service.py 307 36 88%
poller/worker_pool.py 83 0 100%
queue/executor.py 223 111 50%
regression/init.py 4 0 100%
regression/clojure_comparer.py 188 20 89%
regression/comparer.py 887 639 28%
regression/datasets.py 135 27 80%
regression/recorder.py 36 27 25%
regression/utils.py 130 85 35%
replay/init.py 2 0 100%
replay/axis_continuity.py 347 24 93%
replay/certify.py 992 60 94%
replay/crosslang.py 128 2 98%
replay/diagnostics.py 23 10 57%
replay/driver.py 57 1 98%
replay/dsn_admission.py 36 1 97%
replay/equiv_query.py 10 0 100%
replay/event_ingress.py 95 1 99%
replay/fixture_bundle.py 809 60 93%
replay/fixture_config.py 266 11 96%
replay/fixture_extract.py 283 12 96%
replay/fixture_generate.py 103 1 99%
replay/fixture_samples.py 114 11 90%
replay/fixture_selection.py 119 0 100%
replay/fixture_survey.py 140 12 91%
replay/polarity.py 319 25 92%
replay/poller_equiv.py 777 99 87%
replay/prodclone.py 193 2 99%
replay/real_data.py 146 10 93%
replay/schedule.py 205 10 95%
replay/served_math.py 159 4 97%
replay/shard_bench.py 189 65 66%
replay/stagecompare.py 890 161 82%
replay/stages.py 256 40 84%
replay/stepcompare.py 86 1 99%
replay/store.py 120 11 91%
replay/types.py 71 6 92%
run_math_pipeline.py 264 114 57%
types.py 22 0 100%
umap_narrative/501_calculate_comment_extremity.py 112 53 53%
umap_narrative/502_calculate_priorities.py 135 135 0%
umap_narrative/700_datamapplot_for_layer.py 502 502 0%
umap_narrative/701_static_datamapplot_for_layer.py 310 310 0%
umap_narrative/702_consensus_divisive_datamapplot.py 434 275 37%
umap_narrative/801_narrative_report_batch.py 790 726 8%
umap_narrative/803_check_batch_status.py 185 185 0%
umap_narrative/llm_factory_constructor/init.py 2 2 0%
umap_narrative/llm_factory_constructor/model_provider.py 234 234 0%
umap_narrative/polismath_commentgraph/init.py 1 0 100%
umap_narrative/polismath_commentgraph/cli.py 270 270 0%
umap_narrative/polismath_commentgraph/core/init.py 3 3 0%
umap_narrative/polismath_commentgraph/core/clustering.py 108 108 0%
umap_narrative/polismath_commentgraph/core/embedding.py 104 104 0%
umap_narrative/polismath_commentgraph/lambda_handler.py 219 219 0%
umap_narrative/polismath_commentgraph/schemas/init.py 2 0 100%
umap_narrative/polismath_commentgraph/schemas/dynamo_models.py 160 9 94%
umap_narrative/polismath_commentgraph/tests/conftest.py 17 17 0%
umap_narrative/polismath_commentgraph/tests/test_clustering.py 74 74 0%
umap_narrative/polismath_commentgraph/tests/test_embedding.py 55 55 0%
umap_narrative/polismath_commentgraph/tests/test_storage.py 87 87 0%
umap_narrative/polismath_commentgraph/utils/init.py 3 0 100%
umap_narrative/polismath_commentgraph/utils/converter.py 283 237 16%
umap_narrative/polismath_commentgraph/utils/group_data.py 331 289 13%
umap_narrative/polismath_commentgraph/utils/storage.py 584 470 20%
umap_narrative/reset_conversation.py 159 50 69%
umap_narrative/run_pipeline.py 374 230 38%
umap_narrative/topic_naming.py 148 148 0%
utils/clj_hash.py 44 0 100%
utils/env_flags.py 13 0 100%
utils/general.py 63 39 38%
utils/output_profile.py 66 2 97%
utils/serialization.py 10 5 50%
utils/vote_convention.py 29 2 93%
Total 19411 8076 58%

@colinmegill
colinmegill merged commit 9fe0591 into edge Sep 23, 2026
6 checks passed
@colinmegill
colinmegill deleted the fix/clojure-replay-moderation-tail branch September 23, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant