Repository navigation
字节码文件后缀 .bin 改为 .jsb(0.9.0) - #29
Conversation
F-Droid 的 scanner 对源码树里后缀为 .bin 的二进制文件一律判为 prebuilt binary 并中止构建,宿主仓提交的内置页面包因此过不了(TrendingAI 自 1.9.0 起卡在 fdroiddata)。 QuickJS 字节码本身不变,只换文件名,CLI 产出、manifest 派生路径、Bundle 读取、 sample 的资源收集与文档同步改。 格式变化:tinyui 0.9 的 Bundle 只认 .qjsb,旧宿主读不了新包,宿主升级时须加 hostVersion (docs/updates.md §4.1);热下发服务端的路径派生另行同步。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Reviewer's Guide本 PR 将 QuickJS 字节码文件的约定后缀从 Sequence diagram for loading a .qjsb page bundlesequenceDiagram
participant Host as Android/iOS Host
participant Bundle
participant Files as BundleFiles
participant QuickJS
Host->>Bundle: page(name)
Bundle->>Files: read(BuildManifest.file(name) + .qjsb)
Files-->>Bundle: bytecode bytes
Bundle->>QuickJS: runBytecode(bytecode)
QuickJS-->>Host: loaded page
Sequence diagram for host-compatible OTA delivery of .qjsb bundlessequenceDiagram
participant Host
participant Updates as Updates Service
participant Bundle
Host->>Updates: fetch hostVersion/current.json
Updates-->>Host: compatible package pointer
Host->>Updates: fetch manifest.json and pages/*.qjsb
Host->>Host: verify hashes and install package
Host->>Bundle: load installed manifest and files
Bundle-->>Host: page bytecode
Flow diagram for the .qjsb bytecode build and loading pipelineflowchart LR
TSX[TSX page source] --> ESBuild[esbuild]
ESBuild --> QJSC[qjsc-kmp]
QJSC --> Artifact[pages/home.qjsb]
Artifact --> Manifest[manifest.json]
Manifest --> Payload[payload and OTA paths]
Payload --> Bundle[Bundle.page]
Bundle --> QuickJS[QuickJS runBytecode]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
CodeSeer 审查
结论:批准
摘要
本次改动将页面和运行时 QuickJS 字节码产物的后缀统一从 .bin 切换为 .qjsb,并同步调整了 CLI 构建、打包、Kotlin Bundle 读取、sample 资源收集、测试夹具和文档。运行时与 npm 包版本也同步提升到 0.9.0。给出的改动中,产物生成、清单派生和消费路径保持一致,未发现由此次增量引入的明确问题。
整个 PR 至 8e5b6bb · gpt-5.6-terra
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/cli/src/payload.ts" line_range="14" />
<code_context>
export function payload(manifest: PayloadManifest): { path: string; hashKey: string }[] {
return [
- ...manifest.pages.map((module) => ({ path: `${manifest.files[module]}.bin`, hashKey: module })),
+ ...manifest.pages.map((module) => ({ path: `${manifest.files[module]}.qjsb`, hashKey: module })),
...Object.values(manifest.i18n?.files ?? {}).map((path) => ({ path, hashKey: path })),
];
</code_context>
<issue_to_address>
**New packages fail to download**
When a `.qjsb` package is published while the updates server still derives `.bin` paths, the existing updates server still derives bytecode paths with `.bin`, so it does not serve the `.qjsb` path emitted by `payload()` and clients downloading these packages fail. The server-side path update must be deployed before publishing `.qjsb` packages.
Coordinate deployment of the server path change with this release, or make the server serve paths from the package manifest without assuming an extension.
</issue_to_address>
### Comment 2
<location path="packages/cli/src/payload.ts" line_range="14" />
<code_context>
export function payload(manifest: PayloadManifest): { path: string; hashKey: string }[] {
return [
- ...manifest.pages.map((module) => ({ path: `${manifest.files[module]}.bin`, hashKey: module })),
+ ...manifest.pages.map((module) => ({ path: `${manifest.files[module]}.qjsb`, hashKey: module })),
...Object.values(manifest.i18n?.files ?? {}).map((path) => ({ path, hashKey: path })),
];
</code_context>
<issue_to_address>
**Old hosts cannot fetch updates**
When a `.qjsb` bundle is published under a `hostVersion` still used by 0.8 clients, the old `Bundle` loader requests `.bin` files while the new CLI publishes `.qjsb` files, so those clients cannot fetch the package and updates fail. The bundle command accepts the caller’s `hostVersion` without enforcing a version change for this format transition.
Require a new `hostVersion` for the extension transition, or otherwise keep old and new artifact formats isolated by host version.
Also at `compose/src/commonMain/kotlin/app/tinyui/Bundle.kt:27`.
</issue_to_address>
### Comment 3
<location path="compose/src/commonMain/kotlin/app/tinyui/Bundle.kt" line_range="27" />
<code_context>
suspend fun page(name: String): LoadedPage {
require(name in manifest.pages) { "page $name is not in package ${manifest.name}: ${manifest.pages}" }
- val bytecode = read(manifest.file(name) + ".bin")
+ val bytecode = read(manifest.file(name) + ".qjsb")
val module = PageModule(name, bytecode, manifest.buildId(name), i18n())
return LoadedPage(module, sourceMaps(name), this)
</code_context>
<issue_to_address>
**Sample updates remain on old host version**
When the sample’s 0.9.0 package is published using its current host version and snapshot, the sample still declares `HOST_VERSION = "3"` (`sample/shared/src/commonMain/kotlin/app/tinyui/sample/Host.kt:18`), whose frozen snapshot requires TinyUI 0.8.0 (`sample/shared/tinyui-host/3.txt:2`). The new CLI records TinyUI 0.9.0, so `tinyui publish` rejects that package for host version 3; the sample’s snapshot test still passes because 0.9.0 is compatible with the older floor. Sample OTA publishing is blocked.
Increment the sample’s `HOST_VERSION` and add the corresponding host snapshot for the 0.9.0 host before publishing its `.qjsb` packages.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 3 findings to address first, and the CLI and Kotlin runtime now locate only .qjsb files, so any already-published or installed package containing .bin artifacts will no longer be readable by the new code. Reverting restores the old lookup, but packages produced or deployed with the new extension remain and must be rebuilt or redeployed; the impact is bounded and repairable.
Blocking findings: packages/cli/src/payload.ts:14, packages/cli/src/payload.ts:14, compose/src/commonMain/kotlin/app/tinyui/Bundle.kt:27
产物布局由 CLI 决定,同版本起的库才读得了:tinyui-cli 0.9 配旧 tinyui-core 时 manifest 只记 core 版本,publish 会放行给 tinyui 0.8 的宿主,旧 Bundle 取 .bin 取不到。sample 的字节码 后缀随之变了,按 docs/updates.md §4.1 加 hostVersion 并生成快照 4。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* feat: 字节码文件后缀 .bin 改为 .qjsb(tinyui 0.9.0) 与 tiny-ui/tinyui#29 同步:manifest 派生的页面文件路径由 `<files[module]>.bin` 改为 `<files[module]>.qjsb`,上传校验与发布前核对随之。已存储的旧版本按路径原样投递不受影响; 部署后只有 tinyui-cli 0.9 起能发新包,旧 CLI 的 .bin 上传会被判为缺文件。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * 字节码后缀定为 .jsb Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
背景
F-Droid 的
scanner.py对源码树里后缀为.bin的二进制文件一律判为 prebuilt binary 并中止构建。TrendingAI 提交的内置页面包(pages/subscription.bin)因此自 1.9.0 起过不了 fdroiddata 的构建(HarlonWang/TrendingAI#153)。改动
.bin→.jsb:CLI 产出、payload路径派生、Bundle/BuildManifest读取、sample 的资源收集、测试夹具、文档兼容
Bundle只认新后缀,旧宿主读不了新包:宿主升到 0.9 时按 docs/updates.md §4.1 加hostVersion,新包只在新宿主版本下发。tinyui-updates-server 的路径派生另开 PR 同步。验证
pnpm build && pnpm schema:check && pnpm runtime:check && pnpm typecheck && pnpm test全绿./gradlew :compose:testAndroidHostTest :compose:apiCheck :updates:testAndroidHostTest :sample:shared:testAndroidHostTest全绿🤖 Generated with Claude Code
Summary by Sourcery
Adopt the
.jsbbytecode extension and release the coordinated 0.9.0 package and host compatibility updates.Bug Fixes:
.binbytecode artifacts with.jsbartifacts across build outputs, package loading, update payloads, samples, tests, and documentation to avoid binary-file scanner rejection.Enhancements:
Build:
Documentation:
.jsbartifacts and the revised compatibility requirements.Tests:
.jsbpackages and the new host version.