Skip to content

Commit 6b7c195

Browse files
strzhaoclaude
andcommitted
fix(harmonyos): name the run head and the inventory answer in the uninstall evidence, and share the lifecycle dump parser
The verified note still described the second-dump design and cited the commit that introduced it, the shapes note contradicted its own addendum, and parseBundleDump near-copied parseHarmonyBundleDump after the uninstall route stopped reading bm dump -n. parseLaunchTarget now calls the app-lifecycle owner. Co-Authored-By: Claude Code <[email protected]>
1 parent a1787af commit 6b7c195

4 files changed

Lines changed: 19 additions & 30 deletions

File tree

‎docs/evidence/harmonyos-uninstall-2026-11-08.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ error: failed to get information and the parameters may be wrong.
4949
## Consequences for the code
5050

5151
`bm dump` misses and `bm` failures carry their verdict in stdout text at exit
52-
code 0 on this build (7.0.0.111). `install`/`uninstall` success detection keys
53-
on stream content; an exit-code check would read every failure as success.
52+
code 0 on this build (7.0.0.111). `install` success detection keys on stream
53+
content, and `uninstall` success is proven only by an inventory re-read — an
54+
exit-code check would read every failure as success.
5455

5556
Addendum 2026-11-13: the uninstall route no longer interprets this per-bundle
5657
dump. Both probes read the `bm dump -a` inventory through the shared

‎docs/evidence/harmonyos-uninstall-verified-2026-11-12.md‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# HarmonyOS uninstall route with post-uninstall verification, 2026-11-12
22

3-
Evidence for #4292: the public `uninstall` command runs the fixed route end to
4-
end on hardware. The fix at 31dfcd012 keys removal success on a second
5-
`bm dump` that no longer finds the bundle record, not on the `bm uninstall`
6-
answer, because `bm` prints its verdict into stdout at host exit code 0 on
7-
this build (see `harmonyos-uninstall-2026-11-08.md` for the recorded shapes).
3+
Evidence for #4292: the public `uninstall` command runs the route end to end
4+
on hardware. The route at e36de175b answers bundle state twice from the
5+
`bm dump -a` inventory through the shared `parseHarmonyBundleList` (one owner
6+
with the app-lifecycle list), and removal counts only when a non-empty
7+
inventory no longer lists the bundle; the `bm uninstall` answer and any
8+
unparseable read are never proofs, because `bm` prints its verdict into stdout
9+
at host exit code 0 on this build (see `harmonyos-uninstall-2026-11-08.md`
10+
for the recorded shapes).
811

912
## Device and build
1013

@@ -92,10 +95,11 @@ A second uninstall answers honestly that nothing was removed:
9295
test `uninstall refuses to claim removal when the inventory still lists the
9396
bundle` pins the behavior with the recorded output shapes, alongside the
9497
unknown-read and failed-exit refusals the inventory read now carries.
95-
- Local `check:affected --run --head 31dfcd012 --base old-origin/main` passes
98+
- Local `check:affected --run --base old-origin/main` at e36de175b passes
9699
every stage except `unit`; `unit` fails only
97100
`scripts/__tests__/eager-closure-budgets.test.ts` because this clone's
98101
`origin` names a private fork, so the gate reads the wrong merge base. With
99102
`refs/remotes/origin/main` pointed at the upstream head for the duration of
100-
one `pnpm run check:unit`, that chain exits 0. Both receipts are local; CI on
101-
the pushed head is the authoritative run.
103+
one `pnpm run check:unit`, that chain exits 0. Both receipts are local; the
104+
authoritative run is CI at a1787af (16 checks, none failing), a commit that
105+
changes only comments after this run's sources.

‎packages/platform-harmonyos/src/app-lifecycle.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function parseHarmonyIsSystemApp(rawOutput: string): boolean | undefined
7777
return typeof isSystemApp === 'boolean' ? isSystemApp : undefined;
7878
}
7979

80-
function parseHarmonyBundleDump(rawOutput: string): HarmonyBundleDump | undefined {
80+
export function parseHarmonyBundleDump(rawOutput: string): HarmonyBundleDump | undefined {
8181
const jsonStart = rawOutput.indexOf('{');
8282
if (jsonStart === -1) return undefined;
8383
try {

‎packages/platform-harmonyos/src/deployment/runtime.ts‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { DeviceInfo } from '@agent-device/kernel/device';
1111
import { deviceShellArgv, type ShellWord } from '@agent-device/kernel/device-shell';
1212
import { AppError } from '@agent-device/kernel/errors';
1313
import { execFailureDetails } from '@agent-device/host-kit/command';
14-
import { parseHarmonyBundleList } from '../app-lifecycle.ts';
14+
import { parseHarmonyBundleDump, parseHarmonyBundleList } from '../app-lifecycle.ts';
1515
import { setTimeout as sleep } from 'node:timers/promises';
1616

1717
const available = Object.freeze({ available: true } as const);
@@ -140,20 +140,6 @@ async function readBundleInventory(
140140
return bundles;
141141
}
142142

143-
/** Parses the JSON bundle record out of one `bm dump -n` output. */
144-
function parseBundleDump(rawOutput: string): Record<string, unknown> | undefined {
145-
const jsonStart = rawOutput.indexOf('{');
146-
if (jsonStart === -1) return undefined;
147-
try {
148-
const dump = JSON.parse(rawOutput.slice(jsonStart)) as unknown;
149-
return typeof dump === 'object' && dump !== null
150-
? (dump as Record<string, unknown>)
151-
: undefined;
152-
} catch {
153-
return undefined;
154-
}
155-
}
156-
157143
async function deployHarmonyApp(
158144
commands: HostCommandRunner,
159145
device: DeviceInfo,
@@ -232,11 +218,9 @@ async function openHarmonyApp(
232218
}
233219

234220
function parseLaunchTarget(rawOutput: string): { ability: string; module?: string } | undefined {
235-
const modules = parseBundleDump(rawOutput)?.hapModuleInfos;
221+
const modules = parseHarmonyBundleDump(rawOutput)?.hapModuleInfos;
236222
if (!Array.isArray(modules)) return undefined;
237-
const module = (modules as Array<{ mainElementName?: string; moduleName?: string }>).find(
238-
(item) => item.mainElementName,
239-
);
223+
const module = modules.find((item) => item.mainElementName);
240224
return module?.mainElementName
241225
? {
242226
ability: module.mainElementName,

0 commit comments

Comments
 (0)