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

chore(engine): update Rust version to 1.83 and adjust Dockerfiles #667

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

miseyu
Copy link
Contributor

@miseyu miseyu commented Dec 3, 2024

Overview

What I've done

What I haven't done

How I tested

Screenshot

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • New Features

    • Enhanced geometric distance calculation capabilities across various geometric types.
    • Introduced EuclideanLength trait for calculating lengths of geometric entities.
  • Improvements

    • Updated Rust version and dependencies for optimized performance and security.
    • Simplified lifetime management in various implementations, improving code clarity and usability.
  • Bug Fixes

    • Improved error handling in the from_graph method for better traceability during execution.
  • Documentation

    • Updated comments and documentation for clarity in configuration and implementation changes.

@miseyu miseyu self-assigned this Dec 3, 2024
Copy link
Contributor

coderabbitai bot commented Dec 3, 2024

Walkthrough

This pull request primarily updates the Cargo.toml file to increment the Rust version from 1.82 to 1.83 and updates several dependencies to their latest versions. Additionally, it modifies the Makefile.toml to enhance Clippy's linting process by treating warnings as errors. Changes also include updates to Dockerfiles to use the newer Rust base image, adjustments in various Rust source files to simplify lifetime annotations, and the introduction of new traits for calculating Euclidean distances and lengths of geometric entities.

Changes

File Change Summary
engine/Cargo.toml Updated Rust version to 1.83 and incremented versions of multiple dependencies.
engine/Makefile.toml Added -- -D warnings flag to cargo clippy command to treat warnings as errors.
engine/clippy.toml Updated minimum supported Rust version from 1.82 to 1.83.
engine/containers/cli/Dockerfile Changed base image from rust:1.82-slim-bookworm to rust:1.83-slim-bookworm.
engine/containers/worker/Dockerfile Changed base image from rust:1.82-slim-bookworm to rust:1.83-slim-bookworm.
engine/runtime/geometry/src/algorithm/coordinate_position.rs Simplified lifetime management in CoordinatePosition trait implementation for GeometryCow.
engine/runtime/geometry/src/algorithm/coords_iter.rs Simplified lifetime management in CoordsIter trait implementations.
engine/runtime/geometry/src/algorithm/euclidean_distance.rs Introduced EuclideanDistance trait for various geometric types with distance calculation methods.
engine/runtime/geometry/src/algorithm/euclidean_length.rs Introduced EuclideanLength trait for calculating lengths of geometric entities.
engine/runtime/geometry/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs Simplified lifetime management in RTreeObject implementation for Segment.
engine/runtime/geometry/src/algorithm/sweep/cross.rs Removed lifetime parameter from Cross trait implementation for references.
engine/runtime/geometry/src/algorithm/winding_order.rs Simplified lifetime management in Points struct iterator implementations.
engine/runtime/geometry/src/types/line_string.rs Simplified lifetime management in iterator implementations for PointsIter and CoordinatesIter.
engine/runtime/geometry/src/types/multi_polygon.rs Simplified lifetime management in Iterator implementation for Iter.
engine/runtime/geometry/src/types/polygon.rs Simplified lifetime management in From trait implementations and Iterator implementation for Iter.
engine/runtime/runtime/src/dag_schemas.rs Updated edges_from_endpoint method to include lifetime annotation for clarity and improved error handling in from_graph.
engine/runtime/telemetry/src/lib.rs Streamlined configuration of OpenTelemetry TracerProvider by removing with_config method calls.

Possibly related PRs

Suggested labels

engine, cicd

🐇 Hopping through the code, oh what a sight,
Dependencies updated, everything feels right!
Rust version's higher, Clippy's now strict,
With geometric measures, our logic is slick.
From polygons to points, we calculate with ease,
In the world of Rust, we dance like the breeze! 🌟


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 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.

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.

@github-actions github-actions bot added the engine label Dec 3, 2024
Copy link

netlify bot commented Dec 3, 2024

Deploy Preview for reearth-flow canceled.

Name Link
🔨 Latest commit 534da61
🔍 Latest deploy log https://app.netlify.com/sites/reearth-flow/deploys/674e5c478e11db00084673f3

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 and nitpick comments (1)
engine/runtime/geometry/src/types/line_string.rs (1)

