Repository navigation
Conversation
anth-volk
added this pull request to stack #755
October 14, 2026 18:50
anth-volk
force-pushed
the
ruff-complexity
branch
3 times, most recently
from
October 14, 2026 21:06
96b676c to
358d65a
Compare
anth-volk
force-pushed
the
ruff-complexity
branch
from
October 14, 2026 21:43
358d65a to
f5469f1
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split the long deployment-workflow test into focused tests and hoist closure-free test doubles to module level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Characterize every branch of the comparison report record's state validation, the live column type checks, Hugging Face URI parsing, the SPM non-US and historical-wrapper rules, and the v2 application name limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… comparison phases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parse SPM wrapper and model release versions through one helper, and keep the keyword signatures of the public contract builders that the gateway and executor call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge 12 checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and a report builder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ker version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion steps The routes keep their names, decorators, parameters and registration order, so the published OpenAPI document is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…equested-version steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… scoping strategy Every caller already held a RegionResolution, so the builder now takes it whole. Also name the simulation runtime's preview, date-range and state-code limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dataclasses The payloads are built from the same fields in the same way; the golden digest tests still pass unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t scope check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… group The precompute local entrypoint keeps its --force CLI signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gregate output Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…der together Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd aggregate phases Group the coordinator's Modal identity and its injectable seams, and split submitted-parent validation into invocation, claim-state and production checks. The Modal coordinate_report function keeps its signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Modal run_single_simulation_us and _uk functions keep their signatures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s validation The update_version_registry command-line options are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d steps The helpers stay in the self-contained image setup module with lazy imports. Changing fetch_artifacts's source changes its Modal build-layer definition, so the next simulation image build re-runs the artifact fetch layer once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ompare steps Group the job timeout, poll interval, sleep and clock as one JobPolling, and name the HTTP statuses the sentinel compares with. The check command's options are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also pin how a publication id names its owning run, and the restore refusals for no plans and a missing routing store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The modes keep their precedence and output, and the help text is unchanged. Also split the plan-restore loop out of restore_routing_plans and name the parts of a workflow run's publication id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…utput Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pers The helper's subcommands, output lines and messages are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… timing The persistence store still calls the opener with only the connect step and the operation name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pin what the GitHub expression evaluator returns for each operator and status function, and the argv and refusal messages routing command discovery produces, before splitting both test helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Give the fake git its reported state as one FakeGitState, pass a planned release's versions to _plan together, and parametrize each multi-value test case as one argument. The parametrized test ids are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy the Public API's scripts/rules, whose group 8b commits split the command line, the registry reader, validation, the workflow job parser and the mermaid graph builder, and pin their behaviour with new tests. The two copies were identical apart from that refactor and its tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every rule family now passes, so ruff.toml selects ALL instead of the per-group list. It ignores COM812 and ISC001, which conflict with ruff format (ruff's documentation says to disable them with the formatter), and D203 and D213, which are mutually exclusive with the kept D211 and D212. The per-file target version, namespace packages and per-file ignores are unchanged. The sim.quality.ruff-lint rule's enforcer codes become ["ALL"], and its statement names the four ignores and why. The rules-registry skill says every rule applies apart from the listed and registered per-file ignores, that a ruff upgrade PR fixes any new rule's violations, and that an exception is an inline noqa with a reason. The rendered rules page and the AGENTS.md rules block are regenerated, and the changelog fragment describes the complexity refactors and the switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
ruff-complexity
branch
from
October 14, 2026 21:52
f5469f1 to
257e32d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #803
Same-Repository Draft PR Check
PolicyEngine/policyengine-sim-api, not a personal fork.Summary
Phase 1 step 1.8, group 8b, the last group: complexity refactors, then
select = ["ALL"]. Stacked on #802. This completes step 1.8.Every function over ruff's complexity limits is refactored, not suppressed. Each refactor is preceded by a commit that adds characterization tests pinning the current behaviour. Every commit passes ruff and the quality guards.
Contract and persistence libraries:
ComparisonReportRecord.validate_statekeeps its Pydantic signature and is split into report and comparison checks.Entry:
create_app(complexity 52, 144 statements) keeps every route's name, decorators, parameters and registration order. The shared behaviour moves into_EntryRuntime, and Stage 12 error logs still record only the error type.Gateway: active-state route resolution is split into pinned, latest and requested-version steps.
Executor: long argument lists become small frozen groups, including:
Stage 12 coordination (complexity over 10, 11 arguments, 109 statements) becomes a
_ReportCoordinationclass with claim, plan, dispatch, wait and aggregate phases. The Stage 12 parity checks are split by entity, column and report value. The image artifact fetch is split into freshness, credential and download steps.Code from Expose the certified dataset SHA-256 and assert the served identity at deploy #743, Gate releases on a numerical sentinel and make them reversible #744 and Release Stage 12 database sessions and keep original failures visible #789, which merged while this was in progress, is refactored the same way:
release_sentinel.check_deployment(JobPolling, a_Deploymentwith per-case and job-wait steps,HTTPStatus.OK).main: one command function per mode, with the same precedence. Its--helpoutput is byte-identical.restore_routing_plans.bundle_versionsandverify_dispatch.open_connection_with_retry(RetryTiming).Release Stage 12 database sessions and keep original failures visible #789's original-failure reporting and session release are kept inside the new coordination phases.
Kept with a reason (3):
# noqa: PLR0913on three library functions other projects import:create_initial_batch_state,resolve_spm_selectionandinit_simulation_observability. Modal function signatures, local entrypoints, FastAPI routes and Pydantic validators keep their signatures.Rules tool: takes the Public API's group 8b refactor (Refactor tests, scripts and the rules tool, then select every ruff rule (ALL) policyengine-api#3934). Each repository owns its copy; this one is currently identical. Its tests went from 74 to 109.
ALL:ruff.tomlselects every rule, and ignores only the two that conflict withruff format(COM812,ISC001) and one of each mutually exclusive docstring pair (D203,D213).ALLfound nothing that wasn't already fixed.sim.quality.ruff-lintlistsALL.Noticed, not changed: in
release_sentinel, a job that fails but still returns an object result has its values compared anyway. The new tests pin that existing behaviour. It may be worth confirming it's intended.Testing
Every suite passes:
The additions are the characterization tests: 381 in all. The gateway has 1 test deselected and the executor 22 skipped and 3 deselected, as on the base. The grouping renamed 7 parametrized test IDs in the entry's deploy-script tests, and 34 in the gateway's SPM route tests.
tests/goldenunchanged. The entry, executor and gateway OpenAPI dumps are byte-identical to the base.ruff check .withALLgives 0 findings, andruff format --check .passes.src/modal/app.pyis untouched.RELEASE_PAYLOADis set from thecheck-policyengine-updates.ymlstepenv:.SIMULATION_TEST_AUTH_*values come from theSIMULATION_ENTRYPOINT_*secrets throughsecrets: inherit.GOOGLE_APPLICATION_CREDENTIALS_JSONcomes from thegcp_secretModal secret.CI completeruns until the PRs below merge.🤖 Generated with Claude Code