@harmonyos-arkts/d2h 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +13 -0
- package/.claude-plugin/plugin.json +7 -0
- package/README.md +168 -2
- package/agents/android-to-hmos-00-orchestrator.md +312 -0
- package/agents/d2h.md +168 -0
- package/bin/install-opencode.mjs +51 -0
- package/install-opencode.sh +160 -0
- package/opencode/agents.json +16 -0
- package/package.json +16 -4
- package/schemas/android-source-manifest.schema.json +25 -0
- package/schemas/checkpoint-provenance.schema.json +67 -0
- package/schemas/final-acceptance.schema.json +29 -0
- package/schemas/managed-evidence-index.schema.json +15 -0
- package/schemas/managed-evidence.schema.json +114 -0
- package/schemas/migration-config.schema.json +51 -0
- package/schemas/migration-report-index.schema.json +39 -0
- package/schemas/migration-report-item.schema.json +51 -0
- package/schemas/migration-report-summary.schema.json +25 -0
- package/schemas/migration-status.schema.json +202 -0
- package/schemas/preflight.schema.json +60 -0
- package/schemas/source-order-audit.schema.json +16 -0
- package/schemas/source-provenance-event.schema.json +19 -0
- package/schemas/spec-app-shard.schema.json +45 -0
- package/schemas/spec-fact-corrections-shard.schema.json +13 -0
- package/schemas/spec-features-shard.schema.json +43 -0
- package/schemas/spec-index.schema.json +26 -0
- package/schemas/spec-interactions-shard.schema.json +40 -0
- package/schemas/spec-page.schema.json +98 -0
- package/schemas/spec-pages-index.schema.json +1 -0
- package/schemas/spec-unresolved-shard.schema.json +1 -0
- package/schemas/task-envelope.schema.json +55 -0
- package/schemas/task-plan.schema.json +123 -0
- package/skills/android2hmos_resources_convert/SKILL.md +162 -0
- package/skills/android2hmos_resources_convert/references/image-conversion-rules.md +230 -0
- package/skills/android2hmos_resources_convert/references/svg-fix-patterns.md +175 -0
- package/skills/android2hmos_resources_convert/references/xml-drawable-to-svg-rules.md +513 -0
- package/skills/appgraph-rule-audit/SKILL.md +58 -0
- package/skills/appgraph-rule-audit/references/audit-contract.md +47 -0
- package/skills/appgraph-rule-audit/references/recommendation-schema.md +41 -0
- package/skills/appgraph-rule-audit/schemas/rule-opportunities.schema.json +125 -0
- package/skills/arkts-app-identity/SKILL.md +238 -0
- package/skills/arkts-i18n/SKILL.md +496 -0
- package/skills/arkts-i18n/evals/evals.json +84 -0
- package/skills/arkts-i18n/references/code-examples.md +302 -0
- package/skills/arkts-i18n/references/common-pitfalls.md +391 -0
- package/skills/arkts-i18n/references/dynamic-language-switch.md +604 -0
- package/skills/arkts-i18n/references/hardcoded-string-scanner.md +348 -0
- package/skills/arkts-i18n/references/language-codes.md +104 -0
- package/skills/arkts-i18n/references/resource-file-structure.md +775 -0
- package/skills/arkts-i18n/references/static-vs-dynamic.md +242 -0
- package/skills/arkts-i18n/references/v1-compat.md +244 -0
- package/skills/arkts-i18n/scripts/audit_i18n_completeness.sh +174 -0
- package/skills/arkts-icon-sizing/SKILL.md +211 -0
- package/skills/arkts-icon-sizing/scripts/icon_audit.py +131 -0
- package/skills/arkts-icon-sizing/scripts/icon_autofix.py +88 -0
- package/skills/arkts-icon-sizing/scripts/icon_dims.py +179 -0
- package/skills/arkts-icon-sizing/scripts/icon_fix.py +119 -0
- package/skills/arkts-mvvm-architecture/SKILL.md +613 -0
- package/skills/harmonyos-migration-playbook/SKILL.md +56 -0
- package/skills/harmonyos-migration-playbook/agents/openai.yaml +7 -0
- package/skills/harmonyos-migration-playbook/references/arkts-compile.md +24 -0
- package/skills/harmonyos-migration-playbook/references/harmony-runtime.md +53 -0
- package/skills/harmonyos-migration-playbook/references/lesson-lifecycle.md +45 -0
- package/skills/harmonyos-migration-playbook/references/protocol-e2e.md +23 -0
- package/skills/harmonyos-migration-playbook/references/ui-automation.md +52 -0
- package/skills/harmonyos-migration-playbook/references/windows-environment.md +38 -0
- package/skills/maintaining-migration-report/SKILL.md +155 -0
- package/skills/native-library-substitution/SKILL.md +385 -0
- package/skills/native-library-substitution/references/native-library-substitution.json +56906 -0
- package/skills/native-library-substitution/references/native-library-substitution.md +163 -0
- package/skills/preparing-migration-workspace/SKILL.md +124 -0
- package/skills/preparing-migration-workspace/toolchain.json +43 -0
- package/skills/reviewing-migration-process/SKILL.md +62 -0
- package/src/install-opencode.mjs +108 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ArkTS compilation diagnosis
|
|
2
|
+
|
|
3
|
+
Use the compiler error and the smallest failing construct. These are migration patterns, not permission to mechanically rewrite unrelated code.
|
|
4
|
+
|
|
5
|
+
| Error/pattern | Check | Typical repair |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `arkts-no-any-unknown` | untyped catch/callback value | introduce an explicit supported type and narrow safely |
|
|
8
|
+
| `arkts-no-untyped-obj-literals` | object literal crosses a typed boundary | define a class/interface and construct the declared value |
|
|
9
|
+
| `arkts-no-obj-literals-as-types` | inline object type | introduce a named type |
|
|
10
|
+
| `arkts-no-indexed-signatures` | string-key object access | use `Map` or a typed wrapper API |
|
|
11
|
+
| `arkts-no-structural-typing` | shape-compatible literal assigned to class | use the class constructor |
|
|
12
|
+
| `arkts-no-destruct-params` | destructured callback parameter | accept one typed parameter, then read fields |
|
|
13
|
+
| `arkts-no-misplaced-imports` | import emitted below declarations | move imports to the file header |
|
|
14
|
+
| implicit return failure | branch result cannot be inferred | declare a concrete return type |
|
|
15
|
+
|
|
16
|
+
Also check compiler/SDK support before applying these previously observed repairs:
|
|
17
|
+
|
|
18
|
+
- Enum strings usually need an explicit parser rather than a blind cast.
|
|
19
|
+
- Unsupported Unicode escape syntax can be replaced with a supported literal or four-digit escape.
|
|
20
|
+
- A `Button` label constructor and child content must follow the active ArkUI API signature.
|
|
21
|
+
- Complex inline component callbacks may need a data-driven component API.
|
|
22
|
+
- Expressions rejected inside `build()` can move to a typed helper method.
|
|
23
|
+
|
|
24
|
+
Verification: rerun the exact ArkTS compile command and a focused test for behavior affected by the rewrite. A different compiler error is not success.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# HarmonyOS runtime diagnosis
|
|
2
|
+
|
|
3
|
+
The following are Thunderbird migration observations. Confirm them against the active SDK and current call path.
|
|
4
|
+
|
|
5
|
+
## TLS and networking
|
|
6
|
+
|
|
7
|
+
- When TLS reports missing socket/bind state, instrument bind and connect separately. Some SDK paths require binding a local address before `connect` and explicit supported protocols.
|
|
8
|
+
- Android STARTTLS flows do not automatically imply a one-to-one HarmonyOS socket upgrade API. Confirm current platform support; if behavior must change, preserve the user-visible security contract and document the adaptation.
|
|
9
|
+
- A request that appears hung needs stage logs and a deterministic timeout path. Do not assume a timeout strategy works if the scheduling context itself is stalled.
|
|
10
|
+
|
|
11
|
+
### Real-device TLSSocket receive failure (proven platform defect, Mate system build)
|
|
12
|
+
|
|
13
|
+
Symptom chain on a physical phone against any TLS endpoint (incl. `www.qq.com:443`):
|
|
14
|
+
`bind ok → TLS handshake ok → send ok → 'message' callback never delivers any byte`, while the
|
|
15
|
+
system `@ohos.net.http` stack fetches HTTPS fine at the same moment and the identical
|
|
16
|
+
TLSSocket code passes on the emulator.
|
|
17
|
+
|
|
18
|
+
Bisection procedure (ship a probe page, launch via want param, e.g. `--ps tlsProbe 1`):
|
|
19
|
+
|
|
20
|
+
1. control `http.request('https://...')` — if this also fails, the device network is the problem;
|
|
21
|
+
2. TLSSocket to a well-known HTTPS host with an HTTP GET — if handshake succeeds but zero bytes
|
|
22
|
+
arrive, the TLSSocket receive path is broken on that system build;
|
|
23
|
+
3. confirm on the emulator with the same code before blaming the app.
|
|
24
|
+
|
|
25
|
+
Related real bugs to fix BEFORE attributing to the platform (each bit us once):
|
|
26
|
+
|
|
27
|
+
- `TLSSocket.send`/`TCPSocket.send` on real devices rejected ArrayBuffer slices copied from
|
|
28
|
+
Uint8Array (`"data is not string"`); line protocols should send plain strings
|
|
29
|
+
(`tls.send(str)`, `tcp.send({ data: str })`).
|
|
30
|
+
- Servers that reject credentials (163/QQ IMAP with a login password) may half-close without
|
|
31
|
+
firing `close`; treat `message` with 0 length as peer-closed to fail fast, and surface a
|
|
32
|
+
provider-specific hint (authorization code / 授权码) instead of a raw timeout.
|
|
33
|
+
- IPv6-preferred networks can blackhole the AAAA path: resolve with
|
|
34
|
+
`connection.getAddressesByName` and prefer an A record; Coremail servers do not require SNI,
|
|
35
|
+
so IP-direct connect still passes certificate validation.
|
|
36
|
+
|
|
37
|
+
## IME and asynchronous callbacks
|
|
38
|
+
|
|
39
|
+
If work triggered from `TextInput.onSubmit` produces no logs or completion:
|
|
40
|
+
|
|
41
|
+
1. prove the synchronous callback ran;
|
|
42
|
+
2. log before and after the asynchronous boundary;
|
|
43
|
+
3. compare with the same operation triggered by a normal button;
|
|
44
|
+
4. keep IME handling synchronous if the current SDK reproduces the stall, and move business execution to a verified callback path.
|
|
45
|
+
|
|
46
|
+
Do not universalize this behavior without a current reproduction.
|
|
47
|
+
|
|
48
|
+
## Component state
|
|
49
|
+
|
|
50
|
+
- If an externally changed value is not rendered, verify whether the ArkUI component is controlled by that state or only initialized from it.
|
|
51
|
+
- If a static theme lookup does not redraw, establish a real observed state dependency and verify the rendered color after switching.
|
|
52
|
+
|
|
53
|
+
Verification must include the actual runtime path, not only compilation or a matching function name.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Lesson lifecycle
|
|
2
|
+
|
|
3
|
+
## Read before a task
|
|
4
|
+
|
|
5
|
+
Read `.migration/experience/lessons.md` when it exists. Select lessons by task type, symptom, subsystem and applicability. Do not load or repeat unrelated lessons.
|
|
6
|
+
|
|
7
|
+
## Record after validation and commit
|
|
8
|
+
|
|
9
|
+
The orchestrator records a lesson only after the implementation is validated and committed through an explicit checkpoint. Before recording, confirm the repository state with `droid2hmos checkpoint status <android-project>`. Use this structure:
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
## <short title>
|
|
13
|
+
- Task/commit: `<task>` / `<sha>`
|
|
14
|
+
- Evidence level: project-validated | reusable-pattern | platform-rule
|
|
15
|
+
- Applies when: <specific conditions and versions>
|
|
16
|
+
- Symptom: <observable failure>
|
|
17
|
+
- Root cause: <proven cause>
|
|
18
|
+
- Fix: <minimal effective change>
|
|
19
|
+
- Verification: <commands, tests, device evidence>
|
|
20
|
+
- Does not apply when: <known boundary>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Skip routine success, generic coding advice, speculative causes, duplicate lessons and details recoverable from the commit alone.
|
|
24
|
+
|
|
25
|
+
If the project tracks `.migration/experience/lessons.md`, record the lesson there. The migration workspace `<android-project>-migration/` lives outside the Android Git repository, so `droid2hmos checkpoint create` (which commits inside the Android repo) can no longer include it; keep lessons as workspace-local run memory, or version the `<android-project>-migration/` directory independently if the project wants lesson history.
|
|
26
|
+
|
|
27
|
+
In either case, use `droid2hmos checkpoint status <android-project>` to ensure the next migration unit does not inherit an unexplained dirty worktree. Do not use `--all` merely to capture the lesson.
|
|
28
|
+
|
|
29
|
+
## Promote to the public playbook
|
|
30
|
+
|
|
31
|
+
`.migration/experience/lessons.md` is the source-project evidence log, not the cross-project knowledge base. Review a lesson after it is committed. If it is non-obvious, reproducible, useful beyond one task, bounded by explicit applicability conditions, and backed by real verification evidence, add its generalized form to the relevant public Playbook reference immediately as `project-validated`.
|
|
32
|
+
|
|
33
|
+
Public entries must contain:
|
|
34
|
+
|
|
35
|
+
- evidence level;
|
|
36
|
+
- symptom and proven root cause;
|
|
37
|
+
- applicable SDK/tool versions and conditions;
|
|
38
|
+
- recommended fix or workflow;
|
|
39
|
+
- repeatable verification;
|
|
40
|
+
- non-applicable cases;
|
|
41
|
+
- source project and commits.
|
|
42
|
+
|
|
43
|
+
Remove project-specific names and identifiers from the recommendation. Keep them only in source evidence. A public `project-validated` entry is discoverable by later projects but must be treated as a candidate solution there. After an independent project or environment reproduces it, upgrade it to `reusable-pattern` and add the new evidence. Upgrade to `platform-rule` only with active SDK/compiler evidence or a repeatable minimal reproduction.
|
|
44
|
+
|
|
45
|
+
Do not promote routine success, generic advice, speculation, or a workaround whose root cause is unknown. Promotion is a reviewed change to the plugin Playbook; migration agents must not silently mutate an installed or cached plugin copy.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Protocol-level E2E
|
|
2
|
+
|
|
3
|
+
For mail or other network protocols, use a deterministic local server when external infrastructure makes results unstable.
|
|
4
|
+
|
|
5
|
+
Derive a version-1 protocol specification from Android source evidence. Every route must include non-empty `sourceEvidence` and the four scenarios `success`, `empty`, `business-failure`, and `boundary`; do not invent routes or payloads. Generate the server with:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
droid2hmos mock init <android-project> --spec <protocol-spec.json>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The generated `mock-server/scenarios.json` is the protocol fixture and `transcript.jsonl` is request evidence. Start the generated server through the managed service command shown in `mock-server/README.md`, then use `droid2hmos service status` and `droid2hmos service stop`; do not launch a detached Node process directly. Select scenarios with the `x-droid2hmos-scenario` header or `scenario` query parameter.
|
|
12
|
+
|
|
13
|
+
## Evidence layers
|
|
14
|
+
|
|
15
|
+
1. Protocol driver: real socket exchange and server transcript.
|
|
16
|
+
2. Application behavior: parsed data, persistence and error handling.
|
|
17
|
+
3. UI flow: real user action reaches the protocol path and renders the result.
|
|
18
|
+
|
|
19
|
+
Keep each layer's evidence separate. A direct protocol driver does not prove the UI path is connected.
|
|
20
|
+
|
|
21
|
+
For IMAP literals, preserve byte lengths and response framing exactly. Seed known messages and assert complete subjects/senders/content rather than only response success. A small host-side parser mimic can help isolate tokenizer differences, but the final assertion must run against the ArkTS implementation.
|
|
22
|
+
|
|
23
|
+
Restart behavior must be deterministic when launch parameters are consumed only during application creation; verify the process lifecycle rather than assuming a foreground launch recreates it.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# UI automation and visual verification
|
|
2
|
+
|
|
3
|
+
Use device automation as evidence, not as a substitute for understanding the UI.
|
|
4
|
+
|
|
5
|
+
## Reliable workflow
|
|
6
|
+
|
|
7
|
+
1. Start from a known app state.
|
|
8
|
+
2. Capture a screenshot and `dumpLayout` before interaction.
|
|
9
|
+
3. Perform one interaction.
|
|
10
|
+
4. Capture the resulting screenshot, UI tree and relevant log.
|
|
11
|
+
5. Assert the expected visible, navigation or state result.
|
|
12
|
+
|
|
13
|
+
Use the managed evidence commands for collection and packaging:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
droid2hmos evidence capture <android|harmony> <android-project> --name <name> [--target <id>]
|
|
17
|
+
droid2hmos evidence flow android <android-project> --name <name> [--task <task>]
|
|
18
|
+
droid2hmos evidence flow harmony <android-project> --name <name> (--class <class> [--case <case>] | --all)
|
|
19
|
+
droid2hmos evidence compare <android-project> --name <name> --android <android-evidence-dir> --harmony <harmony-evidence-dir>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`capture` collects the screenshot, UI tree/`dumpLayout`, and device logs. `flow` creates before/after captures around a configured Android test or HarmonyOS Hypium test. `compare` creates a dual-platform evidence record; it supports human review but does not by itself prove semantic equivalence. Preserve command output paths as report evidence.
|
|
23
|
+
|
|
24
|
+
For text input, verify focus and current value after each operation. A click can hit an input field or IME candidate and inject unintended text. Close the IME only with a method proven in the current environment.
|
|
25
|
+
|
|
26
|
+
## `dumpLayout` checks
|
|
27
|
+
|
|
28
|
+
- control text/value and selected state;
|
|
29
|
+
- element bounds and scroll viewport;
|
|
30
|
+
- missing or zero-size controls;
|
|
31
|
+
- duplicate windows or duplicated controls;
|
|
32
|
+
- visibility and reachability of the intended action.
|
|
33
|
+
|
|
34
|
+
## Visual comparison dimensions
|
|
35
|
+
|
|
36
|
+
Inspect every user-visible element for content, position, size, spacing, alignment, color, typography, icon, border, state and enabled/clickable behavior. When no visual model or Android device is available, use Android source/resources plus the HarmonyOS UI tree and screenshot; state the evidence limitation.
|
|
37
|
+
|
|
38
|
+
White/non-white screenshot heuristics only detect gross rendering failures. They cannot prove Android parity.
|
|
39
|
+
|
|
40
|
+
## Prefer semantic Hypium UI tests over coordinate injection
|
|
41
|
+
|
|
42
|
+
- **Evidence level:** project-validated
|
|
43
|
+
- **Applies when:** HarmonyOS user flows need repeatable device-side verification and the relevant ArkUI controls can expose semantic nodes. Verified with DevEco SDK 6.0.2(22) and `@ohos/hypium` 1.0.25; recheck APIs on other versions.
|
|
44
|
+
- **Symptom:** a migration relies on repeated coordinate-based device injection, requiring layout dumps and manual coordinate calculation at every step. Scrolling or layout changes cause misclicks, stale-frame dumps and evidence that cannot be replayed reliably.
|
|
45
|
+
- **Root cause:** the command-line injection path was mistaken for the full UI-test capability. Empty IDs in a layout dump were also treated as proof that semantic selection was unavailable, without first checking whether the app had stable ArkUI `.id()` anchors or a test module.
|
|
46
|
+
- **Required acceptance workflow:** development does not have to be test-first, but a runnable `entry_test` Hypium module must exist before the first interactive feature is accepted as complete. Add stable, unique semantic IDs to important interactive controls; locate them through `Driver` selectors such as `ON.id(...)`; execute only the affected class/case after an implementation change. Run the full suite only for broad shared-code changes, coherent batch acceptance and final regression. Dynamic-list IDs must derive from stable business identity, not the current visual position. A feature without a current successful Hypium result remains unverified.
|
|
47
|
+
- **Verification:** rerun the same semantic test suite after layout movement or scrolling and assert the visible/navigation/state result, not merely a successful click. The source project ran five core flows twice: list rendering, detail navigation, timer start/stop, settings entry and editor entry.
|
|
48
|
+
- **Does not apply when:** performing one-off exploratory probing or interacting with content proven to have no usable semantic node, such as Canvas or an external system surface. Coordinate injection may help explore these cases, but it is not acceptance evidence by itself; record why semantic selection is impossible and verify the resulting visible or business state through another repeatable assertion. An unconfirmed Hypium API or a test module not yet created is a setup problem to resolve, not a lasting exception.
|
|
49
|
+
- **API investigation checks:** confirm the correct Hypium dependency/import, selector matching behavior, test delegator launch API, whether the clickable node is the text child or its parent, and ArkTS syntax accepted in the test module. Do not copy an API fix across SDK versions without compiling and running it.
|
|
50
|
+
- **Source evidence:** Cofi migration; test assets commit `65472f1d`, lesson commit `09278323`; five device tests passed in two runs on emulator `127.0.0.1:5555`.
|
|
51
|
+
|
|
52
|
+
Android `uiautomator` and HarmonyOS `dumpLayout` can expose different semantic trees. Missing Compose `AnimatedVisibility` text on the Android side is a comparison-tool limitation until corroborated by the visible app; do not report it directly as an application mismatch.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Windows environment checks
|
|
2
|
+
|
|
3
|
+
Check actual paths rather than trusting environment variables:
|
|
4
|
+
|
|
5
|
+
- Android SDK/JDK/DevEco SDK directories exist and match the invoked tool.
|
|
6
|
+
- Included Gradle builds have the local configuration they require.
|
|
7
|
+
- Proxy settings apply to Gradle/Node and do not unexpectedly intercept device or mail ports.
|
|
8
|
+
- Node/npm pairs come from compatible installations.
|
|
9
|
+
- Commands preserve spaces and non-ASCII paths.
|
|
10
|
+
|
|
11
|
+
Encoding is tool- and file-format-specific. Detect the existing encoding and the consuming compiler/schema requirements before changing it. Do not impose BOM rules globally, and do not rewrite source files merely to normalize encoding.
|
|
12
|
+
|
|
13
|
+
For long tasks, emit progress and bounded diagnostics. Do not leave an unbounded process running when a smaller stage probe can identify the bottleneck.
|
|
14
|
+
|
|
15
|
+
## Long-lived background services under OpenCode on Windows
|
|
16
|
+
|
|
17
|
+
**Evidence level: reusable pattern.** `Start-Process` and Node `detached + unref` can both leave a Mock Server or development server inside the process tree tracked by the Windows command runner. The launcher may print a successful result while the tool call still waits forever for the descendant service.
|
|
18
|
+
|
|
19
|
+
Use the plugin-owned launcher instead:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
droid2hmos service start mock-server <PROJECT> --health-url <URL> -- <command> [args...]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
On Windows it asks `Win32_Process.Create` to create a short-lived host outside the command runner's process tree. The host starts the service with closed stdin and file-backed stdout/stderr, records the actual service PID, then exits. The outer launcher performs only a bounded health check and exits immediately after success.
|
|
26
|
+
|
|
27
|
+
Do not substitute `Start-Process`, a foreground server command, or a project-local `spawn(..., { detached: true }).unref()` launcher. If the system-level creation mechanism is unavailable, stop and ask the user to start the service manually rather than risking a permanently blocked migration run.
|
|
28
|
+
|
|
29
|
+
## DevEco CLI login callback server lifecycle
|
|
30
|
+
|
|
31
|
+
**Evidence level: project-validated.** `devecocli auth login` starts a local OAuth callback server on a random `127.0.0.1` port, and that server lives only as long as the login process. If the process is killed, reaped by a tool-call timeout, or launched as a short-lived child of a CLI invocation, the browser keeps the Huawei login page; completing authorization then redirects to the dead port and the browser shows "localhost refused to connect". The failure does not heal on re-run.
|
|
32
|
+
|
|
33
|
+
- Symptom: browser shows `localhost 拒绝了我们的连接请求` after finishing Huawei account authorization during a DevEco CLI login.
|
|
34
|
+
- Root cause: the login callback server died with its process (orphaned browser tab pointing at a stale port, often left by an earlier automated or timed-out login attempt).
|
|
35
|
+
- Fix workflow: use the managed login `droid2hmos auth login <android-project>` — it kills orphan `devecocli auth login` processes first, relaunches the login process outside the command runner's process tree with stdin held open (auto-sends Enter to trigger the browser), prints the login URL for manual access, and polls `devecocli auth status` with a bounded timeout. Treat a failed `devecocli-auth` preflight gate as `retry.kind: external`; do not retry it with short-lived processes and do not start a second concurrent login while one is pending.
|
|
36
|
+
- Verification: preflight `devecocli-auth` gate passes after `droid2hmos auth login`; `.migration/services/devecocli-auth.pid` is cleaned up after the login process exits.
|
|
37
|
+
- Does not apply when: the CLI was never installed (`toolchain` gate fails first), or the browser cannot reach `127.0.0.1` at all (proxy/VPN intercepting loopback — see the proxy checks above).
|
|
38
|
+
- Source: Android2Harmony droid2hmos CLI, DevEco CLI login callback incident (2026-09).
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maintaining-migration-report
|
|
3
|
+
description: Maintain the lightweight fact-linked migration ledger while implementing or reviewing Android-to-HarmonyOS behavior, recording only implementation files, verification evidence, differences, and analyzer omissions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Maintain the migration report
|
|
7
|
+
|
|
8
|
+
The migration report is the authoritative record of what Android behavior has actually been implemented and verified on HarmonyOS. Keep it synchronized with real code and tests throughout migration; do not reconstruct it only at the end.
|
|
9
|
+
|
|
10
|
+
All `.migration/...` paths below live in the sibling migration workspace `<android-project>-migration/.migration/` in the Android project's parent directory (created by the CLI), not inside the Android project.
|
|
11
|
+
|
|
12
|
+
## Invariants
|
|
13
|
+
|
|
14
|
+
- Treat `.migration/spec/facts/` and `.migration/spec/index.json` as immutable analyzer output. Never edit them to make report validation pass.
|
|
15
|
+
- The JSON files under `.migration/report/` are lightweight overlays. Scripts prefill stable refs, readable fact labels, and control-entry ownership; do not rewrite those fields.
|
|
16
|
+
- Do not edit `.migration/report/index.json` or `validation.json`; host scripts own indexes, hashes, counts, and validation output.
|
|
17
|
+
- A report mapping names the concrete HarmonyOS file and symbol that performs the work. Imports, comments, ref strings, registries without executable wiring, generated hashes, stubs, and test-only symbols are not implementations.
|
|
18
|
+
- Report only observed results. Compilation alone does not prove that a page, control, handler, navigation path, Dialog, or business function works.
|
|
19
|
+
- Evidence for `verified` items and final acceptance must reference `managedEvidence` returned by a successful `droid2hmos test harmony ...` or HarmonyOS `evidence flow`. The CLI writes managed receipts under `.migration/evidence/managed/`, copies logs and HAP files into `.migration/evidence/blobs/` by SHA-256, and binds them to the current facts and HarmonyOS source fingerprint; never hand-write, copy, or modify receipts or archived artifacts.
|
|
20
|
+
- A receipt supports a `verified` item only when `scope.coveredRefs` explicitly contains the item's `ref`, its structured Hypium result reports a non-zero execution count with zero failures, errors, and ignored cases, its target device matches, and every archived artifact has the expected size and SHA-256. A zero process exit code, a screenshot, a similar case name, or merely running a full suite cannot replace these requirements.
|
|
21
|
+
|
|
22
|
+
## Initialize and select work
|
|
23
|
+
|
|
24
|
+
Run once when no report exists:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
droid2hmos report init <android-project>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Start from `.migration/report/index.json`. Select only the page or interaction shards relevant to the current implementation or review. Follow each shard's `factsFile` to obtain the Android fact and source evidence. Read additional Android source when the fact is ambiguous or when checking for analyzer omissions.
|
|
31
|
+
|
|
32
|
+
## Update one report item while the context is fresh
|
|
33
|
+
|
|
34
|
+
Update the relevant item immediately after implementing and testing it. Do not postpone report reconstruction until the end. Preserve `ref`, `kind`, `factLabel`, and `controlRef`; the initializer owns them. Fill only:
|
|
35
|
+
|
|
36
|
+
- `status`: `pending`, `implemented`, `verified`, or `blocked`.
|
|
37
|
+
- `harmonyosFiles[]`: project-relative files that contain the real reachable implementation.
|
|
38
|
+
- `testEvidence[]`: the `managedEvidence` path returned by the current managed HarmonyOS test; the receipt's `scope.coveredRefs` must contain the current item's `ref`. User-visible behavior requires end-to-end evidence from an emulator or physical device.
|
|
39
|
+
- `difference`: normally `null`; write one concise sentence only for a real Android/HarmonyOS difference or blocker.
|
|
40
|
+
|
|
41
|
+
Use the safe item update interface instead of editing a report shard directly:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
droid2hmos report update <android-project> --ref <ref> [--status <status>] [--harmony-file <path>...] [--evidence <path>...] [--difference <text>|--clear-difference]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The command must resolve exactly one existing ref and may change only the four mutable fields above. It validates referenced project files before writing. `discoveries.json`, `summary.json`, and `final-acceptance.json` remain deliberate semantic records and may be edited directly according to their schemas; validate them immediately afterward.
|
|
48
|
+
|
|
49
|
+
Use statuses strictly:
|
|
50
|
+
|
|
51
|
+
- `pending`: not implemented.
|
|
52
|
+
- `implemented`: a real implementation file exists, but item-specific verification is incomplete.
|
|
53
|
+
- `verified`: a real implementation exists and relevant test evidence has been recorded.
|
|
54
|
+
- `blocked`: completion is impossible for the reason in `difference`.
|
|
55
|
+
|
|
56
|
+
Example:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"ref": "interaction.open-settings",
|
|
61
|
+
"kind": "interaction",
|
|
62
|
+
"factLabel": "打开设置页",
|
|
63
|
+
"status": "verified",
|
|
64
|
+
"harmonyosFiles": ["ohos/entry/src/main/ets/pages/MainActivity.ets"],
|
|
65
|
+
"testEvidence": [".migration/evidence/managed/test-harmony-targeted-<fingerprint>.json"],
|
|
66
|
+
"difference": null
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The same HarmonyOS file may legitimately appear on several related facts. This small repetition is intentional traceability, not a request for prose. For an interaction, point to the file containing executable open/navigation/result wiring.
|
|
71
|
+
|
|
72
|
+
## Record analyzer omissions
|
|
73
|
+
|
|
74
|
+
When Android source proves that deterministic facts missed a page, control, entry, interaction, or business feature, append it to `.migration/report/discoveries.json`. Include a unique `discovered.*` ref, kind, concise label, Android source evidence, implementation files, status, test evidence, and optional difference. Do not inject it into `spec/facts`.
|
|
75
|
+
|
|
76
|
+
## Validate continuously
|
|
77
|
+
|
|
78
|
+
After updating report shards, run:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
droid2hmos report validate <android-project>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Repair every structural, reference, mapping, or evidence error before continuing. `valid: true, complete: false` is acceptable during migration.
|
|
85
|
+
|
|
86
|
+
Before claiming the entire migration complete, run:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
droid2hmos test harmony <android-project> --all --target <device-id> --ref <report-ref> [--ref <report-ref>...]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run the real HAP on a Preflight-verified HarmonyOS emulator or physical device and execute application-wide end-to-end functional test cases from the real entry. List only report items and final-acceptance items actually asserted by the suite with `--ref`; never copy every ref merely to pass the gate. When multiple devices are available, specify `--target`; long cases may use `--case-timeout-ms`. If a precondition is unavailable, the case must fail or be explicitly marked ignored by Hypium—never return early and appear to pass. Diagnostic probes that catch exceptions must still assert required capabilities. The command succeeds only when the structured Hypium report has a non-zero execution count and no failures, errors, or ignored cases. Finish `final-acceptance.json` only after these tests pass:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"reportShardVersion": "1.2.0",
|
|
97
|
+
"kind": "final-acceptance",
|
|
98
|
+
"status": "passed",
|
|
99
|
+
"tests": [
|
|
100
|
+
{
|
|
101
|
+
"ref": "acceptance.create-note-from-launcher",
|
|
102
|
+
"name": "从启动页进入首页并完成新增笔记",
|
|
103
|
+
"status": "passed",
|
|
104
|
+
"evidence": [".migration/evidence/managed/test-harmony-all-<fingerprint>.json"]
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"blockers": [],
|
|
108
|
+
"notes": ["在 HarmonyOS 模拟器上从真实应用入口验证"]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Every passed test needs a stable, unique `ref`, and the evidence receipt's `scope.coveredRefs` must contain that ref. `status: passed` is invalid when tests are empty, any test failed, evidence does not match the current source, facts, or device, an archive is damaged, or blockers remain.
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
droid2hmos complete <android-project>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This command re-derives all facts and enforces a non-bypassable completion gate. It requires a passing Preflight and HarmonyOS device, Android analysis evidence that still matches the current source and facts, a structurally and semantically complete report, a full-regression receipt whose structured result passes and matches the current HarmonyOS source, facts, and target device, and fresh, intact managed evidence that explicitly covers the ref of every `verified` claim, discovery, and final-acceptance test. When denied, read the returned `completion.unmet` unchanged, repair the stated cause, and run it again; do not rewrite the denial as a generic error. Do not claim completion unless it exits successfully. Independently inspect the application when acceptance requires human or visual judgment.
|
|
119
|
+
|
|
120
|
+
## Generate the user-facing report
|
|
121
|
+
|
|
122
|
+
The JSON shards are the machine-verifiable ledger, not the user deliverable. After validation, generate the Chinese HTML report entirely from the ledger and deterministic facts:
|
|
123
|
+
|
|
124
|
+
Before final rendering, fill `.migration/report/summary.json`. This is the only free-form user summary. Keep it useful and concise; it has only three mandatory questions:
|
|
125
|
+
|
|
126
|
+
- `summary`: What was migrated and how usable is the result?
|
|
127
|
+
- `incomplete`: What remains incomplete, why, and what is its user impact? Use an empty array only when nothing remains.
|
|
128
|
+
- `nextSteps`: What must the user do next? Use an empty array when no action is needed.
|
|
129
|
+
|
|
130
|
+
`additionalSections` is optional. Use it freely for meaningful information such as important platform differences, migration highlights, risks, or usage notes. Do not manually repeat counts, page lists, mappings, tests, or blockers that the renderer derives from the ledger.
|
|
131
|
+
|
|
132
|
+
Before writing the summary, run `report validate` and read `.migration/report/validation.json`. The summary must agree with the machine result:
|
|
133
|
+
|
|
134
|
+
- If `complete` is false or final acceptance is not `passed`, explicitly call the result partial/incomplete and never say “fully migrated”, “complete”, “all implemented”, or “zero remaining”.
|
|
135
|
+
- Describe unresolved and blocked behavior as incomplete when it has observable user impact. Do not relabel pending analyzer findings as harmless without recording a decision in `unresolved.json`.
|
|
136
|
+
- Do not copy calculated counts into prose. The renderer owns counts, percentages, completion state, and the technical incomplete inventory.
|
|
137
|
+
- `final-acceptance.json` contains only the documented fields. Blockers and notes are concise strings; do not add run IDs, commit hashes, nested blocker objects, or alternative legacy fields.
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"summary": "主要功能已迁移并完成模拟器端到端验证。",
|
|
142
|
+
"incomplete": [],
|
|
143
|
+
"nextSteps": ["发布前在 DevEco Studio 配置正式签名。"],
|
|
144
|
+
"additionalSections": [
|
|
145
|
+
{ "title": "平台差异", "content": "后台任务已改用 HarmonyOS 对应机制。" }
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
droid2hmos complete <android-project>
|
|
152
|
+
droid2hmos report render <android-project>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Render the final `.migration/report/report.html` only after `complete` succeeds. Before completion, `report render` may produce a stage/progress report, which must be labeled explicitly. Do not ask AI to rewrite the same content as a separate prose report. The user-facing body prioritizes result, incomplete behavior, next steps, tests, differences, and blockers. Page/control/entry/navigation mappings, refs, files, and other technical evidence are auxiliary proof and belong only in the collapsed technical trace appendix.
|