Skip to content

fix(build): fail CD build when remote miniapps download fails - #252

Merged
Gaubee merged 5 commits into
mainfrom
opencode/shiny-nebula
Jan 20, 2026
Merged

Gaubee merged 5 commits into
mainfrom
opencode/shiny-nebula

Conversation

@Gaubee

@Gaubee Gaubee commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 修复 CD 构建时远程 miniapps 下载失败但构建仍显示成功的问题
  • 添加超时 (60s) 和重试 (3次) 机制到 fetchWithEtag
  • Build 模式下下载失败立即中断构建,Dev 模式仅警告

问题根因

remoteMiniappsPlugin 在 CI 构建时可能静默失败:

  1. buildStart 阶段网络请求失败时没有捕获错误
  2. writeBundle 阶段检测到目录不存在时直接跳过,不报错
  3. 最终 dist/miniapps/rwa-hub/ 缺失,但构建显示成功

改动

文件 改动
scripts/utils/fetch-with-etag.ts 添加 timeout + retries + 详细错误日志
scripts/vite-plugin-remote-miniapps.ts buildStart/writeBundle 错误捕获和中断
vite.config.ts 配置 timeout: 60000, retries: 3

新行为

Build 模式(CI):

[remote-miniapps] ❌ Failed to download rwa-hub: [fetchWithEtag] All 3 attempts failed...
Error: [remote-miniapps] Build aborted: failed to download remote miniapps: rwa-hub.

Dev 模式:

[remote-miniapps] ⚠️ Failed to download rwa-hub (dev mode): ...

继续运行,不中断开发。

…ONS to use i18n

- Add Chinese string detection to i18n-check.ts script
- Simplify KNOWN_PERMISSIONS to only contain risk field
- Refactor getPermissionInfo() to return translated text via i18n
- Convert MiniappDetailActivity.tsx to use i18n for all UI strings
- Add permission translations to all 4 locale files (zh-CN, en, zh-TW, ar)
- Export permissions module from ecosystem service
- Expand error.json with validation, transaction, crypto, and other error keys
- Update use-send.logic.ts to use i18n for validation messages
- Update use-burn.ts to use i18n for error messages
- Add translations for all 4 locales (zh-CN, en, zh-TW, ar)
…terns

- Add *.stories.tsx and mock-devtools to i18n-check exclude patterns
- Add services/*/types.ts (Zod schemas) to exclude patterns
- Update use-send.bioforest.ts to use i18n for error messages
- Update use-burn.bioforest.ts to use i18n for error messages
- Add i18n-set.ts for batch setting translation keys across all locales
- Add i18n-delete.ts for removing translation keys from all locales
- Update i18n-check.ts to show quick tool usage hints on errors
- Support locale shortcuts (zh -> zh-CN, tw -> zh-TW)
- Support nested key paths (e.g., validation.required)
- Add timeout (60s) and retry (3x) mechanism to fetchWithEtag
- Throw error in buildStart when remote miniapp download fails (build mode)
- Throw error in writeBundle when miniapps are missing from output
- Dev mode only warns, does not interrupt development

This ensures CI builds fail fast when runner network cannot reach
remote miniapp servers, making the issue immediately visible.
@Gaubee
Gaubee merged commit 0c0a2a0 into main Jan 20, 2026
11 of 15 checks passed
@Gaubee
Gaubee deleted the opencode/shiny-nebula branch January 20, 2026 12:58
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