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

support edn any-ref; change ABI version to 0.0.8 #243

Merged
merged 10 commits into from
May 20, 2024
Merged

support edn any-ref; change ABI version to 0.0.8 #243

merged 10 commits into from
May 20, 2024

Conversation

tiye
Copy link
Member

@tiye tiye commented May 15, 2024

@tiye tiye requested a review from a team May 15, 2024 18:32
Copy link
Contributor

coderabbitai bot commented May 15, 2024

Walkthrough

The project has undergone version upgrades and optimizations across Rust and JavaScript components. Key changes include version increments in Cargo.toml and package.json, introduction of a new testing script, and enhancements in dynamic library handling, string manipulation, and dependency updates.

Changes

File Change Summary
Cargo.toml, package.json Updated project version to 0.8.52, cirru_edn to 0.6.8, added check-all script.
src/bin/injection/mod.rs Updated ABI_VERSION to 0.0.9, added lazy dylib caching, refactored related functions.
src/util/string.rs Optimized matches_float with s.clone_into(&mut buffer).
src/builtins/records.rs, Replaced to_owned() with clone_into(&mut) for record operations.
src/calcit/record.rs Modified EdnTag creation using s.to_owned() for specific cases.
src/call_stack.rs Adjusted display_stack function to remove unnecessary reference operator.

In code we trust, with updates so grand,
Versions rise, dependencies stand.
Rust and JavaScript, hand in hand,
With lazy caching, our app is planned.
Strings now clone, in memory's land,
A rabbit's touch, improvements expand.
🌟🐇✨


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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between fd8b5be and 39eba61.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (8)
  • Cargo.toml (2 hunks)
  • package.json (1 hunks)
  • src/bin/injection/mod.rs (1 hunks)
  • src/builtins/meta.rs (1 hunks)
  • src/calcit.rs (5 hunks)
  • src/data.rs (1 hunks)
  • src/data/edn.rs (2 hunks)
  • src/runner.rs (1 hunks)
Files skipped from review due to trivial changes (3)
  • Cargo.toml
  • package.json
  • src/bin/injection/mod.rs
Additional comments not posted (8)
src/data/edn.rs (2)

101-101: Ensure the conversion logic for Calcit::AnyRef(..) is correct.

The conversion logic for Calcit::AnyRef(..) to Edn::AnyRef seems straightforward. Verify that Edn::AnyRef correctly handles the data encapsulated by Calcit::AnyRef.


185-185: Ensure the conversion logic for Edn::AnyRef(..) is correct.

The conversion logic for Edn::AnyRef(..) to Calcit::AnyRef seems straightforward. Verify that Calcit::AnyRef correctly handles the data encapsulated by Edn::AnyRef.

src/runner.rs (1)

34-35: LGTM! Ensure all function calls handle Calcit::AnyRef(..) correctly.

The new match arm for Calcit::AnyRef(..) in evaluate_expr returns the expression as is, which seems appropriate. Ensure that all function calls handle Calcit::AnyRef(..) correctly.

src/builtins/meta.rs (1)

62-62: Add a match arm for Calcit::AnyRef(..).

The addition of the Calcit::AnyRef(..) match arm in the type_of function is correct and consistent with the existing pattern. This ensures that the new AnyRef variant is properly handled.

src/calcit.rs (4)

100-101: The addition of the AnyRef variant to the Calcit enum looks good. Ensure that all necessary implementations and match arms are updated to handle this new variant.


277-277: The fmt::Display implementation for AnyRef is correctly added. Ensure that the format string is appropriate for the intended output.


445-447: The Hash implementation for AnyRef uses the unreachable! macro, which is appropriate if AnyRef should not be hashed. Ensure that this case is indeed unreachable in practice.


592-592: The Ord implementation for AnyRef uses the unreachable! macro, which is appropriate if AnyRef should not be compared. Ensure that this case is indeed unreachable in practice.

src/data.rs Outdated Show resolved Hide resolved
src/calcit.rs Show resolved Hide resolved
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 39eba61 and 08b97f1.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (3)
  • Cargo.toml (2 hunks)
  • package.json (1 hunks)
  • src/calcit.rs (5 hunks)
Files skipped from review as they are similar to previous changes (3)
  • Cargo.toml
  • package.json
  • src/calcit.rs

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: 9

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 08b97f1 and e583bb5.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (14)
  • Cargo.toml (2 hunks)
  • package.json (1 hunks)
  • src/bin/cr.rs (1 hunks)
  • src/builtins.rs (1 hunks)
  • src/builtins/lists.rs (8 hunks)
  • src/builtins/maps.rs (1 hunks)
  • src/builtins/meta.rs (2 hunks)
  • src/builtins/records.rs (5 hunks)
  • src/builtins/refs.rs (1 hunks)
  • src/builtins/syntax.rs (1 hunks)
  • src/codegen/emit_js.rs (1 hunks)
  • src/data.rs (1 hunks)
  • src/runner.rs (2 hunks)
  • src/util/string.rs (1 hunks)
Files not reviewed due to errors (1)
  • src/builtins/records.rs (no review received)
Files skipped from review as they are similar to previous changes (5)
  • Cargo.toml
  • package.json
  • src/builtins/meta.rs
  • src/data.rs
  • src/runner.rs
