Skip to content

Fix what the 0.20 release PR's full suite found - #517

Merged
derrynknife merged 2 commits into
devfrom
build/black-plan-actual
Nov 22, 2026
Merged

derrynknife merged 2 commits into
devfrom
build/black-plan-actual

Conversation

@derrynknife

@derrynknife derrynknife commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

The full suite on the 0.20 release PR (#516) failed in every test job, and lint failed too. Every failure is fixed here, and no seed, tolerance or sample size changes.

Lint: black 26.3.1 formatting in rbd/_plan_actual.py.

Code fixes:

  • unplanned_downtimes was lost on threads, shards and chunks. _Tally.merge passed the other tally's exact total where each simulation's times belong, so the per-simulation list lost its alignment with uptimes. The result then gave None. Merge now extends the list in order, and a chunk's dict carries it. This fixes test_a_simulation_is_the_same_however_the_run_is_cut_up, the shard tests, the held nested RBDs and the numba -threads engine cases. It also matters for least_spend_for_downtime, which reads these times.
  • least_spend_for_downtime is now refused wherever availability is. On a diagram with capacities that is too meshed, analysis_routes said it was simulated, but the call raised.

Tests that predate other 0.20 changes:

  • A plain number is now a valid task duration (First-use friction: plain task durations, n_draws vs mc_samples, a fast first diagram, cost and beta-factor docs #501), so the refusal cases use a negative number instead.
  • The cost categories gained crews and capital, so the expected dict lists them at 0.
  • surpyval 0.29's Hypoexponential accepts stage rates that are all but equal. The test now checks that the route is exact and that the answer is all but cold, instead of insisting on the Markov chain.
  • test_compiled_shuts_are_priced_as_in_python could never pass, and it skips without numba. Its instant renewal cost is deliberately refused, and the compiled engine refuses shutdowns. It becomes test_shuts_are_simulated_in_python: numba refuses with its message, and auto gives the Python runs.

Docs: the shutdowns guide's Opportunities example now defines its diagram (edges was undefined).

Tests run (surpyval 0.29 from PyPI):

  • every failing test file, plus routes, chunks and docs examples, without numba;
  • simulation engines, shards, chunks, standby cases and NPV shutdowns with numba: 480 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V339RzRHo8RS8Cz3uSbQgP

derrynknife and others added 2 commits November 22, 2026 22:54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V339RzRHo8RS8Cz3uSbQgP
- A merged or sharded run kept each simulation's time down unplanned
  only from its first chunk: merge adds the other's times, and a chunk's
  dict carries them, so unplanned_downtimes survives threads, shards and
  chunks as uptimes do.
- least_spend_for_downtime is refused where availability is: a diagram
  with capacities too meshed for its reduced diagram.
- Tests that predate other 0.20 changes: a number is now a task's
  duration (a negative one is refused); the cost categories gained crews
  and capital; surpyval 0.29's Hypoexponential takes stage rates all but
  equal; the compiled engine refuses shutdowns, which auto runs in
  Python.
- The shutdowns guide's Opportunities example defines its diagram.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V339RzRHo8RS8Cz3uSbQgP
@derrynknife derrynknife changed the title Format _plan_actual.py with black Fix what the 0.20 release PR's full suite found Nov 22, 2026
@derrynknife
derrynknife merged commit f819070 into dev Nov 22, 2026
@derrynknife
derrynknife deleted the build/black-plan-actual branch November 22, 2026 13:46
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