-
-
Notifications
You must be signed in to change notification settings - Fork 13
More icu4x testing #527
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
base: main
Are you sure you want to change the base?
More icu4x testing #527
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @sven-oly, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request integrates icu4x
version 2.0.0 into the existing Rust testing framework. The primary goal is to validate the conformance test suite against this new major version, ensuring that all functionalities behave as expected with the updated library. This involves setting up a new Rust project for the 2.0.0 executor and adapting existing test logic to accommodate any API changes or new features introduced in icu4x
2.0.0.
Highlights
- New Rust Executor for ICU4X 2.0.0: This pull request introduces a dedicated Rust executor (
executors/rust/2.0
) to run conformance tests againsticu4x
version 2.0.0. This includes newCargo.toml
,Cargo.lock
,build.rs
, andmain.rs
files to support the new version. - Version Compatibility Updates: Existing common Rust executor code has been updated to handle API changes and new behaviors in
icu4x
2.0.0. This includes modifications to locale handling,ZonedDateTime
parsing, and segmenter object borrowing, ensuring forward compatibility. - Expanded Test Configuration: The
run_config.json
file has been updated to include a newrust2.0
entry, enabling the automated execution of variousicu4x
conformance tests (collation, datetime formatting, number formatting, etc.) against the newly integratedicu4x
2.0.0 executor.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds a new test executor for ICU4X 2.0, along with compatibility shims to handle API changes between versions. The changes are well-structured, using conditional compilation to manage version-specific code. I've found one potential issue in the handling of the backwards
collation option for ICU4X 2.0+ which might cause tests for fr-CA
to fail incorrectly. My detailed feedback is in the review comment.
// From 2.0, backward second level is available only via the fr-CA locale | ||
// <https://github.com/unicode-org/icu4x/pull/6291> | ||
if let Some(backwards) = backwards_option { | ||
options.backward_second_level = match backwards { | ||
"off" => Some(BackwardSecondLevel::Off), | ||
"on" => Some(BackwardSecondLevel::On), | ||
_ => { | ||
return Ok(json!({ | ||
"label": label, | ||
"error_detail": {"backwards": backwards}, | ||
"unsupported": "backwards", | ||
"error_type": "unsupported", | ||
})); | ||
#[cfg(not(any( | ||
ver = "1.3", | ||
ver = "1.4", | ||
ver = "1.5", | ||
ver = "2.0-beta1", | ||
ver = "2.0-beta2" | ||
)))] | ||
{ | ||
let _backwards = backwards; | ||
return Ok(json!({ | ||
"label": label, | ||
"error_detail": {"backwards": backwards}, | ||
"unsupported": "backwards", | ||
"error_type": "unsupported", | ||
})); | ||
} | ||
#[cfg(any( | ||
ver = "1.3", | ||
ver = "1.4", | ||
ver = "1.5", | ||
ver = "2.0-beta1", | ||
ver = "2.0-beta2" | ||
))] | ||
{ | ||
options.backward_second_level = match backwards { | ||
"off" => Some(BackwardSecondLevel::Off), | ||
"on" => Some(BackwardSecondLevel::On), | ||
_ => { | ||
return Ok(json!({ | ||
"label": label, | ||
"error_detail": {"backwards": backwards}, | ||
"unsupported": "backwards", | ||
"error_type": "unsupported", | ||
})); | ||
} | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation unconditionally marks the backwards
option as unsupported for ICU4X 2.0 and later. However, the comment at line 158 correctly notes that this behavior is available implicitly for the fr-CA
locale. This implementation will cause tests for fr-CA
that specify the backwards
option to fail, even if the behavior is correct.
I suggest refactoring this logic to check for the fr-CA
locale. For fr-CA
, the test should be allowed to proceed to verify the implicit behavior. For other locales, it should be marked as unsupported. This will make the test executor more accurate for ICU4X 2.0+.
// From 2.0, backward second level is available only via the fr-CA locale
// <https://github.com/unicode-org/icu4x/pull/6291>
#[cfg(any(
ver = "1.3",
ver = "1.4",
ver = "1.5",
ver = "2.0-beta1",
ver = "2.0-beta2"
))]
if let Some(backwards) = backwards_option {
options.backward_second_level = match backwards {
"off" => Some(BackwardSecondLevel::Off),
"on" => Some(BackwardSecondLevel::On),
_ => {
return Ok(json!({
"label": label,
"error_detail": {"backwards": backwards},
"unsupported": "backwards",
"error_type": "unsupported",
}));
}
}
}
#[cfg(not(any(
ver = "1.3",
ver = "1.4",
ver = "1.5",
ver = "2.0-beta1",
ver = "2.0-beta2"
)))]
if let Some(backwards) = backwards_option {
if langid.to_string() != "fr-CA" {
return Ok(json!({
"label": label,
"error_detail": {"backwards": backwards},
"unsupported": "backwards option is only supported implicitly for fr-CA in ICU4X 2.0+",
"error_type": "unsupported",
}));
}
// For fr-CA, the behavior is implicit. We can't set the option,
// but we can let the test proceed to check the default behavior.
}
Are these still valid?