Line range hint 1-1: Excellent systematic modernization of lifetime handling.

The changes across all files demonstrate a well-executed systematic modernization of lifetime parameters, leveraging Rust 1.83's improved lifetime elision rules. This improves code maintainability while preserving all functionality.

Key benefits:

  • Reduced verbosity
  • Improved readability
  • Consistent modern style
  • No semantic changes
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8fa1606 and 534da61.

⛔ Files ignored due to path filters (1)
  • engine/Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (17)
  • engine/Cargo.toml (6 hunks)
  • engine/Makefile.toml (1 hunks)
  • engine/clippy.toml (1 hunks)
  • engine/containers/cli/Dockerfile (1 hunks)
  • engine/containers/worker/Dockerfile (1 hunks)
  • engine/runtime/geometry/src/algorithm/coordinate_position.rs (1 hunks)
  • engine/runtime/geometry/src/algorithm/coords_iter.rs (4 hunks)
  • engine/runtime/geometry/src/algorithm/euclidean_distance.rs (0 hunks)
  • engine/runtime/geometry/src/algorithm/euclidean_length.rs (0 hunks)
  • engine/runtime/geometry/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs (1 hunks)
  • engine/runtime/geometry/src/algorithm/sweep/cross.rs (1 hunks)
  • engine/runtime/geometry/src/algorithm/winding_order.rs (2 hunks)
  • engine/runtime/geometry/src/types/line_string.rs (5 hunks)
  • engine/runtime/geometry/src/types/multi_polygon.rs (1 hunks)
  • engine/runtime/geometry/src/types/polygon.rs (4 hunks)
  • engine/runtime/runtime/src/dag_schemas.rs (1 hunks)
  • engine/runtime/telemetry/src/lib.rs (3 hunks)
💤 Files with no reviewable changes (2)
  • engine/runtime/geometry/src/algorithm/euclidean_length.rs
  • engine/runtime/geometry/src/algorithm/euclidean_distance.rs
✅ Files skipped from review due to trivial changes (2)
  • engine/clippy.toml
  • engine/Cargo.toml
🔇 Additional comments (19)
engine/runtime/geometry/src/algorithm/winding_order.rs (2)

Line range hint 21-38: LGTM! Good simplification of lifetime annotations.

