Skip to content

Fix the simulation gateway's 81 Pyright errors #865

Closed

Description

@anth-volk

Problem

The simulation gateway has 81 Pyright errors, tolerated by rules/baselines/pyright-gateway.txt under sim.quality.pyright-gateway (added in #864):

  • 66 possibly-unbound variables and 6 "must return value on all code paths" errors in endpoints.py. Each comes from with runtime.span(...): policyengine-observability annotates its scope managers' __exit__ as returning bool, so Pyright assumes a span may swallow the exception raised in its block.
  • 7 argument-type errors in endpoints.py: the budget-window submit response's status, and the VersionRoutingState TypedDict that callers and helpers both treat as a plain dict.
  • 2 attribute-access errors in smoke_app.py, where hasattr(route, "methods") doesn't narrow Starlette's BaseRoute.

Proposal

Fix all 81 without changing behaviour, shrinking the gateway's baseline in each commit until it is empty. Open spans with scopes.span(runtime, ...) from #864, and correct the two annotations and the route narrowing.

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