Repository navigation
Conversation
anth-volk
added this pull request to stack #3888
October 13, 2026 13:29
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ruff-annotations #3907 +/- ##
=====================================================
- Coverage 85.38% 43.77% -41.61%
=====================================================
Files 198 183 -15
Lines 12400 11284 -1116
Branches 2264 1954 -310
=====================================================
- Hits 10588 4940 -5648
- Misses 1111 5893 +4782
+ Partials 701 451 -250 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 13, 2026 16:56
376029d to
2aa2512
Compare
anth-volk
removed this pull request from stack #3888
October 13, 2026 19:26
anth-volk
added this pull request to stack #3917
October 13, 2026 19:26
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 14, 2026 13:52
2aa2512 to
c9d4357
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
3 times, most recently
from
October 14, 2026 18:08
f9c71e0 to
c14b631
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
8 times, most recently
from
October 15, 2026 00:06
31126f6 to
bfed2d6
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
2 times, most recently
from
October 15, 2026 15:45
36d64ce to
3d9fa59
Compare
Run ruff check --fix for the pydocstyle (D) rules: put summaries on the first line, drop blank lines after function docstrings, and normalise blank lines around sections and closing quotes. Only docstring whitespace changes; the published OpenAPI documents and Pydantic JSON schemas are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests are exempt from the missing-docstring rules (D1) but not from the style rules, so give each flagged test and fixture docstring a one-line imperative summary followed by a blank line, describe the parameters the numpy-style sections left out, and correct the validate_country test class, which said 404 where the decorator returns 400. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docstrings to the Redis-backed runtime cache (its Protocols, the in-memory fake, claims and the household and reform-impact caches), the observability runtime and stage plans, and the gateway client and auth helpers. Each says what a reader cannot see from the signature: what a miss means, when entries are rejected, and which Redis behaviour a fake command emulates. Adding a docstring to the fake backend's get makes RET501 report its explicit return None, which stays and is suppressed with a reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docstrings to scripts/rules (the registry model, loader, resolver, validator and renderer), the quality-guard runner and migration guard, the migration baseline, mirroring and smoke-test scripts, the Alembic environments, and the .github helper scripts. Reword the rules tool's noun-phrase function summaries into the imperative and give its multi-line summaries a separating blank line. scripts/rules is the canonical copy of a tool shared byte-for-byte with policyengine-sim-api, and the argparse help taken from module docstrings is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docstrings to the v1 SQLAlchemy models and connection settings, the congressional-district metadata, the v2 catalog publication records and staging, the household and policy migration qualification, the v2 migration target settings, and the v2 SQLModel tables and their enums. The table docstrings say what a row represents: what makes it unique, whether it is immutable, what owns it and what is deleted with it. Pydantic publishes a class docstring as the model's JSON-schema description, so these tables' schemas gain descriptions; none of them is in the published OpenAPI document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docstrings to the v2 resource services (households, policies, user-households and user-policies), the metadata catalog service, and the comparison-run, simulation and report contracts: their sessions, database connectors, transformations, validators and types. They say what each read returns when nothing matches, which writes are deduplicated or idempotent, which typed errors are raised, and how the limit + 1 over-fetch drives has_more. Pydantic publishes class docstrings as JSON-schema descriptions. The metadata result types appear in the published OpenAPI document, so their docstrings are written for API consumers; the simulation and report types are the versioned Stage 12 worker contracts, so theirs describe what each message means to producer and consumer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docstrings to the native route dependencies (one contract line per Protocol method), the health, metadata and specification routers, the v2 metadata route builders and their shared read_resource helper, and the v2 request, document and response models and their methods. Pydantic publishes a model's class docstring as its JSON-schema description, so the response and document models in the OpenAPI document now carry descriptions written for API consumers: what each object represents, that households and policies are immutable and deduplicated, and how to page through results. Route functions, whose docstrings FastAPI would publish as operation descriptions, are unchanged, and so are the documented paths and operations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add module, function and class docstrings to the Flask blueprints, the payload validators and utilities, and the top-level application, constants, country, SPM, migration-flag and query-parameter modules. Reword the existing error-handler, user-profile, policy and cache-key docstrings into one-line imperative summaries, complete the Args sections of get_policy, set_policy and validate_country (whose entry described the wrapper's argument instead of the decorator's), and drop the update_user_profile promise of a 403 for auth0_id edits, which the code never makes. Only validator methods on the published SPM and query-parameter models gained docstrings; their class docstrings are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docstrings to the v1 economy, household, policy, report, simulation and user services, their legacy-to-v2 mirroring helpers and the budget- window cache, including their Pydantic option, result and spec models. They say what a reader cannot see from the signature: which results are cached and how, which writes are mirrored to v2, what None means, and which errors are raised. Reword the existing summaries that ran on without a blank line or past 88 columns, correct get_economic_impact, which claimed to return a tuple, and replace the pass bodies of two exception classes with their new docstrings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Select the pydocstyle rules (D), keeping D211 and D212 of the two mutually exclusive pairs. Test files stay exempt from the missing-docstring rules (D1) but follow the docstring style rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two validator fixtures were the last D103 findings. The disabled cache backend's get() now ends at its docstring instead of suppressing RET501 on an explicit return None. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
api.quality.ruff-lint now lists D, and the rendered rules page and AGENTS.md Rules block are regenerated for the new tool hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 15, 2026 17:21
3d9fa59 to
90d5fe9
Compare
This branch was successfully 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 #3906
Summary
Phase 1 step 1.8, group 4: docstrings. Stacked on #3905.
selectgainsDand ignoresD203andD213, keepingD211(no blank line before a class docstring) andD212(summary on the first line). All 1,336 findings at the base are fixed: about 1,000 docstrings added or reworded across 229 Python files, committed by area (runtime cache and libraries, rules tool and scripts, data layer, v2 services, FastAPI routes and models, Flask routes and utilities, v1 services). Existing docstrings were reworded to say what the code actually does; one test docstring said 404 where the code returns 400.passand..., finds one other change, which is equivalent. In full:passnow have a docstring instead, because PIE790 flagspassafter a docstring....after their new docstring.get()drops its redundantreturn Noneinstead of suppressing RET501.noqa: D…anywhere. The two validator proof fixtures forapi.v2.validators-transformations-no-dbget one-line docstrings rather than a per-file ignore.description, and FastAPI copies a route docstring into the operation description. Compared with the base, withdescriptionkeys removed:/v2/openapi.jsonpreview.EconomicImpactResultreworded).scripts/rulesis byte-identical with sim again (tool sha256db83d5ad2aa4); sim adopts this PR's wording in Enable ruff docstring rules (D) policyengine-sim-api#779.api.quality.ruff-lintnow listsD.Testing
pytest tests/unit tests/contract, to_refactor and the dedupe integration test (themake testset): 2,411 passed.ruff checkandruff format --check(0.15.12) are clean repo-wide.🤖 Generated with Claude Code