Skip to content

Add CompiledReaction.from_pinned; fix ruff-format drift on main - #192

Merged
jc-macdonald merged 1 commit into
mainfrom
fix/from-pinned-index-and-format
Aug 26, 2026
Merged

Add CompiledReaction.from_pinned; fix ruff-format drift on main#192
jc-macdonald merged 1 commit into
mainfrom
fix/from-pinned-index-and-format

Conversation

@jc-macdonald

Copy link
Copy Markdown
Member

Follow-up to #191, which merged with an incomplete fix and left main's "quality" CI check red.

Missing piece from #191: that PR added full_axes and widened pinned to cover from-side-pinned axes, but pinned only ever carries the to-side coordinate for those axes. For a point-to-point transition (pinned on both sides — e.g. a vaccination-dose-progression transition pinned at vax=unvaccinated on from and vax=partial on to), the from-side and to-side coordinates differ, so a consumer building a depletion-target index into from_base can't derive it from pinned alone. Caught this while wiring diphtheria_outbreakvacc's run_hybrid_ctmc consumer: it was depleting the wrong (to-side) coordinate for from-pinned transitions. Adds ReactionArtifactIR.from_pinned / CompiledReaction.from_pinned, threaded the same way as pinned.

CI cleanup: main has been failing the quality (ruff format) check since #191 merged — my own edits there weren't format-clean, plus one pre-existing, unrelated formatting drift in README.md. Both fixed here; ruff format --check . is clean.

Testing: full suite (472/472) + mypy clean. Verified against diphtheria_outbreakvacc's hybrid-CTMC engine tests (7/7 pass) using this branch as the sibling editable install — run_hybrid_ctmc now depletes the correct from-pinned source cell for vax_dose1/vax_dose2/wane_full/wane_partial.

from_pinned records the from-side pinned coordinate for every axis a
transition pins on its from-side selector (full_axes minus from_axes).
This was missing from #191: that PR added full_axes and widened
`pinned` to cover from-pinned axes too, but `pinned` only ever carries
the TO-side coordinate for those axes. For a point-to-point transition
(pinned on both sides, e.g. a vaccination-dose-progression transition
pinned at vax=unvaccinated on from and vax=partial on to), the
from-side and to-side coordinates differ, so a consumer building a
depletion-target index into from_base cannot derive it from `pinned`
alone -- confirmed by diphtheria_outbreakvacc's run_hybrid_ctmc
consumer, which needs exactly this to deplete the correct source cell
rather than the (wrong) to-side one.

Also fixes ruff-format drift left on main by #191's merge (my own
_reactions.py/compile.py edits weren't format-clean) and a
pre-existing, unrelated formatting issue in README.md -- both were
failing the "quality" CI check on main.
@jc-macdonald
jc-macdonald merged commit 11a09a6 into main Aug 26, 2026
3 of 4 checks passed
@jc-macdonald
jc-macdonald deleted the fix/from-pinned-index-and-format branch August 26, 2026 12:50
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