Skip to content

fix(tests): main is red — stale memo resetter + banner tests mocking the wrong seam - #107835

Closed
teknium1 wants to merge 2 commits into
mainfrom
fix/anon-auth-memo-dict-reset
Closed

teknium1 wants to merge 2 commits into
mainfrom
fix/anon-auth-memo-dict-reset

Conversation

@teknium1

@teknium1 teknium1 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Main's Python tests are red with two independent test-only breakages; this restores green. Both reproduce with an empty diff, so every open PR currently fails CI (e.g. #107825 hit both).

Fix 1 — anon-auth fixture resets the token memo to a dead shape

#173105ce6f4 changed _RESOLVE_TOKEN_CACHE from a single tuple slot to a dict keyed by hermes_home_key(), updating the resetters in test_resolve_token_memo.py and test_nous_portal_staging_allowlist.py — but missed the third in test_anon_auth_core.py, which still set the memo to None. The new _RESOLVE_TOKEN_CACHE.get(cache_key) then raises AttributeError: 'NoneType' object has no attribute 'get' (2 failures). One line: reset to {}. Repo-wide grep confirms no other None resetters remain.

Fix 2 — banner SSH fast-path tests mock a function production never calls

The three test_check_via_local_git_ssh_fastpath_* tests (from 338bf9e) patch banner._upstream_main_sha, but _check_via_local_git never calls it — for a github.com origin it calls _github_branch_tip directly. The tests pass only when the runner's UNMOCKED anonymous api.github.com request happens to succeed; CI runners are rate-limited, _github_branch_tip returns None, and all three fail (assert None == 0 / 3 / -1). Patch _github_branch_tip instead — the seam production reads. This is exactly the "patch where production reads" class from AGENTS.md.

Live repro:

  • Fix 1: on origin/main, scripts/run_tests.sh tests/hermes_cli/test_anon_auth_core.py → 2 failed with hermes_cli/auth.py:1639 AttributeError; after → 0 failed.
  • Fix 2: simulating the rate-limited API locally (_github_branch_tip → None, original patches in place) reproduces CI's assert None == 0; with the corrected patch target the tests pass with NO live network (verified under a dead https_proxy). CI itself showed all three failing on both attempts of two unrelated PRs.

Validation

Check Result
4 touched test files (anon_auth_core, resolve_token_memo, nous_portal_staging_allowlist, banner_git_state) 48 passed, 0 failed
banner_git_state under dead https_proxy (no network) 6 passed
ruff clean

Infographic

infographic

173105c changed the resolve_nous_access_token memo from a single
(timestamp, token) tuple slot to a dict keyed by hermes_home_key(), and
updated the two test files that reset it — but missed the third:
test_anon_auth_core.py's fixture still reset it to None, so
_RESOLVE_TOKEN_CACHE.get(cache_key) raised AttributeError and broke
main's Python tests (2 failures in TestTokenAcquisitionSeam /
TestConnectorTokenPath).
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 98cc99d — fix(tests): banner SSH fast-path tests mock the seam product

⚠️ Warnings

OSV vulnerability scan · View job

80 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 5m45s vs 4m49s (+19.4%). 6 job(s) slower, 5 faster, 3 unchanged.

  • Python tests / Run tests: -53.0s
  • OS-specific tests / Windows-only tests: +44.0s
  • Detect affected areas: +10.0s
  • OS-specific tests / macOS-only tests: -8.0s
  • Check no case-colliding filenames / check-case-collisions: +3.0s

@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools duplicate This issue or pull request already exists labels Sep 11, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Duplicate of #107822 (same one-line _RESOLVE_TOKEN_CACHE = {} fixture reset, same file; #107824 is the other copy). Suggest keeping only one of the three open.

The three test_check_via_local_git_ssh_fastpath_* tests (338bf9e)
patch banner._upstream_main_sha, but _check_via_local_git never calls
it — for a github.com origin it calls _github_branch_tip directly. The
tests only passed when the runner's UNMOCKED anonymous api.github.com
request succeeded; on CI runners that request is rate-limited, returns
None, and all three fail (assert None == 0 / -1 / 3). Reproduced by
simulating the rate-limited API locally.

Patch _github_branch_tip instead — the seam production reads.
@kshitijk4poor

Copy link
Copy Markdown
Contributor

Opened #108108 with only this PR's banner hunk (your commit, your authorship) so the six armed salvage PRs blocked on main's red can unblock; whichever of the two merges first makes the other redundant — I'll close mine if this one lands.

kshitijk4poor pushed a commit that referenced this pull request Sep 11, 2026
… (_github_branch_tip)

Since 338bf9e _check_via_local_git reads _github_branch_tip directly; patching _upstream_main_sha intercepted nothing, so on the CI runner the check made a live GitHub call and behind stayed None. From #107835 (banner half; the anon_auth half landed via #107822).
@alt-glitch alt-glitch added P3 Low — cosmetic, nice to have and removed P2 Medium — degraded but workaround exists labels Sep 11, 2026
@teknium1

Copy link
Copy Markdown
Collaborator Author

Closing — FIXED ON MAIN. Both hermeticity fixes this PR carries landed independently:

  • test_anon_auth_core.py memo reset as a dict → 0c0983a (test(auth): anon-auth fixture resets the per-profile token memo as a dict)
  • test_banner_git_state.py patching _github_branch_tip5d2d5e9 (fix(tests): banner ssh-fastpath tests patch the seam production reads)

Same diff shape, nothing left to salvage. Reopen if either file goes red again on origin/main with a run link.

@teknium1 teknium1 closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants