Skip to content

fix: restore Smalruby assets and fix scratch-gui unit tests#4

Merged
takaokouji merged 4 commits into
developfrom
fix/scratch-gui-migration-issues
Jan 20, 2026
Merged

fix: restore Smalruby assets and fix scratch-gui unit tests#4
takaokouji merged 4 commits into
developfrom
fix/scratch-gui-migration-issues

Conversation

@takaokouji
Copy link
Copy Markdown

@takaokouji takaokouji commented Jan 20, 2026

Summary

This PR restores Smalruby-specific customizations and fixes unit test failures in the scratch-gui package after its migration to the smalruby3-editor monorepo. It also resolves runtime errors by fixing the Webpack configuration.

Implementation Details

  • Webpack Configuration Fixes:
    • Restored missing DefinePlugin entries for environment variables (Google Drive, Mesh v2, GA, GTM).
    • Added process polyfill and ProvidePlugin for Webpack 5 compatibility, resolving ReferenceError: process is not defined.
    • Added required HTTP headers for Google Picker API to devServer.
    • Restored Origin Trials configuration in HtmlWebpackPlugin.
  • PWA Support Restoration:
    • Added workbox-webpack-plugin and webpack-pwa-manifest dependencies.
    • Configured Service Worker generation and manifest generation in webpack.config.js.
  • Asset Restoration:
    • Restored Smalruby-specific locales (ja.js) and updated the locales reducer.
    • Restored Hatti as the default character and project assets.
    • Replaced cat icons with Hatti in the ComingSoon component.
    • Added missing PWA icons.
  • Unit Test Fixes:
    • Migrated ruby-downloader.test.jsx from Enzyme to @testing-library/react.
    • Resolved jest-haste-map duplicate mock warnings by moving manual mocks to inline mocks in color-modes.test.js and monitor.test.jsx.
    • Deleted obsolete manual __mocks__ directories.
  • Code Quality:
    • Fixed lint warnings in make-toolbox-xml.js and other modified files.
    • Ensured all 719 unit tests pass.

Test Coverage

  • Verified that npm run test:unit in packages/scratch-gui passes completely.
  • Verified successful build with npm run build:dev.

Co-Authored-By: Gemini noreply@google.com

takaokouji and others added 4 commits January 20, 2026 09:58
- Restore custom locales in src/locales and update locales reducer
- Restore Smalruby default project (Hatti) and its assets
- Replace cat icons with Hatti icons in ComingSoon component
- Add missing PWA icon

Co-Authored-By: Gemini <noreply@google.com>
- Migrate ruby-downloader.test.jsx to @testing-library/react
- Resolve mock conflicts by using inline mocks
- Fix lint warnings in modified files
- All unit tests now pass

Co-Authored-By: Gemini <noreply@google.com>
- Restore missing DefinePlugin environment variables (Google Drive, Mesh v2)
- Restore PWA support (Workbox, WebpackPwaManifest)
- Add process polyfill for Webpack 5 compatibility
- Add Google Picker API headers to devServer
- Restore Origin Trials configuration
- Clean up trademarked images in ComingSoon component

Co-Authored-By: Gemini <noreply@google.com>
@takaokouji takaokouji merged commit 36285b5 into develop Jan 20, 2026
@takaokouji takaokouji deleted the fix/scratch-gui-migration-issues branch January 20, 2026 04:25
takaokouji added a commit that referenced this pull request Apr 12, 2026
- Add next-steps guidance after student joins classroom (#1)
- Add submit hint for students who haven't submitted yet (#2)
- Add STAGE !== 'prod' failsafe for DEV_BYPASS_TOKEN (#3)
- Add fullscreen tooltip to join code expand button (#4)
- Improve member grid prompt to clarify clickable seats (#5)
- Remove window._classroomIdToken debug variable (#8)

Closes #495

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
takaokouji added a commit that referenced this pull request Apr 17, 2026
Rename smalrubyRuby_stringMethodR → smalrubyRuby_methodR and
smalrubyRuby_stringMethodC → smalrubyRuby_methodC to support
methods on all receiver types (string, array, hash).

New REPORTER methods: lines, max, sort, join, keys, values
New COMMAND methods: sort!, reverse!

Add automatic migration for old project files (stringMethodR/C
opcodes are replaced with methodR/C on load, unconditionally).

Refs #524 (Phase 1 #4-#9)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
takaokouji added a commit that referenced this pull request May 7, 2026
Cherry-picked from upstream spork@29bdbd1fe (PR #4 by Aaron Dodson
@ Google). Replace the GUI-side event translator (introduced in
471a08b) with upstream's actual fix in scratch-vm.

upstream already added the proper case branches to Blocks.blocklyListen.
We adopt the same pattern: each modern event name falls through to
the corresponding legacy case, with payload normalization so both
shapes work. Also added single-purpose handlers for block_comment_collapse
and block_comment_resize which had no v1 equivalent.

Cherry-pick context (per .claude/rules/upstream-cherry-pick.md):
- 29bdbd1 is on upstream spork branch only
- Tagged only on prerelease tags (v11.1.0-spork.15, v12.7.0-spork.{1,2})
- We adopted scratch-blocks v2 which is part of the same modern-Blockly
  migration track, so the new event names are already being emitted
  in our build — without this fix, blocks duplicated via the Blockly
  clipboard never get their comment registered in the VM, breaking
  Ruby code generation (looks_sayforsecs falls back to say(...) instead
  of puts(...)).
- Acceptable per the policy: cherry-picking unreleased upstream commits
  is allowed for fatal bugs we can reproduce and that break our
  codebase structurally.

Also adds .claude/rules/upstream-cherry-pick.md documenting the
release-status verification procedure for future cherry-picks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant