Engineering notes · upstream fixes

Small bugs,
tested patches.

Four real upstream reports, each with a reproduction, the smallest patch and a regression test. Every claim links to the public pull request. All four are open and not merged.

STATUS · open PRs: 4 · merged: 0 · updated 2026-11-28

01 — pytest-cid

A mapping that is not a dict

Symptom. normalize(defaultdict(list, {"hash": CIDv0})) raised TypeError: first argument must be callable or None.

Root cause. The mapping was recreated with obj.__class__(dict(items)). For defaultdict, the first constructor argument is the factory, not the initial data.

Patch. Construct the defaultdict with its factory, then update it with the normalized pairs. The factory and the CIDv1 value survive.

Verification. New regression test; pytest -q tests → 21 passed.

02 — pytest-golden

Goldens are text, not a locale

Symptom. On Windows the default encoding is cp1251. A UTF-8 golden containing Cyrillic was decoded as mojibake, so identical output was reported as a diff. Update mode wrote cp1251 bytes.

Root cause. Path.open().read() and Path.write_text(output) both use the platform default encoding.

Patch. Read and write with encoding="utf-8". The golden is now portable across Windows and Linux.

Verification. New compare and update tests; before 2 failed, after 2 passed.

03 — omop-subset

An abstract filter that cannot be built

Symptom. The exported PersonFilter could not be instantiated: it was missing _expression and the required Filter.table field.

Root cause. The class inherited the abstract contract but never implemented it; the table field was also never set.

Patch. Set table = "person", implement _expression, reuse it in _apply, and add a test that runs the filter through Cohort.

Verification. 4 passed; mypy src tests clean.

04 — tool

A failed command with a successful exit

Symptom. pin() ignored the False returned by interpreter.pin_version(), so a failed uv python pin still exited with code 0.

Root cause. The Click command never checked the return value before returning success.

Patch. Check the result, print a failure and raise Exit(code=1).

Verification. New CLI regression test; tests/unit → 22 passed.

05 — The rule

No merged badge before a merge.

These are contributions, not testimonials. The public PR is the evidence; the status stays “open” until a maintainer merges it. If a maintainer asks for changes, the note gets the new status and the patch is updated in the PR — not rewritten as a claim.

How I review and patch ↗ Selected work ↗