Skip to content

Conversation

sven-oly
Copy link
Collaborator

@sven-oly sven-oly commented Sep 5, 2025

Are these still valid?

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 against icu4x version 2.0.0. This includes new Cargo.toml, Cargo.lock, build.rs, and main.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 new rust2.0 entry, enabling the automated execution of various icu4x conformance tests (collation, datetime formatting, number formatting, etc.) against the newly integrated icu4x 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

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

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +158 to 198
// 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",
}));
}
}
}
};

Choose a reason for hiding this comment

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

high

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

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.

2 participants