Skip to content

Fix the executor simulation runtime's 54 Pyright errors #870

Closed

Description

@anth-volk

Problem

projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py, the annual simulation's runtime, has 54 Pyright errors, tolerated by rules/baselines/pyright-executor.txt (sim.quality.pyright-executor, #864):

  • 47 possibly-unbound variables, each assigned inside with runtime.span(...), which Pyright treats as possibly swallowing the exception because policyengine-observability types its scope managers' __exit__ as returning bool;
  • 2 argument errors that follow from those (Unbound | Simulation);
  • 5 others: the compiled reform possibly None, the UK region type, the input dataset's entity_data, and a parameter reassigned with a wider type.

Proposal

Fix all 54 without changing what a run does: open spans with scopes.span (#864), correct _build_simulation's return annotation, and narrow the other values where they're read. The executor's baseline shrinks by 54.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions