@buaa_smat/hometrans 26.0.4 → 26.0.5

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.
Files changed (102) hide show
  1. package/agents/code-reviewer.md +2 -0
  2. package/agents/model-render-worker.md +1 -1
  3. package/i18n/agents/code-reviewer.md +2 -0
  4. package/i18n/agents/model-render-worker.md +1 -1
  5. package/i18n/skills/a2h-app-migrate/SKILL.md +51 -3
  6. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +140 -32
  7. package/i18n/skills/a2h-app-migrate/scripts/dag_graph.mjs +297 -0
  8. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +134 -21
  9. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +21 -4
  10. package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +3 -3
  11. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  12. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +1 -1
  13. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +12 -5
  14. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +7 -8
  15. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -1
  16. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +27 -15
  17. package/i18n/skills/a2h-batch-ui-align/SKILL.md +1 -1
  18. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +4 -0
  19. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +36 -0
  20. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +4 -0
  21. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +4 -0
  22. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +3 -3
  23. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +8 -0
  24. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_in_linear.ts +164 -0
  25. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/self_drawn_sheet.ts +105 -0
  26. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/staggered_lanes.ts +127 -0
  27. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_size_constant.ts +114 -0
  28. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +4 -1
  29. package/i18n/skills/a2h-page-specgen/references/spec-example.md +35 -5
  30. package/i18n/skills/a2h-page-specgen/references/spec-template.md +4 -4
  31. package/i18n/skills/a2h-spec-generate/SKILL.md +3 -1
  32. package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +15 -3
  33. package/i18n/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  34. package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +16 -0
  35. package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +16 -0
  36. package/i18n/skills/a2h-spec-generate/references/spec-samples.md +5 -1
  37. package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +21 -1
  38. package/i18n/skills/a2h-spec-generate/references/worker-rules.md +25 -2
  39. package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +121 -6
  40. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +2 -1
  41. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +3 -0
  42. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +16 -2
  43. package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +11 -2
  44. package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +35 -0
  45. package/package.json +1 -1
  46. package/skills/a2h-app-migrate/SKILL.md +53 -5
  47. package/skills/a2h-app-migrate/references/workflow.yaml +140 -32
  48. package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +226 -0
  49. package/skills/a2h-app-migrate/scripts/dag_graph.mjs +297 -0
  50. package/skills/a2h-app-migrate/scripts/dag_process_executor.mjs +199 -0
  51. package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +897 -0
  52. package/skills/a2h-app-migrate/scripts/dag_runner.mjs +1767 -0
  53. package/skills/a2h-app-migrate/scripts/ledger.mjs +15 -2
  54. package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +8 -2
  55. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -8
  56. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +134 -21
  57. package/skills/a2h-app-migrate/test/test_dag_complete.mjs +222 -0
  58. package/skills/a2h-app-migrate/test/test_dag_production.mjs +670 -0
  59. package/skills/a2h-app-migrate/test/test_dag_runner.mjs +423 -0
  60. package/skills/a2h-app-migrate/test/test_finalize.mjs +21 -4
  61. package/skills/a2h-app-migrate/test/test_image_probe.mjs +1 -1
  62. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +16 -1
  63. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +1 -1
  64. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +12 -5
  65. package/skills/a2h-arkts-logic-coder/SKILL.md +7 -8
  66. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -1
  67. package/skills/a2h-arkts-logic-coder/references/code-generation.md +27 -15
  68. package/skills/a2h-batch-ui-align/SKILL.md +1 -1
  69. package/skills/a2h-batch-ui-align/references/cards/widgets.md +4 -0
  70. package/skills/a2h-batch-ui-align/references/checker-rules.md +36 -0
  71. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +4 -0
  72. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +4 -0
  73. package/skills/a2h-batch-ui-align/references/step5-convert.md +3 -3
  74. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +49 -3
  75. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +36 -0
  76. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +8 -0
  77. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
  78. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_in_linear.ts +164 -0
  79. package/skills/a2h-batch-ui-align/scripts/static_check/rules/self_drawn_sheet.ts +105 -0
  80. package/skills/a2h-batch-ui-align/scripts/static_check/rules/staggered_lanes.ts +127 -0
  81. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_size_constant.ts +114 -0
  82. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_ds1123.test.mjs +433 -0
  83. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_in_linear.test.mjs +288 -0
  84. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +46 -0
  85. package/skills/a2h-page-specgen/references/scenario-authoring.md +4 -1
  86. package/skills/a2h-page-specgen/references/spec-example.md +35 -5
  87. package/skills/a2h-page-specgen/references/spec-template.md +4 -4
  88. package/skills/a2h-spec-generate/SKILL.md +3 -1
  89. package/skills/a2h-spec-generate/references/fusion-task-contract.md +15 -3
  90. package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  91. package/skills/a2h-spec-generate/references/spec-sample-complex.md +16 -0
  92. package/skills/a2h-spec-generate/references/spec-sample-transfer.md +16 -0
  93. package/skills/a2h-spec-generate/references/spec-samples.md +5 -1
  94. package/skills/a2h-spec-generate/references/synthesis-rules.md +21 -1
  95. package/skills/a2h-spec-generate/references/worker-rules.md +25 -2
  96. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +3 -1
  97. package/skills/a2h-spec-generate/scripts/check_spec.ts +262 -6
  98. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +12 -2
  99. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +3 -0
  100. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +16 -2
  101. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +54 -3
  102. package/skills/a2h-spec-generate/test/check-spec.test.ts +247 -0
@@ -384,6 +384,8 @@ Fix every issue the review report lists, plus the Remaining Issues rows of `carr
384
384
 
385
385
  **Permissions are allowlisted.** A missing-permission finding is fixed in `module.json5` `requestPermissions` only with a name that appears in the pipeline's `references/permission-index.json` (`a2h-spec-design-pipeline`; read it, do not guess) **and** is not `"restricted": true` there. A name absent from the index (an invented or misspelled permission) or a restricted (ACL) permission is never written: list it under Remaining Issues as `permission <name>: not in permission-index` / `restricted (ACL) — needs a manual application`, exactly as B2's wiring step and F0 skip them. Append only; never rewrite or reorder the existing entries.
386
386
 
387
+ **A fix that adds or removes a visible element checks the Android render branch first.** A spec step such as "the bottom shows the load-more footer" can come from a ViewModel assignment that the Android UI never draws in that state. When `android_project_path` is available, before adding or removing a visible element, open the Android UI code for that state (the Compose `when (state)` / `if` branch, View `visibility`, the adapter's item types) and confirm the element is drawn there. If the Android branch does not draw it, do not change the code: list the row under Remaining Issues as `spec contradicts Android render: <spec step> vs <android file:line>`, so the spec is corrected instead of the app. Observed miss: a spec said an empty order tab "shows the pull-to-load initial state at the bottom" because the Android ViewModel sets `PullToLoad` on an empty first page; Android's `Empty` branch draws only `EmptyData`, the fix added the footer anyway, and every empty tab gained a "pull up to load more" line.
388
+
387
389
  **Do not revert a legitimate deviation.** A detail recorded in `commit-info.md`'s `## Spec 偏差` (search `<harmonyos_project_path>/.hometrans/spec_group_*/chunk_*/commit-info.md`) was filled from the Android source because the spec left it uncertain: when `android_project_path` is available, check the anchor and keep that behavior; change it only when the basis no longer holds (the anchor is unrelated, the spec actually settles the detail, or the report shows the implementation is wrong), and re-record the row when you do.
388
390
 
389
391
  ## Step F2 — Build Once
@@ -29,7 +29,7 @@ Rules:
29
29
  4. Copy `taskId` and `inputFingerprint` verbatim from `task.md` / `expected.json`. Every citation must be verified by reading the file with line numbers; never estimate an anchor. When evidence is insufficient, record it honestly instead of guessing, and never fabricate a citation.
30
30
  5. **Never write identity.** No `控件:<controlRef>` line and no `controlRef` field anywhere — submit structured `identityAnchor`/`identityAnchors` only; Node derives the final stable IDs. `controlGroupKey` is a local label, not an identity.
31
31
  6. You are the page owner: one user-visible flow = one area-owned SPEC, and every area SPEC needs a `dataFlow` row (entry, data sources, transforms, displayed values, persistence) plus a `pageCoverage` ledger assigning every `controlGroup`/`discovery` to an existing `specStem` or an explicit exclusion reason (R4/R8). Multiple `owner.kind: "area"` SPECs are allowed, one per flow; a duplicate controlGroup/discovery binding fails R7. Fabricated citations and promoted `unknown`/unresolved fields fail the self-check.
32
- 7. **Display-SPEC completeness (R6) and displayed-value derivations (R6a) are required, not optional**: after reconciling, re-check from source what the Area renders/displays exactly as task.md's R6 defines — including when the Area captured no interactions at all. Every numeric/text field states its source field, window, aggregation, rounding, sign and unit conversion. Never emit a behavior without a citation (R5).
32
+ 7. **Display-SPEC completeness (R6) and displayed-value derivations (R6a) are required, not optional**: after reconciling, re-check from source what the Area renders/displays exactly as task.md's R6 defines — including when the Area captured no interactions at all. Every numeric/text field states its source field, window, aggregation, rounding, sign and unit conversion, and the rule must determine exactly one result: when a different order gives a different number (round each operand then subtract vs subtract then round), when the rounding mode changes the value (half-up, truncation, negative halves), or when the time basis changes the slot (nearest series index vs floor, which timezone), write that choice out. List the fields one by one — never summarise several fields as "every record" or "each value", and never leave a field out because it shares a sentence with a neighbour. Attach one worked example to each derived numeric field (concrete input → concrete output); an example that disagrees with the rule, or a rule you cannot exemplify, means the derivation is not understood: reread the source and rewrite it. **R6b (state space)**: a page-flow SPEC writes `## 状态清单` between `## UI序列` and the first scenario, one row per state — `- <state>: <what the user sees>`. All eight states need a row: first frame, loading, success, empty data, insufficient data, failure, non-default locale, return after leaving. A state this page cannot reach still gets a row — `- Loading: not applicable (why)` — never omitted and never blank. Write the visible result, or "keeps the last successful data"; never "otherwise nothing updates". The first frame and the non-default locale carry the real literal. Never emit a behavior without a citation (R5).
33
33
  8. Run the self-check command `task.md` inlines — the spec skill's `check-fused-spec.mjs` (`check-fused-spec.mjs --run <run> --task <id> --reqgen-root <reqgen-root>`). It first runs `check-fusion`, which validates the fused draft and writes the validated `draft.json` beside your output (L1 mints no ids; the canonical `controlRef` is resolved at global L2 from the anchors), then validates every SPEC your `specs[]` declares. Fix every reported error and re-run it. The task is complete only when that command reports the draft and all SPECs valid.
34
34
  9. Do not spawn subagents or nested tasks.
35
35
  10. Do not run Gradle, Android Lint, adb, emulators, or any build tool.
@@ -386,6 +386,8 @@ Fix every issue the review report lists, plus the Remaining Issues rows of `carr
386
386
 
387
387
  **Permissions are allowlisted.** A missing-permission finding is fixed in `module.json5` `requestPermissions` only with a name that appears in the pipeline's `references/permission-index.json` (`a2h-spec-design-pipeline`; read it, do not guess) **and** is not `"restricted": true` there. A name absent from the index (an invented or misspelled permission) or a restricted (ACL) permission is never written: list it under Remaining Issues as `permission <name>: not in permission-index` / `restricted (ACL) — needs a manual application`, exactly as B2's wiring step and F0 skip them. Append only; never rewrite or reorder the existing entries.
388
388
 
389
+ **A fix that adds or removes a visible element checks the Android render branch first.** A spec step such as "the bottom shows the load-more footer" can come from a ViewModel assignment that the Android UI never draws in that state. When `android_project_path` is available, before adding or removing a visible element, open the Android UI code for that state (the Compose `when (state)` / `if` branch, View `visibility`, the adapter's item types) and confirm the element is drawn there. If the Android branch does not draw it, do not change the code: list the row under Remaining Issues as `spec contradicts Android render: <spec step> vs <android file:line>`, so the spec is corrected instead of the app. Observed miss: a spec said an empty order tab "shows the pull-to-load initial state at the bottom" because the Android ViewModel sets `PullToLoad` on an empty first page; Android's `Empty` branch draws only `EmptyData`, the fix added the footer anyway, and every empty tab gained a "pull up to load more" line.
390
+
389
391
  **Do not revert a legitimate deviation.** A detail recorded in `commit-info.md`'s `## Spec deviations` (search `<harmonyos_project_path>/.hometrans/spec_group_*/chunk_*/commit-info.md`) was filled from the Android source because the spec left it uncertain: when `android_project_path` is available, check the anchor and keep that behavior; change it only when the basis no longer holds (the anchor is unrelated, the spec actually settles the detail, or the report shows the implementation is wrong), and re-record the row when you do.
390
392
 
391
393
  ## Step F2 — Build Once
@@ -29,7 +29,7 @@ Rules:
29
29
  4. Copy `taskId` and `inputFingerprint` verbatim from `task.md` / `expected.json`. Every citation must be verified by reading the file with line numbers; never estimate an anchor. When evidence is insufficient, record it honestly instead of guessing, and never fabricate a citation.
30
30
  5. **Never write identity.** No `Control: <controlRef>` line and no `controlRef` field anywhere — submit structured `identityAnchor`/`identityAnchors` only; Node derives the final stable IDs. `controlGroupKey` is a local label, not an identity.
31
31
  6. You are the page owner: one user-visible flow = one area-owned SPEC, and every area SPEC needs a `dataFlow` row (entry, data sources, transforms, displayed values, persistence) plus a `pageCoverage` ledger assigning every `controlGroup`/`discovery` to an existing `specStem` or an explicit exclusion reason (R4/R8). Multiple `owner.kind: "area"` SPECs are allowed, one per flow; a duplicate controlGroup/discovery binding fails R7. Fabricated citations and promoted `unknown`/unresolved fields fail the self-check.
