feat(delphi): Python math poller service (phase 1) — Clojure math-container replacement#2625
Draft
jucor wants to merge 1 commit into
Draft
feat(delphi): Python math poller service (phase 1) — Clojure math-container replacement#2625jucor wants to merge 1 commit into
jucor wants to merge 1 commit into
Conversation
…tainer replacement The poller half of MATH_POLLER_DESIGN.md phase 1: a Python service that replaces the Clojure math container's production duties (vote/mod watermark polling, per-zid serialized compute, four-table Postgres writes). - polismath/poller/service.py: MathPollerService — vote + moderation watermark loops mirroring poller.clj:12-37 (strict >, max-of-batch advancement, POLL_FROM_DAYS_AGO=10 boot window, allowlist/blocklist), per-zid engine chain update_votes -> update_moderation -> recompute() with load-or-init from math_main + full-history rebuild (conv_man.clj:188-207 analog), error path dump -> one retry -> park (errorconv analog). - polismath/poller/worker_pool.py: per-zid FIFO + single-owner flag (strict serialization), take-all!/split-batches coalescing (votes before moderation), bounded cross-zid ThreadPoolExecutor. - polismath/poller/math_writer.py: one math_tick per cycle shared across math_main / math_bidtopid / math_ptptstats (conv_man.clj:158-169); bidToPid positionally aligned with base-clusters.id ascending (prep-bidToPid conv_man.clj:35-40; server participants.ts:33-51). - scripts/math_poller.py CLI (--once / run-forever, SIGTERM/SIGINT) + docker-compose service delphi-math-poller (profile delphi-math, shadow MATH_ENV by default) + example.env documentation. - tests/poller/: 44 unit tests (watermark, coalescing, serialization thread-safety, writer SQL incl. caching_tick MAX+1 subquery + shared tick, bidToPid shape, allow/block, engine-mode passthrough, error path, load-or-init restoration boundary) + 1 opt-in integration test (throwaway postgres:17 on port 5435): end-to-end poll->compute->write, shadow math_env isolation, shared math_tick, caching_tick=1 on first write, restart-resumes. Cutover phasing per MATH_POLLER_DESIGN.md: this ships SHADOW mode only — writes under a math_env the server does not read. The flip is gated on the blob-shape alignment work (to_dict vs prep-main deltas catalogued by the H-B cross-language comparison). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> commit-id:18c7048f
This was referenced Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The poller half of MATH_POLLER_DESIGN.md phase 1: a Python service that
replaces the Clojure math container's production duties (vote/mod watermark
polling, per-zid serialized compute, four-table Postgres writes).
loops mirroring poller.clj:12-37 (strict >, max-of-batch advancement,
POLL_FROM_DAYS_AGO=10 boot window, allowlist/blocklist), per-zid engine chain
update_votes -> update_moderation -> recompute() with load-or-init from
math_main + full-history rebuild (conv_man.clj:188-207 analog), error path
dump -> one retry -> park (errorconv analog).
serialization), take-all!/split-batches coalescing (votes before moderation),
bounded cross-zid ThreadPoolExecutor.
math_main / math_bidtopid / math_ptptstats (conv_man.clj:158-169);
bidToPid positionally aligned with base-clusters.id ascending
(prep-bidToPid conv_man.clj:35-40; server participants.ts:33-51).
docker-compose service delphi-math-poller (profile delphi-math, shadow
MATH_ENV by default) + example.env documentation.
thread-safety, writer SQL incl. caching_tick MAX+1 subquery + shared tick,
bidToPid shape, allow/block, engine-mode passthrough, error path,
load-or-init restoration boundary) + 1 opt-in integration test (throwaway
postgres:17 on port 5435): end-to-end poll->compute->write, shadow math_env
isolation, shared math_tick, caching_tick=1 on first write, restart-resumes.
Cutover phasing per MATH_POLLER_DESIGN.md: this ships SHADOW mode only —
writes under a math_env the server does not read. The flip is gated on the
blob-shape alignment work (to_dict vs prep-main deltas catalogued by the H-B
cross-language comparison).
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
commit-id:18c7048f
Stack: