Skip to content

refactor: define ts and behind_count once, in forge.py (#92) - #94

Merged
tschm merged 2 commits into
mainfrom
rhiza_fix_92_20261008
Oct 8, 2026
Merged

tschm merged 2 commits into
mainfrom
rhiza_fix_92_20261008

Conversation

@tschm

@tschm tschm commented Oct 8, 2026

Copy link
Copy Markdown
Member

Fixes #92.

Done when: ts and _behind_count are each defined exactly once in jq_collector, both forges use that one definition, and coverage stays at 100% of lines and branches.

Both helpers now live in forge.py, next to the other logic the two forges share (ci_summary, cached_ref, fan_out). _behind_count loses its underscore because both forges import it.

Was Now
github_payloads.ts and gitlab._ts (identical bodies) forge.ts
github._behind_count and gitlab._behind_count (identical bodies) forge.behind_count

forge.ts keeps the useful fact from the GitLab copy's docstring: GitLab's …000Z timestamps parse because 3.11's fromisoformat accepts full ISO 8601. That is now a doctest. behind_count also gets doctests.

Callers: github.py, github_api.py, github_payloads.py and gitlab.py each import from forge directly, not through another module, because mypy strict rejects implicit re-exports. test_gitlab.py and test_github_http.py now import these two helpers from forge. Their assertions are unchanged.

Gates

  • prek run --all-files: all hooks pass.
  • mypy (strict): clean.
  • pytest: 478 passed (one new doctest block), 100% of lines and branches.
  • radon cc --show-closures -nc: still prints nothing. The lowest maintainability index is gitlab.py, up from 42.9 to 44.1.

Merge note: #93 (interrogate) also edits forge.py and gitlab.py, in different places. The functions moved here already have docstrings, so they pass #93's 100% gate whichever merges first.

Closes #92

🤖 Generated with Claude Code

@tschm
tschm merged commit e432889 into main Oct 8, 2026
6 checks passed
@tschm
tschm deleted the rhiza_fix_92_20261008 branch October 8, 2026 14:04
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.

Define ts and _behind_count once, in forge.py (see #89)

1 participant