Skip to content

chore: remove unused open_github_url/_StripAuthOnRedirect from _github_http.py#2883

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:chore/2876-remove-unused-github-http
Open

chore: remove unused open_github_url/_StripAuthOnRedirect from _github_http.py#2883
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:chore/2876-remove-unused-github-http

Conversation

@jawwad-ali
Copy link
Copy Markdown

Closes #2876

Description

Removes the two helpers in src/specify_cli/_github_http.py that have no callers anywhere in the repo (production, tests, docs, templates, or workflows):

  • open_github_url() — orphaned when feat: Config-driven opt-in authentication registry with multi-platform support #2393 moved download authentication to the config-driven registry in authentication/http.py. Its only remaining reference was its own definition.
  • _StripAuthOnRedirect (the _github_http copy) — referenced only by open_github_url() itself, and a duplicate of the live redirect/strip-auth implementation in specify_cli/authentication/http.py (a separate class taking a hosts tuple, covered by tests/test_authentication.py::TestRedirectStripping), which is untouched.

No runtime behavior change — dead-code removal only. resolve_github_release_asset_api_url() (used by extensions.py, presets.py, and __init__.py) is retained with all 8 of its tests, and the module docstring is updated to describe what the module does today.

Caller-sweep evidence (string-literal, getattr, and __all__ dynamic patterns also checked — zero matches):

$ git grep -n "open_github_url"
src/specify_cli/_github_http.py:152:def open_github_url(...)    # definition only — no callers

$ git grep -n "_StripAuthOnRedirect"
src/specify_cli/_github_http.py:57,165                # dead copy (removed here)
src/specify_cli/authentication/http.py:59,138         # live implementation — untouched
tests/test_authentication.py:773,776,785,788,798,802  # all import the live authentication.http class

Decision on build_github_request() / GITHUB_HOSTS (acceptance criterion 3): kept as a tested, self-contained utility (11 passing tests in tests/test_github_http.py). That keeps this PR to a single source file with zero test-file changes. Happy to remove them here or in a follow-up if maintainers prefer.

Note on #2442: that open PR currently extends open_github_url, but #2876 was filed by #2442's own author after narrowing that work, asking for these symbols' removal — the corresponding hunks can be dropped from #2442 on its next rebase.

Testing

  • Tested locally with uv run specify --help (exit 0)
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (N/A — the removed code has zero callers, so no command behavior changes)

Details (Windows 11, Python 3.12.12):

  • uvx ruff check src/ — All checks passed
  • uv run pytest tests/test_github_http.py tests/test_authentication.py -q100 passed, 1 skipped
  • Full suite uv run pytest3474 passed, 160 skipped, 14 failed; counts identical to clean main on the same host. The 14 failures are pre-existing environment-only failures (os.symlinkWinError 1314; symlink creation requires elevation/Developer Mode on Windows), unrelated to this change and not touching _github_http.py.
  • Repo-wide grep after the change: no references to the removed symbols remain.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

This PR was developed with Claude Code (Claude Opus 4.8) under my direction — the caller-sweep analysis, the code removal, the local verification runs quoted above, and this description. I reviewed the diff and the evidence before submission. If any of my review responses are AI-assisted, I will disclose that in the thread as well.

…b_http.py

open_github_url() was orphaned when github#2393 moved download authentication
to the config-driven registry in authentication/http.py; its dedicated
_StripAuthOnRedirect handler was referenced only by open_github_url
itself and duplicated the live implementation in authentication/http.py.

Remove both, keep the live resolve_github_release_asset_api_url() and
the tested build_github_request()/GITHUB_HOSTS utilities, and update
the module docstring to match what the module does today.

No runtime behavior change.

Closes github#2876

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jawwad-ali jawwad-ali requested a review from mnriem as a code owner June 6, 2026 16:15
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.

[Chore]: Remove unused open_github_url/_StripAuthOnRedirect from _github_http.py

1 participant