@buaa_smat/hometrans 26.0.5 → 26.0.6

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 (472) hide show
  1. package/README.md +249 -279
  2. package/agents/code-reviewer.md +1 -1
  3. package/dist/cli/editors.json +20 -0
  4. package/dist/platform/registry.js +1 -0
  5. package/dist/platform/validate.js +2 -1
  6. package/i18n/agents/code-reviewer.md +1 -1
  7. package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  8. package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  9. package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  10. package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  11. package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  12. package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  13. package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
  14. package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  15. package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  16. package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  17. package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  18. package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
  19. package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
  20. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
  21. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
  22. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
  23. package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
  24. package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
  25. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  26. package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
  27. package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  28. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
  29. package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
  30. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
  31. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
  32. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
  33. package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
  34. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
  35. package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
  36. package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
  37. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
  38. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
  39. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
  40. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
  41. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
  42. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
  43. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
  44. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
  45. package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
  46. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
  47. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
  48. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
  49. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
  50. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
  51. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
  52. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
  53. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
  54. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
  55. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
  56. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
  57. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
  58. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
  59. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
  60. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
  61. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
  62. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
  63. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
  64. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
  65. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
  66. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
  67. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
  68. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
  69. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
  70. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
  71. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
  72. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
  73. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
  74. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
  75. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
  76. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
  77. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
  78. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
  79. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
  80. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
  81. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
  82. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
  83. package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
  84. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
  85. package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
  86. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
  87. package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
  88. package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
  89. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
  90. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
  91. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
  92. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
  93. package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
  94. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
  95. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
  96. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
  97. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
  98. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
  99. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
  100. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
  101. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
  102. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
  103. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
  104. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
  105. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
  106. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
  107. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
  108. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
  109. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
  110. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
  111. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
  112. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
  113. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
  114. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
  115. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
  116. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
  117. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
  118. package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
  119. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
  120. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
  121. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
  122. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
  123. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
  124. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
  125. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
  126. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
  127. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
  128. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
  129. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
  130. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
  131. package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
  132. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
  133. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
  134. package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
  135. package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
  136. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
  137. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
  138. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
  139. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
  140. package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
  141. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
  142. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
  143. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
  144. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
  145. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
  146. package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
  147. package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
  148. package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
  149. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
  150. package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
  151. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
  152. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
  153. package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
  154. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
  155. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
  156. package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
  157. package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
  158. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
  159. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
  160. package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
  161. package/package.json +2 -1
  162. package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  163. package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  164. package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
  165. package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
  166. package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
  167. package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
  168. package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
  169. package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  170. package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  171. package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  172. package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
  173. package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
  174. package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
  175. package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
  176. package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
  177. package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  178. package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
  179. package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
  180. package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
  181. package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
  182. package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
  183. package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
  184. package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  185. package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  186. package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  187. package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  188. package/skills/a2h-app-migrate/SKILL.md +31 -14
  189. package/skills/a2h-app-migrate/references/stage-map.md +4 -2
  190. package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
  191. package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
  192. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
  193. package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
  194. package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
  195. package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
  196. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
  197. package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
  198. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
  199. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
  200. package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
  201. package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
  202. package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
  203. package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
  204. package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
  205. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  206. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
  207. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
  208. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  209. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
  210. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
  211. package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
  212. package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
  213. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
  214. package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
  215. package/skills/a2h-batch-ui-align/SKILL.md +14 -12
  216. package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
  217. package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
  218. package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
  219. package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
  220. package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
  221. package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
  222. package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
  223. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
  224. package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
  225. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
  226. package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
  227. package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
  228. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
  229. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
  230. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
  231. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
  232. package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
  233. package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
  234. package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
  235. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
  236. package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
  237. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
  238. package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
  239. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
  240. package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
  241. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
  242. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
  243. package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
  244. package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
  245. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
  246. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
  247. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
  248. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
  249. package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
  250. package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
  251. package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
  252. package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
  253. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
  254. package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
  255. package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
  256. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
  257. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
  258. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
  259. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
  260. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
  261. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
  262. package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
  263. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
  264. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
  265. package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
  266. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
  267. package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
  268. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
  269. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
  270. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
  271. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
  272. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
  273. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
  274. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
  275. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
  276. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
  277. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
  278. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
  279. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
  280. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
  281. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
  282. package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
  283. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
  284. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
  285. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
  286. package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
  287. package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
  288. package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
  289. package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
  290. package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
  291. package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
  292. package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
  293. package/skills/a2h-page-specgen/SKILL.md +36 -5
  294. package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
  295. package/skills/a2h-page-specgen/references/evidence.md +2 -1
  296. package/skills/a2h-page-specgen/references/execution-model.md +13 -5
  297. package/skills/a2h-page-specgen/references/gates.md +33 -7
  298. package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
  299. package/skills/a2h-page-specgen/references/spec-example.md +166 -32
  300. package/skills/a2h-page-specgen/references/spec-template.md +8 -5
  301. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
  302. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
  303. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
  304. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
  305. package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
  306. package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
  307. package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
  308. package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
  309. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
  310. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
  311. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
  312. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
  313. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
  314. package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
  315. package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
  316. package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
  317. package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
  318. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
  319. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
  320. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
  321. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
  322. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
  323. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
  324. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
  325. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
  326. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
  327. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
  328. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
  329. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
  330. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
  331. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
  332. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
  333. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
  334. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
  335. package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
  336. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
  337. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
  338. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
  339. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
  340. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
  341. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
  342. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
  343. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
  344. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
  345. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
  346. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
  347. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
  348. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
  349. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
  350. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
  351. package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
  352. package/skills/a2h-resource-convert/SKILL.md +1 -1
  353. package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
  354. package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
  355. package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
  356. package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
  357. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
  358. package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
  359. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
  360. package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
  361. package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
  362. package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
  363. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
  364. package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
  365. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
  366. package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
  367. package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
  368. package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
  369. package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
  370. package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
  371. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
  372. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
  373. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
  374. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
  375. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
  376. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
  377. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
  378. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
  379. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
  380. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
  381. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
  382. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
  383. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
  384. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
  385. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
  386. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
  387. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
  388. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
  389. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
  390. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
  391. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
  392. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
  393. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
  394. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
  395. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
  396. package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
  397. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
  398. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
  399. package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
  400. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
  401. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
  402. package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
  403. package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
  404. package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
  405. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
  406. package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
  407. package/skills/a2h-spec-generate/references/input-formats.md +1 -1
  408. package/skills/a2h-utg-explorer/SKILL.md +11 -5
  409. package/skills/a2h-utg-explorer/references/architecture.md +37 -19
  410. package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
  411. package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
  412. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
  413. package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
  414. package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
  415. package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
  416. package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
  417. package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
  418. package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
  419. package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
  420. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
  421. package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
  422. package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
  423. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
  424. package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
  425. package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
  426. package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
  427. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
  428. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
  429. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
  430. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
  431. package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
  432. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
  433. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
  434. package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
  435. package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
  436. package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
  437. package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
  438. package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
  439. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
  440. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
  441. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
  442. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
  443. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
  444. package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
  445. package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
  446. package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
  447. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
  448. package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
  449. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
  450. package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
  451. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
  452. package/skills/a2h-utg-static/SKILL.md +3 -3
  453. package/skills/a2h-utg-static/references/extractors.md +7 -0
  454. package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
  455. package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
  456. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
  457. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
  458. package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
  459. package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
  460. package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
  461. package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
  462. package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
  463. package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
  464. package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
  465. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
  466. package/resource/convert_pipeline_process.svg +0 -114
  467. package/resource/project_architecture.svg +0 -120
  468. package/resource/set_environment.png +0 -0
  469. package/resource/set_multimodel.png +0 -0
  470. package/skills/a2h-app-migrate/references/specs.example.json +0 -19
  471. package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
  472. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
@@ -1,138 +1,181 @@
1
- # ArkUI runtime contract pitfalls in one rule (@hometrans/arkui-runtime-pitfall)
1
+ # ArkUI runtime contract and route-carrier pitfalls (@hometrans/arkui-runtime-pitfall)
2
2
 
3
- ## Symptom
3
+ Fourteen defect classes that **compile clean, pass every built-in rule, and break 100% at run time**:
4
+ most kill the process or render `undefined` on the receiving page; the rest silently break a feature.
4
5
 
5
- Eight defect classes share one shape: they **compile 100% clean, pass every built-in rule, and break
6
- 100% at run time** — framework-contract errors, not code-logic errors. Four of them kill the process
7
- outright, the rest silently break a feature:
8
-
9
- | Sub-code | Runtime failure | Typical site |
6
+ | Sub-code | Symptom | Severity |
10
7
  | --- | --- | --- |
11
- | `[alpha-scale-mismatch]` | `setAlphaComponent(color, 0.5)` — alpha channel is 0..255, the fraction truncates to alpha byte `0` (or `1` for `1.0`) and the button renders fully (or nearly) transparent ("button disappeared") | login button |
12
- | `[controlled-input-writeback]` | an onChange callback guards the write-back with `if (filtered !== v)` — pure-digit input never writes back, the 4-digit "verify" button stays disabled | captcha dialog |
13
- | `[builder-param-bare-method-ref]` | a custom component (V1 or V2 — HarmonyOS FAQ faqs-arkui-229 shows the V1 form crashing identically) receives `@BuilderParam trailing: this.AvatarTrailing` where the `@Builder` body reads `this` — the bare reference rebinds `this` to the child, tapping triggers `undefined is not callable` and kills the page | profile pages (23 sites) |
14
- | `[builder-param-arrow-inline-component]` | an arrow passed to a `@BuilderParam` writes a component directly (`trailing: () => { PriceText({…}) }`) — only `@Builder` bodies are compiled into UI code, so the call stays a plain call of the component class and throws "class constructor cannot be invoked without 'new'" when the slot renders | order detail, category list |
15
- | `[dialog-controller-v2-builder]` | V1 `CustomDialogController` lives in a `@ComponentV2` host, or its builder target is not an `@CustomDialog` struct — the dialog crashes at open with "class constructor cannot be invoked without 'new'" | address delete dialog |
16
- | `[appstoragev2-connect-creator]` | `AppStorageV2.connect(Cls, key)` missing the 3rd `defaultCreator` argument — first connect throws `BusinessError: The default creator should be function when first connect`, page process killed; also: the same key connected by classes declared in different files (same-name copies per module are different types) — connect throws on the mismatch, uncaught it kills the page | theme slots shared across modules |
17
- | `[input-type-decimal-domain]` | a price/amount/cost/weight/rating field uses `.type(InputType.Number)` — ArkUI's `Number` is a character whitelist that strips `.`, so `99.9` reads back as `999` | filter price range |
18
- | `[theme-mode-closure]` | ThemeMode state is written but no `setColorMode()` exists anywhere in the project — dark mode never applies | settings page (half-wired) |
19
-
20
- ## Detection
21
-
22
- One rule id, one checker, text-based lexical analysis over the whole scene (cross-file tables are
23
- project-wide, so a struct declared in one module and misused in another is still decided):
24
-
25
- - **alpha-scale-mismatch** — `setAlphaComponent(<expr>, <literal>)` where the literal is a pure
26
- fraction (`0 < n <= 1`, so `1.0` truncates to alpha byte 1 ≈ fully transparent too), **and** the
27
- symbol's own declaration is provably 0..255-scale: the declaration in the same file, or in the
28
- file a relative import resolves to. The **function body is authoritative** — a bound check on
29
- the alpha parameter (`alpha > 255`, `alpha <= 255`) survives any comment noise around the
30
- declaration; only when the body has no bound check does the contiguous `//` comment block
31
- directly above it decide, and a block mentioning both scales proves nothing. When that module
32
- also exports `withAlpha`, the finding recommends it for 0..1 semantics. A 0..1-scale helper of
33
- the same name is legal code; an unresolved symbol (kit import, bare global, alias) cannot be
34
- graded and stays silent. Byte values (`128`), variables and comments do not fire.
35
- - **controlled-input-writeback** — the callback belongs to a `TextInput`/`TextArea`/`Search` whose
36
- `text` is one-way bound to `this.x` (only then can a skipped write-back desynchronize display
37
- and state — a Slider's conditional write is fine), and contains no `this.…(…)` call that hands
38
- the value out. Inside it, an `if (x !== v)` guard (either side is the callback parameter) whose
39
- block writes a state: the write is conditional unless the same state is also written
40
- unconditionally elsewhere in the callback, or the guard has an `else` arm writing it too. The
41
- recommended fix shape (unconditional write first, guarded reset after) does not fire.
42
- - **builder-param-bare-method-ref** — `Ident({ prop: this.Method })` where `Ident` resolves to the
43
- file that declares it (alias-aware) and `prop` is one of its `@BuilderParam` members — V1
44
- (`@Component`) and V2 (`@ComponentV2`) children alike (FAQ faqs-arkui-229). Fires only when the
45
- `@Builder` body actually reads `this` — without it the rebinding is harmless. `@LocalBuilder`
46
- members keep the declaring `this` and never fire; arrow-wrapped arguments
47
- (`() => { this.Method() }`) are the legal form.
48
- - **builder-param-arrow-inline-component** — `Ident({ prop: () => { … } })` where `prop` is a
49
- `@BuilderParam` member of `Ident` (resolved by declaration origin) and the arrow body calls a name
50
- **proven to be a component**: a built-in kind (`Text`, `Column`, `ForEach` …), or a struct this file
51
- declares or a relative import resolves to. An imported global `@Builder function`
52
- (`() => { EmptyView() }`), a member builder `this.X()` and an unresolved name (package import) do
53
- not fire; arrows passed to non-`@BuilderParam` members (event callbacks) are not inspected.
54
- `// ARROW-SLOT: <why>` above the property or the call closes that site. Same criterion as the
55
- a2h-batch-ui-align GATE of the same name.
56
- - **dialog-controller-v2-builder** — `new CustomDialogController({ builder: Ident(…) })` where
57
- the enclosing struct is `@ComponentV2`, or the builder target resolves to a struct that is not
58
- `@CustomDialog` (a `@ComponentV2` target or a plain `@Component`). `@CustomDialog` + V1 hosts
59
- and targets are legal; unresolvable targets (package imports) stay silent.
60
- - **appstoragev2-connect-creator** — `AppStorageV2`/`PersistenceV2` `.connect(Cls, key)` with 2
61
- arguments, graded against a project-wide key table:
62
- - unguarded + no creator for that key anywhere → **error** (the first connect necessarily throws);
63
- - unguarded + a creator elsewhere → **warn** (legal only when that site ran first — load/visit order);
64
- - guarded by `keys().includes(key)` earlier in the file + a creator elsewhere → **silent** (the
65
- docs' legal late-connect pattern);
66
- - guarded + no creator anywhere → **warn** (the key can never exist, so the guard is always
67
- false — a silent dead state).
68
- Keys that cannot be resolved to a literal (computed, cross-file imports) stay silent.
69
- Plus: the same key connected by classes declared in **different files** (identity by declaration
70
- origin, alias-aware — several importers of one exported class are the normal pattern and do not
71
- fire; same-name classes copied into each module are different types and do). **Error** at each
72
- uncaught site, **warn** at try/catch-wrapped ones (the throw is designed around, but the feature
73
- silently degrades). Sites whose class origin cannot be resolved are not compared.
74
- - **input-type-decimal-domain** — `.type(InputType.Number)` where the enclosing struct name, the
75
- `TextInput(…)` constructor arguments (bound variables, placeholder text/resource names) contain a
76
- decimal-domain keyword — English words (price / prices / amount / amounts / money / cost / costs /
77
- fee / fees / balance / balances / weight / weights / rating / ratings / discount / decimal) or
78
- Chinese words (价格 / 金额 / 价钱 / 售价 / 单价 / 总价 / 重量 / 评分 / 折扣 / 余额; matched as words,
79
- so `数量`, an integer domain, does not fire). Verification-code and captcha fields do not fire.
80
- - **theme-mode-closure** — some file writes ThemeMode (`x.themeMode = …`, `setThemeMode(…)`, or
81
- `= ThemeMode.<member>`) while no `setColorMode(` call exists in any scanned file. One finding at
82
- the first write site.
83
-
84
- The sub-code is the message-key prefix, so a single rule id stays greppable in reports and in the
85
- `plugin:@hometrans/all` gate statistics (per-sub-code counts via the `[sub-code]` prefix).
8
+ | `[alpha-scale-mismatch]` | `setAlphaComponent(color, 0.5)`: the alpha channel is 0..255, the fraction truncates to fully transparent | error* |
9
+ | `[controlled-input-writeback]` | `if (filtered !== v)` guards the state write, so exactly the accepted input never writes back | warn |
10
+ | `[builder-param-bare-method-ref]` | `@BuilderParam: this.Method` rebinds `this` to the child and the call throws | error |
11
+ | `[builder-param-arrow-inline-component]` | a component written in an arrow `@BuilderParam` body throws at slot render | error |
12
+ | `[dialog-controller-v2-builder]` | V1 `CustomDialogController` in a V2 host, or a target that is not `@CustomDialog` | error |
13
+ | `[appstoragev2-connect-creator]` | 2-arg `connect` without a creator, or one key connected by different-file classes | error / warn |
14
+ | `[input-type-decimal-domain]` | a price/amount field uses `InputType.Number`; `99.9` reads back `999` | warn |
15
+ | `[theme-mode-closure]` | ThemeMode is written but no `setColorMode()` exists | warn |
16
+ | `[foreach-key-stale-render]` | ForEach keys on identity only (e.g. id) while rendering or forwarding content that changes: data replaced with the same id leaves the row stale («refresh only after re-entering»); a whole-object hand-off resolves the child `@Param` / in-file `@Builder` fields the receiver renders | warn |
17
+ | `[sql-identifier-quoting]` | a column/key name is a SQLite keyword outside `%fallback` or not a regular identifier, and it is not quoted; `store.insert/batchInsert` also build the INSERT list without quoting → 14800021 | warn |
18
+ | `[route-param-v2-instance]` | router params carry an `@ObservedV2`/`@Observed` instance; fields arrive as `__ob_*`/`undefined` | error |
19
+ | `[route-param-v2-new]` | `new Xxx(...)` built inline inside params | error |
20
+ | `[route-param-v2-stringify]` | `JSON.stringify` on a decorated instance is not the expected DTO | error |
21
+ | `[route-param-unrebuilt-receive]` | `getParams()` cast back to the decorated contract, with no validation or rebuild | warn |
22
+ | `[route-back-index-base]` | an indexed `back(index)` not derived from `getState().index`: the docs say `[0,+∞)` while the runtime counts from 1 and rejects 0; compute the target and fall back to `back()` when `< 1`. Router receivers only (`router` / `getRouter()` / local alias); `// BACK-INDEX:` closes one site | warn |
23
+ | `[i18n-simple-datetime-format]` | `i18n.getSimpleDateTimeFormatByPattern`: valid patterns are rejected at run time (890001), the call throws and the text loses a segment; the failed creation also leaves a native peer | error |
24
+ | `[self-refresh-feedback]` | a state-bound component (Refresh / Search / Toggle / Tabs / Slider / Swiper) with an unguarded callback: a programmatic write re-runs the business path | warn |
25
+
26
+ \* alpha is an error only when the symbol's declaration provably carries the 0..255 contract.
27
+
28
+ ## Boundaries
29
+
30
+ - **alpha**: the second argument is a pure fraction (`0 < n <= 1`) and the same-file / relatively
31
+ imported declaration is provably 0..255 — the function body's bound check is authoritative, and
32
+ only without one does the directly attached comment block decide. Byte values, variables,
33
+ comments and unresolved symbols stay silent.
34
+ - **controlled-input-writeback**: a `TextInput`/`TextArea`/`Search` whose `text` is one-way bound to
35
+ `this.x`, with an `if (x !== v)` guard around the state write and no `this.…(…)` call handing the
36
+ value out. Unconditional writes and an `else` arm that writes too do not fire.
37
+ - **builder-param-bare-method-ref**: `Ident({ prop: this.Method })` where `prop` is `Ident`'s
38
+ `@BuilderParam` and the `@Builder` body reads `this` (V1 and V2 alike). `@LocalBuilder` and an
39
+ arrow wrapper are legal.
40
+ - **builder-param-arrow-inline-component**: a `@BuilderParam` arrow body that calls a proven
41
+ component (built-in, same-file struct, relatively imported struct). An imported global `@Builder`,
42
+ a member builder and an unresolved name stay silent; `// ARROW-SLOT: <why>` closes a site.
43
+ - **dialog-controller-v2-builder**: `new CustomDialogController({ builder: Ident(…) })` in a
44
+ `@ComponentV2` host, or with a target that is not `@CustomDialog`. `@CustomDialog` + V1 host is legal.
45
+ - **appstoragev2-connect-creator**: 2-arg `connect` against the project-wide key table — no creator
46
+ → error; a creator elsewhere → warn (order-dependent); `keys().includes` guard + creator →
47
+ silent; guard + no creator → warn (dead branch). Same key connected by different-file classes:
48
+ error at uncaught sites, warn inside try/catch. Unresolvable keys stay silent.
49
+ - **input-type-decimal-domain**: `.type(InputType.Number)` on a struct/constructor whose names say
50
+ decimal domain (price/amount/money/cost/weight/rating/价格/金额/重量/评分/折扣/余额 …).
51
+ Verification-code and captcha fields do not fire.
52
+ - **sql-identifier-quoting**: the identifier is a SQLite keyword outside `%fallback` (`from`,
53
+ `index`, `order`, `group`, `values`, `where`, `limit`, `join`, `on`, `to`, …) or is not a regular
54
+ identifier (`^[A-Za-z_][A-Za-z0-9_]*$`), and the SQL writes it bare. `EXPLAIN`, `OFFSET`, `KEY`,
55
+ `FIRST`, … are in the fallback list and stay silent. A quoted DDL still gets an advisory;
56
+ `relationalStore.ValuesBucket` keys are checked the same way; when the project schema has a risky
57
+ column, each `store.insert/batchInsert/insertAll` call is reported. All findings are WARN.
58
+ - **theme-mode-closure**: some file writes ThemeMode while no `setColorMode(` exists anywhere. One
59
+ finding at the first write.
60
+ - **foreach-key-stale-render**: a `ForEach` has a keyGenerator and the key carries at most one
61
+ member of the item (`x.y` → `y`, an identity key); the item generator either reads `item.field`
62
+ directly or hands the whole item to a receiver. A whole-object hand-off resolves the receiver's
63
+ rendered fields — a child component (same file or relative import) through its `@Param`, an
64
+ in-file `@Builder` through its parameter; a non-`@Param` member shows the component name only.
65
+ An unresolvable receiver is still reported, with a generic phrase. Core semantics: **an unchanged
66
+ key means the row is not rebuilt, so the values it receives stay stale; `@ObservedV2`/`@Trace`
67
+ does not cross a reused row** — "make the row `@ComponentV2 + @Param`" alone is not a fix; the
68
+ key must change too, or the list must use LazyForEach. Silent and left to review: a key already
69
+ mixing several members, `JSON.stringify(item)` or a bare `${item}` interpolation, a helper call
70
+ (`(i) => this.keyOf(i)`), an array-literal source, a `ForEach` without a third argument. Close one
71
+ site with `// FOREACH-KEY: <reason>`. Known false positive: when an inner `ForEach` already keys
72
+ on the changing field, its outer "whole item + identity key" is still reported — close it as
73
+ intended (the check reads one level of keys).
74
+ - **route-param-v2-instance / -v2-new / -v2-stringify / -unrebuilt-receive**: the `params` of a
75
+ router-shaped call (`.back` / `.pushUrl` / `.replaceUrl` / `.pushNamedRoute` /
76
+ `.replaceNamedRoute`) is inspected recursively. Type resolution is import-aware (relative imports,
77
+ `as` aliases, `import type`, `import * as ns`); a bare name is trusted only when declared exactly
78
+ once in the scene. `any`/`Object` casts, helper-returned values, object spread, `Object.assign`
79
+ and package types stay silent. The receiver warning also requires that the method has neither a
80
+ `typeof` validation nor a `new Xxx(...)` rebuild.
81
+ - **route-back-index-base**: an indexed `.back(index)` (`back()` / `back({url})` do not count) whose
82
+ index expression is not `getState().index - N` (directly or through a local alias). Only router
83
+ receivers count: `router` / `this.router`-style members, the result of `X.getRouter()`, and a
84
+ local alias of either (`const routing = ui.getRouter()`); a custom stack/queue such as
85
+ `history.back(n)` or `this.queue.back(n)` is not reported. One finding, telling the caller to
86
+ compute the target explicitly and fall back to `back()` when it is `< 1`; close a deliberate
87
+ fixed-depth site with `// BACK-INDEX: <reason>` (on the call line or a comment-only line directly
88
+ above). The index base is inconsistent across the platform's declarations (`UIContext.Router` says
89
+ `[0,+∞)`; `@ohos.router` / `getState().index` / `getStateByIndex` are 1-based; the runtime rejects
90
+ 0), so do not take the `.d.ts` text as the contract.
91
+ - **i18n-simple-datetime-format**: every `getSimpleDateTimeFormatByPattern(...)` call site fires, regardless of the receiver (the method name is platform API); the same name inside a comment does not.
92
+ - **self-refresh-feedback**: the component takes a state (`refreshing` / `value` / `isOn` / `index`) bound to a non-literal, registers the matching callback (`onRefreshing` / `onChange`), that callback body has no first-line short-circuit on the state, and the body makes a call (a pure value echo does not count). The loop wording is used when the state is also assigned outside the callback in the same file; otherwise the wording asks to verify the write sites. `// SELF-REFRESH-OK: <reason>` closes one site.
86
93
 
87
94
  ## Severity
88
95
 
89
- `error` means *a defect whenever the code executes — no legal reading*. `warn` means the finding
90
- turns on intent or business semantics; the gate judges every `@hometrans` warning and repairs the
91
- real ones.
92
-
93
- - `error`: alpha-scale (with a proven 0..255 contract), builder-param (the `@Builder` body reads
94
- `this`), builder-param-arrow-inline-component (a proven component written in an arrow slot),
95
- dialog-controller (a V2 host or a non-`@CustomDialog` target), unguarded 2-arg
96
- connect with no creator for the key anywhere, same-key classes declared in different files at
97
- uncaught sites.
98
- - `warn`: controlled-input-writeback (a guarded write-back can be deliberate),
99
- input-type-decimal-domain (the decimal domain is inferred from names — an integer-only field
100
- with a price-ish name is legal), theme-mode-closure (state-only + resource-qualifier rendering
101
- is a legitimate design), unguarded 2-arg connect whose key has a creator elsewhere
102
- (order-dependent), guarded 2-arg connect with no creator anywhere (the branch can never run —
103
- a design decision), and try/catch-wrapped same-key-different-class sites (the throw is handled
104
- by design, but the feature silently degrades).
96
+ - `error`: alpha (proven 0..255), builder-param (body reads `this` / an arrow slot writes a proven
97
+ component), dialog (V2 host / non-`@CustomDialog`), 2-arg connect with no creator, same-key
98
+ different-class uncaught sites, route-param-v2-instance / -v2-new / -v2-stringify.
99
+ - `error` (always): i18n-simple-datetime-format — the API itself is unusable, independent of the call site.
100
+ - `warn`: controlled-input-writeback, input-type-decimal-domain, theme-mode-closure,
101
+ foreach-key-stale-render, order-dependent or dead-branch connect, try/catch-wrapped
102
+ class-mismatch sites, route-param-unrebuilt-receive, route-back-index-base.
105
103
 
106
104
  ## Fix
107
105
 
108
106
  ```ts
109
- // [alpha-scale-mismatch] 0..1 → 0..255 (or withAlpha(primary, 0.5) when the helper module provides it)
110
- .backgroundColor(this.vm.isLoginEnabled ? theme.primary : setAlphaComponent(theme.primary, 128))
107
+ // [alpha-scale-mismatch]
108
+ setAlphaComponent(theme.primary, 128) // or withAlpha(theme.primary, 0.5)
109
+
110
+ // [controlled-input-writeback] write back unconditionally, reset the text separately
111
+ this.imageCode = filtered;
111
112
 
112
- // [builder-param-bare-method-ref] wrap the reference
113
- AppListItem({
114
- trailing: () => { this.AvatarTrailing() }
115
- })
116
- // or declare the member with @LocalBuilder, whose this stays the declaring component
113
+ // [builder-param-bare-method-ref]
114
+ AppListItem({ trailing: () => { this.AvatarTrailing() } })
117
115
 
118
- // [builder-param-arrow-inline-component] put the component in a @Builder, the arrow only calls it
116
+ // [builder-param-arrow-inline-component]
119
117
  @Builder PriceTrailing() { PriceText({ price: this.price }) }
120
118
  OrderDetailListItem({ trailingContent: () => { this.PriceTrailing() } })
121
119
 
122
- // [dialog-controller-v2-builder] V2 dialogs: no V1 controller
123
- // use promptAction/ComponentContent, or an in-page overlay driven by @Trace state
120
+ // [dialog-controller-v2-builder] V2 uses promptAction/ComponentContent or an in-page overlay
124
121
 
125
- // [appstoragev2-connect-creator] always give the creator, always one class per key —
126
- // declare that class once in a shared module instead of copying it per feature
127
- const slot = AppStorageV2.connect(PrimaryColorSlot, PRIMARY_SLOT_KEY, () => new PrimaryColorSlot());
122
+ // [appstoragev2-connect-creator]
123
+ AppStorageV2.connect(PrimaryColorSlot, PRIMARY_SLOT_KEY, () => new PrimaryColorSlot());
128
124
 
129
125
  // [input-type-decimal-domain]
130
126
  .type(InputType.NUMBER_DECIMAL)
131
127
 
132
- // [theme-mode-closure] apply the mode and restore it on startup
128
+ // [sql-identifier-quoting] quote the table and every column (or rename the column)
129
+ // Do not use store.insert/batchInsert: the platform builds the INSERT list without quotes.
130
+ await store.execute('INSERT OR REPLACE INTO "t" ("id","from") VALUES (?,?)', [id, from]);
131
+
132
+ // [theme-mode-closure]
133
133
  getApplicationContext().setColorMode(modeToConfigurationConstant(mode));
134
+
135
+ // [foreach-key-stale-render]
136
+ // wrong: identity key + changing content (same id, new object → the row never re-renders)
137
+ ForEach(this.rows, (row: RowModel) => { this.RowCard(row) }, (row: RowModel) => `row-${row.id}`)
138
+ // fix A: put the changing fields into the key (for a whole-object hand-off the rule lists the
139
+ // fields the child @Param actually renders)
140
+ ForEach(this.rows, (row: RowModel) => { this.RowCard(row) }, (row: RowModel) => `${row.id}:${row.status}`)
141
+ ForEach(this.rows, (row: RowModel) => { RowView({ row: row }) }, (row: RowModel) => `${row.id}:${row.count}`)
142
+ // fix B (only together with A or LazyForEach — not a fix on its own):
143
+ // a memoized ForEach row never re-runs the item generator, so the child's @Param is not
144
+ // recomputed; @ObservedV2/@Trace only refreshes a component that reads the field directly,
145
+ // it does not push a new value through a reused row. Make the key follow the rendered fields,
146
+ // or switch this list to LazyForEach + notifyDataChange.
147
+ // Static list (genuinely immutable) — close it:
148
+ // FOREACH-KEY: fixed enum, never replaced at run time
149
+
150
+ // [route-param-*] always a flat DTO across pages; validate and rebuild on the receiver
151
+ interface ItemResultDto { id: number; code: string; title: string; enabled: boolean; }
152
+ const result = { item: toItemDto(item) };
153
+ router.back({ url: 'pages/TargetPage', params: result });
154
+ const dto = params.item;
155
+ if (dto !== undefined && typeof dto.code === 'string') {
156
+ this.viewModel.onItemSelected(new Item(dto.id, dto.code, dto.title, dto.enabled));
157
+ }
158
+
159
+ // [route-back-index-base] derive the target from getState().index; fall back when out of range
160
+ const targetIndex = router.getState().index - 2;
161
+ if (targetIndex >= 1) {
162
+ router.back(targetIndex);
163
+ } else {
164
+ router.back();
165
+ }
166
+
167
+ // [i18n-simple-datetime-format] self-implement, do not use the i18n formatter
168
+ const hh = d.getHours() < 10 ? `0${d.getHours()}` : `${d.getHours()}`;
169
+ const mm = d.getMinutes() < 10 ? `0${d.getMinutes()}` : `${d.getMinutes()}`;
170
+ const label = `${hh}:${mm}`;
171
+
172
+ // [self-refresh-feedback] split the gesture state from the business state, or guard the body
173
+ Refresh({ refreshing: this.refreshing }) { this.content() }
174
+ .onRefreshing(() => {
175
+ if (this.refreshing) { return; } // a programmatic set is not a user pull
176
+ this.onRefresh();
177
+ })
134
178
  ```
135
179
 
136
- For `[controlled-input-writeback]`, write the filtered value back unconditionally and only then
137
- decide whether the field text itself must be reset — never gate the state write on
138
- `filtered !== v`.
180
+ `JSON.parse(JSON.stringify(entity))` is not a fix — it round-trips through the same broken
181
+ serialization the rule reports.
@@ -1,106 +1,73 @@
1
1
  # 平台 API 入参 / 返回契约(@hometrans/platform-api-contract)
2
2
 
3
- ## 现象
3
+ 平台 API 的**文档契约**未被类型系统强制:d.ts 允许的实参在运行期被拒(常返回 `undefined`),
4
+ 或返回值在失败时是 `undefined`。代码编译全绿,运行期静默失效或下一行成员访问崩进程。
5
+
6
+ | 子码 | 现象 | 级别 |
7
+ | --- | --- | --- |
8
+ | `[buffer-arg-type]` | `Uint8Array` 传给要求 `ArrayBuffer` 的 API,返回 `undefined`,下一行 `createPixelMap` 崩 | error |
9
+ | `[nullable-return-unguarded]` | API 失败返回 `undefined`,未判空即成员访问/链式调用 | warn |
10
+ | `[extra-data-empty-string]` | `extraData: ""`,NetStack 报 401、请求不发出 | error / warn |
11
+ | `[encoded-arg-missing]` | `loadData` 传原始 HTML,遇 `#` 截断,页面空白且不报错 | warn |
12
+ | `[sql-capability]` | `CREATE VIRTUAL TABLE` 用了目标平台没有的 module/tokenizer | warn |
13
+ | `[image-src-form]` | `Image(运行期表达式)`,字符串源形态无法静态验证 | warn |
14
+
15
+ ## 判定边界
16
+
17
+ 表格驱动子码读 `data/api-param-contract.json`,`extraData` 走 CFG;都按方法级。
18
+
19
+ - **buffer-arg-type**:调用方必须是 API 的真实 owner(`receiver`);`argIndex` 实参不命中
20
+ `allowText` 且命中 `rejectText`(可直接命中,或沿唯一局部声明)→ error。`.buffer` 系列、
21
+ `as ArrayBuffer`、字符串字面量、真实 `ArrayBuffer`、URI 重载放行。只认语句括号深度 0 的调用,
22
+ 闭包体归闭包自己;if 语句只取条件文本当判空守卫。
23
+ - **nullable-return-unguarded**:唯一赋值的 `api(...)` 之后,首次深度 0 的 `x.` 与赋值之间没有
24
+ 判空 → warn,报在使用行。认 `x === null|undefined`、`x !== null|undefined`、`!x`、`if (x)`、
25
+ `x &&`;helper 断言等认不出,故只 warn。
26
+ - **extra-data-empty-string**:左值是 `extraData` 的赋值。字面量 `""` → error;非空字面量 /
27
+ `JSON.stringify` → 过;局部变量有界回溯;方法参数查调用点(有人传 `""` → error,无法证明
28
+ 非空 → warn);非 string 跳过。空值守卫内安全;无关分支只把调用点证明降为 warn。
29
+ - **encoded-arg-missing**:实参(或其唯一赋值来源)必须来自 `encoders`(`encodeToStringSync` /
30
+ `encodeSync` / `encodeURIComponent` / `encodeURI`)。无插值且不含 `#` / `%` 的字面量放行;
31
+ 另有两类合法调用形态同样放行(`acceptWhen`):`encoding` 字面量为 `base64`,或
32
+ `baseUrl` / `historyUrl` 传了非空字面量(d.ts:两参同时为空才走 `data:` URL;建议传空格)。
33
+ 变量形式无法证明非空,仍 warn;回溯失败仍 warn;`receiver` 必须锚定真实 owner
34
+ (如 `WebviewController.loadData`;分析器给的是 `MethodSignature` 对象,比较前统一转字符串)。
35
+ - **sql-capability**:从 `build-profile.json5` 的 `runtimeOS` 取目标平台,解析不到直接静默。
36
+ 只报 `sqlCapabilities` 查表结果为 `false`;`true`、未登记、变量 tokenizer 静默。只看
37
+ `CREATE VIRTUAL TABLE` 起始行后的 3 行窗口。
38
+ - **image-src-form**:只报运行期表达式(成员访问、调用、模板、拼接)。`$r` / `$rawfile` /
39
+ `PixelMap` / 裸标识符 / 无插值字面量 / 注释跳过;不解析 data URL 内容。
4
40
 
5
- 平台 API 的**文档契约**没有被类型系统强制:d.ts 允许的实参类型在运行期被拒(往往不抛错,
6
- 而是返回 `undefined`),或者返回值在失败时是 `undefined`。于是代码编译全绿、内置规则全过,
7
- 运行期要么静默失效、要么下一行成员访问直接崩进程。
8
-
9
- | 子码 | 运行期表现 |
10
- | --- | --- |
11
- | `[buffer-arg-type]` | `image.createImageSource(bytes)`,而 `bytes` 是 `util.Base64Helper().decodeSync(...)` 出来的 `Uint8Array`(d.ts 要求 `ArrayBuffer`)——**编译零诊断**,运行期返回值是 `undefined`,紧接着 `source.createPixelMap()` 抛 `Cannot read property 'createPixelMap' of undefined`,进程被杀 |
12
- | `[nullable-return-unguarded]` | 同一类 API 失败时返回 `undefined`,调用方未判空就做成员访问/链式调用——同样抛 `Cannot read property … of undefined`(被 try/catch 兜住时则静默降级) |
13
- | `[extra-data-empty-string]` | `http.HttpRequestOptions.extraData` 传了 `""`(类型是 `string \| Object \| ArrayBuffer`,空串完全合法)——NetStack 在参数校验阶段拒绝,请求根本不发出,日志只有 `NETSTACK error 401 Parameter error`(看起来像鉴权失败) |
14
-
15
- ## 判定
16
-
17
- 三个子码共用一条规则:两个"表格驱动"子码按 `data/api-param-contract.json` 判定,一个"值域"
18
- 子码(extraData)走 CFG 语义分析。检查都在方法级进行。
19
-
20
- ### 表格驱动(`data/api-param-contract.json`)
21
-
22
- 契约表按 **API 方法名**(路径最后一段)索引,新增同类 API 只改 JSON:
23
-
24
- ```json
25
- {
26
- "argContracts": {
27
- "createImageSource": {
28
- "argIndex": 0,
29
- "expect": "ArrayBuffer",
30
- "receiver": "multimedia\\.image|@kit\\.ImageKit|(?:^|[^.\\w$])image[.:]",
31
- "rejectText": ["decodeSync(", "new Uint8Array(", "new util.TextEncoder().encode("],
32
- "allowText": [".buffer", ".buffer.slice(", ".buffer.subarray(", "as ArrayBuffer"]
33
- }
34
- },
35
- "nullableReturns": {
36
- "createImageSource": { "type": "ImageSource", "receiver": "multimedia\\.image|..." }
37
- }
38
- }
39
- ```
40
-
41
- **精度规则(每条都对应一次真实误报)**
42
-
43
- - 只把 `ArkInvokeStmt` / `ArkAssignStmt` 当调用点,`:ArkIfStmt` 只取**条件文本**当判空守卫——
44
- ArkAnalyzer 的 if 语句原文包含整个块体,照抄会"if 行和调用行各报一次"。
45
- - 只认**本语句括号深度 0** 的调用:写在 `.then(() => { … })` 闭包里的调用属于闭包自己的方法,
46
- 不再算到外层语句头上(否则 then 行与闭包内行重复)。
47
- - 被调方必须属于该 API 的真实归属(`receiver`):项目里同名封装
48
- (`ImageUtil.createImageSource(bytes: Uint8Array)`)不会触发。
49
- - `allowText` 命中的实参是**正确写法**,一律放行:`x.buffer`、`x.buffer.slice(...)`、
50
- `x.buffer.subarray(...)`、`as ArrayBuffer`(内联写法同样放行)。
51
- - 局部变量回溯**只沿唯一声明**:方法内同名声明出现多次(`if/else` 各一个)时直接沉默——
52
- 文本层回溯不分作用域,宁可漏报也不误报。
53
-
54
- - **buffer-arg-type**——`receiver` 通过的调用,`argIndex` 位置的实参**不命中** `allowText`
55
- 且**命中** `rejectText`(或经唯一局部声明回溯到命中)即 **error**。字符串字面量、真正的
56
- `ArrayBuffer`、`.buffer` 系列、URI 重载均不触发。
57
- - **nullable-return-unguarded**——`const|let|var x = api(…)` 中 `api` 属于
58
- `nullableReturns`,其后**首次**深度 0 出现 `x.` 且与赋值之间没有任何判空即 **warn**,
59
- 报在**使用语句那一行**。认的判空:`x === null|undefined`、`x !== null|undefined`、`!x`、
60
- `if (!x)`、`if (x)`、`x &&`。判空写法开放式(helper 断言、包一层函数等认不出来),
61
- 所以定 warn 交人工裁决,不阻断。
41
+ ## 严重度
62
42
 
63
- ### 值域(CFG 语义)
43
+ - `error`:`[buffer-arg-type]`;可证为空的 `[extra-data-empty-string]`(字面量或调用点确传 `""`)。
44
+ - `warn`:`[nullable-return-unguarded]`、无法证明为空的 extraData、`[encoded-arg-missing]`、
45
+ `[sql-capability]` 的 `false` 命中、`[image-src-form]`。只有 `@hometrans` 的 warn 进入判定,
46
+ error 必修。
64
47
 
65
- - **extra-data-empty-string**——`ArkAssignStmt` 左值是名为 `extraData` 的
66
- `ArkInstanceFieldRef`(`{ extraData: body }` 与 `options.extraData = body` 在 IR 里同形)。
67
- 逐个赋值点判断取值能否为空串:字面量 `""` → 可证为空(**error**);非空字面量 /
68
- `JSON.stringify(...)` → 通过;方法内局部变量 → 有界回溯其赋值(取并集);方法参数 →
69
- 跨文件查调用点(有调用点传 `""` → **error**,无法证明非空 → **warn**);非 string 类型
70
- (Object / ArrayBuffer)→ 不是本缺陷,跳过。赋值被空值判断包住即安全
71
- (`if (body.length > 0) options.extraData = body;`);`if (method === RequestMethod.POST)`
72
- 这类无关分支不算,只能让调用点证明降级为 warn。
48
+ ## 修复
73
49
 
74
- ## 严重度
50
+ ```ts
51
+ // [buffer-arg-type] Uint8Array → ArrayBuffer(底层缓冲区的精确切片)
52
+ const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
53
+ const source = image.createImageSource(buffer);
75
54
 
76
- - `error`:`[buffer-arg-type]`——实参形态(不命中 `allowText` 且命中 `rejectText`,含唯一局部
77
- 声明回溯)在任何合法读法下都是错的;`[extra-data-empty-string]` 可证为空(字面量,或某调用点
78
- 确实传 `""`)。
79
- - `warn`:`[nullable-return-unguarded]`(判空写法可识别性与失败路径可达性取决于代码,交评审)、
80
- `[extra-data-empty-string]` 可能为空但无法证明(无空值保护)。
55
+ // [nullable-return-unguarded] 先判空,不要直接链式调用
56
+ if (source === undefined) { this.releasePixelMap(); return; }
81
57
 
82
- 只评判 `@hometrans` 的 warn:门禁逐条判断是否为真缺陷,确认是再修,误报或不该改的记录理由
83
- 后保留;error 必须修。其它规则集的 warn 一律忽略。
58
+ // [extra-data-empty-string] 空体不赋字段,而不是赋 ""
59
+ if (body.length > 0) { options.extraData = body; }
84
60
 
85
- ## 修复
61
+ // [encoded-arg-missing] 先 Base64 或 URL 编码(确保 # 不会成为 fragment)
62
+ const b64 = new util.Base64Helper().encodeToStringSync(bytes);
63
+ this.controller.loadData(b64, 'text/html', 'base64');
86
64
 
87
- ```ts
88
- // [buffer-arg-type] Uint8Array → ArrayBuffer(取底层缓冲区的精确切片)
89
- const bytes: Uint8Array = new util.Base64Helper().decodeSync(pureBase64);
90
- const buffer: ArrayBuffer =
91
- bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
92
- const source: image.ImageSource | undefined = image.createImageSource(buffer);
65
+ // 或者:官方给出的另一条合法路径 —— baseUrl/historyUrl 传非空(推荐空格),
66
+ // 此时 HTML 以普通文档加载,# 不会成为 fragment
67
+ this.controller.loadData(html, 'text/html', 'UTF-8', ' ', ' ');
93
68
 
94
- // [nullable-return-unguarded] 失败即回落占位,不要直接链式调用
95
- if (source === undefined) {
96
- this.releasePixelMap(); // 渲染占位分支
97
- return;
98
- }
99
- source.createPixelMap().then(/* … */).catch(/* … */);
69
+ // [sql-capability] 改用目标平台自带的分词器
70
+ "... USING fts5(content, tokenize = 'trigram')"
100
71
 
101
- // [extra-data-empty-string] 空请求体时不赋 extraData,而不是赋 ""
102
- const options: http.HttpRequestOptions = { method: POST, header: { 'Content-Type': 'application/json' } };
103
- if (body.length > 0) {
104
- options.extraData = body;
105
- }
72
+ // [image-src-form] 确认是 http(s) / file / data:<mime>;base64,<payload>,并满足对应权限/沙箱要求
106
73
  ```