refactor(auth): extract SSH/browser helpers into auth_browser_helpers (s2) - #80428
Open
andrexibiza wants to merge 5 commits into
Open
refactor(auth): extract SSH/browser helpers into auth_browser_helpers (s2)#80428andrexibiza wants to merge 5 commits into
andrexibiza wants to merge 5 commits into
Conversation
…elpers.py Slice s2 of the auth.py god-file kill (epic NousResearch#78647, target NousResearch#78637): the SSH / remote-session detection and graphical-browser helpers (_is_remote_session, _CONSOLE_BROWSER_NAMES, _can_open_graphical_browser, _ssh_user_at_host, _print_loopback_ssh_hint) move byte-verbatim into hermes_cli/auth_browser_helpers.py. Seam: hermes_cli.auth re-exports every moved name (eager import at the vacated site + PEP 562 module __getattr__ fallback), so bare-name call sites inside the monolith, downstream from-hermes_cli.auth import importers, and test monkeypatches all keep resolving unchanged. The ONE non-verbatim body adjustment is the function-local round-trip seam inside _print_loopback_ssh_hint that imports _is_remote_session through the monolith re-export at call time, so monkeypatch.setattr(auth, ...) keeps steering the moved code; OAUTH_OVER_SSH_DOCS_URL is imported at the bottom of the new module to break the import cycle. Regression coverage: tests/test_auth_browser_helpers_seam.py asserts real identity (auth.<name> is helpers.<name>) for every re-exported name, the PEP 562 fallback, and behavior smokes. Existing affected suites (test_auth_loopback_ssh_hint, test_graphical_browser_detection, test_setup_tts_xai_oauth, test_subscription_cli, test_anthropic_oauth_pkce, test_spotify_auth) pass unchanged. Golden receipts (recomputed at pin 863e313): - def-aligned 3396-3557 with-NL sha 91e0fd158ce44af1b2f32ce24363e1254587825df4cf9bda8c16c480a2544bc6 - banner-inclusive 3392-3557 with-NL sha 6fb799dafb81ab602bb86f11dba294f3d94ffafe4a8f3cded76f4f502f4651a4 Collision census: all 38 open PRs touching hermes_cli/auth.py hunk-checked; window 3396-3557 clean (nearest live hunk 3969; the two nominal overlaps 17246/17647 are base-drift artifacts created before the window existed and fail git apply --check at HEAD). Signed-off-by: Andrex Ibiza, MBA <84248988+andrexibiza@users.noreply.github.com>
Contributor
Author
Interlock receipt
|
Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
…trigger run) Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract the SSH/browser helper family from
hermes_cli/auth.pyintohermes_cli/auth_browser_helpers.pywith a PEP 562 seam so every moved name still resolvesis-identical through the monolith namespace.Part of #78637 (auth kill target) · Part of #78647 (Large-file decomposition epic)
Why this matters to users
auth.pyis a god-file under active conquest. This slice moves remote-session / graphical-browser / SSH-hint helpers out without behavior change, so future auth work doesn't keep colliding inside an 8k+ line monolith and so the kill board can advance.What moved
_is_remote_session_can_open_graphical_browser_ssh_user_at_host_print_loopback_ssh_hint_CONSOLE_BROWSER_NAMES(+ related constants in window)Window (parent
863e3131855): 3396–3557 (def-aligned) / 3392–3557 (banner-inclusive).Golden receipts
91e0fd158ce44af1b2f32ce24363e1254587825df4cf9bda8c16c480a2544bc66fb799dafb81ab602bb86f11dba294f3d94ffafe4a8f3cded76f4f502f4651a4difflib 0 after sanctioned seams (lazy round-trip + bottom
OAUTH_OVER_SSH_DOCS_URLimport).Double-blind review
No CRITICAL/IMPORTANT. Spec compliance PASS.
Collision gate
Live census over full open-PR population (~19k). Nominal #17246 / #17647 = base-drift pre-window, CONFLICTING, fail
git apply --check— not live collisions on this window. s3/s4/s5 windows remain gated on their own colliders (FILE-LIST on #78637).Stat
How to test
scripts/run_tests.sh tests/hermes_cli/test_auth_browser_helpers_seam.py # plus affected: loopback / graphical-browser / related auth suitesReviewer receipts: seam identity
is, both import orders, ruff clean, LF-only, DCO present.Platforms
Windows native + git-bash runner.
Interlock