Skip to content

fix(target): preserve app context across bundle and publish - #74

Open
sunnylqm wants to merge 13 commits into
masterfrom
fix/preserve-app-target-context
Open

fix(target): preserve app context across bundle and publish#74
sunnylqm wants to merge 13 commits into
masterfrom
fix/preserve-app-target-context

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • use the brand-specific default app config and honor an explicit --config when selecting or creating an app
  • carry appId and config from bundle into the publish step
  • pass the resolved appId from version creation into native-package binding
  • add regression coverage for explicit app targets and custom config files

Problem

A single publish command could operate on more than one app context:

  • bundle --appId ... --name ... used the explicit app for Hermes base lookup, but did not forward it to publish
  • publish --appId ... created the OTA version under that app, then the internal binding step re-read the default selected app
  • createApp --config ... selected the newly created app in the default config rather than the requested file
  • app selection hard-coded update.json, so the Cresc default cresc.config.json was not consistently honored

In a multi-app project this could create a version for one app and attempt to bind it against another app's native package.

Changes

  • normalize appId and config as part of bundle options
  • preserve both values in named and interactive bundle publishing
  • reuse the already resolved app ID for both automatic and interactive binding
  • use updateJson as the brand-aware default config path
  • pass createApp's explicit config path into selectApp

Tests

  • verifies bundle publish requests preserve appId and config
  • verifies getSelectedApp reads an explicit config path
  • verifies createApp writes selection to the explicit config path
  • verifies explicit appId is used for upload, version creation, and binding
  • updates the existing interactive publish regression to require the resolved app ID

GitHub Actions will run lint/typecheck, unit tests with coverage, and the npm publish dry run.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Added support for targeting bundles and app creation with a specific application ID and configuration file.
    • Preserved selected application details throughout publishing and version updates.
    • Added configuration-aware publishing requests.
  • Bug Fixes

    • Ensured version updates use the correct application ID when publishing.
    • Improved handling of custom configuration paths during app selection and creation.
    • Added retry support when application targeting fails.
  • Tests

    • Added coverage for custom app targeting, configuration files, bundle publishing, and version updates.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 52 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 637a85f7-5741-46a1-acf7-dc2154ef84b3

📥 Commits

Reviewing files that changed from the base of the PR and between 49fa3e8 and 146c0e8.

📒 Files selected for processing (2)
  • src/app.ts
  • src/bundle.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d8cdc4e-ee1c-44a9-9661-e12012631c28

📥 Commits

Reviewing files that changed from the base of the PR and between e3b926f and 49fa3e8.

📒 Files selected for processing (4)
  • src/app.ts
  • src/bundle.ts
  • tests/target-context.test.ts
  • tests/versions.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/versions.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Bundle publishing now carries explicit appId and config values through normalization, request construction, app selection, and version updates. App creation reads and writes the selected configuration path. Tests cover target resolution, configuration targeting, bundle publishing, and version binding.

Changes

Target context propagation

Layer / File(s) Summary
Application configuration targeting
src/app.ts, tests/target-context.test.ts
Application selection and creation accept an explicit configuration path. Target resolution supports explicit appId values, memoizes successful lookups, and retries after failures.
Bundle target propagation
src/bundle.ts, tests/target-context.test.ts
Bundle normalization preserves appId and config. Publish request construction and Hermes and publishing paths use the resolved target.
Version app binding
src/versions.ts, tests/versions.test.ts
Selector-driven and interactive package updates now receive the resolved appId.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 49fa3

This change keeps the selected app and configuration consistent through bundling, version creation, and native-package binding, preventing cross-app targeting drift. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant normalizeBundleOptions
  participant createAppTargetResolver
  participant createPublishBundleRequest
  participant PublishAPI
  participant versionCommands
  CLI->>normalizeBundleOptions: provide appId and config
  normalizeBundleOptions->>createAppTargetResolver: resolve target context
  createAppTargetResolver-->>createPublishBundleRequest: return appId and configPath
  createPublishBundleRequest->>PublishAPI: submit bundle publish request
  PublishAPI-->>CLI: return version ID
  CLI->>versionCommands: update version with appId
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: preserving app context across bundle and publish workflows.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/preserve-app-target-context

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

sunnylqm commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator Author

全部评审意见已逐项落实:

  • 新增 operation-scoped app target resolver,同一次 bundle 操作只解析一次 selected-app 配置。
  • Hermes base、named publish、interactive publish 和原生包 binding 始终复用同一个 appId,避免构建期间配置切换造成跨应用发布。
  • bundle --name 在耗时构建前完成目标应用预检;纯 bundle 的自动 Hermes base 查询仍保持 best-effort,并支持失败后重试。
  • createApp --configselectApp --config 和 Cresc 的 cresc.config.json 默认路径保持一致。
  • 已补齐所有受影响目标解析、应用命令和 bundle/publish helper 的 JSDoc,覆盖 CodeRabbit 提出的 docstring coverage 警告;按其上一轮统计的 12 个受影响函数计算,除原有 versionCommands.publish 外均已有对应 JSDoc,覆盖率高于 80% 门槛。
  • 回归测试覆盖配置从 app 42 切换到 app 99、失败后重试、显式 appId 不读取配置、上传/创建版本/绑定使用同一应用,以及自定义配置文件写入。

最新提交:146c0e8

GitHub Actions run #175 全部通过:

  • lint / Biome formatting ✅
  • TypeScript typecheck ✅
  • 完整单元测试与覆盖率 ✅
  • npm publish dry-run ✅

CodeRabbit 对功能变更的最近一次完整增量评审结论为 No actionable commentsMerge Risk: Minimal;当前无未解决 review thread,最新 commit status 亦为 success。

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