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

refactor!: upgrade to axum 0.7 #62

Merged
merged 27 commits into from
Sep 12, 2024
Merged

refactor!: upgrade to axum 0.7 #62

merged 27 commits into from
Sep 12, 2024

Conversation

kwaa
Copy link
Member

@kwaa kwaa commented Jul 26, 2024

closed #50

Summary by CodeRabbit

  • New Features

    • Enhanced GitHub Actions workflows to fetch the entire repository history, improving capabilities for complex tasks.
    • Introduced a specific route for serving OpenAPI JSON documentation.
    • Streamlined the configuration of rust-analyzer in the development environment.
  • Updates

    • Upgraded various dependencies to newer versions, potentially enhancing functionality and security.
  • Chores

    • Removed outdated Docker build commands in favor of a new command for updating dependencies.

@kwaa kwaa added the enhancement New feature or request label Jul 26, 2024
@kwaa kwaa added this to the 0.3 [Strobe Nights] milestone Jul 26, 2024
Copy link
Contributor

coderabbitai bot commented Jul 26, 2024

Walkthrough

The pull request introduces several modifications across multiple files, primarily focusing on updating GitHub Actions workflows to fetch the entire commit history and upgrading various dependencies in the Rust project. Significant changes include the transition to actions/checkout@v4 with a fetch-depth of 0, updates to several libraries in Cargo.toml, and refinements in routing logic and server initialization. Additionally, the flake.nix configuration has been adjusted to better manage rust-analyzer within the development environment.

Changes

File Path Change Summary
.github/workflows/check.yml Added fetch-depth: 0 to actions/checkout@v4.
.github/workflows/gh-pages.yml Updated actions/checkout from v2 to v4 and added fetch-depth: 0.
.github/workflows/release.yml Added fetch-depth: 0 to actions/checkout@v4.
Cargo.toml Updated multiple dependencies to newer versions, including activitypub_federation, axum, and others.
Justfile Removed commented-out Docker commands and added a new up command for dependency updates.
crates/api_admin/src/routes/mod.rs Changed request parameter type from Request<B> to Request<Body>, and next from Next<B> to Next.
crates/backend/src/lib.rs Transitioned from SocketAddr to TcpListener for server binding.
crates/openapi/Cargo.toml Changed utoipa-swagger-ui dependency from versioned to workspace-based management.
crates/openapi/src/lib.rs Added explicit route for serving OpenAPI JSON documentation.
crates/tracing/Cargo.toml Updated console-subscriber dependency from version 0.2 to 0.4.
flake.nix Removed rust-analyzer from the toolchain definition and included it in the devShells.default.

Assessment against linked issues

