Skip to content

Minor fixes flagged in review of #539 (program sampling RNG, demos NameError, conftest hook, parallel_progress jobs) #562

Open

Description

@RomeshA

Collected from the Copilot and Claude bot reviews on #539, so they are tracked in the project. Each is small; they can be fixed in one PR.

  • Program.sample() passes rng_sampler only to capacity_constraint.sample(); spend_data, unit_cost, saturation and coverage fall back to the global np.random, breaking reproducibility of program sampling.
  • demo() references an undefined name demos in its error message (should be demo_projects).
  • tests/conftest.py::pytest_collection_modifyitems has the wrong hook signature (session, config, items) and mutates items while iterating.
  • parallel_progress() no longer appends ApplyResult objects to jobs in the kwargs branch, so worker exceptions are not re-raised.
  • run_sim checks isinstance(rng, np.random._generator.Generator); use the public np.random.Generator.
  • excel.py writes "N" for a transfer with an explicit constant value of 0 (value.vals or value.assumption is falsy).
  • plotting.py tuple colour special-case calls .startswith on a float when given an RGB tuple.
  • Mutable default acceptance_criteria=[] in five signatures.
  • test_tox_markovchain.py: ration typo, boolean mask used as index, broken f-string in the failure path, hash(demo) seeding, and __main__ block calling the test without its argument.

Implementation plan

Fix each item in place and add a test for the Program.sample() reproducibility (sample twice with the same seed, assert equality) and the parallel_progress exception propagation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions