Skip to content

Enforce Pyright for the simulation gateway and executor - #875

Merged
anth-volk merged 3 commits into
mainfrom
pyright-enforce
Oct 26, 2026
Merged

anth-volk merged 3 commits into
mainfrom
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.

#873 merged on 2026-10-26, so this PR is now the bottom of the stack and its CI runs in full.

🤖 Generated with Claude Code

@anth-volk
anth-volk added this pull request to stack #867 October 21, 2026 15:44
@anth-volk
anth-volk force-pushed the pyright-enforce branch 2 times, most recently from 85e560d to b0c9a63 Compare October 21, 2026 21:37
@anth-volk
anth-volk force-pushed the pyright-enforce branch 2 times, most recently from 5cfaa88 to 9543869 Compare October 26, 2026 12:01
@anth-volk
anth-volk force-pushed the pyright-enforce branch 2 times, most recently from eb6bef0 to 9ff4573 Compare October 26, 2026 12:55
Base automatically changed from pyright-executor-remainder to main October 26, 2026 13:03
anth-volk and others added 3 commits October 26, 2026 17:04
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>
@anth-volk
anth-volk marked this pull request as ready for review October 26, 2026 13:11
@anth-volk
anth-volk requested a review from a team as a code owner October 26, 2026 13:11
@anth-volk
anth-volk merged commit 4c3ca42 into main Oct 26, 2026
22 checks passed
@anth-volk
anth-volk deleted the pyright-enforce branch October 26, 2026 13:12
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