32
- 7. **Display-SPEC completeness (R6) and displayed-value derivations (R6a) are required, not optional**: after reconciling, re-check from source what the Area renders/displays exactly as task.md's R6 defines — including when the Area captured no interactions at all. Every numeric/text field states its source field, window, aggregation, rounding, sign and unit conversion. Never emit a behavior without a citation (R5).
32
+ 7. **Display-SPEC completeness (R6) and displayed-value derivations (R6a) are required, not optional**: after reconciling, re-check from source what the Area renders/displays exactly as task.md's R6 defines — including when the Area captured no interactions at all. Every numeric/text field states its source field, window, aggregation, rounding, sign and unit conversion, and the rule must determine exactly one result: when a different order gives a different number (round each operand then subtract vs subtract then round), when the rounding mode changes the value (half-up, truncation, negative halves), or when the time basis changes the slot (nearest series index vs floor, which timezone), write that choice out. List the fields one by one — never summarise several fields as "every record" or "each value", and never leave a field out because it shares a sentence with a neighbour. Attach one worked example to each derived numeric field (concrete input → concrete output); an example that disagrees with the rule, or a rule you cannot exemplify, means the derivation is not understood: reread the source and rewrite it. **R6b (state space)**: a page-flow SPEC writes `## 状态清单` between `## UI序列` and the first scenario, one row per state — `- <state>: <what the user sees>`. All eight states need a row: first frame, loading, success, empty data, insufficient data, failure, non-default locale, return after leaving. A state this page cannot reach still gets a row — `- Loading: not applicable (why)` — never omitted and never blank. Write the visible result, or "keeps the last successful data"; never "otherwise nothing updates". The first frame and the non-default locale carry the real literal. Never emit a behavior without a citation (R5).
33
33
  8. Run the self-check command `task.md` inlines — the spec skill's `check-fused-spec.mjs` (`check-fused-spec.mjs --run <run> --task <id> --reqgen-root <reqgen-root>`). It first runs `check-fusion`, which validates the fused draft and writes the validated `draft.json` beside your output (L1 mints no ids; the canonical `controlRef` is resolved at global L2 from the anchors), then validates every SPEC your `specs[]` declares. Fix every reported error and re-run it. The task is complete only when that command reports the draft and all SPECs valid.
34
34
  9. Do not spawn subagents or nested tasks.
35
35
  10. Do not run Gradle, Android Lint, adb, emulators, or any build tool.
