fix: make all templates runnable; clean CLI output; add smoke + sanity tests#5
Conversation
UAT surfaced several issues; this fixes them and adds empirical smoke +
simulation sanity tests to lock the behaviour.
- init: generate a seed file matching each template's compartments so
`init --template {sis,seir}` + `run` works (previously the static S,I,R
seed broke SIS and SEIR with a compartment mismatch)
- run: viz now saves `patch_timeseries_<model>_ode.png` (the path run --json
reports) and plots the model's actual compartments instead of hardcoded
S,I,R (fixed SIS KeyError, SEIR missing E)
- list-models: print clean user-facing output instead of routing it through
the logger (no more timestamps / cli.py source refs); also for run/validate
- catalog: drop the dangling `ka_fmd_sirsv_discrete` entry (model file removed)
- setup_simulation: accept `patch`/`population` columns case-insensitively
- tests: add tests/test_cli_e2e.py (all templates init->run, artifacts exist,
clean list-models) and tests/test_simulation_sanity.py (conservation,
non-negativity, epidemic growth, network spread, waning endemicity)
|
Warning Review limit reached
More reviews will be available in 5 minutes and 21 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A hands-on UAT (scaffold → configure → run a 10-patch waning-immunity model) surfaced several issues. This fixes them and adds tests that would have caught each.
Bugs fixed
init --template {sis,seir}+runwas broken. The scaffold shipped one fixedS,I,Rseed file, which mismatches SIS (S,I) and SEIR (S,E,I,R) compartments.initnow generates a seed file matching the chosen template. (The getting-started walkthrough tells users toinit --template seirthenrun— previously that errored.)run --jsonreported a non-existent plot path. It returnedpatch_timeseries_<model>_ode.pngwhilevizsavedall_patches_<model>_ode.png.viznow saves the reported name and plots the model's actual compartments (fixes an SISKeyError: R_0and SEIR droppingE).list-models/validate/runrouted user-facing text through the logger (timestamps +cli.py:NN). Now printed cleanly, matching the docs.--jsonoutput is unaffected.list-modelsadvertisedka_fmd_sirsv_discrete, whose implementation file was removed. Dropped from the catalog.setup_simulationhardcodedPopulation; the docs say lowercasepopulation. Now accepted case-insensitively.Tests added
tests/test_cli_e2e.py— every template scaffolds, runs, and the reported CSV/plot artifacts exist on disk;list-modelsoutput is clean and only lists implemented models.tests/test_simulation_sanity.py— multi-patch SIRS: population conservation, non-negativity, epidemic growth from a seed, network-driven spatial spread, and endemic persistence under waning immunity.All 33 tests pass;
ruff checkandruff format --checkclean.