Skip to content

fix(dncl): keep the order of functions after running the Japanese program (#2620) - #2630

Merged
smalruby3-editor-bot[bot] merged 3 commits into
topic/japanese-mode-1731from
topic/autopilot-2620
Nov 29, 2026
Merged

smalruby3-editor-bot[bot] merged 3 commits into
topic/japanese-mode-1731from
topic/autopilot-2620

Conversation

@smalruby3-editor-bot

Copy link
Copy Markdown

Summary

日本語タブで一度実行してからコードタブ → 日本語タブへ戻ると、関数の定義がプログラムの先頭へ移っていた(B30)。

原因: 実行(handleExecuteLine)は Redux の Ruby(コードタブを通ったあとはブロックから作った Ruby。関数の定義を先に出す)をそのままブロックにしていた。そのため実行のあと、ブロックのスクリプトの並びが「関数が先」になっていた。

Changes Made

  • ruby-tab.jsx: 日本語タブで実行するときは、ブロックにする Ruby を rubyInScriptOrder で書いた順に作り直す(ルビータブの実行は変えない)。
  • integration テスト dncl-code-tab-script-order.test.js に「コードタブを通ったあと実行しても関数の並びが変わらない」を足した。
  • docs/dncl/README.md の「ブロックを通ったときの並び」に実行のときのことを足した。

Test Coverage

  • jest の調べ用テストで、Issue のプログラムをブロックにして変数・リストの値を変えても、ブロックから作る Ruby が変わらないこと(rubyInScriptOrder が効くこと)を確かめた。
  • integration テストは CI で流す。

Closes #2620

🤖 Generated with Claude Code

…gram

Running in the Japanese tab turned the Ruby of the blocks into blocks again. That Ruby puts
the function definitions first, so after a run the functions moved to the top of the program.
Run the Ruby in the written order of the scripts instead (rubyInScriptOrder).

Closes #2620

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🤖 autopilot autopilot が処理対象にした Issue/PR(daemon が付与) label Nov 29, 2026
@smalruby3-editor-bot

smalruby3-editor-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Author

🤖 autopilot status

field value
Status Review
AI Status —
HITL No
Size middle

Linked issue #2620. Maintained by autopilot (single writer); do not edit.

@github-actions

Copy link
Copy Markdown

🚀 Preview deployed (stg API): https://preview.smalruby.app/topic-autopilot-2620-8b9e864e/

The issue was not seen with short programs without a list, so the run test
also uses the program with a list. Make the ordered Ruby only after the check
of the Japanese lines with an error.

Refs #2620

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smalruby3-editor-bot

Copy link
Copy Markdown
Author

🤖 敵対的レビュー(round 1): 指摘 3 件(Must 0 / Question 1 / FYI 2)

Question

  • [Q1] packages/scratch-gui/test/integration/dncl-code-tab-script-order.test.js:114 足した実行のテストは FUNCTIONS_BETWEEN_CALLS(関数 2 つ・リスト無し)だけで流していた。Issue には「短いプログラム(関数 1〜2 つ・リスト無し)では実行しても起きなかった」とあり、直しが無くても通ってしまい、退行を捕まえられないおそれがある — 修正済み(3a213e6cda)。リストを使う FUNCTION_AFTER_MAIN でも同じ手順を流す test.each にした

FYI

  • [FYI1] packages/scratch-gui/src/containers/ruby-tab.jsx:1353 rubyInScriptOrder(targetToCode を 2 回呼ぶ)を、日本語の誤りで止める早期 return より前で計算していた — 修正済み(3a213e6cda)。早期 return のあとへ移した(振る舞いは同じ)
  • [FYI2] ほかに Redux の Ruby をブロックにする経路(プレビュー・保存・緑の旗の controls.jsx など)は rubyCode.modified のときだけ変換し、そのときの Ruby は日本語から作った書いた順なので、同じ不具合は無いことを確かめた。手元では、軽量 worktree の node_modules(main checkout)に @smalruby/ja-notation が無く build:dev と eslint の import 解決が落ちるため、直しを外した版で integration テストが落ちることは確かめられなかった(CI の integration-test-gui で確かめる) — 見送り: 情報共有のみ

直してほしい指摘は、モニターの「AI に直してもらう」で指示を書くか、Request changes で ID を指定してから 🙋 HITL を外してください(例: Q1はOK, FYI1は修正して)。ふつうのコメントだけでは autopilot は動きません。

@smalruby3-editor-bot
smalruby3-editor-bot Bot marked this pull request as ready for review November 29, 2026 00:33
@smalruby3-editor-bot
smalruby3-editor-bot Bot merged commit 1f1f00e into topic/japanese-mode-1731 Nov 29, 2026
11 checks passed
@smalruby3-editor-bot
smalruby3-editor-bot Bot deleted the topic/autopilot-2620 branch November 29, 2026 00:50

This branch was previously deployed

1 inactive deployment
stg — 3a213e6c Deployed Nov 29, 2026 by smalruby3-editor-bot[bot] via cleanup #666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 autopilot autopilot が処理対象にした Issue/PR(daemon が付与)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants