chore: project hygiene tidy — publish guard, uv_build band, HTTPStatus, Response.json() charset#18
Merged
Merged
Conversation
Refuse to run when GITHUB_REF_NAME or PYPI_TOKEN is unset, so local invocations cannot corrupt pyproject.toml via uv version "". Closes deferred-work entry: "just publish lacks env-var validation". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Accept all 0.x releases; stops the every-minor bump treadmill. An incompatible 0.x bump (hypothetical) surfaces as a loud build error in CI, not a silent regression. Closes deferred-work entry: "uv_build>=0.11,<0.12 narrow window". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces 11 instances of `assert status == <int> # noqa: PLR2004` with `assert status == HTTPStatus.<NAME>` across three test files. Each substitution removes a noqa; HTTPStatus members are IntEnum so behavior is unchanged. Non-status-code PLR2004 noqas (counts, elapsed, intentionally-invalid status==99) are out of scope. Partial: deferred-work "PLR2004 per-file-ignores" entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces 400 → HTTPStatus.BAD_REQUEST and 500 → HTTPStatus.INTERNAL_SERVER_ERROR in the 4xx/5xx exception dispatch block. The < 600 synthetic upper bound has no stdlib equivalent, so its PLR2004 noqa stays — now with an inline justification. Closes deferred-work entry: "PLR2004 per-file-ignores" (for status codes; non-status instances remain open). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Routes the body through self.text instead of json.loads(self.content), so a declared charset (e.g. iso-8859-1) is respected before JSON parsing. ASCII / UTF-8 bodies are unchanged. Docstring now explicitly documents the json.JSONDecodeError raise contract. Wrapping JSONDecodeError in a domain exception is left to a future response-API revision. Closes deferred-work entries: "Response.json() raises raw and ignores charset" (retro) and "Response.json() honor declared charset" (1-2). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes four entries closed by this PR (just publish guard, uv_build band, Response.json() charset+raise — last one was duplicated across the retro section and the original Story 1-2 review). Rewords the PLR2004 entry to document what was actually done (status codes migrated to http.HTTPStatus) and what remains open (~11 non- status noqas on counts and primitive values). Also fixes pre-existing missing trailing newline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- PydanticDecoder.decode TypeError fallback: branch is deliberately exercised via mock in tests; contract is pinned, no action pending. Steady state, not deferred work. - PLR2004 noqas on non-status-code literals: decision made in spec discussion (bare noqas or per-line justifications acceptable; per-file-ignores rejected per user's lint-suppression hierarchy). Documenting current state, not deferred work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Closes four entries in
planning/deferred-work.md. Spec:planning/specs/2026-06-02-project-hygiene-tidy-design.md. Plan:planning/plans/2026-06-02-project-hygiene-tidy-plan.md.just publishenv-var guard — refuses to run whenGITHUB_REF_NAMEorPYPI_TOKENis unset, so local invocations can no longer corruptpyproject.tomlviauv version "".uv_buildband widening —>=0.11,<0.12→>=0.11,<1.0. Stops the every-minor bump treadmill; a hypothetical 0.x break surfaces as a loud build error.http.HTTPStatussubstitution — 11 status-code integer literals (200, 418, 503, 504) replaced withHTTPStatus.*constants acrosstest_transports_httpx2.py,test_response.py,test_middleware.py, plus the 400/500 bounds in the 4xx/5xx dispatch block ofsrc/httpware/transports/httpx2.py. Removes 12 of the 25# noqa: PLR2004instances in the repo. The synthetic< 600upper bound keeps its noqa with an inline justification.Response.json()charset fix — routes throughself.textso declared charsets (e.g.iso-8859-1) are honored before JSON parsing. Strict improvement; ASCII / UTF-8 bodies unchanged. Docstring now explicitly documents thejson.JSONDecodeErrorraise contract. Wrapping the exception in a domain type is left to a future response-API revision.Six atomic commits, no public API break, no CI invariant change.
Test plan
just lint-ciexits 0just test— 296 passing (one new:test_response_json_uses_declared_charset)env -i PATH="$PATH" HOME="$HOME" just publishexits non-zero withGITHUB_REF_NAME is required; refusing to run outside CIand leavespyproject.tomluntouchedgrep -rn 'PLR2004' src/ tests/shows no remaining noqas on status-code literals (200/418/503/504/400/500); only non-status instances (counts,elapsed, intentionally-invalidstatus==99) and the justified< 600synthetic-upper-bound noqa remaingrep -E 'just publish\|uv_build>=0\.11,<0\.12\|Response\.json' planning/deferred-work.mdreturns empty🤖 Generated with Claude Code