@@ -10,10 +10,56 @@ This skill is a **thin executor** for the declarative graph in [references/workf
10
10
  **The single authority on topology, gates, invoke, artifact contracts and failure policy:** `references/workflow.yaml` (especially `policy.*` + the node DAG).
11
11
  Artifact sources of truth / CLI contract quick reference: [references/stage-map.md](references/stage-map.md).
12
12
 
13
- Load the yaml → trim by `PROFILE` → advance by each node's `needs` / `invoke` / `dispatch`; sub-agents return JSON; MANIFEST / LEDGER are maintained by the executor. Do not restate the details in this file.
13
+ Load the yaml → trim by `PROFILE` → let the production DAG Runner advance each node's `needs`, while semantic `invoke` work is handed to the current host; sub-agents return JSON; the production executor initializes MANIFEST, and the Runner exclusively commits LEDGER and node terminal states. Do not restate the details in this file.
14
14
 
15
15
  **No voluntary stop for context budget** — the model must not end the run on its own because of the context budget (`policy.context_budget`). The context window, remaining tokens, a growing session or compaction are not stop conditions.
16
16
 
17
+ ## Deterministic DAG Runner (production entry)
18
+
19
+ Every node in the real `workflow.yaml` is advanced by the Node state machine: topology, variables, artifact validation, failure policy, ledger and the unique `run_end` belong to the Runner; `dag_production_executor.mjs` only executes the current node's deterministic actions or hands semantic work to the current host. Production runs select this executor automatically, need no `--executor-command`, and do not enable parallel scheduling.
20
+
21
+ ```bash
22
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_runner.mjs run \
23
+ --workflow ${SKILLS_ROOT}/a2h-app-migrate/references/workflow.yaml \
24
+ --run-dir <DAG_RUN_DIR> --profile full \
25
+ --vars '{"ANDROID":"<ANDROID>","HMOS":"<HMOS>"}'
26
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_runner.mjs continue --state <DAG_RUN_DIR>/dag-run-state.json
27
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_runner.mjs status --state <DAG_RUN_DIR>/dag-run-state.json
28
+ ```
29
+
30
+ `DAG_RUN_DIR` stores only Runner state, attempt requests/results and action cursors; it must be separate from production `${WORK}`, `${RUN_DIR}` and `${HMOS}`. Do not write production directories before preflight passes; `run_start` is committed only after `boot.workspace` succeeds. `continue` resumes the same `run_id`; a committed action cursor is inherited only for Runner interruption recovery, while business retries and review rewinds use a new cursor.
31
+
32
+ Every `run` / `continue` / `complete` / `confirm` / `rewind` stdout includes `presentation`. Before handling a wait, the host must refresh the fixed progress block from `policy.user_facing` in `events` order: render the full checklist from `checklist` and current `nodes`; select the sentence for `doing` / `terminal` from `event.user_facing`, status, reason/evidence; immediately give the user the warning requested by a `notice` event's `event.text`. Merge multiple events from one response into one checklist instead of flooding separate messages. Announce a terminal state only after the Runner returns `terminal`, never merely because the executor returned `ok:true`; `status` does not replay historical events.
33
+
34
+ ### Host handling of waits and callbacks
35
+
36
+ When `run` / `continue` returns `waiting_external`, read `wait.kind` from the current attempt's `<file_id>.request.json`:
37
+
38
+ - `skill`: the primary session loads `wait.skill` and executes `wait.invoke` as `primary_skill_inline`; never substitute a shell worker for the Skill.
39
+ - `host_action`: the current host performs signing adoption, the final report or another host action.
40
+ - `config`: collect startup configuration from the user. `image_read`: strictly follow `wait.instructions` and launch a one-shot foreground sub-agent to read images. These two use the executor's `answer` callback; the others use `complete`.
41
+
42
+ After a Skill / host action finishes, write `{"attempt_id":"<id>","ok":true,"set_vars":{}}`; on failure write `ok:false` and a non-empty `reason`. Then run:
43
+
44
+ ```bash
45
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_production_executor.mjs complete \
46
+ --request <DAG_RUN_DIR>/attempts/<file_id>.request.json --outcome <outcome.json>
47
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_runner.mjs complete \
48
+ --state <DAG_RUN_DIR>/dag-run-state.json --attempt-id <id> \
49
+ --result-file <DAG_RUN_DIR>/attempts/<file_id>.result.json
50
+ ```
51
+
52
+ For config / image-read answers, replace the executor subcommand with `answer --answer <answer.json>`, then call Runner `complete` as above. The executor produces only the strict result; the host must not append node terminal states, `run_start` or `run_end`. Stale attempts, invalid results and early executor exits block the run; never record them as business soft failures or pretend they completed. Only a contract script exiting non-zero by contract (including capture_audit / gate scripts) and a host `ok:false` count as business failed; executor protocol errors, config errors (e.g. `INVALID_SKILL`, `INVALID_SET_VARS`) and implementation gaps (`UNSUPPORTED_*`) always exit non-zero without a result, and the Runner blocks.
53
+
54
+ `waiting_human` can advance only through a real gate confirmation or a bounded rewind, not a normal `complete` bypass:
55
+
56
+ ```bash
57
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_runner.mjs confirm --state <DAG_RUN_DIR>/dag-run-state.json --node review.arch --confirmed-by user
58
+ node ${SKILLS_ROOT}/a2h-app-migrate/scripts/dag_runner.mjs rewind --state <DAG_RUN_DIR>/dag-run-state.json --node review.arch
59
+ ```
60
+
61
+ `rewind` reruns only the current gate's `runner.rewind_to` and its downstream, clears the corresponding REUSE variables and increments generation. `FROM_NODE` resume uses a new DAG control directory and `run --resume-from <node> --base-profile <profile>`, retains production `${WORK}` / `${LEDGER}`, and still follows `planResume()` profile, SPEC_ENGINE, artifact-probe and inheritance rules. If a hard_stop has `error.ledger_started` false (it stopped before run_start, so the ledger has no record of this run), do not use `--resume-from`; fix the cause per `error.hint` and start a fresh `run`.
62
+
17
63
  ---
18
64
 
19
65
  ## Parameters
@@ -155,7 +201,9 @@ See workflow.yaml → `observability`.
155
201
  | `scripts/env_preflight.mjs` | Startup preflight / one-click customer self-check (fills in work/run-dir/ui-info-root by default); fixed serial |
156
202
  | `scripts/infer_android_root.mjs` | At entry, determines the Android project root from the APK path prefix (substitutes it when the given path is not the project root, before preflight) |
157
203
  | `scripts/paths_preflight.mjs` | Path submodule |
158
- | `scripts/validate_workflow.mjs` | Static self-check of workflow.yaml |
204
+ | `scripts/validate_workflow.mjs` | Static self-check of workflow.yaml (including every production node's Runner kind, fixed order, reuse/skip, gates and finalize ownership) |
205
+ | `scripts/dag_runner.mjs` | Production DAG state machine; exclusively owns node terminal states, resume/rewind, ledger commits and the unique run_end |
206
+ | `scripts/dag_production_executor.mjs` | Production node action driver; deterministic scripts, per-action cursors, Skill/config/image/host_action waits and strict callbacks |
159
207
  | `scripts/human_review_gate.mjs` | Human gates (arch / spec_gen / ui_batch) |
160
208
  | `scripts/run_dir.mjs` | Run directory for spec generation: `--show` reads the pointer / decides between resuming and creating a new one (`--fresh`) / `--record` takes the actual directory as authoritative (pointer `${WORK}/reqgen/current.json` records the current one) |
161
209
  | `scripts/spec_layout.mjs` | The single implementation of the enrich.spec_gen artifact layout (`<run>/generation/pages` page-grouped root, location of specs.json); both engines share that publish root (page-specgen's private workspace also lives under the root) |
@@ -163,7 +211,7 @@ See workflow.yaml → `observability`.
163
211
  | `scripts/check_spec_pipeline_done.mjs` | Completion check for logic.spec_pipeline (all groups terminal, no unfinished chunks, Finalization has written `state.finalization` **with both gate markers** `finalization.homecheck` / `finalization.smoke` — `done` alone is not completion; all failed → exit 3; hard fingerprint `specs_json_sha256`/paths mismatch → exit 4; soft knobs like `wave_width` go to `soft_stale` only and do not archive; `--archive-stale` / `--archive-failed` archive only on exit 4/3 so before_run can start a new round) |
164
212
  | `scripts/check_module_docs_done.mjs` | Completion check for enrich.module_docs (`--mark` records the start time; the state file must be no older than it — the state file is the incremental baseline and is kept across runs) |
165
213
  | `scripts/check_ui_batch_done.mjs` | Probe 4: whether ui.batch is reusable (batch_report.md exists, batch_progress.json's mode is full, no pending pages) |
166
- | `scripts/ledger.mjs` | Reads/writes `${LEDGER}`: append only, kept across runs; `--start` records run_start, `--node … --status` records a node's terminal state, `--failures` lists this run's soft failures |
214
+ | `scripts/ledger.mjs` | Reads/writes `${LEDGER}`: append only, kept across runs; supports `--start` / `--node … --status` / `--failures`; in production only the Runner commits run_start, node terminal states and the unique run_end, never the host directly |
167
215
  | `scripts/diagnose.mjs` | Incremental start-up diagnosis (read-only): scenario 1 / 2 / 3, reuse / repair / rebuild per artifact, migrated pages whose source changed and new pages, the scope `SCOPE=auto` recommends |
168
216
  | `scripts/source_fp.mjs` | Per-page Android source fingerprint (UTG anchors + referenced layouts, line endings normalised); written into the ledger at finalize, so the diagnosis finds migrated pages whose source changed |
169
217
  | `scripts/migration_manifest.mjs` | logic.finalize step 4: merges this round's UI / business-logic status per UTG page id into `${HMOS}/.hometrans/migration_manifest.json` (kept across runs and scopes; a failed retry never overwrites a migrated record; never fails the node) |
@@ -6,6 +6,27 @@ version: 2
6
6
  id: a2h-app-migrate
7
7
  skill_root_var: SKILLS_ROOT
8
8
 
9
+ # Ready-node ordering for the deterministic Runner; adds no dependencies and does not enable parallel scheduling.
10
+ serial_order:
11
+ - bootstrap
12
+ - discover.android_index
13
+ - boot.workspace
14
+ - discover.arch
15
+ - discover.utg_static
16
+ - review.arch
17
+ - discover.utg_snapshot
18
+ - discover.feature_scope
19
+ - ui.batch
20
+ - review.ui_batch
21
+ - enrich.spec_gen
22
+ - review.spec_gen
23
+ - enrich.module_docs
24
+ - barrier.l2_enrich
25
+ - adopt.signing
26
+ - adopt.specs_json
27
+ - logic.spec_pipeline
28
+ - logic.finalize
29
+
9
30
  policy:
10
31
  # ui.batch is the only device:true node in the whole graph (Android device, adb), so "at most 1 device at a time" is currently guaranteed by the topology itself.
11
32
  # The HarmonyOS-side cold-start smoke test (hdc) runs once each in discover.arch G10 / ui.batch Step 6.3 / the spec_pipeline wrap-up:
@@ -66,17 +87,18 @@ policy:
66
87
  failure_semantics: |
67
88
  hard_stop: node fails -> the whole pipeline stops, reporting the failure reason and how to resume.
68
89
  hard_stop_unless_logic_skipped: same as hard_stop; but when SKIP_LOGIC is true (or the profile has force_skipped the logic chain) it is treated as skipped.
69
- ledger: ${LEDGER} is append-only and kept across runs (profile=resume relies on it to know the original run's profile and each node's terminal state). boot.workspace records run_start;
70
- **every node** records one line when it reaches a terminal state: node ${SKILLS_ROOT}/a2h-app-migrate/scripts/ledger.mjs --ledger ${LEDGER} --node <id>
71
- --status done|reused|skipped|failed [--reason <reason>] (skipped because artifacts are reused -> reused; skipped via skip_if / force_skip -> skipped).
72
- Before a node **starts** running (after the skip / reuse decision, before its first action) record `ledger.mjs --ledger ${LEDGER} --node <id> --begin`;
73
- the terminal line then carries started_at / duration_s. Record a terminal state as soon as it is reached, never in a batch later; deferring is allowed only while the ledger cannot be written yet:
74
- bootstrap records done after boot.workspace writes run_start, and must pass --started-at <ISO time bootstrap started> (note it when starting).
75
- ui.batch / enrich.spec_gen / logic.spec_pipeline: the **same** ledger.mjs command that records the terminal state also writes the resume summary
76
- (ledger.mjs calls write_resume_summary with the status it just wrote, run_at = this round's run_start.at); do not run it separately:
77
- ui.batch → ... --node ui.batch --status <s> --work ${WORK} --hmos ${HMOS}
78
- enrich.spec_gen → ... --node enrich.spec_gen --status <s> --work ${WORK} --run-dir ${RUN_DIR}
79
- logic.spec_pipeline → ... --node logic.spec_pipeline --status <s> --work ${WORK} --hmos ${HMOS}
90
+ ledger: ${LEDGER} is append-only and kept across runs (profile=resume relies on it to know the original run's profile and each node's terminal state). After boot.workspace succeeds, the Runner records run_start;
91
+ **every node** has its terminal line submitted by the Runner through ledger.mjs (equivalent arguments: --ledger ${LEDGER} --node <id>
92
+ --status done|reused|skipped|failed [--reason <reason>]; skipped because artifacts are reused -> reused; skipped via skip_if / force_skip -> skipped).
93
+ Before a node **starts** running (after the skip / reuse decision, before its first action), the Runner records the equivalent of `--node <id> --begin`;
94
+ the terminal line then carries started_at / duration_s. Record a terminal state as soon as it is reached, never in a batch later.
95
+ The host and production executor must not append node terminal states, run_start or run_end themselves; bootstrap's done is also submitted only by the Runner after run_start (the ledger cannot be written to disk before that), with its original start time.
96
+ ui.batch / enrich.spec_gen / logic.spec_pipeline: **immediately after** recording the ledger (within the same terminal-state step,
97
+ with the terminal state already fixed) run write_resume_summary.mjs, passing the status just written to the ledger verbatim as --status,
98
+ together with --ledger ${LEDGER} (writes run_at = this round's run_start.at, so the previous round is not misread):
99
+ ui.batch → --work ${WORK} --node ui.batch --hmos ${HMOS} --status <s> --ledger ${LEDGER}
100
+ enrich.spec_gen → --work ${WORK} --node enrich.spec_gen --run-dir ${RUN_DIR} --status <s> --ledger ${LEDGER}
101
+ logic.spec_pipeline → --work ${WORK} --node logic.spec_pipeline --hmos ${HMOS} --status <s> --ledger ${LEDGER}
80
102
  status=skipped -> write an ok:false tombstone (do not project page counts / waves that may still be from the previous round in the leaf);
81
103
  done|failed|reused -> project from the leaf artifacts. If writing fails, try to write a tombstone instead; if that fails too, delete the old file.
82
104
  **Do not** hang it on after_run: success has not been judged then, so --status is not known yet; and the skip path never runs after_run.
@@ -270,7 +292,8 @@ policy:
270
292
  scaffold_new (HMOS does not exist / is empty / contains only .git·.DS_Store·.hometrans; emptiness is judged like create_project, ignoring those three; .hometrans is HomeTrans's own records, moved aside for the shell creation and put back)
271
293
  requires arch to build the shell first, otherwise boot.workspace / utg_static would dirty the directory. Handling: paths_preflight does a non-destructive probe;
272
294
  boot.workspace needs discover.arch when ${SERIALIZE_DISCOVER}; utg_static hangs off boot.workspace.
273
- So existing_project and scaffold_new both run arch -> utg_static (scaffold_new additionally goes through boot.workspace in between).
295
+ So both modes run arch -> utg_static. serial_order puts boot.workspace before arch: under existing_project it runs first and
296
+ commits run_start, so an arch failure still has this run's ledger; under scaffold_new the conditional edge still makes it wait for arch (arch -> boot.workspace -> utg_static).
274
297
  ⚠ validate_workflow performs the race check on maximum parallelism (ignoring conditional_needs).
275
298
 
276
299
  ⚠ The two static UTG directories are always kept separate. discover.utg_static writes ${UTG_DIR} (default ${WORK}/utg_static).
@@ -442,6 +465,7 @@ vars:
442
465
  # decided by run_dir.mjs before enrich.spec_gen starts (an unfinished run is resumed, otherwise a new one is created).
443
466
  # Used as is when the user explicitly gives run_dir=. <run-id> is only a placeholder.
444
467
  RUN_DIR: { required: false, from: run_dir, default: "${WORK}/reqgen/<run-id>", set_by: "run_dir.mjs (pointer ${WORK}/reqgen/current.json)" }
468
+ RUN_DIR_GIVEN: { required: false, default: false, set_true_when: "the user explicitly passes run_dir" }
445
469
  # Private output directory of discover.utg_static. Do **not** set it to ${UI_UTG_DIR}. ui.batch only copies into it; the two nodes never write the same directory.
446
470
  UTG_DIR: { required: false, default: "${WORK}/utg_static" }
447
471
  # UTG directory used by a2h-batch-ui-align (copy target, or write directory when Step 3.1 reruns; Step 3.2 only reads it); not configurable.
@@ -478,6 +502,9 @@ nodes:
478
502
  - id: bootstrap
479
503
  lane: boot
480
504
  type: local
505
+ runner:
506
+ action: production
507
+ kind: bootstrap
481
508
  user_facing:
482
509
  announce: fail_only
483
510
  name: Startup check
@@ -499,7 +526,7 @@ nodes:
499
526
  # would judge with the wrong directory and hard_stop right away. It also comes before probe: PROFILE must first be switched to the original run's profile,
500
527
  # and the later reuse decisions / preflight all follow it.
501
528
  - plan_resume:
502
- when: "${PROFILE} == resume or ${FROM_NODE} != bootstrap"
529
+ when: "${PROFILE} == 'resume' or ${FROM_NODE} != 'bootstrap'"
503
530
  script: "${SKILLS_ROOT}/a2h-app-migrate/scripts/resume_plan.mjs"
504
531
  runner: node
505
532
  args: "--workflow ${SKILLS_ROOT}/a2h-app-migrate/references/workflow.yaml --ledger ${LEDGER} --from-node ${FROM_NODE} [--base-profile ${RESUME_BASE_PROFILE} only when non-empty] --engine ${SPEC_ENGINE} --engine-given ${SPEC_ENGINE_GIVEN}"
@@ -784,7 +811,7 @@ nodes:
784
811
  # Env image-read probe (semantics in policy.image_read). Skip when this run will not run ui.batch (REUSE_UI_BATCH) or IMAGE_READ is already not probe.
785
812
  # Verdict is for tip only — **never** pass it to ui.batch; the leaf Step 1 probes again.
786
813
  - probe_image_read:
787
- skip_when: "${IMAGE_READ} != probe or ${REUSE_UI_BATCH} == true"
814
+ skip_when: "${IMAGE_READ} != 'probe' or ${REUSE_UI_BATCH} == true"
788
815
  steps: |
789
816
  1) node ${SKILLS_ROOT}/a2h-batch-ui-align/scripts/image_probe.mjs prepare --dir <PROBE_DIR>
790
817
  -> stdout is one JSON line {image, state, prompt}. (Shares the same script with a2h-batch-ui-align Step 1; do not pass --hp, the verdict goes only to the orchestrator tip.)
@@ -822,6 +849,9 @@ nodes:
822
849
  - id: boot.workspace
823
850
  lane: boot
824
851
  type: local
852
+ runner:
853
+ action: production
854
+ kind: workspace
825
855
  user_facing:
826
856
  announce: fail_only
827
857
  name: Working directory
@@ -850,7 +880,7 @@ nodes:
850
880
  script: "${SKILLS_ROOT}/a2h-app-migrate/scripts/write_resume_summary.mjs"
851
881
  runner: node
852
882
  args: "--work ${WORK} --clear-stale"
853
- when: "${FROM_NODE} == null or ${FROM_NODE} == '' or ${FROM_NODE} == bootstrap"
883
+ when: "${FROM_NODE} == null or ${FROM_NODE} == '' or ${FROM_NODE} == 'bootstrap'"
854
884
  exit_other: continue
855
885
  success:
856
886
  - all:
@@ -864,6 +894,9 @@ nodes:
864
894
  - id: discover.android_index
865
895
  lane: discover
866
896
  type: local
897
+ runner:
898
+ action: production
899
+ kind: script
867
900
  user_facing:
868
901
  announce: fail_only
869
902
  name: Code index
@@ -888,6 +921,10 @@ nodes:
888
921
  - id: discover.utg_static
889
922
  lane: discover
890
923
  type: skill
924
+ runner:
925
+ action: production
926
+ kind: skill
927
+ reuse_if: "${REUSE_DISCOVER_UTG} == true"
891
928
  # Same Node version as ui.batch Step 3.1 (so page node ids are consistent across the two chains of the same App).
892
929
  skill: a2h-utg-static
893
930
  user_facing:
@@ -897,14 +934,16 @@ nodes:
897
934
  done: "Page relations are sorted out. {nodes} pages, {edges} navigations. Nothing missing. The feature list will use these relations later."
898
935
  failed: "Page relations were not finished: {reason}. Without these relations the feature list cannot be written."
899
936
  reused: "Page relations were not redone this round; the result from last time is reused."
900
- skipped: "No feature list this round, so page relations were not sorted out."
937
+ skipped: "The feature list is not rewritten this round, so page relations were not sorted out."
901
938
  dispatch: "primary_skill_inline"
902
939
  # Hangs off boot.workspace: scaffold_new serialization propagates through it, see policy.parallel_rule.
903
940
  needs: [boot.workspace, discover.android_index]
904
941
  parallel_group: discover_par
905
942
  # The only consumer is discover.utg_snapshot -> enrich.spec_gen (the UI chain uses its own ${UI_UTG_DIR}). When spec generation does not run this round
906
943
  #(skipped / reused / ui-only) it is just a critical path in front of review.arch; do not run it.
907
- skip_if: "${REUSE_DISCOVER_UTG} == true or ${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true or ${PROFILE} == ui-only"
944
+ # REUSE_SPEC_GENERATE is the consumer's reuse (not this node's), so it belongs in skip_if; keep it in sync with discover.utg_snapshot's when.
945
+ # validate_workflow.mjs allows it via CROSS_NODE_REUSE_IN_SKIP_IF; this node's own reuse stays only in runner.reuse_if.
946
+ skip_if: "${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true or ${PROFILE} == 'ui-only'"
908
947
  reads: { android_index: "${ANDROID}/.homegraph/" }
909
948
  writes: { workspace: "${UTG_DIR}/", utg: "${UTG_DIR}/utg.json", click_paths: "${UTG_DIR}/click_paths.json" }
910
949
  # The driver's exit code is not trustworthy: a failed stage still exits 0; checking file existence alone is fooled by Phase B artifacts left from the previous round;
@@ -983,6 +1022,10 @@ nodes:
983
1022
  - id: discover.arch
984
1023
  lane: discover
985
1024
  type: skill
1025
+ runner:
1026
+ action: production
1027
+ kind: skill
1028
+ reuse_if: "${REUSE_DISCOVER_ARCH} == true"
986
1029
  skill: a2h-arch-generate
987
1030
  user_facing:
988
1031
  announce: always
@@ -996,7 +1039,7 @@ nodes:
996
1039
  needs: [bootstrap, discover.android_index]
997
1040
  parallel_group: discover_par
998
1041
  dispatch: "primary_skill_inline"
999
- skip_if: "${REUSE_DISCOVER_ARCH} == true or ${SKIP_DISCOVER_ARCH}"
1042
+ skip_if: "${SKIP_DISCOVER_ARCH}"
1000
1043
  # Clear the gate checkpoint right before actually executing (lifecycle in policy.human_interaction).
1001
1044
  before_run:
1002
1045
  - clear_gate_checkpoint:
@@ -1053,6 +1096,13 @@ nodes:
1053
1096
  - id: review.arch
1054
1097
  lane: discover
1055
1098
  type: adopt
1099
+ runner:
1100
+ action: production
1101
+ kind: gate
1102
+ gate: arch
1103
+ checkpoint: "${CHECKPOINT_DIR}/arch-reviewed.ok"
1104
+ rewind_to: discover.arch
1105
+ rewind_clear_vars: [REUSE_DISCOVER_ARCH]
1056
1106
  needs: [discover.arch, discover.utg_static]
1057
1107
  also_needs_group: discover_par
1058
1108
  human_gate: true
@@ -1091,6 +1141,9 @@ nodes:
1091
1141
  - id: discover.utg_snapshot
1092
1142
  lane: discover
1093
1143
  type: local
1144
+ runner:
1145
+ action: production
1146
+ kind: snapshot
1094
1147
  needs: [review.arch]
1095
1148
  summary: freeze ${UTG_DIR} into ${UTG_SNAPSHOT}, read-only for enrich.spec_gen
1096
1149
  user_facing:
@@ -1117,14 +1170,14 @@ nodes:
1117
1170
  script: "${SKILLS_ROOT}/a2h-app-migrate/scripts/ensure_utg_snapshot.mjs"
1118
1171
  runner: node
1119
1172
  args: "--from ${UTG_DIR} --to ${UTG_SNAPSHOT}"
1120
- when: "not (${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true or ${PROFILE} == ui-only)"
1173
+ when: "not (${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true or ${PROFILE} == 'ui-only')"
1121
1174
  exit_nonzero: hard_stop
1122
1175
  success:
1123
1176
  - any:
1124
1177
  - all:
1125
1178
  - file_exists: "${UTG_SNAPSHOT}/utg.json"
1126
1179
  - file_exists: "${UTG_SNAPSHOT}/click_paths.json"
1127
- - when: "${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true or ${PROFILE} == ui-only"
1180
+ - when: "${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true or ${PROFILE} == 'ui-only'"
1128
1181
  on_fail: hard_stop
1129
1182
 
1130
1183
  # Feature-level incremental scope (hometrans-incremental.html "feature-level increment" F-8): when the input is not a page
@@ -1133,6 +1186,7 @@ nodes:
1133
1186
  - id: discover.feature_scope
1134
1187
  lane: discover
1135
1188
  type: local
1189
+ runner: { action: production, kind: host_action }
1136
1190
  needs: [discover.utg_snapshot]
1137
1191
  summary: resolve a feature description / requirement document / Android version diff / confirmed scope file into a feature-level scope.json (v2)
1138
1192
  user_facing:
@@ -1152,6 +1206,10 @@ nodes:
1152
1206
  - script_exit_0: { runner: node, script: "${SKILLS_ROOT}/a2h-app-migrate/scripts/scope_model.mjs", args: "check ${HMOS}/.hometrans/incremental/scope.json --existing ${HMOS}/.hometrans/incremental/existing.json --ledger ${HMOS}/.hometrans/migration_manifest.json" }
1153
1207
  - when: "${FEATURE_SCOPE} == false"
1154
1208
  - skipped: true
1209
+ actions:
1210
+ - host_action:
1211
+ action: discover_feature_scope
1212
+ reason: Resolve and confirm the incremental scope per invoke; the host settles it under auto and waits for F5 confirmation under interactive
1155
1213
  invoke: |
1156
1214
  Context budget, context window, remaining tokens, a growing session or imminent compaction are not reasons to finish (policy.context_budget).
1157
1215
  First decide the input (in this order, stop at the first hit):
@@ -1181,6 +1239,11 @@ nodes:
1181
1239
  - id: enrich.spec_gen
1182
1240
  lane: enrich
1183
1241
  type: skill
1242
+ runner:
1243
+ action: production
1244
+ kind: skill
1245
+ reuse_if: "${REUSE_SPEC_GENERATE} == true"
1246
+ after_terminal: resume_summary
1184
1247
  skill: ${SPEC_ENGINE} → skill_by_engine
1185
1248
  skill_by_engine: { spec-generate: a2h-spec-generate, page-specgen: a2h-page-specgen }
1186
1249
  user_facing:
@@ -1195,7 +1258,7 @@ nodes:
1195
1258
  parallel_group: post_utg
1196
1259
  dispatch: "primary_skill_inline"
1197
1260
  needs: [discover.utg_snapshot, discover.feature_scope]
1198
- skip_if: "${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE} or ${REUSE_SPEC_GENERATE} == true"
1261
+ skip_if: "${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE}"
1199
1262
  # Clear the gate checkpoint right before actually executing (lifecycle in policy.human_interaction).
1200
1263
  before_run:
1201
1264
  - clear_gate_checkpoint:
@@ -1375,6 +1438,13 @@ nodes:
1375
1438
  - id: review.spec_gen
1376
1439
  lane: adopt
1377
1440
  type: adopt
1441
+ runner:
1442
+ action: production
1443
+ kind: gate
1444
+ gate: spec_gen
1445
+ checkpoint: "${CHECKPOINT_DIR}/spec-gen-reviewed.ok"
1446
+ rewind_to: enrich.spec_gen
1447
+ rewind_clear_vars: [REUSE_SPEC_GENERATE]
1378
1448
  needs: [enrich.spec_gen]
1379
1449
  skip_if: "${SKIP_LOGIC} or ${SKIP_SPEC_GENERATE}"
1380
1450
  human_gate: true
@@ -1414,6 +1484,11 @@ nodes:
1414
1484
  - id: ui.batch
1415
1485
  lane: enrich
1416
1486
  type: skill
1487
+ runner:
1488
+ action: production
1489
+ kind: skill
1490
+ reuse_if: "${REUSE_UI_BATCH} == true"
1491
+ after_terminal: resume_summary
1417
1492
  skill: a2h-batch-ui-align
1418
1493
  user_facing:
1419
1494
  announce: always
@@ -1426,8 +1501,8 @@ nodes:
1426
1501
  dispatch: "primary_skill_inline"
1427
1502
  needs: [discover.utg_snapshot, discover.arch, discover.feature_scope]
1428
1503
  also_needs_group: discover_par
1429
- # a feature scope with no page at all (no-UI logic only) leaves UI conversion nothing to do
1430
- skip_if: "${REUSE_UI_BATCH} == true or (${PROFILE} == incremental and ${FEATURE_SCOPE} == true and ${SCOPE_PAGES} == 0)"
1504
+ # A feature scope with no pages leaves UI conversion nothing to do; REUSE_UI_BATCH belongs only to runner.reuse_if.
1505
+ skip_if: "${PROFILE} == incremental and ${FEATURE_SCOPE} == true and ${SCOPE_PAGES} == 0"
1431
1506
  # Clear the gate checkpoint right before actually executing (lifecycle in policy.human_interaction).
1432
1507
  before_run:
1433
1508
  - clear_gate_checkpoint:
@@ -1469,7 +1544,7 @@ nodes:
1469
1544
  # Never pass image_read= (policy.image_read): a2h-batch-ui-align Step 1 probes again and writes host_caps.json
1470
1545
  [reuse_static_workspace=${UTG_DIR} only when discover.utg_static actually ran this round]
1471
1546
  # if any of the following is true it did not run this round; **do not pass** this argument, and Step 3.1 runs by itself:
1472
- # ${REUSE_DISCOVER_UTG} / ${SKIP_LOGIC} / ${SKIP_SPEC_GENERATE} / ${REUSE_SPEC_GENERATE} == true / ${PROFILE} == ui-only
1547
+ # ${REUSE_DISCOVER_UTG} / ${SKIP_LOGIC} / ${SKIP_SPEC_GENERATE} / ${REUSE_SPEC_GENERATE} == true / ${PROFILE} == 'ui-only'
1473
1548
  [takeover_allowed=true only when this migrate has already run ui.batch once: this round's ledger records ui.batch as failed, or review.ui_batch chose "rerun"]
1474
1549
  [Unattended contract (policy.leaf_questions)]
1475
1550
  · The app module for Step 2 a2h-resource-convert is the app_module passed above (the same as the spec chain); do not ask the user;
@@ -1557,6 +1632,13 @@ nodes:
1557
1632
  - id: review.ui_batch
1558
1633
  lane: enrich
1559
1634
  type: adopt
1635
+ runner:
1636
+ action: production
1637
+ kind: gate
1638
+ gate: ui_batch
1639
+ checkpoint: "${CHECKPOINT_DIR}/ui-batch-reviewed.ok"
1640
+ rewind_to: ui.batch
1641
+ rewind_clear_vars: [REUSE_UI_BATCH]
1560
1642
  needs: [ui.batch]
1561
1643
  human_gate: true
1562
1644
  user_facing:
@@ -1629,6 +1711,10 @@ nodes:
1629
1711
  - id: enrich.module_docs
1630
1712
  lane: enrich
1631
1713
  type: skill
1714
+ runner:
1715
+ action: production
1716
+ kind: skill
1717
+ reuse_if: "${REUSE_MODULE_DOCS} == true"
1632
1718
  skill: a2h-module-semantic-docs
1633
1719
  user_facing:
1634
1720
  announce: always
@@ -1643,7 +1729,7 @@ nodes:
1643
1729
  # (needs still only hangs off ui.batch; start order in policy.parallel_rule / schedule_hint).
1644
1730
  needs: [discover.arch, ui.batch]
1645
1731
  dispatch: "primary_skill_inline"
1646
- skip_if: "${SKIP_MODULE_DOCS} or ${REUSE_MODULE_DOCS} == true"
1732
+ skip_if: "${SKIP_MODULE_DOCS}"
1647
1733
  # The state file is kept across runs (it is the incremental baseline for --incremental preserve and must not be deleted); checking existence alone lets the previous round pose as success.
1648
1734
  # Record the time before starting; success requires the state file to be no older than it.
1649
1735
  before_run:
@@ -1694,6 +1780,9 @@ nodes:
1694
1780
  - id: barrier.l2_enrich
1695
1781
  lane: enrich
1696
1782
  type: local
1783
+ runner:
1784
+ action: production
1785
+ kind: barrier
1697
1786
  # The ui side waits for review.ui_batch (which implies ui.batch; under force_skip that need is satisfied by the skipped terminal state).
1698
1787
  # The spec side still waits for enrich.spec_gen (review.spec_gen is gated separately before adopt and can wrap up outside this barrier).
1699
1788
  # Do not run --assert-ready again here: the gate itself exiting 1 is enough to stop the interactive path.
@@ -1716,6 +1805,10 @@ nodes:
1716
1805
  - id: adopt.signing
1717
1806
  lane: adopt
1718
1807
  type: local
1808
+ runner:
1809
+ action: production
1810
+ kind: host_action
1811
+ reuse_if: "${REUSE_LOGIC_PIPELINE} == true"
1719
1812
  user_facing:
1720
1813
  announce: always
1721
1814
  name: Signing
@@ -1724,7 +1817,7 @@ nodes:
1724
1817
  failed: "Signing is not configured yet: {reason}."
1725
1818
  skipped: "No business logic this round, so signing was not checked."
1726
1819
  needs: [barrier.l2_enrich]
1727
- skip_if: "${SKIP_LOGIC} or ${SKIP_LOGIC_PIPELINE} or ${REUSE_LOGIC_PIPELINE} == true"
1820
+ skip_if: "${SKIP_LOGIC} or ${SKIP_LOGIC_PIPELINE}"
1728
1821
  writes: { build_profile: "${HMOS}/build-profile.json5" }
1729
1822
  success:
1730
1823
  - any:
@@ -1769,6 +1862,9 @@ nodes:
1769
1862
  - id: adopt.specs_json
1770
1863
  lane: adopt
1771
1864
  type: adopt
1865
+ runner:
1866
+ action: production
1867
+ kind: adopt_specs
1772
1868
  user_facing:
1773
1869
  announce: fail_only
1774
1870
  name: Adopt spec list
@@ -1796,6 +1892,11 @@ nodes:
1796
1892
  - id: logic.spec_pipeline
1797
1893
  lane: logic
1798
1894
  type: skill
1895
+ runner:
1896
+ action: production
1897
+ kind: skill
1898
+ reuse_if: "${REUSE_LOGIC_PIPELINE} == true"
1899
+ after_terminal: resume_summary
1799
1900
  skill: a2h-spec-design-pipeline
1800
1901
  user_facing:
1801
1902
  announce: always
@@ -1810,7 +1911,7 @@ nodes:
1810
1911
  # There is no parallelizable node before or after this one (needs adopt.specs_json; the only successor is logic.finalize), so Task buys no parallelism.
1811
1912
  dispatch: primary_skill_inline
1812
1913
  needs: [adopt.specs_json, adopt.signing]
1813
- skip_if: "${SKIP_LOGIC} or ${SKIP_LOGIC_PIPELINE} or ${REUSE_LOGIC_PIPELINE} == true"
1914
+ skip_if: "${SKIP_LOGIC} or ${SKIP_LOGIC_PIPELINE}"
1814
1915
  # Before this node **actually executes**: archive only on a hard fingerprint mismatch (exit 4) or all failed (exit 3).
1815
1916
  # exit 4: specs.json content / hard paths differ from this round -> without archiving, pipeline I1 also aborts and every later round gets stuck.
1816
1917
  # exit 3: all groups failed -> resuming as is would only rerun smoke + Finalization; a retry must start a new round.
@@ -1883,6 +1984,9 @@ nodes:
1883
1984
  - id: logic.finalize
1884
1985
  lane: finalize
1885
1986
  type: local
1987
+ runner:
1988
+ action: production
1989
+ kind: host_action
1886
1990
  needs: [logic.spec_pipeline]
1887
1991
  summary: summary report + final build fallback
1888
1992
  user_facing:
@@ -1891,11 +1995,13 @@ nodes:
1891
1995
  doing: "Summarizing this round's migration results. The HarmonyOS project will be built once more if needed."
1892
1996
  done: "The report for this round's migration is written: logic-convert-report.md in the workspace. The build verdict, UI conversion and the feature list are all in this report."
1893
1997
  failed: "The wrap-up report was not finished: {reason}."
1998
+ success:
1999
+ - file_exists: "${LOGIC_REPORT}"
1894
2000
  invoke: |
1895
- Present to the user per policy.user_facing: send user_facing.doing when starting, user_facing.done when written, user_facing.failed when it cannot be written.
1896
- The report body is still written in full per steps 1–4 below. Stage names use each user_facing.name (UI conversion, feature list, module notes, business logic, signing), not node ids.
2001
+ Present to the user per policy.user_facing: send user_facing.doing when starting; send user_facing.done only after the Runner commits the node terminal state and run_end, and user_facing.failed when it cannot be written.
2002
+ Write the report body in full per steps 1–3 below and follow the return protocol in step 4. Stage names use each user_facing.name (UI conversion, feature list, module notes, business logic, signing), not node ids.
1897
2003
  1. Final build fallback — run only when needed, and never leave uncommitted changes in the workspace
1898
- 0. logic.spec_pipeline was skipped this round (${SKIP_LOGIC} / ${SKIP_LOGIC_PIPELINE} / ${REUSE_LOGIC_PIPELINE} == true / ${PROFILE} == ui-only) ->
2004
+ 0. logic.spec_pipeline was skipped this round (${SKIP_LOGIC} / ${SKIP_LOGIC_PIPELINE} / ${REUSE_LOGIC_PIPELINE} == true / ${PROFILE} == 'ui-only') ->
1899
2005
  **no build, no commit**: this round has no logic changes to fall back on (the UI chain's ui.batch built by itself); when reused, the build was already done in
1900
2006
  the round that produced it. The report says "No business logic was written this round, so no extra build was done." and goes straight to step 2.
1901
2007
  (spec-design-pipeline's W0 requires a clean trunk: **any** uncommitted change stops it directly; only on Mid-flight re-entry, when all dirty files are
@@ -1912,7 +2018,7 @@ nodes:
1912
2018
  · ${HMOS} is not a git repo -> run the fixer as usual without committing, and note it in the report.
1913
2019
  c. The report writes one line with the build verdict, using one of these plain sentences: the business logic step already built successfully / build passed / build passed after fixes (with commit hash) / build still fails / the workspace has uncommitted changes, so no build was done.
1914
2020
  2. Add a "Business logic" section to the report, first split into three cases by how logic.spec_pipeline was handled this round:
1915
- · skipped (${SKIP_LOGIC} or ${SKIP_LOGIC_PIPELINE} or ${PROFILE} == ui-only) -> **do not read** spec_pipeline_state.json / design_map.md /
2021
+ · skipped (${SKIP_LOGIC} or ${SKIP_LOGIC_PIPELINE} or ${PROFILE} == 'ui-only') -> **do not read** spec_pipeline_state.json / design_map.md /
1916
2022
  claim_audit.json: they were left by some earlier round and are not this round's results. The report says "No business logic was written this round.";
1917
2023
  when the state file exists add only the sentence "There is an earlier progress record; it is not this round's result and is not included in this report".
1918
2024
  · reused (${REUSE_LOGIC_PIPELINE} == true) -> read as usual (probe 7 already verified that it belongs to this round's inputs),
@@ -1956,7 +2062,9 @@ nodes:
1956
2062
  node ${SKILLS_ROOT}/a2h-app-migrate/scripts/scope_report.mjs --hmos ${HMOS} --scope-json ${SCOPE_JSON}
1957
2063
  --specs-json ${SPECS_JSON} --android ${ANDROID} --utg <the same page graph> --work ${WORK} --lang en
1958
2064
  It never fails this node; a missing input only drops its part.
1959
- 5. Return only ok|fail and the report path.
2065
+ 5. After writing the report, return only ok|fail and the report path; do not append your own logic.finalize terminal record or run_end.
2066
+ The Runner verifies the report and commits the only logic.finalize done, then enforces full-DAG completion and writes the single run_end.
2067
+ If an assertion exits non-zero or evidence is incomplete, the Runner blocks certification; the host must not present the stage report as a completion certificate.
1960
2068
 
1961
2069
  schedule_hint:
1962
2070
  # discover_par conditional parallelism and the scaffold_new serial fallback are in policy.parallel_rule; not repeated here.