@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
|
@@ -4,7 +4,7 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import test from "node:test";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
|
-
import { discoverOperations, operationOwner, pageModulePrefixes } from "../operation-evidence.mjs";
|
|
7
|
+
import { discoverOperations, operationOwner, pageModulePrefixes, selectEnclosingRow } from "../operation-evidence.mjs";
|
|
8
8
|
|
|
9
9
|
const { DatabaseSync } = createRequire(import.meta.url)("node:sqlite");
|
|
10
10
|
const tempRoot = path.join(os.tmpdir(), "opencode");
|
|
@@ -753,3 +753,531 @@ test("Kotlin template parentheses do not truncate the real transport call", (t)
|
|
|
753
753
|
assert.equal(operations[0].status, "discovered");
|
|
754
754
|
assert.deepEqual(operations[0].send_span, ref(uri, 2, 4));
|
|
755
755
|
});
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* The Java/Activity shape that produced zero operations in a real run: the page
|
|
759
|
+
* declaration resolves to a `class` node whose only outgoing edges are
|
|
760
|
+
* `contains`, while the request call site lives in a shared client file that is
|
|
761
|
+
* only reachable through those members.
|
|
762
|
+
*/
|
|
763
|
+
function javaClassSeedFixture(t, { linkMember = true, deadSeed = false, label = "MainActivity", declaredLine = 3 } = {}) {
|
|
764
|
+
const sourceProject = fs.mkdtempSync(path.join(tempRoot, "android-class-seed-"));
|
|
765
|
+
const ui = "app/src/main/java/demo/ui/MainActivity.java";
|
|
766
|
+
const client = "app/src/main/java/demo/data/api/GeoNamesClient.java";
|
|
767
|
+
writeNumberedSource(sourceProject, ui, [
|
|
768
|
+
[1, "package demo.ui;"],
|
|
769
|
+
[3, "public class MainActivity {"],
|
|
770
|
+
[4, " void onCreate() {"],
|
|
771
|
+
[5, " new GeoNamesClient().fetchNearestPlaceInfo();"],
|
|
772
|
+
[6, " }"],
|
|
773
|
+
[7, "}"],
|
|
774
|
+
]);
|
|
775
|
+
writeNumberedSource(sourceProject, client, [
|
|
776
|
+
[1, "package demo.data.api;"],
|
|
777
|
+
[3, "public class GeoNamesClient {"],
|
|
778
|
+
[4, " void fetchNearestPlaceInfo() {"],
|
|
779
|
+
[5, " Request request = new Request.Builder().url(baseUrl).build();"],
|
|
780
|
+
[6, " client.newCall(request).enqueue(null);"],
|
|
781
|
+
[7, " }"],
|
|
782
|
+
[8, "}"],
|
|
783
|
+
]);
|
|
784
|
+
|
|
785
|
+
const db = new DatabaseSync(":memory:");
|
|
786
|
+
db.exec(`
|
|
787
|
+
CREATE TABLE nodes (
|
|
788
|
+
id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
|
|
789
|
+
file_path TEXT, start_line INTEGER, end_line INTEGER
|
|
790
|
+
);
|
|
791
|
+
CREATE TABLE edges (
|
|
792
|
+
id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
|
|
793
|
+
);
|
|
794
|
+
`);
|
|
795
|
+
const node = db.prepare(
|
|
796
|
+
"INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line, end_line) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
797
|
+
);
|
|
798
|
+
for (const row of [
|
|
799
|
+
["main-class", "class", "MainActivity", "demo.ui.MainActivity", ui, 3, 7],
|
|
800
|
+
["main-oncreate", "method", "onCreate", "demo.ui.MainActivity.onCreate", ui, 4, 6],
|
|
801
|
+
["client-class", "class", "GeoNamesClient", "demo.data.api.GeoNamesClient", client, 3, 8],
|
|
802
|
+
["client-fetch", "method", "fetchNearestPlaceInfo", "demo.data.api.GeoNamesClient.fetchNearestPlaceInfo", client, 4, 7],
|
|
803
|
+
]) node.run(...row);
|
|
804
|
+
const edge = db.prepare("INSERT INTO edges (id, source, target, kind, line) VALUES (?, ?, ?, ?, ?)");
|
|
805
|
+
// `deadSeed` keeps the page's seed with no traversable edge at all: the
|
|
806
|
+
// pre-fix Java/Activity shape, where `reachable` never left the seed.
|
|
807
|
+
if (!deadSeed) edge.run(1, "main-class", "main-oncreate", "contains", 4);
|
|
808
|
+
edge.run(2, "client-class", "client-fetch", "contains", 4);
|
|
809
|
+
if (linkMember) edge.run(3, "main-oncreate", "client-fetch", "calls", 5);
|
|
810
|
+
|
|
811
|
+
const pageId = `activity:${label}`;
|
|
812
|
+
const page = {
|
|
813
|
+
page_id: pageId,
|
|
814
|
+
label,
|
|
815
|
+
declared_at: `${ui}:${declaredLine}`,
|
|
816
|
+
source_file: ui,
|
|
817
|
+
out_edges: [],
|
|
818
|
+
behavior_edges: [],
|
|
819
|
+
source_origins: [],
|
|
820
|
+
};
|
|
821
|
+
const footprint = new Map([[pageId, {
|
|
822
|
+
all: new Set([ui, client]),
|
|
823
|
+
writable: new Set(),
|
|
824
|
+
resolvedFile: ui,
|
|
825
|
+
origin_units: [],
|
|
826
|
+
unresolved: [],
|
|
827
|
+
}]]);
|
|
828
|
+
t.after(() => {
|
|
829
|
+
db.close();
|
|
830
|
+
fs.rmSync(sourceProject, { recursive: true, force: true });
|
|
831
|
+
});
|
|
832
|
+
return {
|
|
833
|
+
pageId,
|
|
834
|
+
discover: () => discoverOperations({
|
|
835
|
+
pages: [page],
|
|
836
|
+
db,
|
|
837
|
+
sourceProject,
|
|
838
|
+
endpoints: [{ file: client, method: "GET", path: null }],
|
|
839
|
+
footprint,
|
|
840
|
+
}).get(pageId),
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
test("a class-seeded page reaches its own members through contains", (t) => {
|
|
845
|
+
const fixture = javaClassSeedFixture(t);
|
|
846
|
+
const operations = fixture.discover();
|
|
847
|
+
assert.equal(operations.length, 1, JSON.stringify(operations, null, 2));
|
|
848
|
+
assert.equal(operations[0].status, "discovered", JSON.stringify(operations[0].unknown));
|
|
849
|
+
assert.deepEqual(operations[0].send_span, ref("app/src/main/java/demo/data/api/GeoNamesClient.java", 6));
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
test("an enclosing method whose body ended before the call is not selected", () => {
|
|
853
|
+
const rows = [{ id: "near", start_line: 4 }, { id: "outer", start_line: 2 }];
|
|
854
|
+
const ends = { near: 6, outer: 11 };
|
|
855
|
+
// Line 9 sits after the nearest method closed: borrowing it truncated the response slice.
|
|
856
|
+
assert.deepEqual(selectEnclosingRow(rows, (row) => ends[row.id], 9), { id: "outer", start_line: 2, end_line: 11 });
|
|
857
|
+
assert.deepEqual(selectEnclosingRow(rows, (row) => ends[row.id], 5), { id: "near", start_line: 4, end_line: 6 });
|
|
858
|
+
// No candidate covers the line at all: the caller must fall back, not invent one.
|
|
859
|
+
assert.equal(selectEnclosingRow(rows, () => 3, 9), null);
|
|
860
|
+
// No recorded ranges (older graphs): keep the legacy nearest-row answer.
|
|
861
|
+
assert.deepEqual(selectEnclosingRow(rows, () => null, 9), { id: "near", start_line: 4 });
|
|
862
|
+
assert.equal(selectEnclosingRow([], () => null, 9), null);
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
test("declared_at inside a class body seeds the enclosing declaration", (t) => {
|
|
866
|
+
const fixture = javaClassSeedFixture(t, { label: "NoNodeHasThisLabel", declaredLine: 5 });
|
|
867
|
+
const operations = fixture.discover();
|
|
868
|
+
assert.equal(operations.length, 1, JSON.stringify(operations, null, 2));
|
|
869
|
+
assert.equal(operations[0].status, "discovered", JSON.stringify(operations[0].unknown));
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
test("a dead-end seed with gated call sites keeps the page partial with a cause", (t) => {
|
|
873
|
+
const fixture = javaClassSeedFixture(t, { linkMember: false, deadSeed: true });
|
|
874
|
+
const operations = fixture.discover();
|
|
875
|
+
assert.equal(operations.length, 1, JSON.stringify(operations, null, 2));
|
|
876
|
+
assert.equal(operations[0].status, "partial");
|
|
877
|
+
assert.equal(operations[0].unknown?.reason, "operation-ownership-unresolved");
|
|
878
|
+
assert.equal(operations[0].unknown?.cause, "page-reachability");
|
|
879
|
+
assert.equal(operations[0].unknown?.gated_call_sites, 1);
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
test("a page with a live closure but no request of its own stays silent, not partial", (t) => {
|
|
883
|
+
// The page reaches its members (so its closure is not a dead end) but owns no
|
|
884
|
+
// call site. Gated-away shared-file call sites must not flip it to partial.
|
|
885
|
+
const fixture = javaClassSeedFixture(t, { linkMember: false, deadSeed: false });
|
|
886
|
+
const operations = fixture.discover();
|
|
887
|
+
assert.deepEqual(operations, [],
|
|
888
|
+
`a page without requests must not publish an operation candidate: ${JSON.stringify(operations, null, 2)}`);
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
test("a page declared inside a shared navigation builder is not seeded from that builder", (t) => {
|
|
892
|
+
const sourceProject = fs.mkdtempSync(path.join(tempRoot, "android-nav-builder-seed-"));
|
|
893
|
+
const graph = "src/nav/AppGraph.kt";
|
|
894
|
+
const pageBody = "src/ui/PageA.kt";
|
|
895
|
+
const routeA = "src/ui/RouteA.kt";
|
|
896
|
+
const shared = "src/data/SharedApi.kt";
|
|
897
|
+
writeNumberedSource(sourceProject, graph, [
|
|
898
|
+
[1, "package demo.nav"],
|
|
899
|
+
[3, "fun appGraph() {"],
|
|
900
|
+
[4, " routeA()"],
|
|
901
|
+
[5, "}"],
|
|
902
|
+
]);
|
|
903
|
+
writeNumberedSource(sourceProject, pageBody, [
|
|
904
|
+
[1, "package demo.ui"],
|
|
905
|
+
[3, "fun pageA() {"],
|
|
906
|
+
[4, "}"],
|
|
907
|
+
]);
|
|
908
|
+
writeNumberedSource(sourceProject, routeA, [
|
|
909
|
+
[1, "package demo.ui"],
|
|
910
|
+
[3, "fun routeA() { sharedGetA() }"],
|
|
911
|
+
]);
|
|
912
|
+
writeNumberedSource(sourceProject, shared, [
|
|
913
|
+
[1, "package demo.data"],
|
|
914
|
+
[3, "fun sharedGetA() { client.getA() }"],
|
|
915
|
+
]);
|
|
916
|
+
|
|
917
|
+
const db = new DatabaseSync(":memory:");
|
|
918
|
+
db.exec(`
|
|
919
|
+
CREATE TABLE nodes (
|
|
920
|
+
id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
|
|
921
|
+
file_path TEXT, start_line INTEGER
|
|
922
|
+
);
|
|
923
|
+
CREATE TABLE edges (
|
|
924
|
+
id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
|
|
925
|
+
);
|
|
926
|
+
`);
|
|
927
|
+
const node = db.prepare(
|
|
928
|
+
"INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line) VALUES (?, ?, ?, ?, ?, ?)",
|
|
929
|
+
);
|
|
930
|
+
for (const row of [
|
|
931
|
+
["graph", "function", "appGraph", "demo.nav.appGraph", graph, 3],
|
|
932
|
+
["page-a", "function", "pageA", "demo.ui.pageA", pageBody, 3],
|
|
933
|
+
["route-a", "function", "routeA", "demo.ui.routeA", routeA, 3],
|
|
934
|
+
["shared-get-a", "function", "sharedGetA", "demo.data.sharedGetA", shared, 3],
|
|
935
|
+
]) node.run(...row);
|
|
936
|
+
const edge = db.prepare("INSERT INTO edges (id, source, target, kind, line) VALUES (?, ?, ?, ?, ?)");
|
|
937
|
+
edge.run(1, "graph", "route-a", "calls", 4);
|
|
938
|
+
edge.run(2, "route-a", "shared-get-a", "calls", 3);
|
|
939
|
+
|
|
940
|
+
const pageId = "compose-route:RouteAOnly";
|
|
941
|
+
const operations = discoverOperations({
|
|
942
|
+
pages: [{
|
|
943
|
+
page_id: pageId, label: "NoNodeMatchesThisLabel",
|
|
944
|
+
declared_at: `${graph}:4`, source_file: pageBody,
|
|
945
|
+
out_edges: [], behavior_edges: [], source_origins: [],
|
|
946
|
+
}],
|
|
947
|
+
db,
|
|
948
|
+
sourceProject,
|
|
949
|
+
endpoints: [{ file: shared, function: "sharedGetA", method: "GET", path: "/a" }],
|
|
950
|
+
footprint: new Map([[pageId, {
|
|
951
|
+
all: new Set([graph, pageBody, routeA, shared]),
|
|
952
|
+
writable: new Set(),
|
|
953
|
+
resolvedFile: pageBody,
|
|
954
|
+
origin_units: [],
|
|
955
|
+
unresolved: [],
|
|
956
|
+
}]]),
|
|
957
|
+
}).get(pageId);
|
|
958
|
+
|
|
959
|
+
// Seeding `appGraph` would reach routeA -> sharedGetA and attribute the
|
|
960
|
+
// sibling route's request to this page. The builder must be rejected.
|
|
961
|
+
assert.deepEqual(operations, [],
|
|
962
|
+
`a shared navigation builder must not seed a page: ${JSON.stringify(operations, null, 2)}`);
|
|
963
|
+
t.after(() => {
|
|
964
|
+
db.close();
|
|
965
|
+
fs.rmSync(sourceProject, { recursive: true, force: true });
|
|
966
|
+
});
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
test("a sibling page's implementation reached only through dispatch fan-out is external", (t) => {
|
|
970
|
+
const sourceProject = fs.mkdtempSync(path.join(tempRoot, "android-sibling-owner-"));
|
|
971
|
+
const screen = "src/ui/CategoryScreen.kt";
|
|
972
|
+
const siblingScreen = "src/ui/CommentScreen.kt";
|
|
973
|
+
const ownVm = "src/goods/CategoryViewModel.kt";
|
|
974
|
+
const siblingVm = "src/goods/CommentViewModel.kt";
|
|
975
|
+
const baseVm = "src/common/BaseViewModel.kt";
|
|
976
|
+
const api = "src/goods/GoodsService.kt";
|
|
977
|
+
writeNumberedSource(sourceProject, screen, [
|
|
978
|
+
[1, "package demo.ui"],
|
|
979
|
+
[3, "fun Category(viewModel: CategoryViewModel) {"],
|
|
980
|
+
[4, " viewModel.load()"],
|
|
981
|
+
[5, "}"],
|
|
982
|
+
]);
|
|
983
|
+
writeNumberedSource(sourceProject, ownVm, [
|
|
984
|
+
[1, "package demo.goods"],
|
|
985
|
+
[3, "class CategoryViewModel : BaseViewModel() {"],
|
|
986
|
+
[4, " override fun load() { repo.getCategory() }"],
|
|
987
|
+
[5, "}"],
|
|
988
|
+
]);
|
|
989
|
+
writeNumberedSource(sourceProject, siblingVm, [
|
|
990
|
+
[1, "package demo.goods"],
|
|
991
|
+
[3, "class CommentViewModel : BaseViewModel() {"],
|
|
992
|
+
[4, " override fun load() { repo.getComment() }"],
|
|
993
|
+
[5, "}"],
|
|
994
|
+
]);
|
|
995
|
+
writeNumberedSource(sourceProject, baseVm, [
|
|
996
|
+
[1, "package demo.common"],
|
|
997
|
+
[3, "abstract class BaseViewModel {"],
|
|
998
|
+
[4, " abstract fun load()"],
|
|
999
|
+
[5, "}"],
|
|
1000
|
+
]);
|
|
1001
|
+
|
|
1002
|
+
const db = new DatabaseSync(":memory:");
|
|
1003
|
+
db.exec(`
|
|
1004
|
+
CREATE TABLE nodes (
|
|
1005
|
+
id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
|
|
1006
|
+
file_path TEXT, start_line INTEGER
|
|
1007
|
+
);
|
|
1008
|
+
CREATE TABLE edges (
|
|
1009
|
+
id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
|
|
1010
|
+
);
|
|
1011
|
+
`);
|
|
1012
|
+
const node = db.prepare(
|
|
1013
|
+
"INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line) VALUES (?, ?, ?, ?, ?, ?)",
|
|
1014
|
+
);
|
|
1015
|
+
for (const row of [
|
|
1016
|
+
["screen", "function", "Category", "demo.ui.Category", screen, 3],
|
|
1017
|
+
["own-class", "class", "CategoryViewModel", "demo.goods.CategoryViewModel", ownVm, 3],
|
|
1018
|
+
["own-load", "method", "load", "demo.goods.CategoryViewModel.load", ownVm, 4],
|
|
1019
|
+
["sibling-screen", "function", "Comment", "demo.ui.Comment", siblingScreen, 3],
|
|
1020
|
+
["sibling-class", "class", "CommentViewModel", "demo.goods.CommentViewModel", siblingVm, 3],
|
|
1021
|
+
["sibling-load", "method", "load", "demo.goods.CommentViewModel.load", siblingVm, 4],
|
|
1022
|
+
["base-class", "class", "BaseViewModel", "demo.common.BaseViewModel", baseVm, 3],
|
|
1023
|
+
["base-load", "method", "load", "demo.common.BaseViewModel.load", baseVm, 4],
|
|
1024
|
+
]) node.run(...row);
|
|
1025
|
+
const edge = db.prepare("INSERT INTO edges (id, source, target, kind, line) VALUES (?, ?, ?, ?, ?)");
|
|
1026
|
+
edge.run(1, "screen", "own-class", "instantiates", 3);
|
|
1027
|
+
edge.run(2, "own-class", "own-load", "contains", 4);
|
|
1028
|
+
edge.run(3, "own-class", "base-class", "extends", 3);
|
|
1029
|
+
edge.run(4, "base-class", "base-load", "contains", 4);
|
|
1030
|
+
edge.run(5, "base-load", "own-load", "calls", 4);
|
|
1031
|
+
edge.run(6, "base-load", "sibling-load", "calls", 4);
|
|
1032
|
+
edge.run(7, "sibling-screen", "sibling-class", "instantiates", 3);
|
|
1033
|
+
edge.run(8, "sibling-class", "sibling-load", "contains", 4);
|
|
1034
|
+
|
|
1035
|
+
const pageId = "compose-route:Category";
|
|
1036
|
+
const owners = new Map([
|
|
1037
|
+
[ownVm, new Set([pageId])],
|
|
1038
|
+
[siblingVm, new Set(["compose-route:Comment"])],
|
|
1039
|
+
]);
|
|
1040
|
+
const operations = discoverOperations({
|
|
1041
|
+
pages: [{
|
|
1042
|
+
page_id: pageId, label: "Category", declared_at: `${screen}:3`, source_file: screen,
|
|
1043
|
+
out_edges: [], behavior_edges: [], source_origins: [],
|
|
1044
|
+
}],
|
|
1045
|
+
db,
|
|
1046
|
+
sourceProject,
|
|
1047
|
+
endpoints: [
|
|
1048
|
+
{ file: api, function: "getCategory", method: "GET", path: "/category" },
|
|
1049
|
+
{ file: api, function: "getComment", method: "GET", path: "/comment" },
|
|
1050
|
+
],
|
|
1051
|
+
footprint: new Map([[pageId, {
|
|
1052
|
+
all: new Set([screen, ownVm, siblingVm]),
|
|
1053
|
+
writable: new Set(),
|
|
1054
|
+
resolvedFile: screen,
|
|
1055
|
+
origin_units: [],
|
|
1056
|
+
unresolved: [],
|
|
1057
|
+
}]]),
|
|
1058
|
+
resolveOwners: file => owners.get(file) ?? new Set(),
|
|
1059
|
+
}).get(pageId);
|
|
1060
|
+
|
|
1061
|
+
const own = operations.find(operation => operation.send_span?.uri === ownVm);
|
|
1062
|
+
const sibling = operations.find(operation => operation.send_span?.uri === siblingVm);
|
|
1063
|
+
assert.ok(own, `missing own operation: ${JSON.stringify(operations, null, 2)}`);
|
|
1064
|
+
assert.ok(sibling, `sibling evidence must stay in the ledger: ${JSON.stringify(operations, null, 2)}`);
|
|
1065
|
+
assert.equal(own.owner, "page");
|
|
1066
|
+
assert.equal(sibling.owner, "external");
|
|
1067
|
+
t.after(() => {
|
|
1068
|
+
db.close();
|
|
1069
|
+
fs.rmSync(sourceProject, { recursive: true, force: true });
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* `declared_at` may point past a nested type that has already closed. The seed
|
|
1075
|
+
* fallback must walk to the next enclosing type instead of giving up on the
|
|
1076
|
+
* nearest one, and must refuse a type whose recorded body does not cover the
|
|
1077
|
+
* line at all.
|
|
1078
|
+
*/
|
|
1079
|
+
function typeSeedFixture(t, { hostEnd = 30 } = {}) {
|
|
1080
|
+
const sourceProject = fs.mkdtempSync(path.join(tempRoot, "android-type-seed-"));
|
|
1081
|
+
const host = "src/ui/Host.kt";
|
|
1082
|
+
const client = "src/data/Client.java";
|
|
1083
|
+
writeNumberedSource(sourceProject, host, [
|
|
1084
|
+
[1, "package demo.ui"],
|
|
1085
|
+
[3, "class Earlier {"],
|
|
1086
|
+
[6, "}"],
|
|
1087
|
+
[8, "class Host {"],
|
|
1088
|
+
[12, " class Listener {"],
|
|
1089
|
+
[16, " }"],
|
|
1090
|
+
[18, " fun run() {"],
|
|
1091
|
+
[24, " }"],
|
|
1092
|
+
[30, "}"],
|
|
1093
|
+
]);
|
|
1094
|
+
writeNumberedSource(sourceProject, client, [
|
|
1095
|
+
[1, "package demo.data"],
|
|
1096
|
+
[3, "class Client {"],
|
|
1097
|
+
[4, " void get() {"],
|
|
1098
|
+
[5, " client.newCall(request).enqueue(null);"],
|
|
1099
|
+
[6, " }"],
|
|
1100
|
+
[8, "}"],
|
|
1101
|
+
]);
|
|
1102
|
+
|
|
1103
|
+
const db = new DatabaseSync(":memory:");
|
|
1104
|
+
db.exec(`
|
|
1105
|
+
CREATE TABLE nodes (
|
|
1106
|
+
id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
|
|
1107
|
+
file_path TEXT, start_line INTEGER, end_line INTEGER
|
|
1108
|
+
);
|
|
1109
|
+
CREATE TABLE edges (
|
|
1110
|
+
id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
|
|
1111
|
+
);
|
|
1112
|
+
`);
|
|
1113
|
+
const node = db.prepare(
|
|
1114
|
+
"INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line, end_line) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
1115
|
+
);
|
|
1116
|
+
for (const row of [
|
|
1117
|
+
["earlier", "class", "Earlier", "demo.ui.Earlier", host, 3, 6],
|
|
1118
|
+
["host", "class", "Host", "demo.ui.Host", host, 8, hostEnd],
|
|
1119
|
+
["listener", "class", "Listener", "demo.ui.Host.Listener", host, 12, 16],
|
|
1120
|
+
["host-run", "method", "run", "demo.ui.Host.run", host, 18, 24],
|
|
1121
|
+
["client", "class", "Client", "demo.data.Client", client, 3, 8],
|
|
1122
|
+
["client-get", "method", "get", "demo.data.Client.get", client, 4, 6],
|
|
1123
|
+
]) node.run(...row);
|
|
1124
|
+
const edge = db.prepare("INSERT INTO edges (id, source, target, kind, line) VALUES (?, ?, ?, ?, ?)");
|
|
1125
|
+
edge.run(1, "host", "listener", "contains", 12);
|
|
1126
|
+
edge.run(2, "host", "host-run", "contains", 18);
|
|
1127
|
+
edge.run(3, "host-run", "client-get", "calls", 20);
|
|
1128
|
+
|
|
1129
|
+
const pageId = "page:TypeSeed";
|
|
1130
|
+
t.after(() => {
|
|
1131
|
+
db.close();
|
|
1132
|
+
fs.rmSync(sourceProject, { recursive: true, force: true });
|
|
1133
|
+
});
|
|
1134
|
+
return discoverOperations({
|
|
1135
|
+
pages: [{
|
|
1136
|
+
page_id: pageId, label: "NoSuchNode",
|
|
1137
|
+
declared_at: `${host}:20`, source_file: host,
|
|
1138
|
+
out_edges: [], behavior_edges: [], source_origins: [],
|
|
1139
|
+
}],
|
|
1140
|
+
db,
|
|
1141
|
+
sourceProject,
|
|
1142
|
+
endpoints: [{ file: client, method: "GET", path: null }],
|
|
1143
|
+
footprint: new Map([[pageId, {
|
|
1144
|
+
all: new Set([host, client]),
|
|
1145
|
+
writable: new Set(),
|
|
1146
|
+
resolvedFile: host,
|
|
1147
|
+
origin_units: [],
|
|
1148
|
+
unresolved: [],
|
|
1149
|
+
}]]),
|
|
1150
|
+
}).get(pageId);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
test("the enclosing-type seed skips a closed nested type and takes the outer one", (t) => {
|
|
1154
|
+
const operations = typeSeedFixture(t);
|
|
1155
|
+
assert.equal(operations.length, 1, JSON.stringify(operations, null, 2));
|
|
1156
|
+
assert.equal(operations[0].status, "discovered");
|
|
1157
|
+
assert.deepEqual(operations[0].send_span, ref("src/data/Client.java", 5));
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
test("an earlier type whose body ends before the declaration line is not seeded", (t) => {
|
|
1161
|
+
// `Host` itself ends at 17, so every preceding type closed before line 20.
|
|
1162
|
+
const operations = typeSeedFixture(t, { hostEnd: 17 });
|
|
1163
|
+
assert.deepEqual(operations, [],
|
|
1164
|
+
`a type that does not cover the line must not seed the page: ${JSON.stringify(operations, null, 2)}`);
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* A Java/OkHttp client is the shape that regressed a real run: the byte window
|
|
1169
|
+
* around the call reached back to the file head (`import …model.PlaceInfo`
|
|
1170
|
+
* matched the state pattern) and forward into the next method, so an operation
|
|
1171
|
+
* claimed five unroled "response" lines and one bogus state read. Every one of
|
|
1172
|
+
* them became a mandatory unknown in the audit.
|
|
1173
|
+
*/
|
|
1174
|
+
function javaOkHttpWindowFixture(t, { inlineCallback }) {
|
|
1175
|
+
const sourceProject = fs.mkdtempSync(path.join(tempRoot, "android-op-window-"));
|
|
1176
|
+
const client = "src/data/Client.java";
|
|
1177
|
+
writeNumberedSource(sourceProject, client, inlineCallback ? [
|
|
1178
|
+
[1, "package demo.data;"],
|
|
1179
|
+
[3, "import demo.model.PlaceInfo;"],
|
|
1180
|
+
[5, "class Client {"],
|
|
1181
|
+
[6, " void load() {"],
|
|
1182
|
+
[7, " Request request = new Request.Builder().url(base).build();"],
|
|
1183
|
+
[8, " client.newCall(request).enqueue(new Callback() {"],
|
|
1184
|
+
[9, " public void onResponse(Call c, Response response) throws IOException {"],
|
|
1185
|
+
[10, " try (ResponseBody body = response.body()) {"],
|
|
1186
|
+
[11, " emitter.onSuccess(body.string());"],
|
|
1187
|
+
[12, " }"],
|
|
1188
|
+
[13, " }"],
|
|
1189
|
+
[14, " });"],
|
|
1190
|
+
[15, " }"],
|
|
1191
|
+
[17, " void other() {"],
|
|
1192
|
+
[18, " if (!response.isSuccessful()) { }"],
|
|
1193
|
+
[19, " handler.onFailure();"],
|
|
1194
|
+
[20, " }"],
|
|
1195
|
+
[21, "}"],
|
|
1196
|
+
] : [
|
|
1197
|
+
[1, "package demo.data;"],
|
|
1198
|
+
[3, "import demo.model.PlaceInfo;"],
|
|
1199
|
+
[5, "class Client {"],
|
|
1200
|
+
[6, " void load() {"],
|
|
1201
|
+
[7, " client.getPlace(Place());"],
|
|
1202
|
+
[8, " handler.onResponse { }"],
|
|
1203
|
+
[9, " if (!result.isSuccessful()) { }"],
|
|
1204
|
+
[10, " handler.onFailure { }"],
|
|
1205
|
+
[11, " pending.then { }"],
|
|
1206
|
+
[12, " work.complete { }"],
|
|
1207
|
+
[13, " }"],
|
|
1208
|
+
[14, "}"],
|
|
1209
|
+
]);
|
|
1210
|
+
|
|
1211
|
+
const db = new DatabaseSync(":memory:");
|
|
1212
|
+
db.exec(`
|
|
1213
|
+
CREATE TABLE nodes (
|
|
1214
|
+
id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
|
|
1215
|
+
file_path TEXT, start_line INTEGER, end_line INTEGER
|
|
1216
|
+
);
|
|
1217
|
+
CREATE TABLE edges (
|
|
1218
|
+
id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
|
|
1219
|
+
);
|
|
1220
|
+
`);
|
|
1221
|
+
const node = db.prepare(
|
|
1222
|
+
"INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line, end_line) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
1223
|
+
);
|
|
1224
|
+
const rows = inlineCallback
|
|
1225
|
+
? [
|
|
1226
|
+
["client", "class", "Client", "demo.data.Client", client, 5, 21],
|
|
1227
|
+
["client-load", "method", "load", "demo.data.Client.load", client, 6, 15],
|
|
1228
|
+
["client-other", "method", "other", "demo.data.Client.other", client, 17, 20],
|
|
1229
|
+
]
|
|
1230
|
+
: [
|
|
1231
|
+
["client", "class", "Client", "demo.data.Client", client, 5, 14],
|
|
1232
|
+
["client-load", "method", "load", "demo.data.Client.load", client, 6, 13],
|
|
1233
|
+
];
|
|
1234
|
+
for (const row of rows) node.run(...row);
|
|
1235
|
+
const edge = db.prepare("INSERT INTO edges (id, source, target, kind, line) VALUES (?, ?, ?, ?, ?)");
|
|
1236
|
+
edge.run(1, "client", "client-load", "contains", 6);
|
|
1237
|
+
if (inlineCallback) edge.run(2, "client", "client-other", "contains", 17);
|
|
1238
|
+
|
|
1239
|
+
const pageId = "page:Client";
|
|
1240
|
+
const operations = discoverOperations({
|
|
1241
|
+
pages: [{
|
|
1242
|
+
page_id: pageId, label: "Client", declared_at: `${client}:5`, source_file: client,
|
|
1243
|
+
out_edges: [], behavior_edges: [], source_origins: [],
|
|
1244
|
+
}],
|
|
1245
|
+
db,
|
|
1246
|
+
sourceProject,
|
|
1247
|
+
endpoints: [inlineCallback
|
|
1248
|
+
? { file: client, method: "GET", path: null }
|
|
1249
|
+
: { file: "src/goods/GoodsService.kt", function: "getPlace", method: "GET", path: "/place" }],
|
|
1250
|
+
footprint: new Map([[pageId, {
|
|
1251
|
+
all: new Set([client]),
|
|
1252
|
+
writable: new Set(),
|
|
1253
|
+
resolvedFile: client,
|
|
1254
|
+
origin_units: [],
|
|
1255
|
+
unresolved: [],
|
|
1256
|
+
}]]),
|
|
1257
|
+
}).get(pageId);
|
|
1258
|
+
|
|
1259
|
+
t.after(() => {
|
|
1260
|
+
db.close();
|
|
1261
|
+
fs.rmSync(sourceProject, { recursive: true, force: true });
|
|
1262
|
+
});
|
|
1263
|
+
return operations;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
test("an operation scan stays inside its enclosing method (imports and the next method excluded)", (t) => {
|
|
1267
|
+
const operations = javaOkHttpWindowFixture(t, { inlineCallback: true });
|
|
1268
|
+
assert.equal(operations.length, 1, JSON.stringify(operations, null, 2));
|
|
1269
|
+
const operation = operations[0];
|
|
1270
|
+
assert.deepEqual(operation.state_read_spans, [],
|
|
1271
|
+
`import lines must not become state reads: ${JSON.stringify(operation.state_read_spans)}`);
|
|
1272
|
+
assert.deepEqual(operation.response_spans, [],
|
|
1273
|
+
`an inline OkHttp callback lives inside the send span; the next method must not leak: ${JSON.stringify(operation.response_spans)}`);
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
test("response branches carry a closed role and non-branch lines are skipped", (t) => {
|
|
1277
|
+
const operations = javaOkHttpWindowFixture(t, { inlineCallback: false });
|
|
1278
|
+
assert.equal(operations.length, 1, JSON.stringify(operations, null, 2));
|
|
1279
|
+
const spans = operations[0].response_spans;
|
|
1280
|
+
assert.deepEqual(spans.map(span => `${span.span.start}:${span.role}`),
|
|
1281
|
+
["8:callback", "10:callback", "11:promise", "12:complete"],
|
|
1282
|
+
JSON.stringify(spans, null, 2));
|
|
1283
|
+
});
|
|
@@ -1232,3 +1232,30 @@ test("I6 incomplete or failed audits never report complete coverage", () => {
|
|
|
1232
1232
|
assert.equal(anchorFailed.status, "failed");
|
|
1233
1233
|
assert.equal(anchorFailed.coverage_status, "partial");
|
|
1234
1234
|
});
|
|
1235
|
+
|
|
1236
|
+
test("a producer-reserved resolution is ignored and surfaced as a diagnostic", () => {
|
|
1237
|
+
const result = auditWith((discovery, evidence) => {
|
|
1238
|
+
const unknown = {
|
|
1239
|
+
id: "unk_source_limit",
|
|
1240
|
+
scope: "composition",
|
|
1241
|
+
reason: "review-incomplete",
|
|
1242
|
+
cause: "source-unit-limit",
|
|
1243
|
+
locator: "source-unit-limit",
|
|
1244
|
+
omitted_source_units: ["src/omitted.js"],
|
|
1245
|
+
relevance_review: { status: "reviewed", conclusion: "blocks-composition" },
|
|
1246
|
+
next_action: "Review the omitted SourceUnits",
|
|
1247
|
+
};
|
|
1248
|
+
evidence.unknowns = [unknown];
|
|
1249
|
+
discovery.unknowns = [unknown];
|
|
1250
|
+
discovery.resolutions = [{
|
|
1251
|
+
unknown_id: unknown.id,
|
|
1252
|
+
status: "resolved",
|
|
1253
|
+
evidence_refs: [reference],
|
|
1254
|
+
assertion_ids: [],
|
|
1255
|
+
review_status: "reviewed",
|
|
1256
|
+
}];
|
|
1257
|
+
});
|
|
1258
|
+
assert.equal(result.status, "completed");
|
|
1259
|
+
assert.equal(result.coverage_status, "partial");
|
|
1260
|
+
assert.ok(result.diagnostics.some(entry => entry.code === "resolution-producer-reserved"));
|
|
1261
|
+
});
|