Skip to content

Harden local type checking and test mocking

Tamir Duberstein tools 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20260410-harden-type-checking-e92ed8b4cac1

Versions newest first

  1. v2 Latest14 patches 3 repliesApplied
  2. v114 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Replace b4 CI integration with simple shell script.
- Fix placement of test docstrings.
- Fix from_git_config(cache_dir=None).
- Add missing spaces in README.md.
- Fix b4 send-prefixes.
- Link to v1: https://patch.msgid.link/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/14Add ci script and mypy suppressionsci.sh pyproject.toml+20 -00 replies
2/14Type make_msg and drop test suppressionspyproject.toml tests/conftest.py tests/test_auth_headers.py +4 more+140 -1340 replies
3/14Add ruff import checks to b4 CIci.sh pyproject.toml src/liblore/__init__.py +8 more+8 -170 replies
4/14Add ruff format check to CIci.sh pyproject.toml src/liblore/__init__.py +11 more+395 -1950 replies
5/14Add pyright strict checks to CIci.sh pyproject.toml src/liblore/node.py +1 more+18 -70 replies
6/14Replace HTTP session mocks with responsespyproject.toml tests/conftest.py tests/test_auth_headers.py +2 more+1097 -8750 replies
7/14Add ty checks to CIci.sh pyproject.toml src/liblore/node.py +2 more+26 -210 replies
8/14Drop redundant read-only property testtests/test_node.py+0 -60 replies
9/14Type from_git_config keyword argumentspyproject.toml src/liblore/node.py+17 -20 replies
10/14Add authheaders stub and typed callablesrc/liblore/node.py tests/test_auth_headers.py typings/authheaders/__init__.pyi+50 -200 replies
11/14Replace batch mocks with subclassestests/test_node.py+51 -370 replies
12/14Use CompletedProcess in git config teststests/test_node.py+45 -320 replies
13/14Update README for uv-based dev checksREADME.md+7 -40 replies
14/14Add b4 send configuration.b4-config+7 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/14] Harden local type checking and test mocking

This series raises the local quality floor by making the type-checking tooling stricter and by removing test patterns that rely on unsafe or poorly typed mocks.

It starts by wiring the repository into b4 CI checks, then adds ruff, pyright, and ty so the same checks run consistently in one place. After that, it removes suppressions incrementally by making the code and tests more explicit and better typed: typed keyword forwarding in from_git_config, a typed authheaders integration, and test-local subclasses instead of method reassignment.

The goal is to keep each change reviewable on its own while moving the tree toward a stricter baseline with fewer exceptions and less fragile mocking.

It would be nice to reduce or remove the use of patch entirely, but this series stops short of that since it would require significant restructuring.

The final commit adds the minimal b4 configuration needed to send this series. :)

---
Changes in v2:
- Replace b4 CI integration with simple shell script.
- Fix placement of test docstrings.
- Fix from_git_config(cache_dir=None).
- Add missing spaces in README.md.
- Fix b4 send-prefixes.
- Link to v1: https://patch.msgid.link/[email protected]

---
Tamir Duberstein (14):
Add ci script and mypy suppressions
Type make_msg and drop test suppressions
Add ruff import checks to b4 CI
Add ruff format check to CI
Add pyright strict checks to CI
Replace HTTP session mocks with responses
Add ty checks to CI
Drop redundant read-only property test
Type from_git_config keyword arguments
Add authheaders stub and typed callable
Replace batch mocks with subclasses
Use CompletedProcess in git config tests
Update README for uv-based dev checks
Add b4 send configuration

 .b4-config                       |    7 +
 README.md                        |   11 +-
 ci.sh                            |   10 +
 pyproject.toml                   |   25 +-
 src/liblore/__init__.py          |    2 +-
 src/liblore/node.py              |  104 +-
 src/liblore/utils.py             |   89 +-
 tests/conftest.py                |   90 +-
 tests/test_auth_headers.py       |   83 +-
 tests/test_cache.py              |  214 ++--
 tests/test_email_utils.py        |   63 +-
 tests/test_formatting.py         |  324 +++---
 tests/test_mbox.py               |    7 +-
 tests/test_message.py            |   11 +-
 tests/test_node.py               | 1999 +++++++++++++++++++++-----------------
 tests/test_thread.py             |   35 +-
 typings/authheaders/__init__.pyi |   13 +
 17 files changed, 1809 insertions(+), 1278 deletions(-)

---
base-commit: 1c0b653bdb6eeb95625e99419d4b34d31cb55c99
change-id: 20260410-harden-type-checking-e92ed8b4cac1

Best regards,

Signature · 1 line
Tamir Duberstein <[email protected]>