Skip to content

fix: discard orphaned macOS session instead of erroring silently - #117

Merged
noFAYZ merged 1 commit into
mainfrom
fix/macos-orphaned-session-116
Aug 26, 2026
Merged

noFAYZ merged 1 commit into
mainfrom
fix/macos-orphaned-session-116

Conversation

@noFAYZ

@noFAYZ noFAYZ commented Aug 26, 2026

Copy link
Copy Markdown
Owner

What and why

Zuno's macOS builds are ad-hoc signed (apple_signing_identity: "-" in the release workflow), so the Keychain entry backing the encrypted session's AES key is scoped to a code signature that changes on every update. When the old key became unreadable, load_or_create_cookie_encryption_key treated that as "no entry" and minted a fresh one, then load_encrypted_youtube_music_cookie tried decrypting the existing session file with the new key — an AEAD tag mismatch, guaranteed to fail.

That decrypt error propagated up through load_youtube_music_cookie, and restoreSession's catch swallowed it into a plain "not logged in" — indistinguishable, from the user's side, from having never signed in. The broken file was never cleaned up, so every later launch repeated the exact same failure. This is the root cause of #116: cached library UI, but a session that silently died and can't come back on its own.

What changed

  • load_encrypted_youtube_music_cookie now treats any failure after confirming the file exists (key unreadable, decrypt failure, invalid UTF-8) as an orphaned session: delete the file and report "no session" cleanly, instead of throwing. The next sign-in starts fresh instead of retrying the same dead bytes on every launch.
  • proxy_http_request's network-failure logging now walks the full .source() chain (error_cause_chain) instead of reqwest's bare top-level "error sending request for url" — that wrapper was hiding whether a failure was DNS, TLS, or connection-level, which is exactly what's missing from Unable to login to youtube on mac os #116's log to diagnose the separate iframe_api failure the reporter also hit.

What this does not fix

The underlying ad-hoc-signing churn itself — that needs a real Apple Developer ID certificate + notarization, which is a release-pipeline/cost decision, not a code fix. This patch stops it from masquerading as silent data loss; it doesn't stop the churn.

How it was checked

  • cargo check — clean, no warnings
  • cargo test — 30/30 pass, including a new test for error_cause_chain
  • The macOS-cfg-gated fix itself can't be exercised on this dev machine (no macOS target installed) — syntax/type-checked by inspection with explicit closure return types to remove inference ambiguity; CI's macOS rust job is the first real build of it

Closes #116

Zuno's macOS builds are ad-hoc signed, so the Keychain entry backing the
session's encryption key becomes unreadable on every update. The old code
treated that as NoEntry and minted a fresh key, then tried decrypting the
existing session file with it — guaranteed to fail. That thrown error was
swallowed by restoreSession's catch and reported as a plain sign-out, with
the broken file left behind to repeat the failure on every later launch.

load_encrypted_youtube_music_cookie now treats any failure past confirming
the file exists as an orphaned session: delete the file, report no session
cleanly, so the next login starts fresh instead of retrying dead bytes
forever.

Also walks the full source chain in proxy_http_request's network-failure
logging (error_cause_chain) — reqwest's own Display only showed the
top-level wrapper, hiding whether a failure was DNS, TLS, or connection
level.

Closes #116
@vercel

vercel Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zuno Ready Ready Preview Aug 26, 2026 8:03pm

@noFAYZ
noFAYZ merged commit c237f8b into main Aug 26, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
Preview — 2d9dff42 Deployed Aug 26, 2026 by vercel[bot]
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.

Unable to login to youtube on mac os

1 participant