Repository navigation
fix(harmonyos): narrow the unsupported-stream error before reporting it - #3147
Merged
wgqqqqq merged 1 commit intoSep 20, 2026
Merged
Conversation
`HostSessionStream.catchUp` hands the caught value to
`HostSessionCallbacks.onError`, which is typed `(error: Error) => void`.
The `HostStreamUnsupportedError` branch passed `error` unchanged and relied
on implicit structural assignability, which ArkTS rejects, so `assembleHap`
failed on current SDKs:
10605030 ArkTS Compiler Error
Structural typing is not supported (arkts-no-structural-typing)
At File: entry/src/main/ets/services/HostSessionStream.ets:265:32
The sibling branch two lines below already narrows with `error as Error`.
Do the same in the unsupported-stream branch. The reported error, the
`close()` that follows, and the retry path are all unchanged.
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
The HarmonyOS
entrymodule does not compile on current DevEco SDKs:assembleHapstops atentry/src/main/ets/services/HostSessionStream.ets:265withThis already fails on
main(e0b8ae60d), so nobody can build or install the HarmonyOS app from the default branch. The PR adds the one missing type narrowing that makes the module compile again.HostSessionStream.catchUphands the caught value toHostSessionCallbacks.onError, which is typed(error: Error) => void. TheHostStreamUnsupportedErrorbranch passederrorunchanged and relied on implicit structural assignability, which ArkTS rejects. The sibling branch two lines below already narrows witherror as Error; this PR does the same in the unsupported-stream branch.Fixes: no issue filed — found while building the app for a device.
Type and Areas
Type: bug fix (compile regression)
Areas: HarmonyOS mobile app (
src/apps/mobile/harmonyos)Motivation / Impact
assembleHapfails, so the HarmonyOS app cannot be built or installed frommainat all.onError, and the followingclose()and retry paths are untouched.Verification
source scripts/ohos-env.sh && "$HVIGORW" --mode module -p product=default -p module=entry@default assembleHap --no-daemonBUILD FAILED—1 ERROR: 10605030 ArkTS Compiler Error ... At File: .../services/HostSessionStream.ets:265:32BUILD SUCCESSFUL(producesentry-default-signed.hap, 8.79 MB)hdc install -r entry/build/default/outputs/default/entry-default-signed.hap→install bundle successfullyhdc shell aa start -b com.bitfun.app -a EntryAbility→start ability successfully; the home screen renders and lists the connected host.pnpm run harmony:architecture→HarmonyOS architecture contracts are satisfied.HostStreamUnsupportedErrorruntime branch itself, which needs an older host that rejectsread_stream. The change is a compile-time annotation only.Reviewer Notes
The narrowed branch is only reachable when a host answers
read_streamwith an unknown-command rejection; the object passed toonErroris the same one as before. Rollback is a one-line revert with no data or compatibility impact.AI-assisted: yes. Testing level: fully tested for the reported failure (build + device install + launch); the runtime branch was not exercised.
Checklist