Skip to content

python-math #21: feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0 - #2649

Draft
jucor wants to merge 1 commit into
spr/edge/d1ae732bfrom
spr/edge/0add28f3
Draft

python-math #21: feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0#2649
jucor wants to merge 1 commit into
spr/edge/d1ae732bfrom
spr/edge/0add28f3

Conversation

@jucor

@jucor jucor commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What

Aligns clojure-legacy emission and selection semantics with Clojure's prep-main blob — the JSON math result (math_main.data) as assembled by prep-main (conv_man.clj:45-74) — per the step-0 battery diagnosis (journal 2026-07-22 session 3; fingerprints in docs/divergences.json).

Battery effect: vw:uniform8 (8 steps), vw:single-cut, and biodiversity:uniform8 (8 steps) went from DIVERGENCE to full MATCH; vw:front-loaded6 remains open (a base-cluster count edge at small N).

Emission (Conversation.to_dict, legacy-gated; improved mode unchanged)

  • group-clusters: members emitted as BASE-CLUSTER ids (Clojure's folded form); the unfolded participant ids stay under the snake_case alias group_clusters.
  • votes-base: per-base-cluster A/D/S (agree/disagree/seen) bucket lists over the sort-by-id clustered members (agg-bucket-votes-for-tid, conversation.clj:601-608), instead of whole-matrix integer totals.
  • pca: comment-projection and comment-extremity emitted (using the existing functions from fix D12).
  • Sign parity: pca.center, base-clusters x/y, group-clusters centers, and comment-projection are negated at emission — Delphi's vote matrix is the NEGATION of Clojure's (AGREE = +1 vs -1); comps are covariance-derived and already equal (verified max|clj+py| = 1e-16 on center).
  • repness (the per-group representative-comment statistics): emitted as {gid: [finalize-cmt-stats-shaped entries]} (repness.clj:173); the internal dict is preserved under repness_full for the from_dict round-trip.
  • mod-in / mod-out / lastModTimestamp: null until moderation has been applied.
  • tids (comment ids) emitted in Clojure's column order (first-vote arrival), with the pca arrays permuted alongside; from_dict inverts the center sign and restores the arrival tracker in legacy mode.

Selection/stat parity

  • group-aware-consensus multiplies (A+1)/(S+2) over EVERY group — a group with zero seen-votes contributes 1/2 rather than being skipped (conversation.clj:639-641).
  • repness rest-stats sum over the OTHER GROUPS only (repness.clj:125), excluding unclustered voters from the comparison domain.
  • Exact-score ties in repness/consensus selection resolve by Clojure's stable sort over named-matrix column order: update_votes tracks first-vote arrival order, conv_repness accepts tid_order, and the selectors iterate as-given in legacy mode.

Also

Skip the three math-tree-hashing harness tests in delphi-only CI images (no /math tree in the container; fixes CI run 29881478306's 3 failures).

Testing

TDD: tests/test_legacy_blob_shape.py (25 tests, RED observed per fix).

commit-id:0add28f3


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 22, 2026
@jucor jucor changed the title feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0 feat(math): clojure-legacy blob emission + selection parity — Clojure… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/d1ae732b to edge July 22, 2026 02:10
@jucor jucor changed the title feat(math): clojure-legacy blob emission + selection parity — Clojure… feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0 Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/d1ae732b July 22, 2026 02:10
@jucor
jucor force-pushed the spr/edge/0add28f3 branch from f5a2c36 to aa5a214 Compare July 22, 2026 02:31
@jucor jucor changed the title feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0 feat(math): clojure-legacy blob emission + selection parity — Clojure… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/d1ae732b to edge July 22, 2026 03:54

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/0add28f3 branch from 5e139c1 to f870240 Compare July 28, 2026 00:11
@jucor jucor changed the title feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0 python-math #21: feat(math): clojure-legacy blob emission + selection parity — Clojure-exact math_main at step 0 Jul 28, 2026
… parity — Clojure-exact math_main at step 0

## What

Aligns clojure-legacy emission and selection semantics with Clojure's prep-main blob — the JSON math result (`math_main.data`) as assembled by `prep-main` (conv_man.clj:45-74) — per the step-0 battery diagnosis (journal 2026-07-22 session 3; fingerprints in `docs/divergences.json`).

Battery effect: vw:uniform8 (8 steps), vw:single-cut, and biodiversity:uniform8 (8 steps) went from DIVERGENCE to full MATCH; vw:front-loaded6 remains open (a base-cluster count edge at small N).

## Emission (`Conversation.to_dict`, legacy-gated; improved mode unchanged)

- group-clusters: members emitted as BASE-CLUSTER ids (Clojure's folded form); the unfolded participant ids stay under the snake_case alias `group_clusters`.
- votes-base: per-base-cluster A/D/S (agree/disagree/seen) bucket lists over the sort-by-id clustered members (`agg-bucket-votes-for-tid`, conversation.clj:601-608), instead of whole-matrix integer totals.
- pca: comment-projection and comment-extremity emitted (using the existing functions from fix D12).
- Sign parity: `pca.center`, base-clusters x/y, group-clusters centers, and comment-projection are negated at emission — Delphi's vote matrix is the NEGATION of Clojure's (AGREE = +1 vs -1); comps are covariance-derived and already equal (verified max|clj+py| = 1e-16 on center).
- repness (the per-group representative-comment statistics): emitted as `{gid: [finalize-cmt-stats-shaped entries]}` (repness.clj:173); the internal dict is preserved under `repness_full` for the `from_dict` round-trip.
- mod-in / mod-out / lastModTimestamp: null until moderation has been applied.
- tids (comment ids) emitted in Clojure's column order (first-vote arrival), with the pca arrays permuted alongside; `from_dict` inverts the center sign and restores the arrival tracker in legacy mode.

## Selection/stat parity

- group-aware-consensus multiplies (A+1)/(S+2) over EVERY group — a group with zero seen-votes contributes 1/2 rather than being skipped (conversation.clj:639-641).
- repness rest-stats sum over the OTHER GROUPS only (repness.clj:125), excluding unclustered voters from the comparison domain.
- Exact-score ties in repness/consensus selection resolve by Clojure's stable sort over named-matrix column order: `update_votes` tracks first-vote arrival order, `conv_repness` accepts `tid_order`, and the selectors iterate as-given in legacy mode.

## Also

Skip the three math-tree-hashing harness tests in delphi-only CI images (no `/math` tree in the container; fixes CI run 29881478306's 3 failures).

## Testing

TDD: `tests/test_legacy_blob_shape.py` (25 tests, RED observed per fix).

commit-id:0add28f3
@jucor
jucor force-pushed the spr/edge/0add28f3 branch from f870240 to f907436 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