The change to use an elided lifetime ('_) instead of an explicit lifetime parameter simplifies the code while maintaining the same semantics. This aligns well with modern Rust practices.


Line range hint 39-47: LGTM! Consistent lifetime simplification.

The ExactSizeIterator implementation follows the same lifetime simplification pattern as the Iterator implementation, maintaining consistency throughout the code.

engine/runtime/geometry/src/algorithm/sweep/cross.rs (1)

Line range hint 15-21: LGTM! Good simplification of lifetime annotations.

The removal of explicit lifetime parameter 'a from the reference implementation is a good improvement. This change leverages Rust's lifetime elision rules while maintaining the same safety guarantees, making the code more concise and easier to maintain.

engine/containers/worker/Dockerfile (1)

2-2: Verify Rust 1.83 compatibility across the project.

The base image update to rust:1.83-slim-bookworm looks good. To ensure smooth deployment:

  1. Confirm all dependencies support Rust 1.83
  2. Verify successful builds in CI pipeline
  3. Check for any performance impact
✅ Verification successful

The initial scan revealed that the workspace is configured to use Rust 1.83 in the main engine/Cargo.toml, but the websocket component specifies 1.81. Let's gather more information about dependencies and toolchain specifications to ensure complete compatibility.


Rust 1.83 update is compatible with the project

The workspace explicitly specifies Rust 1.83 as the minimum supported version in engine/Cargo.toml, and all other crates inherit this version through workspace inheritance. The dependencies in Cargo.lock show no version conflicts that would prevent using Rust 1.83.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Rust version compatibility

# Check if Cargo.toml specifies any version constraints
rg "rust-version|MSRV" -A 2

# Look for any conditional compilation based on Rust version
rg "#\[cfg\(.*rust_version.*\)\]" -A 2

Length of output: 4460


Script:

#!/bin/bash
# Check for any version-specific dependencies in Cargo.toml files
rg "version\s*=\s*\"" engine/Cargo.lock -A 1

# Check for any rust toolchain specifications
fd "rust-toolchain" --type f --exec cat {}

Length of output: 73551

engine/containers/cli/Dockerfile (1)

2-2: LGTM! Good version consistency across services.

The base image update to rust:1.83-slim-bookworm maintains consistency with the worker Dockerfile, which is excellent practice for ensuring reliable builds and reducing version-related issues across services.

engine/Makefile.toml (1)

23-23: Note: Clippy warnings will now block builds

The addition of -- -D warnings flag makes clippy treat all warnings as errors. This enforces stricter code quality standards but may require addressing existing warnings across the codebase.

Let's check for any existing clippy warnings that might now block builds:

Consider adding this change gradually:

  1. First, fix existing warnings
  2. Then enable -D warnings flag
engine/runtime/geometry/src/algorithm/relate/geomgraph/index/rstar_edge_set_intersector.rs (1)

44-44: LGTM: Good lifetime parameter simplification

The change from explicit lifetime 'a to anonymous lifetime '_ simplifies the code while maintaining the same semantics. This aligns well with Rust's lifetime elision rules.

engine/runtime/runtime/src/dag_schemas.rs (1)

387-387: LGTM: Improved lifetime annotation clarity

The explicit lifetime parameter in the return type better expresses the relationship between the returned references and the DagSchemas instance.

engine/runtime/geometry/src/types/polygon.rs (3)

Line range hint 394-411: LGTM: Simplified lifetime annotation

The change to use anonymous lifetime '_ instead of explicit 'a simplifies the code while maintaining the same semantics. This is in line with modern Rust practices.


Line range hint 412-437: LGTM: Consistent lifetime annotation simplification

The change maintains consistency with other implementations by using the anonymous lifetime '_.


Line range hint 438-456: LGTM: Consistent lifetime annotation pattern

The change follows the established pattern of using anonymous lifetimes, maintaining consistency throughout the codebase.

engine/runtime/geometry/src/algorithm/coords_iter.rs (3)

Line range hint 585-618: LGTM: Simplified iterator implementation

The iterator implementation has been updated to use anonymous lifetimes, consistent with the project-wide changes.


Line range hint 619-657: LGTM: Consistent Debug implementation

The Debug trait implementation has been updated to use anonymous lifetimes, maintaining consistency with other changes.


Line range hint 658-724: LGTM: Consistent implementation patterns

Both Iterator and Debug implementations for GeometryExteriorCoordsIter have been updated to use anonymous lifetimes, maintaining consistency with the codebase-wide changes.

engine/runtime/geometry/src/types/multi_polygon.rs (1)

167-167: LGTM: Good lifetime parameter simplification.

The change to use anonymous lifetime '_ instead of an explicit lifetime parameter aligns with modern Rust practices and improves code readability without changing the semantics.

engine/runtime/geometry/src/algorithm/coordinate_position.rs (1)

50-50: LGTM: Consistent lifetime parameter simplification.

The change to use anonymous lifetime '_ for GeometryCow implementation aligns with the PR's objective to modernize the codebase and matches similar changes in other files.

engine/runtime/geometry/src/types/line_string.rs (3)

Line range hint 113-123: LGTM: Clean lifetime simplification for PointsIter traits.

The changes to ExactSizeIterator and DoubleEndedIterator implementations for PointsIter appropriately use anonymous lifetimes, improving code clarity.


Line range hint 141-151: LGTM: Clean lifetime simplification for CoordinatesIter traits.

The changes to ExactSizeIterator and DoubleEndedIterator implementations for CoordinatesIter follow the same pattern of lifetime simplification.


Line range hint 319-328: LGTM: Consistent lifetime handling in conversion implementations.

The changes to From trait implementations for NLineString2 and NLineString3 conversions maintain consistency with the lifetime simplification pattern across the codebase.

Also applies to: 342-362

engine/runtime/telemetry/src/lib.rs Show resolved Hide resolved
engine/runtime/telemetry/src/lib.rs Show resolved Hide resolved
@miseyu miseyu merged commit 7856962 into main Dec 3, 2024
18 checks passed
@miseyu miseyu deleted the chore/bump-engine-crates branch December 3, 2024 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant