Skip to content

Enforce Pyright for the simulation gateway and executor - #875

Draft
anth-volk wants to merge 3 commits into
pyright-executor-remainderfrom
pyright-enforce
Draft

anth-volk wants to merge 3 commits into
pyright-executor-remainderfrom
pyright-enforce

Conversation

@anth-volk

@anth-volk anth-volk commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #874

Same-Repository Draft PR Check

  • This PR is a draft.
  • This PR is from a branch in PolicyEngine/policyengine-sim-api, not a personal fork.

Summary

Sixth in the Pyright stack, on top of #873. With the gateway (#866) and the executor (#869, #871, #873) at zero Pyright errors, their rules move from ratcheted to enforced, and their empty baselines are deleted:

Rule Before After
sim.quality.pyright-gateway ratcheted, rules/baselines/pyright-gateway.txt (0 entries) enforced, no baseline
sim.quality.pyright-executor ratcheted, rules/baselines/pyright-executor.txt (0 entries) enforced, no baseline
sim.quality.pyright-apis-integ ratcheted, 4 entries unchanged; the PR above this one (#877) resolves them

The rules guard treats ratcheted to enforced as a tightening, so no downgrade reason is needed.

Commits (red, then green)

  1. Prove the gateway and executor Pyright rules as enforced rules. The proofs now check what an enforced rule allows. Each bad fixture is the package's real report from main at ceb30e1, unchanged; it now fails with every error new and no baseline. Each good fixture is a clean report recorded from the fixed package. Red: the rewritten proof tests failed against the old ratchet fixtures. Green: they pass once the fixture baselines are removed and the clean reports recorded. The guard and the rules-tool tests pass at this commit alone (checked in a separate checkout).

  2. Enforce Pyright for the gateway and executor, and drop their baselines. Red: deleting the baseline files made the guard fail with baseline file ... does not exist. Green: with both rules enforced, the guard, the rules-tool tests and python -m scripts.rules pyright pass (gateway and executor "passed with no Pyright errors", apis-integ 4 listed).

  3. Say the gateway and executor proofs use excerpts of the real reports. Comment-only, from the review; the proof tests pass.

Suppressions added

None.

Real bugs found

None.

Self-review

review-code on this PR's diff, run by a separate agent, found no bugs. Findings:

  1. Nothing in the guard stopped these rules from being ratcheted again with any count. Fixed in Run Pyright in CI for every package, in its own locked environment #864: moving an enforced rule to ratcheted now needs a [rule.downgrade] reason.
  2. The proof comments called the bad fixtures the packages' real errors, but they are three-error excerpts. Fixed (commit 3, "Say the gateway and executor proofs use excerpts of the real reports").

Environment variables

No CI, image or deployment changes.

Testing

  • python -m unittest discover -s scripts/rules/tests -t .: pass.
  • python scripts/run_quality_guards.py and python -m scripts.rules guard --base-ref pyright-executor-remainder: pass.
  • python -m scripts.rules pyright: all eight packages pass.

This PR is above the bottom of the stack, so its CI runs only CI complete, which fails by design until the PRs below merge.

🤖 Generated with Claude Code

anth-volk and others added 3 commits October 22, 2026 00:33
Their proofs compared a recorded report with a fixture baseline. With
no errors left, each proof now checks what an enforced rule allows:
the bad fixture is the package's real report from before its fixes
(main at ceb30e1), which fails with every error new, and the good
fixture is a clean report recorded from the fixed package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both packages have no Pyright errors, so sim.quality.pyright-gateway and
sim.quality.pyright-executor move from ratcheted to enforced, and their
empty baselines go. apis-integ stays ratcheted at 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The proof comments called the bad fixtures the packages' real errors
before their fixes; they are three-error excerpts of those 81- and
178-error reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Enforce Pyright for the simulation gateway and executor

1 participant