Skip to content

quality: strict typing + full docstring coverage across the package#4

Merged
cnewkirk merged 1 commit into
mainfrom
typing-docstrings
Jul 4, 2026
Merged

quality: strict typing + full docstring coverage across the package#4
cnewkirk merged 1 commit into
mainfrom
typing-docstrings

Conversation

@cnewkirk

@cnewkirk cnewkirk commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

A typing + documentation quality pass over the whole hueman package. No runtime behavior changes.

  • mypy --strict is now clean (0 errors across 19 source files; was 139 errors in 12 files). [tool.mypy] strict = true is added to pyproject.toml so it stays enforced, with mypy, types-requests, and types-PyYAML added to the dev extras.
  • Docstring coverage is 100%: every module, class, function, and method — including private helpers and __init__s — has a Google-style docstring matching the existing house style in sun.py (122 were missing). Docstrings were written against the code, documenting contracts (BLOCKED plan semantics, debounce/override behavior, timeslot wrap rules, YAML coercion quirks) rather than restating it.
  • Typing style is uniform modern 3.10+: builtin generics, X | None unions, collections.abc imports, from __future__ import annotations everywhere. Zero # type: ignore; only 3 cast() calls, all at genuine JSON boundaries with explanatory comments.

Behavior safety

This package drives a live daemon, so the pass was constrained to zero behavior change:

  • New assert x is not None narrowing sits only where the old code immediately dereferenced the same value (the failure mode changes from AttributeError to AssertionError; under python -O it is byte-for-byte the old behavior).
  • The few "restructures" (typed locals, an early return, two loop-variable renames) were each traced to exact runtime no-ops in review.
  • No test files touched: the identical pre-existing suite passes, 307/307.

Verification

  • mypy --strict --no-incremental hueman/Success: no issues found in 19 source files
  • pytest -q307 passed
  • AST audit → 0 missing docstrings package-wide
  • Independent reviewer pass over the full diff: no Critical/Important findings; the minor consistency nits it raised are fixed in this branch.

🤖 Generated with Claude Code

- mypy --strict now passes (was 139 errors in 12 files); [tool.mypy]
  strict = true added to pyproject so it stays that way, with mypy and
  type stubs in the dev extras
- every module, class, function, and method has a Google-style
  docstring (122 were missing), matching the house style in sun.py
- zero runtime behavior change: annotations, narrowing guards, and
  docstrings only; the 307-test suite is untouched and passing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cnewkirk
cnewkirk merged commit cdbb88e into main Jul 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant