Skip to content

ritsu v0.55.2

Latest

Choose a tag to compare

@github-actions github-actions released this 13 Nov 22:12

ritsu 0.55.2

This release puts right two things 0.55.1 left. A rulec name with no alias that has a character some target takes in no name, such as area_m², rate% or कीमत, passed check with nothing said, and the generated code of Python, TypeScript, JavaScript, Rust and Go did not compile. rulec now writes each such character as _, the same in every language, and says so with W121. And every language's lexer now reads whether a character of a name is a letter from ritsu's Unicode 17.0 tables, as 0.55.1's checks of the targets' names do, so the names a source can have no longer depend on the Rust that built ritsu.

Fixed (rulec)

  • A name with no alias that has a character some target takes in no name is written with _ for that character, in the generated code of every language, and check says so (W121). A rulec name that begins with a letter goes on with any character up to a delimiter, and a value's name with no alias is written into the generated code as it is. check said nothing of a name such as area_m², 面積㎡, rate% or कीमत, whose vowel sign Go takes in no name, and the generated code of a language that takes no such character did not compile, whichever Rust built ritsu. Each such character is now written as _ (area_m_, क_मत), and the same in every language, as one name is one identifier in all of them; where that is the identifier of another name of the rule, a number goes after it (差_2). This holds for the names of values (derives, defines, a table's output columns and the like), groups and shapes. The names a value travels under, the keys of the input JSON and the records, and the names the messages give stay the ones declared. An input's, an output's, a sequence's or a field's name was already E011's, which asks for an ASCII alias.

    rule area_fee v1
    
    inputs
      width : number  range >=0 <=100
      depth : number  range >=0 <=100
    
    outputs
      fee : money[USD]  round down(1USD)
    
    define area_m² : number = width * depth
    
    table fee_by_area
    policy unique
    | area_m² | -> fee |
    | <=50    | 5USD   |
    | >50     | 9USD   |
    

    0.55.1 passed it with nothing said, and the Python it generated did not compile (SyntaxError: invalid character '²' (U+00B2)), nor did the TypeScript, the JavaScript, the Rust and the Go. This release says:

    $ rulec check area_fee.rule
    warning[W121]: Some target languages take no `²` in a name, so the generated code writes `area_m²` as `area_m_`
      --> area_fee.rule:10
       |
    10 | define area_m² : number = width * depth
       |        ^^^^^^^ the definition's name
       |
     Languages that take no such character in a name include Python, TypeScript, JavaScript, Rust and Go. One name is one identifier, so every language's generated code writes this name as `area_m_`; the name a value travels under (the keys of the input JSON, the records) and the name a message gives stay the one declared.
     To choose the name the generated code uses yourself, give it an alias (`area_m²(<alias>)`).
    
    ok area_fee.rule
    

    and the generated code writes area_m_ = width * depth.

Fixed (rulec, chobo, dandori, kaname, koyomi, sekisho, yuen, sakai)

  • The names a source can have no longer depend on the Rust that built ritsu. The lexers read whether a character of a name is a letter or a number from ritsu's Unicode 17.0 tables, as 0.55.1's checks of the targets' names do, and no longer from char. Built with Rust 1.100, whose char reads Unicode 18.0, ritsu read a name that begins with a letter Unicode 18.0 added, such as U+0558, as a name, and chobo passed it in check only to stop it at gen with E063. Whatever Rust builds ritsu, such a character now begins no name (rulec's E002, and E001 in chobo, kaname and koyomi). The binaries published up to 0.55.1 were built with Rust 1.99.1 and 1.98.0, whose char reads Unicode 17.0, and read names as every build of this release does.

Changed

  • dandori's agents and connect test tools take opentelemetry-api 1.45.2, for the advisory of opentelemetry-api 1.45.1 (GHSA-mf5v-w3w3-f6cg).

Changes that can make a run that used to pass fail

  • rulec check warns with W121 of a value's, a group's or a shape's name with no alias that has a character Python, TypeScript, JavaScript, Rust or Go takes in no name, and every language's generated code writes the name with _. Ruby, PHP and Swift take some such names as they are, area_m² among them, and their generated code changes as well: generate it again, or rulec gen --check reports the committed code out of date. rulec api and the <rule>_from functions give a shape's parameter under the new identifier (注文² becomes 注文_), and PHP that passes it as a named argument needs the new name. The keys of the input JSON and the records do not change.
  • Built with Rust 1.100 or later, ritsu stops a name that begins with a letter Unicode 18.0 added. It used to read it as a name. Built with Rust 1.99 or earlier, as the binaries published up to 0.55.1 were, ritsu did not read such a character as a letter either, and nothing changes.

ritsu 0.55.2(日本語)

0.55.1 で残した二つを直しました。rulec の別名の無い名前に、出力先のどれかが名前に取らない字があると(area_m²、rate%、कीमत など)、check は何も言わずに通し、Python、TypeScript、JavaScript、Rust、Go の生成コードが組めませんでした。いまは、その字をどの言語でも _ にして書き、W121 でそう言います。また、どの言語も、ソースの名前を読むときに字が文字かどうかを、0.55.1 で出力先の名前を見るのに使った Unicode 17.0 の表で見るようにしました。書ける名前が、ritsu を組んだ Rust の版で変わりません。

直したこと(rulec)

  • 別名の無い名前に、出力先のどれかが名前に取らない字があれば、どの言語の生成コードでもその字を _ にして書き、check がそう言うようにしました(W121)。 rulec の名前は、文字で始まれば、区切りの字までどの字も続けられます。別名の無い値の名前は、生成コードにそのまま書かれます。area_m²、面積㎡、rate%、Go が母音記号を名前に取らない कीमत のような名前でも、check は何も言わず、その字を取らない言語では生成コードが組めませんでした。ritsu を組んだ Rust の版によらず起きていました。いまは、そういう字を _ にして書きます(area_m_、क_मत)。一つの名前はどの言語でも一つの識別子なので、どの言語でも同じに書きます。それがこの規則のほかの名前の識別子なら、後ろに番号を付けます(差_2)。値の名前(導出、define、表の出力の列など)と、グループと shape の名前が対象です。受け渡しする値の名前(入力の JSON のキーや記録)と、メッセージに書く名前は、宣言した名前のままです。入力、出力、並び、フィールドの名前は、前から E011 が ASCII の別名を求めています。

    rule area_fee v1
    
    inputs
      width : number  range >=0 <=100
      depth : number  range >=0 <=100
    
    outputs
      fee : money[USD]  round down(1USD)
    
    define area_m² : number = width * depth
    
    table fee_by_area
    policy unique
    | area_m² | -> fee |
    | <=50    | 5USD   |
    | >50     | 9USD   |
    

    0.55.1 はこの規則を何も言わずに通し、生成した Python は組めませんでした(SyntaxError: invalid character '²' (U+00B2))。TypeScript、JavaScript、Rust、Go も同じです。この版では次のように言います。

    $ RULEC_LANG=ja rulec check area_fee.rule
    警告[W121]: `area_m²` の `²` を名前に取らない言語があるので、生成コードでは `area_m_` と書きます
      --> area_fee.rule:10
       |
    10 | define area_m² : number = width * depth
       |        ^^^^^^^ 定義の名前
       |
     その字を名前に取らない言語には、Python・TypeScript・JavaScript・Rust・Go があります。一つの名前を一つの識別子で書くので、生成コードは、どの言語でもこの名前を `area_m_` と書きます。受け渡しする値の名前(入力の JSON のキーや記録)と、メッセージに書く名前は、宣言した名前のままです。
     生成コードでの名前を自分で決めるなら、別名を付けてください(`area_m²(<別名>)`)。
    
    ok area_fee.rule
    

    生成コードは area_m_ = width * depth と書きます。

直したこと(rulec、chobo、dandori、kaname、koyomi、sekisho、yuen、sakai)

  • 書ける名前が、ritsu を組んだ Rust の版で変わらないようにしました。 各言語はソースの名前を読むとき、字が文字か数かを、char でなく、0.55.1 で出力先の名前を見るのに使った ritsu の Unicode 17.0 の表で見ます。Rust 1.100 の char は Unicode 18.0 を読みます。そのため Rust 1.100 で組んだ ritsu は、Unicode 18.0 で加わった文字(U+0558 など)で始まる名前を名前と読み、chobo は check で通して gen の E063 で止めていました。いまはどの Rust で組んでも、その字で名前は始まりません(rulec は E002、chobo・kaname・koyomi は E001)。0.55.1 までの公開のバイナリは、char が Unicode 17.0 の Rust 1.99.1 と 1.98.0 で組んであり、名前の読み方はこの版と同じです。

変えたこと

  • dandori の試験の道具(agents と connect)が opentelemetry-api 1.45.2 を使うようになりました(opentelemetry-api 1.45.1 のアドバイザリ GHSA-mf5v-w3w3-f6cg のため)。

前は通っていた実行が落ちうる変更

  • 別名の無い値、グループ、shape の名前に、Python、TypeScript、JavaScript、Rust、Go のどれかが名前に取らない字があると、rulec check が W121 を出し、どの言語の生成コードもその名前を _ にして書きます。 Ruby、PHP、Swift は、area_m² のように、そういう名前の一部をそのまま書けていました。その生成コードも変わるので、生成し直してください。そうしないと、rulec gen --check が、コミットしてあるコードを古いと言います。rulec api と <規則>_from の関数は、shape の引数を新しい識別子で言います(注文² は 注文_ になります)。PHP で名前付き引数として渡しているなら、新しい名前にしてください。入力の JSON のキーと記録は変わりません。
  • Rust 1.100 以降で組んだ ritsu は、Unicode 18.0 で加わった文字で始まる名前を止めます。 前は名前と読んでいました。0.55.1 までの公開のバイナリのように Rust 1.99 までで組んだ ritsu は、もともとその字を文字と読まず、変わることはありません。