Objective Addressed Explanation
Drop actix-web support, upgrade to axum 0.7 and hyper/http 1.0 (#50) The changes do not indicate actix-web support removal.
Use rsa instead of openssl (#50) No information regarding the use of rsa or openssl.
Use AFIT instead of async-trait (#50) No details provided on async-trait usage.

Poem

🐰 In the meadow where code does play,
A rabbit hops, brightening the day.
Dependencies updated, workflows refined,
In the land of Rust, new features aligned.
With each little change, we leap and cheer,
For a brighter tomorrow, the future is near! 🌼✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 29e9c12 and 9ab3a6d.

Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
Files selected for processing (1)
  • flake.nix (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • flake.nix

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

@kwaa kwaa added the help wanted Extra attention is needed label Jul 26, 2024
@kwaa kwaa changed the title refactor!: use activitypub-federation fork refactor!: upgrade to axum 0.7 Sep 12, 2024
@kwaa kwaa marked this pull request as ready for review September 12, 2024 06:47
@kwaa kwaa removed the help wanted Extra attention is needed label Sep 12, 2024
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: 0

Outside diff range and nitpick comments (2)
crates/openapi/src/lib.rs (1)

9-13: The updated routing logic looks good! Consider removing the commented-out code.

The changes to the routes function improve the clarity of the routing setup by explicitly defining the route for the OpenAPI JSON documentation. The use of get and Json from axum is appropriate for this purpose.

Since the Swagger UI integration is commented out, it seems like it's not planned for implementation in the near future. Consider removing the commented-out code to keep the codebase clean and maintain focus on the active features. If the Swagger UI integration is still desired, consider creating a separate issue or task to track its implementation.

Justfile (1)

61-63: LGTM! Consider adding a comment to document the command.

The new up command is a helpful addition to update dependencies using cargo update. The implementation looks good.

To improve the maintainability of the Justfile, consider adding a comment above the command to document its purpose. For example:

+# update dependencies
 up:
   cargo update
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b325aaa and 29e9c12.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (11)
  • .github/workflows/check.yml (1 hunks)
  • .github/workflows/gh-pages.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • Cargo.toml (3 hunks)
  • Justfile (1 hunks)
  • crates/api_admin/src/routes/mod.rs (2 hunks)
  • crates/backend/src/lib.rs (2 hunks)
  • crates/openapi/Cargo.toml (1 hunks)
  • crates/openapi/src/lib.rs (1 hunks)
  • crates/tracing/Cargo.toml (1 hunks)
  • flake.nix (1 hunks)
Additional comments not posted (17)
crates/openapi/src/lib.rs (1)

1-2: LGTM!

The updated import statement correctly includes the necessary functionality from axum to support the changes in the routes function. The imports are properly specified and there are no unused imports.

crates/tracing/Cargo.toml (1)

33-33: LGTM!

Updating the optional console-subscriber dependency to version 0.4 is a reasonable change that may introduce improvements or bug fixes. Since the dependency is not enabled by default, it is unlikely to break existing functionality.

crates/openapi/Cargo.toml (1)

29-29: LGTM! The change to use a workspace dependency for utoipa-swagger-ui is a good approach.

Using a workspace dependency for utoipa-swagger-ui offers several benefits:

  1. Consistency: It ensures that all workspace members use the same version of the dependency, reducing the risk of version conflicts and incompatibilities.

  2. Simplified management: By declaring the dependency once at the workspace level, it becomes easier to manage and update across multiple crates within the workspace.

  3. Faster builds: Cargo can optimize builds by sharing the same dependency across multiple crates, reducing redundant compilations.

This change aligns well with the broader goal of streamlining dependency management and promoting better integration within the workspace.

.github/workflows/gh-pages.yml (1)

26-28: LGTM!

The upgrade to actions/checkout@v4 and the addition of fetch-depth: 0 are great improvements that align with the best practices for GitHub Actions workflows. These changes ensure that the workflow has access to the latest features and the complete commit history, enhancing its functionality and reliability.

.github/workflows/check.yml (1)

25-26: LGTM!

The addition of fetch-depth: 0 to the actions/checkout@v4 step is a necessary change to ensure that the entire commit history is fetched. This is important for subsequent steps like nix flake check that require the full context of the repository.

The AI-generated summary accurately captures the purpose and impact of this change.

crates/api_admin/src/routes/mod.rs (1)

Line range hint 25-39: LGTM!

The changes to the auth middleware function are necessary to ensure compatibility with Axum 0.7. The updates to the Request and Next types align with the new Axum API and should not affect the functionality of the middleware.

The change from Request<B> to Request<Body> provides a more specific type for the request body, while the simplification of Next<B> to Next suggests that the middleware system in Axum 0.7 now handles the request body internally.

Overall, the modifications are appropriate and maintain the existing logic of the auth middleware.

crates/backend/src/lib.rs (2)

41-46: LGTM!

The change simplifies the server setup by directly creating a TCP listener with the specified host and port from the environment configuration. This aligns with the PR objective of upgrading to Axum 0.7 and hyper/http 1.0.


47-48: LGTM!

Starting the server using axum::serve with the TCP listener is a more streamlined method compared to the earlier commented-out approach. The change enhances the clarity and efficiency of the server initialization process.

.github/workflows/release.yml (1)

41-42: LGTM!

The addition of fetch-depth: 0 to the actions/checkout@v4 step ensures that the entire repository history is fetched during the checkout process. This can be beneficial for workflows that require access to the full commit history, such as generating changelogs or performing operations that depend on previous commits.

The change is straightforward and does not introduce any issues or errors in the workflow configuration.

Cargo.toml (7)

86-88: Verify the need for updating to an alpha release.

The activitypub_federation dependency has been updated to version 0.6.0-alpha, which is an alpha release. While this update may introduce new features or improvements, alpha releases are not considered stable and may contain bugs or breaking changes.

Please ensure that you have thoroughly tested the application with this new version to identify any potential issues or breaking changes. If the new features are not critical, consider waiting for a more stable release.


90-93: Test the application with the updated release candidate.

The apalis dependency has been updated to version 0.6.0-rc, which is a release candidate. While release candidates are generally more stable than alpha releases, it's still important to thoroughly test the application to ensure compatibility and identify any potential issues.

Please make sure you have tested the application with this new version and confirmed that everything works as expected.


94-94: Ensure compatibility with the updated release candidate.

The apalis-cron dependency has been updated to version 0.6.0-rc, which is consistent with the apalis dependency update. As mentioned earlier, please make sure you have thoroughly tested the application to ensure compatibility and identify any potential issues with this new release candidate version.


97-97: Review the changelog, update the code, and test thoroughly.

The axum dependency has been updated from version 0.6 to 0.7, which is a significant minor version bump. This update may introduce new features, improvements, and possibly breaking changes.

Please make sure you have:

  1. Reviewed the changelog and migration guide to understand the changes introduced in this new version.
  2. Updated the code to handle any breaking changes and to leverage new features, if applicable.
  3. Thoroughly tested the application to ensure compatibility and identify any potential issues.

106-109: Review the changelog, update the code, and test thoroughly.

The reqwest dependency has been updated from version 0.11 to 0.12, which is a minor version bump. This update may introduce new features, improvements, and possibly breaking changes.

Please ensure that you have:

  1. Reviewed the changelog and migration guide to understand the changes introduced in this new version.
  2. Updated the code to handle any breaking changes and to leverage new features, if applicable.
  3. Thoroughly tested the application to ensure compatibility and identify any potential issues.

110-110: Review the changelog, update the code, and test thoroughly.

The scraper dependency has been updated from version 0.19 to 0.20, which is a minor version bump. This update may introduce new features, improvements, and possibly breaking changes.

Please ensure that you have:

  1. Reviewed the changelog and migration guide to understand the changes introduced in this new version.
  2. Updated the code to handle any breaking changes and to leverage new features, if applicable.
  3. Thoroughly tested the application to ensure compatibility and identify any potential issues.

123-123: Review the changelog, update the code, and test thoroughly.

The tower-http dependency has been updated from version 0.4 to 0.5, which is a minor version bump. This update may introduce new features, improvements, and possibly breaking changes.

Please ensure that you have:

  1. Reviewed the changelog and migration guide to understand the changes introduced in this new version.
  2. Updated the code to handle any breaking changes and to leverage new features, if applicable.
  3. Thoroughly tested the application to ensure compatibility and identify any potential issues.
flake.nix (1)

38-40: LGTM!

The modification to the filter function enhances the source filtering logic by including paths related to the activitypub-federation documentation. This change is consistent with the project's objectives and does not introduce any issues.

@kwaa kwaa merged commit b0527b2 into main Sep 12, 2024
1 check passed
@kwaa kwaa deleted the refactor/submodule branch September 12, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fork activitypub-federation-rust
1 participant