-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: tighten loader typing #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: tighten loader typing #130
Conversation
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| def _log_discovered_count( | ||
| *, section: object, descriptor: str | ||
| *, section: LibrarySection, descriptor: str | ||
| ) -> int | None: | ||
| try: | ||
| total = getattr(section, "totalSize") # type: ignore[assignment] | ||
| except Exception: # pragma: no cover - defensive guard | ||
| total = None | ||
| total = getattr(section, "totalSize", None) | ||
| if isinstance(total, int): | ||
| logger.info( | ||
| "Discovered %d Plex %s(s) for ingestion.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore defensive guard around Plex section totalSize access
The new _log_discovered_count helper now calls getattr(section, "totalSize", None) without the previous try/except guard. In PlexAPI, section.totalSize performs a network lookup and can raise plexapi.exceptions.PlexApiException or other IO errors when the server is unreachable. Because this call is only for logging, allowing the exception to propagate will abort the entire ingestion run before any items are queued. The prior implementation swallowed these failures and continued. Please reintroduce the exception handling so that transient Plex errors only skip the log rather than crash ingestion.
Useful? React with 👍 / 👎.
What
Why
Anyfallbacks and clarifying runtime protocols makes the staged loader easier to reason about and safer to extendAffects
Testing
uv run pytest tests/test_enrichment_stage.py tests/test_loader_orchestrator.py tests/test_loader_integration.pyDocumentation
mcp_plex/loader/AGENTS.mdtyping guidancehttps://chatgpt.com/codex/tasks/task_e_68e4900da3e48328bc800e41c3843b03