Tighten the mypy baseline established in commit d456df8 so we can flip warn_return_any = True and warn_unreachable = True in mypy.ini. Each item is small and independent.
See AI_READINESS.md criterion B1 for the rubric context. Current baseline: mypy . exits 0 on 91 production files at the lenient v1 floor.
Checklist
Acceptance
mypy . passes after each commit.
mypy.ini has warn_return_any = True and warn_unreachable = True re-enabled (matching their original v1 intent).
scripts/ is no longer excluded from the default mypy scope.
Refs
- Rubric:
AI_READINESS.md (criterion B1).
- Baseline commit: `d456df8`.
- Anti-defensiveness:
AGENTS.md "Execution discipline" section.
Tighten the mypy baseline established in commit
d456df8so we can flipwarn_return_any = Trueandwarn_unreachable = Trueinmypy.ini. Each item is small and independent.See
AI_READINESS.mdcriterion B1 for the rubric context. Current baseline:mypy .exits 0 on 91 production files at the lenient v1 floor.Checklist
models/sketch_validation.py:115— remove defensiveif text is None: return Falseagainst astr-typed param. Per AGENTS.md anti-defensiveness rule ("don't add error handling for scenarios that can't happen"). Unblocks flippingwarn_unreachable = Trueinmypy.ini.auth/session_seal.py:32—Any-leak throughdict[str, Any]-declared boundary. Fix withfrom typing import cast; return cast(dict[str, Any], json.loads(raw.decode("utf-8"))). Surface-area: 1 line.auth/router.py:788→auth/service.py:293load_session—Any-leak through the return-type chain.service.load_sessionis declared-> AuthSessionStatebut mypy treatsstateasAnyat the return statement. Audit the typing chain (likely_get_auth_service(request)returnsAnyvia FastAPIrequest.state). After fixes 2 + 3, flipwarn_return_any = Trueinmypy.ini.scripts/snap.py:168— realPath | Nonenarrowing bug. Currently mypy-excluded viamypy.iniexcludeblock. Fix the narrowing, then removescripts/from the exclude list so dev tools are also gated.Acceptance
mypy .passes after each commit.mypy.inihaswarn_return_any = Trueandwarn_unreachable = Truere-enabled (matching their original v1 intent).scripts/is no longer excluded from the default mypy scope.Refs
AI_READINESS.md(criterion B1).AGENTS.md"Execution discipline" section.