Skip to content

python-math #40: feat(math): mode collapse C4 — delete-only improved branches (ban filter, tally sources, blob shape) - #2669

Draft
jucor wants to merge 1 commit into
spr/edge/30038853from
spr/edge/fe2b0bb2
Draft

python-math #40: feat(math): mode collapse C4 — delete-only improved branches (ban filter, tally sources, blob shape)#2669
jucor wants to merge 1 commit into
spr/edge/30038853from
spr/edge/fe2b0bb2

Conversation

@jucor

@jucor jucor commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

What

Phase 2, chunk C4 of GOAL_CUTOVER_READY.md (the standing goal document for making the Python math engine ready to replace the Clojure one in production). The "mode collapse" removes the engine-mode switch that selected between clojure-legacy behavior (reproducing the old Clojure engine exactly) and improved behavior; this chunk executes the delete-only branches — the ones not parked for later re-landing (inventory in journal session 7). After it, conversation.py and pca_kmeans_rep/ are entirely engine_mode-free (grep: 0 hits).

Deletions — the Clojure-exact behavior is now the only path

  • Quirk Q1 ban filtering deleted outright. Q1 is the quirk that the Clojure engine never honored participant bans (participants.mod = -1); Julien ruled that bans are not a Polis feature, so improvement-queue item 1 is dropped rather than parked. rating_mat is now a raw copy of the vote matrix, and the banned-participant set (mod_out_ptpts) is still ingested but has no effect — exactly like the Clojure worker.
  • Repness tid_order (the comment ordering in the representativeness output): always the arrival-order tie-break, i.e. ties resolve by first-vote arrival order.
  • Group-votes tally source: always raw_rating_mat (3 call sites).
  • In-conv — the set of participants counted as "in the conversation" for clustering: always the carry + greedy-floor rule; the improved threshold-only arm is deleted. The JSON result blob (math_main.data) serializes the persisted in-conv set when present.
  • Blob votes-base: always the Clojure-exact per-bucket vote vectors.
  • Group-aware consensus: always the every-group Laplace product, where zero-vote groups contribute the smoothed factor 1/2 (divergence fingerprint FP-b3670cb052).
  • to_dict: _apply_legacy_blob_shape runs unconditionally; from_dict: the watermark / arrival-order / sign / permutation restore runs unconditionally.
  • Repness totals: the "rest" comparison domain is always clustered voters only.

Testing

Deleted 18 improved-mode test pins across 6 test files (12 were failing against the collapsed engine, 6 passed only vacuously); 65+34 tests green on the affected files.

commit-id:fe2b0bb2


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 27, 2026
This was referenced Jul 27, 2026
@jucor
jucor force-pushed the spr/edge/fe2b0bb2 branch from 2d12f22 to 9f1542f Compare July 28, 2026 00:11
@jucor
jucor force-pushed the spr/edge/30038853 branch from be468f9 to 8bf1e87 Compare July 28, 2026 00:11
@jucor jucor changed the title feat(math): mode collapse C4 — delete-only improved branches (ban filter, tally sources, blob shape) python-math #40: feat(math): mode collapse C4 — delete-only improved branches (ban filter, tally sources, blob shape) Jul 28, 2026
…branches (ban filter, tally sources, blob shape)

## What

Phase 2, chunk C4 of `GOAL_CUTOVER_READY.md` (the standing goal document for making the Python math engine ready to replace the Clojure one in production). The "mode collapse" removes the engine-mode switch that selected between clojure-legacy behavior (reproducing the old Clojure engine exactly) and improved behavior; this chunk executes the delete-only branches — the ones not parked for later re-landing (inventory in journal session 7). After it, `conversation.py` and `pca_kmeans_rep/` are entirely `engine_mode`-free (grep: 0 hits).

## Deletions — the Clojure-exact behavior is now the only path

- Quirk Q1 ban filtering deleted outright. Q1 is the quirk that the Clojure engine never honored participant bans (`participants.mod = -1`); Julien ruled that bans are not a Polis feature, so improvement-queue item 1 is dropped rather than parked. `rating_mat` is now a raw copy of the vote matrix, and the banned-participant set (`mod_out_ptpts`) is still ingested but has no effect — exactly like the Clojure worker.
- Repness `tid_order` (the comment ordering in the representativeness output): always the arrival-order tie-break, i.e. ties resolve by first-vote arrival order.
- Group-votes tally source: always `raw_rating_mat` (3 call sites).
- In-conv — the set of participants counted as "in the conversation" for clustering: always the carry + greedy-floor rule; the improved threshold-only arm is deleted. The JSON result blob (`math_main.data`) serializes the persisted in-conv set when present.
- Blob `votes-base`: always the Clojure-exact per-bucket vote vectors.
- Group-aware consensus: always the every-group Laplace product, where zero-vote groups contribute the smoothed factor 1/2 (divergence fingerprint FP-b3670cb052).
- `to_dict`: `_apply_legacy_blob_shape` runs unconditionally; `from_dict`: the watermark / arrival-order / sign / permutation restore runs unconditionally.
- Repness totals: the "rest" comparison domain is always clustered voters only.

## Testing

Deleted 18 improved-mode test pins across 6 test files (12 were failing against the collapsed engine, 6 passed only vacuously); 65+34 tests green on the affected files.

commit-id:fe2b0bb2
@jucor
jucor force-pushed the spr/edge/fe2b0bb2 branch from 9f1542f to 274e02e 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.

1 participant