Additional comments not posted (6)
src/builtins/refs.rs (1)

29-29: LGTM! The use of clone_into is appropriate here.

src/builtins/maps.rs (2)

82-82: LGTM! The use of clone_into is appropriate here.


86-86: LGTM! The use of clone_into is appropriate here.

src/bin/cr.rs (1)

107-107: LGTM! This change ensures that the snapshot configuration is updated with the entry configuration.

src/builtins.rs (1)

49-51: LGTM! This change ensures that stack information is attached to errors from procs.

src/codegen/emit_js.rs (1)

852-853: Ensure the cloned elements are necessary.

The cloning of elements into mutable variables seems correct, but please verify if this is necessary for the intended logic.

src/builtins/syntax.rs Show resolved Hide resolved
src/util/string.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
src/builtins/lists.rs Show resolved Hide resolved
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e583bb5 and e0c3bba.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (2)
  • Cargo.toml (4 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • package.json

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e0c3bba and 2bbfb5b.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (2)
  • Cargo.toml (4 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • package.json

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2bbfb5b and 0588861.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (2)
  • Cargo.toml (4 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • package.json

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0588861 and 55f7cfa.
Files selected for processing (1)
  • src/bin/injection/mod.rs (3 hunks)
Additional comments not posted (5)
src/bin/injection/mod.rs (5)

22-25: Introduce caching for dynamic libraries using lazy_static.

This change introduces a lazy initialization pattern for caching dynamic libraries, which is a good practice to avoid repeated loading and unloading of libraries, potentially improving performance and stability.


27-36: Implement load_dylib function to manage dynamic library loading and caching.

This function effectively manages the loading of dynamic libraries and caches them to avoid redundant loads. This is crucial for performance in environments where frequent library calls are made.


38-38: Update ABI_VERSION to "0.0.8".

This change aligns with the PR's objective to update the ABI version, ensuring compatibility with the latest changes.


73-81: Refactor call_dylib_edn to use the new load_dylib function.

This refactoring ensures that the function leverages the new caching mechanism introduced for dynamic libraries, which should improve performance and maintainability.


141-147: Refactor call_dylib_edn_fn to use the new load_dylib function and handle ABI version checks.

The refactoring here is consistent with the changes made in call_dylib_edn, applying the same improvements and ensuring that the ABI version is checked before proceeding with function calls.

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 55f7cfa and 36ea6db.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (2)
  • Cargo.toml (4 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • package.json

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 36ea6db and b77e35a.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (2)
  • Cargo.toml (4 hunks)
  • package.json (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • package.json

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between b77e35a and c02708b.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (4)
  • Cargo.toml (4 hunks)
  • package.json (2 hunks)
  • src/bin/injection/mod.rs (3 hunks)
  • src/util/string.rs (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • Cargo.toml
  • package.json
  • src/util/string.rs
Additional comments not posted (5)
src/bin/injection/mod.rs (5)

22-25: Introduce caching for dynamic libraries using lazy_static.

This change introduces a global cache for dynamic libraries, which can help in reducing the overhead of loading libraries multiple times. Good use of lazy_static for thread-safe, lazy initialization.


27-36: Refactor load_dylib to utilize caching mechanism.

The refactoring of load_dylib to use the newly introduced cache is a good practice. It avoids reloading the libraries multiple times which can be resource-intensive. The use of unwrap is generally risky but acceptable here assuming the lock will not be poisoned.


38-38: Update ABI_VERSION to "0.0.9".

Updating the ABI version is crucial for maintaining compatibility with the changes in the dynamic libraries. Ensure that all dependent systems are aware of this version change.


73-81: Ensure ABI version compatibility before invoking library functions.

This is a crucial check to ensure that the ABI version of the loaded library matches the expected version. This prevents potential runtime errors due to ABI incompatibilities. Good use of error handling to provide clear feedback if versions do not match.


141-147: Duplicate ABI version check logic in call_dylib_edn_fn.

The ABI version check logic is repeated in call_dylib_edn_fn. Consider abstracting this logic into a separate function to avoid code duplication and improve maintainability.

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: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between c02708b and 43c155a.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (4)
  • Cargo.toml (4 hunks)
  • src/builtins/records.rs (11 hunks)
  • src/calcit/record.rs (1 hunks)
  • src/call_stack.rs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • src/builtins/records.rs
Additional comments not posted (1)
src/call_stack.rs (1)

128-128: Enhanced error logging in display_stack by including stack kind.

This change should help in better understanding the context of errors during debugging.

@@ -100,7 +100,7 @@ impl CalcitRecord {
}

let new_name_id: EdnTag = match new_tag {
Calcit::Str(s) | Calcit::Symbol { sym: s, .. } => EdnTag::new(s),
Calcit::Str(s) | Calcit::Symbol { sym: s, .. } => EdnTag(s.to_owned()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure comprehensive error handling for new Calcit types in extend_field.

Consider adding specific error messages or handling for other Calcit types that might not be covered by the current implementation.

@NoEgAm NoEgAm merged commit e63a636 into main May 20, 2024
1 check passed
@NoEgAm NoEgAm deleted the any-ref branch May 20, 2024 06: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.

None yet

2 participants