Skip to content

python-math #30: feat(delphi): poller-equivalence harness (goal condition 2) — PASSES live on vw + pc-meta-02 - #2657

Draft
jucor wants to merge 1 commit into
spr/edge/9467ac51from
spr/edge/1530cd63
Draft

python-math #30: feat(delphi): poller-equivalence harness (goal condition 2) — PASSES live on vw + pc-meta-02#2657
jucor wants to merge 1 commit into
spr/edge/9467ac51from
spr/edge/1530cd63

Conversation

@jucor

@jucor jucor commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

What

The condition-(2) harness from GOAL_R1_PARITY.md, specified in MATH_POLLER_EQUIV_SPEC.md: one throwaway Postgres, the REAL Clojure math container (clojure -M:run full, writing under MATH_ENV=clj-ref) and the Python MathPollerService (MATH_ENV=py-shadow) fed identical timed vote batches — math_env being the column that keys each math result row, so the two engines write side by side in the same database.

Written rows are compared per batch with the battery acceptance criteria (StepComparer projection, plus the quirk-Q7 exclusion: subgroup stats that Clojure computes and persists but nothing downstream ever consumes), extended with a measured Clojure self-jitter envelope for floats — two independent Clojure runs establish the envelope, the float threshold is max(2x envelope, 1e-9), and structural divergences are never excused. The protocol includes a kill+restart seam mid-schedule, and checks caching_tick MAX+1 per env, math_ticks monotonic, and exactly-once watermark coverage.

Guards: NO-COVERAGE (0 aligned batches / ready:false / empty store => FAIL — a vacuous pass is structurally impossible), a fail-fast feeder with runner-log evidence capture, and a startup gate closing the quirk-Q19 race window (see below).

Live results

2026-07-24; stores + verdict JSONs under real_data/.local/replays/poller_equiv/:

  • vw: verdict MATCH, 8/8 batches, restart seam after batch 4, ticks OK, 0 envelope-excused divergences.
  • pc-meta-02: verdict MATCH, 6/6 batches, seam after batch 3, moderation stream live (146/146 moderation events woven, matching the Clojure side).

Real bugs found and fixed by the harness arc

  • The Python poller stringified pid/tid/zid at ingestion (postgres.py poll_votes/poll_votes_since/poll_moderation, service.py str(zid)) — native DB ints now flow end-to-end, matching Clojure. The poll_moderation fix also prevents a would-be regression: int vote-tids vs str mod-tids would have silently disabled comment moderation.
  • derive_ptptstats wrote conv.participant_info — a DIFFERENT STATISTIC from Clojure's prep-ptpt-stats. It is now the verbatim geometric port (repness.clj:383-413: centricness/coreness/extremeness in PCA space, columnized per conv_man.clj:79-88, group order via clojure_hash_map_key_order).
  • Quirk Q19 (CLOJURE_QUIRKS.md): a GENUINE Clojure production bug — conv_man.clj queue-message-batch! races on discovery of a brand-new zid (conversation ID): two conv-actors get spawned, one is orphaned, and its accumulated votes are silently lost (reproduced 3x). The harness carves it out via test-input sequencing only: wait for the container's first poll cycle before feeding (the acceptance criteria are untouched). Flagged for an upstream fix.
  • Five harness-environment findings (the Clojure postgres:// URL regex, POLL_FROM_DAYS_AGO long parse, SSL mode, shared-millisecond cut ties vs strict-> watermarks, per-row insert visibility) — fixed in the harness, with the Clojure behaviors documented.

Testing

Harness + poller: 497 passed. Full delphi suite: 1134 passed / 22 skipped / 46 xfailed, zero failures. The live protocol is opt-in (it needs the real services); the unit surface covers every pure decision point.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

commit-id:1530cd63


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

This was referenced Jul 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This was referenced Jul 25, 2026
@jucor
jucor force-pushed the spr/edge/1530cd63 branch from 14b4077 to 9571274 Compare July 28, 2026 00:11
@jucor jucor changed the title feat(delphi): poller-equivalence harness (goal condition 2) — PASSES live on vw + pc-meta-02 python-math #30: feat(delphi): poller-equivalence harness (goal condition 2) — PASSES live on vw + pc-meta-02 Jul 28, 2026
…tion 2) — PASSES live on vw + pc-meta-02

## What

The condition-(2) harness from `GOAL_R1_PARITY.md`, specified in `MATH_POLLER_EQUIV_SPEC.md`: one throwaway Postgres, the REAL Clojure math container (`clojure -M:run full`, writing under `MATH_ENV=clj-ref`) and the Python `MathPollerService` (`MATH_ENV=py-shadow`) fed identical timed vote batches — `math_env` being the column that keys each math result row, so the two engines write side by side in the same database.

Written rows are compared per batch with the battery acceptance criteria (`StepComparer` projection, plus the quirk-Q7 exclusion: subgroup stats that Clojure computes and persists but nothing downstream ever consumes), extended with a measured Clojure self-jitter envelope for floats — two independent Clojure runs establish the envelope, the float threshold is max(2x envelope, 1e-9), and structural divergences are never excused. The protocol includes a kill+restart seam mid-schedule, and checks `caching_tick` MAX+1 per env, `math_ticks` monotonic, and exactly-once watermark coverage.

Guards: NO-COVERAGE (0 aligned batches / `ready:false` / empty store => FAIL — a vacuous pass is structurally impossible), a fail-fast feeder with runner-log evidence capture, and a startup gate closing the quirk-Q19 race window (see below).

## Live results

2026-07-24; stores + verdict JSONs under `real_data/.local/replays/poller_equiv/`:

- `vw`: verdict MATCH, 8/8 batches, restart seam after batch 4, ticks OK, 0 envelope-excused divergences.
- `pc-meta-02`: verdict MATCH, 6/6 batches, seam after batch 3, moderation stream live (146/146 moderation events woven, matching the Clojure side).

## Real bugs found and fixed by the harness arc

- The Python poller stringified pid/tid/zid at ingestion (`postgres.py` `poll_votes`/`poll_votes_since`/`poll_moderation`, `service.py` `str(zid)`) — native DB ints now flow end-to-end, matching Clojure. The `poll_moderation` fix also prevents a would-be regression: int vote-tids vs str mod-tids would have silently disabled comment moderation.
- `derive_ptptstats` wrote `conv.participant_info` — a DIFFERENT STATISTIC from Clojure's `prep-ptpt-stats`. It is now the verbatim geometric port (`repness.clj:383-413`: centricness/coreness/extremeness in PCA space, columnized per `conv_man.clj:79-88`, group order via `clojure_hash_map_key_order`).
- Quirk Q19 (`CLOJURE_QUIRKS.md`): a GENUINE Clojure production bug — `conv_man.clj` `queue-message-batch!` races on discovery of a brand-new zid (conversation ID): two conv-actors get spawned, one is orphaned, and its accumulated votes are silently lost (reproduced 3x). The harness carves it out via test-input sequencing only: wait for the container's first poll cycle before feeding (the acceptance criteria are untouched). Flagged for an upstream fix.
- Five harness-environment findings (the Clojure `postgres://` URL regex, `POLL_FROM_DAYS_AGO` long parse, SSL mode, shared-millisecond cut ties vs strict-`>` watermarks, per-row insert visibility) — fixed in the harness, with the Clojure behaviors documented.

## Testing

Harness + poller: 497 passed. Full delphi suite: 1134 passed / 22 skipped / 46 xfailed, zero failures. The live protocol is opt-in (it needs the real services); the unit surface covers every pure decision point.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

commit-id:1530cd63
@jucor
jucor force-pushed the spr/edge/1530cd63 branch from 9571274 to 370fbd8 Compare July 28, 2026 01:10
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.

2 participants