refactor(translate): 翻訳を共通 cors-proxy 経由に統一し translate 専用 Lambda を obsolete 化 (#862)#864
Merged
Conversation
翻訳拡張 (scratch3_translate) の CORS 回避を専用 Lambda (`/scratch-api-proxy/translate`) では なく Smalruby の汎用 cors-proxy (`GET /cors-proxy?url=<encoded 翻訳URL>`) の再利用に統一する (#861 の text2speech と同方式)。translate 専用 Lambda は obsolete になる。 - scratch3_translate/index.js: serverURL を upstream 値に戻し、翻訳 URL 組み立て箇所だけ generic cors-proxy でラップ (Smalruby マーカーで囲む)。upstream 差分が最小化。 - test/unit/extension_translate_proxy.js: cors-proxy 経路を検証するよう更新。 - docs (infra/smalruby-api / maintenance/markers-vm) を汎用プロキシ方式に更新し、 translate 専用 Lambda が obsolete である旨を明記。 - Lambda コード/CDK ルートは deploy を伴うため今回は残置。 Closes #862 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
🤖 autopilot status
Linked issue #862. Maintained by autopilot (single writer); do not edit. |
|
🚀 Preview deployed: https://smalruby.jp/smalruby3-editor/topic/autopilot-862/ |
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 1, 2026
…ot-862 refactor(translate): 翻訳を共通 cors-proxy 経由に統一し translate 専用 Lambda を obsolete 化 (#862)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
翻訳拡張 (
scratch3_translate) の CORS 回避を、専用 Lambda (/scratch-api-proxy/translate) ではなく Smalruby の汎用 cors-proxy (
GET /cors-proxy?url=<encoded 翻訳URL>) の再利用に統一する。これは #861 の text2speech と同じ設計思想で、translate 専用 Lambda は obsolete になる。
Changes Made
packages/scratch-vm/src/extensions/scratch3_translate/index.jsserverURLを upstream の値 (https://translate-service.scratch.mit.edu/) に戻した(upstream 定数は変えず、fetch 直前でラップ → upstream merge の衝突を最小化)。
CORS_PROXY_HOST = 'https://api.smalruby.app/cors-proxy'を追加。getTranslateの URL 組み立て箇所で、最終 URL を${CORS_PROXY_HOST}?url=${encodeURIComponent(翻訳URL)}にラップしてから fetch。translate CORS proxy) を汎用プロキシ方式に更新。docs/maintenance/smalruby-markers-vm.md: translate CORS proxy マーカーの説明を更新。docs/infra/smalruby-api.md:/scratch-api-proxy/translateを obsolete と明記(Lambda コード / CDK ルートは deploy を伴うため今回は残置)。
Test Coverage
test/unit/extension_translate_proxy.jsを cors-proxy 経路の検証に更新(fetch URL が
cors-proxy?url=経由で、CORS-locked な translate サービスを直叩きしないこと)。cd packages/scratch-vm && npm exec tap -- test/unit/extension_translate_proxy.js --disable-coverage→ 4/4 緑。npm run lint→ 0 errors(残る 3 warnings は本 PR で触れていない test ファイルの既存分)。Notes
cdk deployはしていない(既存 cors-proxy を使うだけでインフラ変更・deploy 不要)。.claude/rules/infra/smalruby-api.mdの obsolete 明記は autopilot では行わない(fix(autopilot): runner が .claude/ 編集の権限プロンプトで stall する (非対話化) #820:.claude/編集が権限プロンプトで stall する)。人間 (メンテナ) が手で追記する。Related Issues
Closes #862
🤖 Generated with Claude Code