@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.
- package/README.md +249 -279
- package/agents/code-reviewer.md +1 -1
- package/dist/cli/editors.json +20 -0
- package/dist/platform/registry.js +1 -0
- package/dist/platform/validate.js +2 -1
- package/i18n/agents/code-reviewer.md +1 -1
- package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
- package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
- package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/package.json +2 -1
- package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/skills/a2h-app-migrate/SKILL.md +31 -14
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
- package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
- package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
- package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
- package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
- package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
- package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- 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
- package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
- package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
- package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
- package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
- package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
- package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
- package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
- package/skills/a2h-page-specgen/SKILL.md +36 -5
- package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
- package/skills/a2h-page-specgen/references/evidence.md +2 -1
- package/skills/a2h-page-specgen/references/execution-model.md +13 -5
- package/skills/a2h-page-specgen/references/gates.md +33 -7
- package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
- package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
- package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
- package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
- package/skills/a2h-resource-convert/SKILL.md +1 -1
- package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
- package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
- package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
- package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
- package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
- package/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
- package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
- package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
- package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
- package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
- package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
- package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
- package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
- package/skills/a2h-utg-static/SKILL.md +3 -3
- package/skills/a2h-utg-static/references/extractors.md +7 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
- package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
- package/resource/convert_pipeline_process.svg +0 -114
- package/resource/project_architecture.svg +0 -120
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
|
@@ -1,138 +1,181 @@
|
|
|
1
|
-
# ArkUI runtime contract
|
|
1
|
+
# ArkUI runtime contract and route-carrier pitfalls (@hometrans/arkui-runtime-pitfall)
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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)
|
|
12
|
-
| `[controlled-input-writeback]` |
|
|
13
|
-
| `[builder-param-bare-method-ref]` |
|
|
14
|
-
| `[builder-param-arrow-inline-component]` |
|
|
15
|
-
| `[dialog-controller-v2-builder]` | V1 `CustomDialogController`
|
|
16
|
-
| `[appstoragev2-connect-creator]` |
|
|
17
|
-
| `[input-type-decimal-domain]` | a price/amount
|
|
18
|
-
| `[theme-mode-closure]` | ThemeMode
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- **
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
the
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- `
|
|
94
|
-
|
|
95
|
-
|
|
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]
|
|
110
|
-
|
|
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]
|
|
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]
|
|
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
|
|
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]
|
|
126
|
-
|
|
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
|
-
// [
|
|
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
|
-
|
|
137
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
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
|
-
// [
|
|
95
|
-
|
|
96
|
-
this.releasePixelMap(); // 渲染占位分支
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
source.createPixelMap().then(/* … */).catch(/* … */);
|
|
69
|
+
// [sql-capability] 改用目标平台自带的分词器
|
|
70
|
+
"... USING fts5(content, tokenize = 'trigram')"
|
|
100
71
|
|
|
101
|
-
// [
|
|
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
|
```
|