Skip to content
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

feat: disable v3 #2734

Merged
merged 1 commit into from
Dec 18, 2024
Merged

feat: disable v3 #2734

merged 1 commit into from
Dec 18, 2024

Conversation

nmrgt
Copy link
Collaborator

@nmrgt nmrgt commented Dec 18, 2024

Summary by CodeRabbit

  • Chores
    • Updated the supported API versions for route registration, now supporting only version 3.1.0.

Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

Walkthrough

The pull request modifies the SUPPORTED_VERSIONS constant in the registerExpressRoute.ts file, reducing the supported API versions from two versions (["3.0.0", "3.1.0"]) to a single version (["3.1.0"]). This change indicates a deprecation of the older API version 3.0.0, leaving only version 3.1.0 as the supported version for route registration functionality.

Changes

File Change Summary
api/src/pdc/proxy/helpers/registerExpressRoute.ts Reduced SUPPORTED_VERSIONS from ["3.0.0", "3.1.0"] to ["3.1.0"], removing support for version 3.0.0

Possibly related PRs

Suggested reviewers

  • jonathanfallon

Poem

🐰 API versions dance and sway,
Old routes now fade, new paths hold sway
Three-point-zero, farewell and adieu
Three-point-one stands proud and true
A rabbit's code, lean and bright! 🚀

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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. (Beta)
  • @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.

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

🔭 Outside diff range comments (1)
api/src/pdc/proxy/helpers/registerExpressRoute.ts (1)

Line range hint 52-53: Clean up backward compatibility code

Since v3.0.0 is being removed, the FIXME comment and special handling for "v3" -> "v3.0" conversion appears to be obsolete.

Apply this diff to clean up the obsolete code:

-      // FIXME: This is a dirty hack to ensure backward compatibility
-      const apiVersion = api_version == "v3" ? "v3.0" : api_version;
+      const apiVersion = api_version;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 99e4fca and 0d7d1ce.

📒 Files selected for processing (1)
  • api/src/pdc/proxy/helpers/registerExpressRoute.ts (1 hunks)

@@ -23,7 +23,7 @@ export interface RouteParams {
rpcAnswerOnFailure?: boolean;
}

const SUPPORTED_VERSIONS = ["3.0.0", "3.1.0"].map((v) => semver.parse(v));
const SUPPORTED_VERSIONS = ["3.1.0"].map((v) => semver.parse(v));
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Breaking Change: Verify API v3.0.0 deprecation strategy

Removing support for API v3.0.0 is a breaking change that could impact existing clients. Consider the following recommendations:

  1. Ensure proper communication to API consumers about this deprecation
  2. Consider implementing a deprecation notice period
  3. Update API documentation to reflect this change

Would you like me to help draft deprecation notices or documentation updates?


💡 Codebase verification

Version 3.0.0 support removal is not fully complete

The codebase still contains v3.0.0 specific handling that needs attention:

  • registerExpressRoute.ts has a backward compatibility hack that maps "v3" to "v3.0"
  • CarpoolLabelRepository.ts contains v3.0.0 specific fraud label handling
  • CreateJourneyAction.ts includes version 3.0 in its version range check

These locations need to be updated to remove v3.0.0 support:

  • api/src/pdc/proxy/helpers/registerExpressRoute.ts: Remove the backward compatibility hack for "v3" to "v3.0" mapping
  • api/src/pdc/providers/carpool/repositories/CarpoolLabelRepository.ts: Remove the v3.0.0 version check and legacy fraud label handling
  • api/src/pdc/services/acquisition/actions/CreateJourneyAction.ts: Update the version range check to only support 3.1.0
🔗 Analysis chain

Verify version handling impact

Let's verify that removing v3.0.0 support is handled correctly throughout the codebase.

Also applies to: 58-61

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining v3.0.0 API references or version handling

# Search for v3.0.0 version strings
echo "Searching for v3.0.0 references..."
rg -l "3\.0\.0|v3\.0"

# Search for version-specific handling
echo "Searching for version-specific code paths..."
rg -l "v3\." 

# Search for API version documentation
echo "Searching for API documentation..."
fd -g "*api*.md" -g "*swagger*.{json,yaml}" -g "*openapi*.{json,yaml}"

Length of output: 1270


Script:

#!/bin/bash
# Let's examine the specific version handling in the key files

# Check the API spec file content
echo "=== Checking API spec file ==="
cat api/specs/api-v3.1.yaml

# Check version handling in registerExpressRoute
echo -e "\n=== Checking registerExpressRoute implementation ==="
cat api/src/pdc/proxy/helpers/registerExpressRoute.ts

# Check version handling in CarpoolLabelRepository
echo -e "\n=== Checking CarpoolLabelRepository implementation ==="
cat api/src/pdc/providers/carpool/repositories/CarpoolLabelRepository.ts

# Look for any version-specific routing or handling
echo -e "\n=== Checking for version-specific routing patterns ==="
ast-grep --pattern 'if ($_ === "3.0.0") { $$$ }'

Length of output: 111705


Script:

#!/bin/bash
# Let's check for any remaining v3.0.0 specific handling in the codebase

# Check registerExpressRoute.ts content with proper error handling
echo "=== Checking registerExpressRoute.ts ==="
cat api/src/pdc/proxy/helpers/registerExpressRoute.ts 2>/dev/null || echo "File not found"

# Check API spec for version references
echo -e "\n=== Checking API version references in spec ==="
rg -A 5 "version" api/specs/api-v3.1.yaml 2>/dev/null || echo "File not found"

# Check for version-specific code paths
echo -e "\n=== Checking for version-specific code paths ==="
rg -A 5 "3\.0\.0|v3\.0" --type ts 2>/dev/null || echo "No version-specific code found"

# Look for version comparisons
echo -e "\n=== Checking for version comparisons ==="
ast-grep --pattern 'semver.parse($_)' 2>/dev/null || echo "No version comparisons found"

Length of output: 7947

@nmrgt nmrgt merged commit cd7a32e into main Dec 18, 2024
8 checks passed
@nmrgt nmrgt deleted the feat/disable_v3 branch December 18, 2024 10:44
@coderabbitai coderabbitai bot mentioned this pull request Jan 17, 2025
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.

1 participant