Skip to content

Conversation

@TimilsinaBimal
Copy link
Owner

No description provided.

@vercel
Copy link

vercel bot commented Dec 20, 2025

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

Project Deployment Review Updated (UTC)
watchly Ready Ready Preview, Comment Dec 20, 2025 3:32pm

@gemini-code-assist
Copy link

Summary of Changes

Hello @TimilsinaBimal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a substantial architectural refactor aimed at improving the modularity, resilience, and overall performance of the application's core services. Key components like Stremio API interactions, TMDB data fetching, and the recommendation engine have been decoupled into specialized modules. This foundational work enables new features such as persistent Stremio authentication via email/password, more granular control over catalog item limits, and a more sophisticated, on-demand catalog update system. The changes also include significant enhancements to the recommendation algorithm and user interface improvements for a smoother experience.

Highlights

  • Core Service Refactor: Major architectural overhaul, splitting monolithic StremioService, TMDBService, and RecommendationService into smaller, more focused modules (StremioBundle, TMDBClient, TMDBService, RecommendationEngine, UserProfileService, etc.) to enhance modularity, maintainability, and testability.
  • Enhanced Stremio Authentication: Introduced direct email and password login for Stremio, allowing the system to automatically refresh expired authentication keys, improving user experience and addon stability. Passwords are now securely encrypted in the token store.
  • Dynamic Catalog Configuration: Added min_items and max_items settings for each catalog, giving users more granular control over the number of recommendations displayed, directly configurable from the frontend.
  • On-Demand Catalog Updates: Transitioned from a scheduled background catalog update system to an on-demand, lazy update mechanism. Updates are now triggered when a user requests a catalog and an update is due, reducing server load and ensuring fresher recommendations.
  • Improved Recommendation Engine: The recommendation logic has been significantly refined with a new RecommendationEngine that incorporates multi-phase discovery, freshness injection, and advanced diversification strategies based on user profile and content attributes.
  • New Public Stats Endpoint: Added a /stats endpoint to provide lightweight public statistics, such as the total number of users, by leveraging a new count_users method in the token store.
  • Frontend UI/UX Improvements: The web configuration interface received updates for better mobile responsiveness, improved password input handling with a toggle button, and clearer catalog configuration options including min/max item controls.
  • Dependency Updates & Tooling: Integrated yamlfmt into pre-commit hooks for consistent YAML formatting and updated the application version to 1.3.3.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/ci.yml
    • .github/workflows/linter.yml
    • .github/workflows/release.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and impressive refactoring of the application's core services. The introduction of a BaseClient, the modularization of Stremio interactions into the StremioBundle, and the restructuring of the recommendation logic into a clear pipeline are all excellent changes that will greatly improve maintainability and resilience. The shift to an on-demand catalog update system is also a smart optimization.

My review focuses on a few minor points related to exception handling to make the code even more robust. Overall, this is a fantastic set of changes that modernizes the codebase and adds valuable new features like email/password authentication.

Comment on lines +103 to +104
token = await token_store.store_user_data(user_id, payload_to_store)
logger.info(f"[{redact_token(token)}] Account {'updated' if existing_data else 'created'} for user {user_id}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The call to token_store.store_user_data is no longer wrapped in a try...except block. The store_user_data function can raise exceptions like redis.exceptions.RedisError or OSError if the Redis store is unavailable. This will result in an unhandled exception and a 500 error for the user. It's important to handle these potential storage errors gracefully, as was done previously.

Suggested change
token = await token_store.store_user_data(user_id, payload_to_store)
logger.info(f"[{redact_token(token)}] Account {'updated' if existing_data else 'created'} for user {user_id}")
# 5. Store user data
try:
token = await token_store.store_user_data(user_id, payload_to_store)
logger.info(f"[{redact_token(token)}] Account {'updated' if existing_data else 'created'} for user {user_id}")
except RuntimeError as exc:
raise HTTPException(status_code=500, detail="Server configuration error.") from exc
except Exception as exc:
logger.error(f"Token storage failed: {exc}")
raise HTTPException(status_code=503, detail="Storage temporarily unavailable.") from exc

Comment on lines +97 to +101
try:
await bundle.auth.get_user_info(auth_key)
is_valid = True
except Exception:
pass

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This try...except block catches all exceptions and silently passes, which can hide potential bugs or issues during the auth key validation. It would be better to at least log the exception to aid in debugging. A similar block in app/api/endpoints/manifest.py already includes logging, which would be great to have here for consistency.

            except Exception as e:
                logger.debug(f"Auth key validation failed during catalog fetch: {e}")
                pass

Comment on lines +139 to +140
except Exception:
pass

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This try...except block for retrieving catalog limits silently ignores all exceptions. This could make it difficult to diagnose problems with user settings, for example if there's a malformed catalog configuration. I recommend adding a log message to capture potential errors.

            except Exception as e:
                logger.warning(f"Could not parse catalog limits for {cfg_id}: {e}")
                pass

Comment on lines +183 to +185
except Exception as exc:
logger.error(f"Token deletion failed: {exc}")
raise HTTPException(status_code=503, detail="Storage temporarily unavailable.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The exception handling here has been broadened from specific (redis_exceptions.RedisError, OSError) to a generic except Exception. This is generally not recommended as it can catch and mask unexpected errors (like HTTPException which is caught and re-raised just above). It would be more robust to catch the specific exceptions you expect from storage operations. Consider restoring the previous, more specific exception handling. You'll also need to re-import from redis import exceptions as redis_exceptions.

Suggested change
except Exception as exc:
logger.error(f"Token deletion failed: {exc}")
raise HTTPException(status_code=503, detail="Storage temporarily unavailable.")
except (redis_exceptions.RedisError, OSError) as exc:
logger.error(f"Token deletion failed: {exc}")
raise HTTPException(status_code=503, detail="Storage temporarily unavailable.") from exc

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.

3 participants