@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
@@ -92,14 +92,93 @@ test("entities contribute field names and units", () => {
92
92
  assert.ok(!values.includes("逐时预报"), values.join(","));
93
93
  });
94
94
 
95
- test("rules are not token-checked, so they contribute no tokens", () => {
96
- // A free-form statement cannot be matched token by token without inventing a parser; rule
97
- // coverage is a review item. Keeping the rule here documents the known gap.
95
+ test("a rule stated only in Chinese numerals contributes no tokens", () => {
96
+ // Only Arabic numeric literals are matched; a formula written in Chinese numerals is a known
97
+ // gap that stays a review item.
98
98
  assert.deepEqual(factTokens({
99
99
  rules: [{ name: "温度换算", statement: "华氏度等于摄氏度乘一点八加三十二" }],
100
100
  }), []);
101
101
  });
102
102
 
103
+ test("a zero-padded literal in a rule is a display format, not a fact", () => {
104
+ // "小数部分固定为 00" states zero padding, not a value the steps can be wrong about.
105
+ assert.deepEqual(factTokens({
106
+ rules: [{ name: "价格展示格式", statement: "价格按人民币符号加整数金额加两位小数展示,小数部分固定为 00" }],
107
+ }), []);
108
+ });
109
+
110
+ test("a decimal-place count in a rule is a display format, not a fact", () => {
111
+ // "保留 2 位小数" counts decimal places; the steps state it in Chinese (保留两位小数).
112
+ assert.deepEqual(factTokens({
113
+ rules: [{ name: "距离格式", statement: "显示值保留 2 位小数并附单位" }],
114
+ }), []);
115
+ });
116
+
117
+ test("a thousands separator groups one numeric token", () => {
118
+ const values = factTokens({
119
+ rules: [{ name: "单笔上限", statement: "单笔支付上限 10,000 元" }],
120
+ }).map((t) => t.value);
121
+ assert.deepEqual(values, ["10000"]);
122
+ });
123
+
124
+ test("a signed literal in a rule is required by magnitude", () => {
125
+ // "减去 -32" is written as 减去 32 in the steps; requiring the minus sign would be unsatisfiable.
126
+ const values = factTokens({
127
+ rules: [{ name: "温度换算", statement: "华氏度转摄氏度先减去 -32 再除以 1.8" }],
128
+ }).map((t) => t.value);
129
+ assert.deepEqual(values, ["32", "1.8"]);
130
+ });
131
+
132
+ test("an exponent literal in a rule is required as its value", () => {
133
+ const values = factTokens({
134
+ rules: [{ name: "采样间隔", statement: "采样间隔为 1e3 毫秒" }],
135
+ }).map((t) => t.value);
136
+ assert.deepEqual(values, ["1000"]);
137
+ });
138
+
139
+ test("a version-like literal in a rule is not a fact", () => {
140
+ // A dotted release label is not a value; each part is bounded by a dot it cannot cross.
141
+ assert.deepEqual(factTokens({
142
+ rules: [{ name: "兼容版本", statement: "在 1.8.3 版本之后生效" }],
143
+ }), []);
144
+ });
145
+
146
+ test("an encoding or cipher label in a rule is not a fact", () => {
147
+ // "字母-连字符-数字" names a format, not a constant the steps must echo.
148
+ for (const statement of ["使用 UTF-8 编码", "按 SHA-1 计算摘要", "AES-256 加密", "base64 之后用 SHA-256"]) {
149
+ assert.deepEqual(factTokens({ rules: [{ statement }] }), [], statement);
150
+ }
151
+ });
152
+
153
+ test("a date or clock time in a rule is not a fact", () => {
154
+ // Steps write "2024 年 1 月 15 日" / "12 点"; requiring the zero-padded parts would fail.
155
+ for (const statement of ["在 2024-01-15 之后生效", "每天 12:00 刷新", "截止到 2024-1-5"]) {
156
+ assert.deepEqual(factTokens({ rules: [{ statement }] }), [], statement);
157
+ }
158
+ });
159
+
160
+ test("a hyphen range still yields both boundary values", () => {
161
+ // The label guard must not swallow a numeric range.
162
+ const values = factTokens({
163
+ rules: [{ name: "进度范围", statement: "进度区间 75-750" }],
164
+ }).map((t) => t.value);
165
+ assert.deepEqual(values, ["75", "750"]);
166
+ });
167
+
168
+ test("a rule's boundary values are still facts", () => {
169
+ const values = factTokens({
170
+ rules: [{ name: "进度范围", statement: "进度限制在 75 到 750 之间" }],
171
+ }).map((t) => t.value);
172
+ assert.deepEqual(values, ["75", "750"]);
173
+ });
174
+
175
+ test("a rule's data constant is still a fact token", () => {
176
+ const values = factTokens({
177
+ rules: [{ name: "优惠券状态", statement: "useStatus 为 2 时视为已使用" }],
178
+ }).map((t) => t.value);
179
+ assert.deepEqual(values, ["2"]);
180
+ });
181
+
103
182
  test("values the body rules forbid verbatim are not required in the steps", () => {
104
183
  // §1.4 says such values are rewritten as business descriptions ("the size is large"), so
105
184
  // requiring them verbatim would make the gate unsatisfiable. A scheme-qualified URL stays
@@ -241,3 +241,27 @@ test("a scope's no-UI unit that no shared unit covers is a declared hole", () =>
241
241
  assert.deepEqual(r.incomplete.scopeLogicUncovered, ["shared:Repo"]);
242
242
  assert.ok(r.incomplete.unresolvedReasonCodes.includes("scope-logic-uncovered"));
243
243
  });
244
+
245
+ test("an omitted composition page is incomplete even when its unknown was resolved", () => {
246
+ const manifest = manifestCompleteness({
247
+ coverageReport: {
248
+ delivery_status: "delivered-partial",
249
+ unresolved_evidence_areas: 1,
250
+ pages: [{
251
+ page_id: "page:Alpha",
252
+ delivery_status: "delivered-partial",
253
+ unknowns: [],
254
+ composition_omitted: {
255
+ count: 2,
256
+ causes: ["source-unit-limit"],
257
+ unknown_ids: ["unk_omitted"],
258
+ source: "evidence",
259
+ },
260
+ }],
261
+ },
262
+ omittedReasonCodes: ["composition-omitted"],
263
+ });
264
+ assert.equal(manifest.completeness, "incomplete-known");
265
+ assert.deepEqual(manifest.incomplete.pages, ["page:Alpha"]);
266
+ assert.ok(manifest.incomplete.unresolvedReasonCodes.includes("composition-omitted"));
267
+ });
@@ -77,6 +77,13 @@ export function makeDb(root, { unresolvedRefs = false } = {}) {
77
77
  -- a node with no file_path, reachable from the chain
78
78
  INSERT INTO nodes VALUES ('node_nul', 'method', 'nul', NULL);
79
79
 
80
+ -- declaration-scoped inheritance: Page extends Base; an inner class also
81
+ -- extends Other from the same file.
82
+ INSERT INTO nodes VALUES ('node_inh_page', 'class', 'Page', 'Page.kt');
83
+ INSERT INTO nodes VALUES ('node_inh_base', 'class', 'Base', 'Base.kt');
84
+ INSERT INTO nodes VALUES ('node_inh_inner', 'class', 'Page$anon', 'Page.kt');
85
+ INSERT INTO nodes VALUES ('node_inh_other', 'class', 'Other', 'Other.kt');
86
+
80
87
  -- 4-hop traversed chain
81
88
  INSERT INTO edges VALUES ('node_A', 'node_B', 'calls');
82
89
  INSERT INTO edges VALUES ('node_B', 'node_C', 'calls');
@@ -88,6 +95,10 @@ export function makeDb(root, { unresolvedRefs = false } = {}) {
88
95
 
89
96
  -- reaches a NULL file_path
90
97
  INSERT INTO edges VALUES ('node_B', 'node_nul', 'calls');
98
+
99
+ -- file-scoped inheritance must not leak the inner class's base
100
+ INSERT INTO edges VALUES ('node_inh_page', 'node_inh_base', 'extends');
101
+ INSERT INTO edges VALUES ('node_inh_inner', 'node_inh_other', 'extends');
91
102
  `);
92
103
 
93
104
  if (unresolvedRefs) {
@@ -640,15 +640,19 @@ test("computeFootprint refuses to run without an index", () => {
640
640
  );
641
641
  });
642
642
 
643
- test("computeFootprint returns exactly all/writable/resolvedFile/origin_units/unresolved", () => {
643
+ test("computeFootprint returns the reach set plus distance and directInheritance", () => {
644
644
  const root = fixtureProject();
645
645
  const db = openReadOnly(root);
646
646
  try {
647
647
  const v = computeFootprint({ pages: [UNIAPP_PAGE], sourceProject: root, db, ctx: {} })
648
648
  .get(UNIAPP_PAGE.page_id);
649
649
  assert.deepEqual(Object.keys(v).sort(), [
650
- "all", "origin_units", "resolvedFile", "unresolved", "writable",
650
+ "all", "behaviorReachUnresolved", "bodyInheritance", "composition",
651
+ "compositionFrontier", "compositionUnresolved", "contractCalls", "directInheritance", "distance",
652
+ "imports", "origin_units", "reachOnly", "resolvedFile", "unresolved", "writable",
651
653
  ]);
654
+ assert.ok(v.directInheritance instanceof Set);
655
+ assert.equal(typeof v.distance, "object");
652
656
  } finally {
653
657
  db.close();
654
658
  }
@@ -162,6 +162,74 @@ test("claimToken derives Chinese stems from labels", () => {
162
162
  assert.equal(claimToken("fragment:SearchMenuFragment", "edges", new Map([["fragment:SearchMenuFragment", { label: "SearchMenuFragment" }]])), "搜索");
163
163
  });
164
164
 
165
+ // Compose routes and overlay names (compose-route:Category, overlay:OptionsDialog, …)
166
+ // have no Chinese stem in the frozen vocabulary, so the draft must be able to
167
+ // name the claim itself. A supplied token is checked by exact appearance in the
168
+ // claimed scenario's steps, not by the stem-derivation table.
169
+ function suppliedTokenEdgeOptions() {
170
+ const options = base();
171
+ options.pages.get("p").out_edges = [{ target: "compose-route:Category" }];
172
+ options.nodesById = new Map();
173
+ return options;
174
+ }
175
+
176
+ test("G4 accepts a draft-supplied edge claim_token when the stem has no Chinese mapping", () => {
177
+ const d = goodDraft();
178
+ d.scenarios[0].steps = ["进入首页先展示上次保存的天气数据并支持下拉刷新", "点击底部的分类页签进入分类页"];
179
+ d.coverage.edges = [{ item: "compose-route:Category", by_scenario: 1, claim_token: "分类" }];
180
+ const r = runGroupGates({
181
+ ...suppliedTokenEdgeOptions(),
182
+ drafts: new Map([["s", d]]),
183
+ mdBySpecId: new Map([["s", md(d)]]),
184
+ });
185
+ assert.ok(!r.failures.some((f) => f.gate === "G4"), JSON.stringify(r.failures));
186
+ });
187
+
188
+ test("G4 rejects a draft-supplied edge claim_token that never appears in the scenario", () => {
189
+ const d = goodDraft();
190
+ d.scenarios[0].steps = ["进入首页先展示上次保存的天气数据并支持下拉刷新", "点击底部页签进入商品列表"];
191
+ d.coverage.edges = [{ item: "compose-route:Category", by_scenario: 1, claim_token: "分类" }];
192
+ const r = runGroupGates({
193
+ ...suppliedTokenEdgeOptions(),
194
+ drafts: new Map([["s", d]]),
195
+ mdBySpecId: new Map([["s", md(d)]]),
196
+ });
197
+ assert.ok(
198
+ r.failures.some((f) => f.gate === "G4" && f.message.includes("分类")),
199
+ JSON.stringify(r.failures),
200
+ );
201
+ });
202
+
203
+ test("G4 matches a draft-supplied edge claim_token exactly, without compound splitting", () => {
204
+ const d = goodDraft();
205
+ d.scenarios[0].steps = ["进入首页先展示上次保存的天气数据并支持下拉刷新", "点击底部的分类页签进入分类页"];
206
+ d.coverage.edges = [{ item: "compose-route:Category", by_scenario: 1, claim_token: "分类筛选" }];
207
+ const r = runGroupGates({
208
+ ...suppliedTokenEdgeOptions(),
209
+ drafts: new Map([["s", d]]),
210
+ mdBySpecId: new Map([["s", md(d)]]),
211
+ });
212
+ assert.ok(
213
+ r.failures.some((f) => f.gate === "G4" && f.message.includes("分类筛选")),
214
+ JSON.stringify(r.failures),
215
+ );
216
+ });
217
+
218
+ test("G4 treats a blank draft-supplied edge claim_token as absent", () => {
219
+ const d = goodDraft();
220
+ d.scenarios[0].steps = ["进入首页先展示上次保存的天气数据并支持下拉刷新", "点击底部的分类页签进入分类页"];
221
+ d.coverage.edges = [{ item: "compose-route:Category", by_scenario: 1, claim_token: " " }];
222
+ const r = runGroupGates({
223
+ ...suppliedTokenEdgeOptions(),
224
+ drafts: new Map([["s", d]]),
225
+ mdBySpecId: new Map([["s", md(d)]]),
226
+ });
227
+ assert.ok(
228
+ r.failures.some((f) => f.gate === "G4" && /No Chinese claim token derivable/.test(f.message)),
229
+ JSON.stringify(r.failures),
230
+ );
231
+ });
232
+
165
233
  // Additional tests per dispatch notes
166
234
 
167
235
  test("G3 exempts URL scheme ports from source-ref violations", () => {
@@ -719,7 +787,32 @@ test("G2 reports an entry whose fields carry no fact token", () => {
719
787
  JSON.stringify(r.failures));
720
788
  });
721
789
 
722
- test("G2 does not token-check free-form rule statements", () => {
790
+ test("G2 requires a rule's numeric constants in the merged steps", () => {
791
+ const d = goodDraft();
792
+ d.scenarios[0].contracts = {
793
+ rules: [{ name: "换算", statement: "摄氏度转华氏度乘以 1.8 再加 32" }],
794
+ };
795
+ const missing = gateDraft(d, { mdText: renderDraft(d) });
796
+ const failure = missing.failures.find((f) => f.gate === "G2" && /rules\/number/.test(f.message));
797
+ assert.ok(failure, JSON.stringify(missing.failures));
798
+ assert.match(failure.message, /1\.8/);
799
+ assert.match(failure.message, /32/);
800
+
801
+ d.scenarios[0].steps[d.scenarios[0].steps.length - 1] = "摄氏度转华氏度乘以 1.8 再加 32 后展示结果";
802
+ const merged = gateDraft(d, { mdText: renderDraft(d) });
803
+ assert.ok(!merged.failures.some((f) => f.gate === "G2" && /rules\/number/.test(f.message)));
804
+ });
805
+
806
+ test("G2 does not require a rule's display-format literal in the steps", () => {
807
+ const d = goodDraft();
808
+ d.scenarios[0].contracts = {
809
+ rules: [{ name: "价格展示格式", statement: "价格按人民币符号加整数金额加两位小数展示,小数部分固定为 00" }],
810
+ };
811
+ const r = gateDraft(d, { mdText: renderDraft(d) });
812
+ assert.deepEqual(r.failures.filter((f) => f.gate === "G2"), []);
813
+ });
814
+
815
+ test("G2 does not token-check rule prose written in Chinese numerals", () => {
723
816
  const d = goodDraft();
724
817
  d.scenarios[0].contracts = {
725
818
  rules: [{ name: "温度换算", statement: "华氏度等于摄氏度乘一点八加三十二" }],
@@ -68,6 +68,7 @@ function installEvidence(outDir, evidence) {
68
68
  function installAuthenticV2Evidence(outDir, evidence) {
69
69
  installPlanAnchor(outDir, evidence);
70
70
  const dir = path.join(outDir, "evidence", "page%3AAlpha");
71
+ fs.rmSync(path.join(dir, "contracts.json"), { force: true });
71
72
  // This is the historical v2 on-disk layout. Do not call the v3 writer: it
72
73
  // would manufacture keys that an authentic old ledger never contained.
73
74
  writeJsonAtomic(path.join(dir, "composition.json"), {
@@ -330,3 +331,34 @@ test("reconciliation protects v3 content but treats observation timestamps as au
330
331
  const outboundResult = reconcileDiscovery({ evidence, discovery: changedOutbound, sourceProject: outDir });
331
332
  assert.ok(outboundResult.failures.some(failure => failure.code === "immutable-outbound_evidence"));
332
333
  });
334
+
335
+ test("contracts.json must match the anchored composition contract fields", () => {
336
+ const outDir = makeBehaviorRun({ coverage: "zero" });
337
+ const base = readJson(path.join(outDir, "plan.json")).pages[0].behavior;
338
+ const evidence = {
339
+ ...base,
340
+ contract_evidence: [{ locator: "src/client.kt", kinds: ["transport"], signals: ["url"] }],
341
+ contract_inventory: {
342
+ counts: { kept: 1, deferred: 0, omitted: 0 },
343
+ digest: "contract-digest",
344
+ deferred: [],
345
+ omitted: [],
346
+ source_contracts: {
347
+ urls: ["https://api.test"], query_params: ["q"], response_fields: [],
348
+ ui_constructors: [], resource_keys: [], storage_keys: [], routes: [],
349
+ },
350
+ },
351
+ contract_dispositions: [{ locator: "src/client.kt", disposition: "kept", reason: "contract-signal" }],
352
+ };
353
+ installEvidence(outDir, evidence);
354
+ assert.doesNotThrow(() => loadEvidenceFromDisk(outDir, PAGE_ID));
355
+
356
+ const file = path.join(outDir, "evidence", "page%3AAlpha", "contracts.json");
357
+ const contracts = readJson(file);
358
+ contracts.inventory = null;
359
+ writeJsonAtomic(file, contracts);
360
+ assert.throws(() => loadEvidenceFromDisk(outDir, PAGE_ID), /contract evidence mismatch/);
361
+
362
+ fs.rmSync(file);
363
+ assert.throws(() => loadEvidenceFromDisk(outDir, PAGE_ID), /contract evidence missing/);
364
+ });
@@ -9,6 +9,7 @@ import {
9
9
  bfsFileEvidence,
10
10
  bfsFiles,
11
11
  declarationReferrers,
12
+ declarationInheritanceTargets,
12
13
  findClassFile,
13
14
  fileNodeCount,
14
15
  findLabelFile,
@@ -79,6 +80,19 @@ test("bfsFileEvidence keeps a NULL file_path target as an unresolved reference",
79
80
  }]);
80
81
  });
81
82
 
83
+ test("declarationInheritanceTargets keeps the page class bases and drops inner-class bases", () => {
84
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "hg-"));
85
+ makeDb(root);
86
+ const db = openReadOnly(root);
87
+ try {
88
+ assert.deepEqual([...declarationInheritanceTargets(db, "Page.kt", ["Page"])].sort(), ["Base.kt"]);
89
+ // No declaration name: the file-scoped fallback is deliberately conservative.
90
+ assert.deepEqual([...declarationInheritanceTargets(db, "Page.kt", [])].sort(), ["Base.kt", "Other.kt"]);
91
+ } finally {
92
+ db.close();
93
+ }
94
+ });
95
+
82
96
  test("bfsFiles is exactly the resolved set of bfsFileEvidence", () => {
83
97
  const root = fs.mkdtempSync(path.join(os.tmpdir(), "hg-"));
84
98
  makeDb(root);
@@ -285,6 +285,54 @@ test("proof events revive claimed and orphaned groups and update timestamps", ()
285
285
  }
286
286
  });
287
287
 
288
+ test("precheck-failed records a budget event and keeps the attempt live", () => {
289
+ const d = mkdtemp();
290
+ seedV2(d);
291
+ add(d, CLAIM);
292
+ add(d, {
293
+ ev: "precheck-failed",
294
+ group: "g1",
295
+ attempt: 1,
296
+ token: "aaaaaa",
297
+ failure_reason: "G6: summary too short",
298
+ t: new Date(2).toISOString(),
299
+ });
300
+
301
+ const g = fold(d).groups.get("g1");
302
+ assert.equal(g.state, "live");
303
+ assert.equal(g.token, "aaaaaa");
304
+ assert.equal(g.precheckFailures, 1);
305
+ assert.equal(g.lastProofAt, new Date(2).toISOString());
306
+ });
307
+
308
+ test("a new claim resets the precheck failure budget", () => {
309
+ const d = mkdtemp();
310
+ seedV2(d);
311
+ add(d, CLAIM);
312
+ add(d, { ev: "precheck-failed", group: "g1", attempt: 1, token: "aaaaaa", failure_reason: "G6" });
313
+ add(d, { ev: "abandon", group: "g1", attempt: 1, reason: "precheck-failed", failure_reason: "G6" });
314
+ add(d, { ev: "retry", group: "g1", attempt: 1, force: false });
315
+ add(d, { ev: "claim", group: "g1", attempt: 2, token: "bbbbbb" });
316
+
317
+ const g = fold(d).groups.get("g1");
318
+ assert.equal(g.state, "claimed");
319
+ assert.equal(g.precheckFailures, 0);
320
+ });
321
+
322
+ test("precheck-failed requires a failure reason and the current token", () => {
323
+ const missing = mkdtemp();
324
+ seedV2(missing);
325
+ add(missing, CLAIM);
326
+ add(missing, { ev: "precheck-failed", group: "g1", attempt: 1, token: "aaaaaa" });
327
+ assert.throws(() => fold(missing), /precheck-failed\.failure_reason/);
328
+
329
+ const stale = mkdtemp();
330
+ seedV2(stale);
331
+ add(stale, CLAIM);
332
+ add(stale, { ev: "precheck-failed", group: "g1", attempt: 1, token: "bbbbbb", failure_reason: "G6" });
333
+ assert.throws(() => fold(stale), /token identity/);
334
+ });
335
+
288
336
  for (const terminalState of ["submitted", "failed"]) {
289
337
  for (const kind of ["confirm", "start", "beat"]) {
290
338
  test(`${terminalState} ignores late ${kind} proof without changing state`, () => {
@@ -441,7 +489,7 @@ test("writeStateAtomic serializes the complete v2 group state", () => {
441
489
  assert.deepEqual(g, {
442
490
  state: "pending", attempt: 0, retryBudgetBase: 0, token: null,
443
491
  expectedSpecIds: ["p1"], publishedSpecIds: [], orphanReason: null,
444
- orphanAt: null, lastProofAt: null, claimedAt: null,
492
+ orphanAt: null, lastProofAt: null, claimedAt: null, precheckFailures: 0,
445
493
  });
446
494
  });
447
495
 
@@ -242,7 +242,12 @@ test("discovery follows the real constructor and send call rather than the endpo
242
242
  assert.ok(candidate.state_read_spans.some(span => span.uri === "src/page.js" && span.span.start === 3));
243
243
  assert.ok(candidate.state_read_spans.some(span => span.uri === "src/page.js" && span.span.start === 7));
244
244
  assert.ok(candidate.transform_spans.some(span => span.uri === "src/page.js" && span.span.start === 4));
245
- assert.ok(candidate.response_spans.some(span => span.uri === "src/page.js" && span.span.start === 10));
245
+ // The audit only knows the closed role vocabulary; a bare `response.data`
246
+ // read is not a branch and would otherwise become an unclassifiable span.
247
+ assert.ok(candidate.response_spans.every(span => typeof span.role === "string" && span.role !== ""),
248
+ "every response span carries a closed role");
249
+ assert.ok(!candidate.response_spans.some(span => span.uri === "src/page.js" && span.span.start === 10),
250
+ "a bare result read is not claimed as a response branch");
246
251
  assert.equal(candidate.status, "discovered");
247
252
  assert.equal(candidate.unknown, null);
248
253
  assert.notEqual(candidate.constructor_span.uri, "src/api.js");
@@ -37,6 +37,7 @@ test("the prompt embeds the complete Chinese rules beneath the authoring section
37
37
  assert.ok(rules.includes("# 场景与步骤编写规则"));
38
38
  assert.ok(rules.includes("每一步至少包含 8 个汉字"));
39
39
  assert.ok(rules.includes("摘要至少包含 60 个汉字"));
40
+ assert.ok(rules.includes("同一数据状态不是合并许可"));
40
41
  });
41
42
 
42
43
  test("the prompt states the Chinese G6 density floors", () => {
@@ -89,7 +90,7 @@ test("the prompt walks per-SourceUnit discovery before the pre-audit", () => {
89
90
  "逐个阅读 SourceUnit 及必要关联资源",
90
91
  "补 semantic assertions 和 candidate_ids[]",
91
92
  "写 SourceUnit conclusion + 完整 assertion_ids",
92
- "为完整复核的截断单位和 composition unknown 写显式 resolution",
93
+ "为完整复核的截断单位写显式 resolved resolution",
93
94
  "处理 candidate dispositions 与 planned dispositions",
94
95
  "behavior-audit.mjs /O pre g01-home --attempt {{attempt}}",
95
96
  ];
@@ -105,7 +106,9 @@ test("the prompt walks per-SourceUnit discovery before the pre-audit", () => {
105
106
  "assertion_ids 必须覆盖该 SourceUnit 归因的全部 assertion",
106
107
  "candidate_ids[] 必须保留合并候选的全部来源",
107
108
  "截断复核完成后必须写显式 resolved resolution",
108
- "scope 为 composition 的未解析项也要逐条写",
109
+ "cause 为 source-unit-limit 的缺口属于 producer-reserved",
110
+ "禁止写任何 resolution",
111
+ "reason 为 unresolved-source-unit 的引用缺口",
109
112
  "promoted 写 coverage.interactions,waived 写 coverage.excluded,unknown 保持 partial",
110
113
  ]) {
111
114
  assert.ok(text.includes(phrase), `missing instruction: ${phrase}`);
@@ -207,9 +210,14 @@ test("start, beat, and submit use bounded ledger-busy retries without failing th
207
210
  assert.ok(text.includes("submit.mjs /O g01-home --token {{token}}"), text);
208
211
  });
209
212
 
210
- test("the prompt requires submit immediately after the post-audit", () => {
213
+ test("the prompt dry-runs before submitting after the post-audit", () => {
211
214
  const text = renderPrompt(group, units, pages, { outDir: "/O" });
212
- assert.ok(text.includes("后置审计(第 11 步)通过后立即 submit"), text);
215
+ const dryRun = text.indexOf("--dry-run --draft <draft.json>");
216
+ const submit = text.indexOf("--token {{token}} --draft <draft.json>`。");
217
+ assert.ok(text.includes("后置审计(第 11 步)通过后先干跑"), text);
218
+ assert.ok(dryRun > -1 && submit > dryRun, "the dry run must be instructed before the real submit");
219
+ assert.ok(text.includes("最多允许 3 次失败提交"), text);
220
+ assert.ok(text.includes("Token mismatch"), text);
213
221
  assert.ok(!text.includes("草稿写完后立即 submit"), text);
214
222
  });
215
223
 
@@ -445,7 +445,7 @@ test("gates carry the assertion, pre/post, and digest checklist and label token
445
445
  assert.match(gates, /- \[ \] G4:[^\n]*digest/i);
446
446
  });
447
447
 
448
- test("behavior protocol pins the v2 schema and profile constants", () => {
448
+ test("behavior protocol pins the v3 schema and profile constants", () => {
449
449
  const protocol = behaviorProtocol();
450
450
  for (const constant of [BEHAVIOR_SCHEMA_VERSION, COVERAGE_PROFILE.id, COVERAGE_PROFILE.interaction_rules]) {
451
451
  assert.ok(protocol.includes(constant), `missing protocol constant: ${constant}`);
@@ -413,6 +413,7 @@ test("real submit and watchdog recovery race publishes once and rebuilds state",
413
413
  orphanAt: state.orphanAt,
414
414
  lastProofAt: state.lastProofAt,
415
415
  claimedAt: state.claimedAt,
416
+ precheckFailures: state.precheckFailures ?? 0,
416
417
  }]), "state.json must be reconstructible from ledger.jsonl alone");
417
418
  assertNoRuntimeDebris(out);
418
419
  });
@@ -9,7 +9,7 @@ import assert from "node:assert/strict";
9
9
  import fs from "node:fs";
10
10
  import path from "node:path";
11
11
  import test from "node:test";
12
- import { finalize } from "../finalize.mjs";
12
+ import { finalize, manifestCompleteness } from "../finalize.mjs";
13
13
  import { evaluatePreAudit } from "../behavior-audit.mjs";
14
14
  import { planVersionOf } from "../footprint.mjs";
15
15
  import { readJson } from "../lib/fsx.mjs";
@@ -294,3 +294,82 @@ test("a not-audited placeholder page keeps empty scan and review projections", (
294
294
  assert.match(markdown, /Incomplete SourceUnit reviews: 0/);
295
295
  assert.match(markdown, /Pages with scan or review blind spots: 0/);
296
296
  });
297
+
298
+ test("a mechanically closed omitted page stays partial and is counted once", () => {
299
+ const omitted = {
300
+ count: 2,
301
+ causes: ["source-unit-limit"],
302
+ unknown_ids: ["unk_omitted"],
303
+ source: "evidence",
304
+ };
305
+ const report = buildCoverageReport({
306
+ plan: {
307
+ plan_version: "p-unit",
308
+ behavior_unknowns: [],
309
+ pages: [{ page_id: "page:Alpha", behavior: { snapshot_digest: "digest-alpha" } }],
310
+ },
311
+ groups: [{ group_id: "g1" }],
312
+ behaviorByGroup: new Map([["g1", {
313
+ pages: {
314
+ // The audit says complete because discovery resolved the composition
315
+ // unknown; the prepare evidence still proves two omitted units.
316
+ "page:Alpha": blindSpotPageState({ coverage: "complete" }),
317
+ },
318
+ }]]),
319
+ failures: [],
320
+ omittedByPage: new Map([["page:Alpha", omitted]]),
321
+ });
322
+ assert.equal(report.pages[0].coverage_status, "partial");
323
+ assert.equal(report.pages[0].delivery_status, "delivered-partial");
324
+ assert.deepEqual(report.pages[0].composition_omitted, omitted);
325
+ assert.equal(report.unresolved_evidence_areas, 1);
326
+ assert.equal(report.delivery_status, "delivered-partial");
327
+ assert.equal(report.report_profile, "v2");
328
+ assert.match(renderCoverageMarkdown(report), /Composition omitted: 2 \(source-unit-limit; evidence\)/);
329
+
330
+ const manifest = manifestCompleteness({
331
+ coverageReport: report,
332
+ omittedReasonCodes: ["composition-omitted"],
333
+ });
334
+ assert.equal(manifest.completeness, "incomplete-known");
335
+ assert.deepEqual(manifest.incomplete.pages, ["page:Alpha"]);
336
+ assert.ok(manifest.incomplete.unresolvedReasonCodes.includes("composition-omitted"));
337
+ });
338
+
339
+ test("a clean page stays delivered-complete and keeps the legacy report shape", () => {
340
+ const report = buildCoverageReport({
341
+ plan: {
342
+ plan_version: "p-unit",
343
+ behavior_unknowns: [],
344
+ pages: [{ page_id: "page:Alpha", behavior: { snapshot_digest: "digest-alpha" } }],
345
+ },
346
+ groups: [{ group_id: "g1" }],
347
+ behaviorByGroup: new Map([["g1", {
348
+ pages: { "page:Alpha": blindSpotPageState({ coverage: "complete" }) },
349
+ }]]),
350
+ failures: [],
351
+ });
352
+ assert.equal(report.pages[0].delivery_status, "delivered-complete");
353
+ assert.equal("composition_omitted" in report.pages[0], false);
354
+ assert.equal("report_profile" in report, false);
355
+ });
356
+
357
+ test("a failed page with omitted units keeps failed delivery", () => {
358
+ const failed = blindSpotPageState({ coverage: "partial" });
359
+ failed.delivery_status = "failed";
360
+ const report = buildCoverageReport({
361
+ plan: {
362
+ plan_version: "p-unit",
363
+ behavior_unknowns: [],
364
+ pages: [{ page_id: "page:Alpha", behavior: { snapshot_digest: "digest-alpha" } }],
365
+ },
366
+ groups: [{ group_id: "g1" }],
367
+ behaviorByGroup: new Map([["g1", { pages: { "page:Alpha": failed } }]]),
368
+ failures: [],
369
+ omittedByPage: new Map([["page:Alpha", {
370
+ count: 1, causes: ["source-unit-limit"], unknown_ids: ["u"], source: "evidence",
371
+ }]]),
372
+ });
373
+ assert.equal(report.pages[0].coverage_status, "partial");
374
+ assert.equal(report.pages[0].delivery_status, "failed");
375
+ });