Skip to content

Conversation

sriramveeraghanta
Copy link
Member

@sriramveeraghanta sriramveeraghanta commented Aug 5, 2025

Description

  • Enable Github APIs to fetch plane version that is released.
  • Save Current version as part of the instance details

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)

Summary by CodeRabbit

  • New Features

    • The system now dynamically checks and displays both the current application version and the latest available version from GitHub during instance registration or update.
  • Chores

    • Improved error handling and messaging for version checks.
    • Removed unused environment variable configuration for instance keys.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The changes update the instance registration command to dynamically determine both the current and latest application versions, including remote checks via the GitHub API. The previous static method for reading the version from package.json is replaced with new methods for version resolution and error handling. Additionally, the INSTANCE_KEY environment variable is removed from the common settings.

Changes

Cohort / File(s) Change Summary
Instance Registration Version Management
apps/api/plane/license/management/commands/register_instance.py
Replaces static version reading with dynamic methods to fetch current and latest versions, including GitHub API querying. Removes read_package_json, adds check_for_current_version and check_for_latest_version, and updates error handling and assignment logic.
Settings Cleanup
apps/api/plane/settings/common.py
Removes the declaration and assignment of the INSTANCE_KEY environment variable.

Sequence Diagram(s)

sequenceDiagram
    participant Command
    participant Env
    participant FileSystem
    participant GitHubAPI
    participant Instance

    Command->>Env: Check APP_VERSION
    alt APP_VERSION exists
        Env-->>Command: Return APP_VERSION
    else
        Command->>FileSystem: Read package.json for version
        alt package.json found
            FileSystem-->>Command: Return version
        else
            FileSystem-->>Command: Return "v0.1.0"
        end
    end
    Command->>GitHubAPI: Query for latest release tag
    alt API success
        GitHubAPI-->>Command: Return latest version
    else
        GitHubAPI-->>Command: Fallback to current version
    end
    Command->>Instance: Register/Update with current and latest version
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A bunny hops through lines of code,
Fetching versions, lightening the load.
No more static keys to find—
Now GitHub’s latest, neatly aligned!
With every hop, the code grows bright,
Version checks done just right.
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a78313f and 2f4b5c9.

📒 Files selected for processing (1)
  • apps/api/plane/license/management/commands/register_instance.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/api/plane/license/management/commands/register_instance.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-register-instance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sriramveeraghanta sriramveeraghanta changed the title fix: enable github api to fetch latest version information [PRIME-17] fix: enable github api to fetch latest version information Aug 5, 2025
Copy link

makeplane bot commented Aug 5, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/api/plane/license/management/commands/register_instance.py (1)

38-40: Consider rate limiting and authentication for GitHub API.

The GitHub API has rate limits (60 requests/hour for unauthenticated requests). For production usage, consider:

  1. Adding authentication token to increase rate limits
  2. Implementing caching to reduce API calls
  3. Adding retry logic with exponential backoff

For better reliability, consider caching the latest version check results or using GitHub webhooks to notify of new releases rather than polling the API on every instance registration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6450793 and a78313f.

📒 Files selected for processing (2)
  • apps/api/plane/license/management/commands/register_instance.py (3 hunks)
  • apps/api/plane/settings/common.py (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/api/plane/settings/common.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
apps/api/plane/license/management/commands/register_instance.py (4)

52-53: LGTM! Version retrieval integration looks good.

The integration of version checking into the handle method is clean and follows good separation of concerns.


65-66: LGTM! Instance creation with version fields.

The addition of current and latest version fields to instance creation is correctly implemented.


78-79: LGTM! Instance update with version fields.

The version field updates in the existing instance path are correctly implemented.


5-5: Ensure requests is declared in your dependency manifest

I didn’t locate any standard Python dependency files in the repo (requirements.txt, requirements-.txt, pyproject.toml, setup.cfg, setup.py, Pipfile, or poetry.lock). Please confirm how your project manages dependencies and add requests to the appropriate manifest so it’s installed in all environments.

Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables the system to check for the latest Plane version from GitHub's API and saves the current version as part of instance details during registration or updates.

  • Adds GitHub API integration to fetch the latest release version from the makeplane/plane repository
  • Updates version detection to use environment variables or package.json as fallback
  • Removes unused INSTANCE_KEY environment variable configuration

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
apps/api/plane/settings/common.py Removes unused INSTANCE_KEY environment variable configuration
apps/api/plane/license/management/commands/register_instance.py Adds GitHub API integration for version checking and refactors version detection logic

@sriramveeraghanta sriramveeraghanta merged commit 927da43 into preview Aug 18, 2025
5 of 9 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-register-instance branch August 18, 2025 14:42
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.

2 participants