Skip to content

feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A)#2618

Draft
jucor wants to merge 1 commit into
spr/edge/2324207efrom
spr/edge/d61d82ad
Draft

feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A)#2618
jucor wants to merge 1 commit into
spr/edge/2324207efrom
spr/edge/d61d82ad

Conversation

@jucor

@jucor jucor commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Introduces the engine-mode switch that will select between Clojure-parity
warm-start (clojure-legacy) and the current cold-recompute behavior
(improved, default). This commit only adds the flag and the plumbing to
capture the previous tick's state; no behavior changes yet (commits B and D
consume the captured state).

  • New polismath/utils/engine_mode.py: ENGINE_MODE_* constants +
    resolve_engine_mode(), reusing pca._resolve_impl_flag (pca.py:37-57) so
    resolution rules match the PCA-solver switch. Default 'improved'.
  • Conversation.init gains cold-default fields group_clusterings={} and
    group_k_smoother={} (Clojure threads these on the conv,
    conversation.clj:433-484; NOT persisted, per conv_man.clj:52-74).
  • recompute() captures prev_pca / prev_group_clusterings /
    prev_group_k_smoother from the deepcopied result BEFORE the compute steps
    overwrite them (mirrors Clojure fnks reading the incoming conv:
    conversation.clj:385, 457) and threads them into _compute_pca /
    _compute_clusters as optional params (unused in this commit).

TDD RED evidence (before implementing engine_mode.py):
tests/test_engine_mode.py collection error:
"ModuleNotFoundError: No module named 'polismath.utils.engine_mode'"

Cold-start invariance guard: a single-shot vw pipeline run is byte-identical
under both modes (first-tick warm-start state is empty, so the modes must
coincide). This guards commits B and D from drifting on the cold path.

Tests: 8 new (7 flag-resolution + 1 cold invariance). Full suite 414 passed,
17 skipped, 47 xfailed (was 406/17/47).

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

commit-id:d61d82ad


Stack:


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

@jucor
jucor marked this pull request as draft July 18, 2026 01:48
@jucor
jucor force-pushed the spr/edge/d61d82ad branch from d27ed5f to 29d0998 Compare July 18, 2026 01:59
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… Jul 18, 2026
@jucor
jucor changed the base branch from spr/edge/c9daf6b3 to edge July 18, 2026 13:27
@jucor
jucor force-pushed the spr/edge/d61d82ad branch from 29d0998 to 4d179bd Compare July 18, 2026 13:28
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 18, 2026
@jucor jucor mentioned this pull request Jul 18, 2026
@jucor
jucor changed the base branch from edge to spr/edge/d83b0abf July 18, 2026 13:28
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/2324207e July 22, 2026 06:16
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/2324207e to edge July 22, 2026 06:50
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/2324207e July 22, 2026 06:50
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/2324207e to edge July 22, 2026 08:11
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/2324207e July 22, 2026 08:11
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/2324207e to edge July 22, 2026 09:58
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/2324207e July 22, 2026 09:58
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/2324207e to edge July 22, 2026 11:21
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/2324207e July 22, 2026 11:21
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… Jul 24, 2026
@jucor
jucor changed the base branch from spr/edge/2324207e to edge July 24, 2026 06:02
@jucor jucor changed the title feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start sca… feat(math): add POLISMATH_ENGINE_MODE flag + prev-tick warm-start scaffolding (PR-A) Jul 24, 2026
@jucor
jucor changed the base branch from edge to spr/edge/2324207e July 24, 2026 06:02
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