Repository navigation
Conversation
Delete the commented-out TestPolicySearch class in the to-refactor policy tests, along with the note that introduced it, the commented-out profiler import in the Flask app and the commented-out service imports in the services package. The GPT-4 experiment's example reform is reworded as prose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each of these six scripts has a python3 shebang and a __main__ entry point, so it is meant to be run directly. Git now records them as executable; running them through python is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The user-profile update note keeps its link to issue #2054, which was closed as not planned, and now says so. The simulation serializer note explains that its JSON-in-a-string projection serves only the v1 contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The three logging.exception calls in the household routes used the root logger. They now use a module logger, so the records are named after policyengine_api.routes.household_routes; the message text and traceback are unchanged. The module keeps its existing structured logger for log_struct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catalog extractor builds a date's midnight with tzinfo=UTC directly instead of attaching UTC afterwards; the result is the same aware value. Every other naive value stays naive, with an inline reason: reform impact start_time and report run timestamps are naive columns (and the runtime cache's datetime.min fallback must compare with them), economy start_time has always held local time, the default year and household period follow the host's local calendar, and the rules registry checks review and expiry dates against the local date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The eight asserts in the v2 household, policy and user-household services and the two in the rules ci-scripts guard now raise TypeError when the narrowed value has the wrong type. None runs inside a Pydantic validator and nothing catches AssertionError: the v2 routes return their generic 500 and the mirror paths report an "unexpected" failure for either type, and the rules callers check for a missing [ci_scripts] table first. The checks also hold under python -O, which strips asserts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
validate_country no longer prints "Validating country" on every request (#3909). The simulation and report routes no longer print on create and get, where the URL already carries the country and id; their update messages, whose id comes from the request body, become debug records on a module logger with the same text. The remaining prints are output by design and carry a reason: the CLI entry points' JSON evidence and results, the startup timings and the unauthenticated simulation client warning on stderr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Printing is these scripts' job. The four scripts with more than three prints (the version bump, the migration baseline capture, the local boot smoke test and the rules CLI) route their output through one _report helper. Three of those helpers' prints carry the suppression; the version bump's helper passes its file argument through, which T201 does not flag, and its stderr messages still go to stderr. Every other print carries an inline reason, as does the catalog publication qualification test, whose printed evidence is its report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Behaviour-identical fixes: the runtime cache version's sha1 is marked usedforsecurity=False (the digest is unchanged), and the GPT-4 experiment parses its embedding strings with ast.literal_eval. Test modules reuse one constant per fake credential or claim token instead of repeating the literal, and the Cloud Run deploy-script tests run bash through one helper. Every other finding keeps its code with an inline reason: try/except/pass on the deliberate telemetry and logging catch-alls (S110, alongside their BLE001 reason), environment-variable and Secret Manager names and test sentinels (S105, S106), fixed repository commands (S603, S607), fixed https and loopback URLs (S310), the experiment's untimed requests (S113), the load test's seeded random mix (S311) and fixed table names in a test query (S608). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Select flake8-datetimez (DTZ), eradicate (ERA), flake8-executable (EXE), flake8-fixme (FIX), flake8-logging-format (G), flake8-logging (LOG), flake8-bandit (S), flake8-print (T20) and flake8-todos (TD). Tests follow all nine: their exemptions stay limited to S101, D1, ANN and PLR2004. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
api.quality.ruff-lint now lists DTZ, ERA, EXE, FIX, G, LOG, S, T20 and TD. The rendered rules page also picks up the rules tool's new hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added this pull request to stack #3888
October 13, 2026 17:53
2 tasks done
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
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 #3914
Also fixes #3909: the country validator's
print("Validating country")is removed.Summary
Phase 1 step 1.8, group 6: security, logging and debugging leftovers. Stacked on #3913.
selectgainsS,T20,LOG,G,DTZ,ERA,TD,FIXandEXE. All 262 findings at the base are fixed or kept with an inline reason, one commit per family.logger.debugcalls on a module logger, because their ids come from the request body.TypeError. None runs inside a Pydantic validator, and nothing catchesAssertionError. Every check was already guaranteed by an earlier one, so none is expected to fire; the v2 routes and the mirror paths treat either type the same way. No production command runs Python with-O, so these asserts were live.capture_migration_baseline.py,smoke_test_local_boot.pyand the rules tool's CLI route output through one_reporthelper. Application code keeps theapi.pystartup timings, the gateway-auth warning on stderr and the JSON evidence of the migration qualification commands.hashlib.sha1(..., usedforsecurity=False)(same digest), and the GPT-4 experiment parses embeddings withast.literal_evalinstead ofeval.requestscalls, where a timeout would change behaviour.S110: eachtry/except/passalready carried a reasonedBLE001suppression from group 5, which now listsS110too.tests/to_refactor/python/test_policy.py). The two TODOs become plain notes; the user-profile one keeps its link to Utilize a technology like Marshmallow to validate inbound requests #2054 and says it was closed. Six Python scripts with a shebang and a__main__entry point are now executable.api.quality.ruff-lintnow lists the nine families. The shared rules tool changed (explicit checks and reasoned suppressions), so its hash is now1c4bbb2a93f8; sim takes the same copy in Enable ruff security, logging and debugging rules (S, T20, LOG, G, DTZ, ERA, TD, FIX, EXE) policyengine-sim-api#785.Testing
pytest tests/unit tests/contract, to_refactor and the dedupe integration test (themake testset): 2,420 passed, the same as the base.make typecheck-v2is clean. mypy on the 78 changed files outside that gate gives the same output as the base.ruff checkandruff format --check(0.15.12) are clean repo-wide./v2/openapi.jsonpreview and the legacy spec are byte-identical to the base..githubscripts changed only in comments, output helpers or file mode, and the environment variables they read are unchanged.CI complete, which fails and says why (step 0.7, Make CI enforcement trustworthy before the rules registry #3887). Its full run starts once the PRs below it merge.🤖 Generated with Claude Code