Skip to content

Conversation

@gitgasm
Copy link

@gitgasm gitgasm commented Nov 30, 2025

Summary

Fixes #13

This PR addresses several authentication handling issues:

  • Silent auth failure: When get_plex_account() returns None due to expired/invalid tokens, the workflow would crash with 'NoneType' object has no attribute 'watchlist'. Now it gracefully degrades - search results are still shown but watchlist features are disabled until re-authentication.

  • Version upgrade wipes credentials: The version check in utils.py would delete ALL files including accounts.json and servers.json when the workflow version changes. This forced users to re-authenticate after every update. Now authentication files are preserved.

  • Terminal debugging safety: The version check now only runs when the Alfred environment variable is set, preventing accidental cleanup when running scripts from terminal for debugging.

  • Auth failure logging: Added logging when authentication fails in accounts_add_delete.py to help with debugging.

Test plan

  • Authenticate with Plex account
  • Verify search works when account token is valid
  • Invalidate token (or clear cache) and verify search still shows results (without watchlist features)
  • Upgrade workflow version and verify credentials are preserved
  • Run scripts from terminal and verify no files are deleted

🤖 Generated with Claude Code

Fixes BenjaminOddou#13

This PR addresses issues with authentication handling:

1. **Silent auth failure**: When `get_plex_account()` returns `None` due to
   expired/invalid tokens, the workflow would crash with `'NoneType' object
   has no attribute 'watchlist'`. Now it gracefully degrades - search results
   are still shown but watchlist features are disabled until re-authentication.

2. **Version upgrade wipes credentials**: The version check in `utils.py`
   would delete ALL files including `accounts.json` and `servers.json`
   when the workflow version changes. This forced users to re-authenticate
   after every update. Now authentication files are preserved.

   Additionally, the version check now only runs when the Alfred
   environment variable is set, preventing accidental cleanup when
   running scripts from terminal for debugging.

3. **Auth failure logging**: Added logging when authentication fails in
   `accounts_add_delete.py` to help with debugging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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.

Issue with script not responding

1 participant