Skip to content

fix: add spaces around current element operator in flutter version_expr#8616

Open
roele wants to merge 1 commit intojdx:mainfrom
roele:issues/8613
Open

fix: add spaces around current element operator in flutter version_expr#8616
roele wants to merge 1 commit intojdx:mainfrom
roele:issues/8613

Conversation

@roele
Copy link
Contributor

@roele roele commented Mar 16, 2026

The version_expr for flutter requires spaces around the current element operator otherwise it collides with the tera parser throwing a nasty error.

mise ERROR failed to parse template fromJSON(body).releases | filter({#.channel == "stable"}) | map({#.version}) | sortVersions() in ~/Downloads/mise/mise.toml
mise ERROR Failed to parse '__tera_one_off'
mise ERROR  --> 1:94
  |
1 | fromJSON(body).releases | filter({#.channel == "stable"}) | map({#.version}) | sortVersions()
  |                                                                                              ^---
  |
  = expected a comment end (`#}`)

Copilot AI review requested due to automatic review settings March 16, 2026 18:30
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 addresses a critical parsing error in the Flutter version_expr by introducing necessary spacing around the current element operator. This ensures that the version expression is correctly interpreted by the Tera parser, preventing runtime failures and allowing for accurate retrieval of Flutter versions.

Highlights

  • Fix Flutter version_expr parsing: Added spaces around the current element operator (#.) within the Flutter version_expr to resolve a parsing error caused by the Tera template engine.
  • Updated test case: Modified the corresponding test case in src/backend/version_list.rs to reflect the corrected version_expr format.
Changelog
  • registry/flutter.toml
    • Modified the version_expr to include spaces around the current element operator (#.) to prevent parsing errors.
  • src/backend/version_list.rs
    • Updated the test case for version_expr to match the new spacing requirements for the Flutter version expression.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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
Contributor

@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

The pull request effectively addresses the Tera parser error by adding necessary spaces around the current element operator (#.) in the version_expr for Flutter. The change is consistently applied in both the registry/flutter.toml configuration and the corresponding test case in src/backend/version_list.rs, ensuring the fix is robust and tested. The solution is concise and directly resolves the reported issue without introducing new complexities or regressions.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 16, 2026

Greptile Summary

This PR fixes a tera template parser collision in version_expr configurations for Flutter and Julia. When a version_expr string contains {#, the contains_template_syntax check in mise_toml.rs flags it as a tera template, causing the tera parser to treat {# as the start of a comment block ({# ... #}) and throw a parse error. Adding spaces ({ # }) prevents the exact {# substring from appearing while keeping the expr-lang closure syntax valid.

Key changes:

  • registry/flutter.toml: {#.channel == "stable"}{ #.channel == "stable" } and {#.version}{ #.version }
  • registry/julia.toml: {# matches "..."}{ # matches "..." } (addresses the same bug raised in the previous review)
  • src/backend/version_list.rs: Both test cases updated to use the corrected spaced syntax, keeping tests in sync with the registry definitions

Confidence Score: 5/5

  • This PR is safe to merge — it applies a minimal, targeted fix with no functional regressions.
  • The change is a simple whitespace addition in three places (two registry TOML files and one test file). It directly fixes a documented parse error with no side effects: expr-lang accepts the spaced { # } closure syntax identically, the fix is verified by updated tests, and a grep of the registry directory confirms no other {# occurrences remain.
  • No files require special attention.

Important Files Changed

Filename Overview
registry/flutter.toml Fixed {# tera comment collision in version_expr by adding spaces around the current-element operator ({ # } instead of {#}), preventing the tera parser from treating the expression as a template comment.
registry/julia.toml Same tera comment collision fixed in Julia's version_expr ({ # matches ... } instead of {# matches ...}), consistent with the Flutter fix and addressed from the previous review thread.
src/backend/version_list.rs Test cases for both Flutter and Julia version_expr parsing updated to use the new spaced syntax, keeping tests in sync with the registry changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[mise.toml loads version_expr] --> B{contains_template_syntax check}
    B -->|"Old syntax: brace-hash triggers match"| C[Passed to Tera parser]
    B -->|"New syntax: space prevents match"| D[Skips Tera rendering]
    C --> E["ERROR: expected comment end"]
    D --> F[Passed directly to expr-lang eval]
    F --> G[filter / map closures evaluated]
    G --> H[Versions extracted successfully]
Loading

Last reviewed commit: 7466a76

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.

3 participants