@buaa_smat/hometrans 26.0.6 → 26.0.8
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 +6 -3
- package/agents/a2h-executor.md +37 -0
- package/dist/cli/editors.json +13 -0
- package/dist/platform/compose.js +4 -0
- package/dist/platform/registry.js +3 -1
- package/dist/platform/transform.js +37 -3
- package/env-requirements.json +15 -1
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
- package/i18n/skills/a2h-app-migrate/SKILL.md +2 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +27 -4
- package/i18n/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +7 -7
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
- package/i18n/skills/a2h-page-specgen/SKILL.md +1 -1
- package/i18n/skills/a2h-page-specgen/references/gates.md +3 -1
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +11 -11
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +3 -3
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +144 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +132 -3
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +2 -0
- package/package.json +1 -1
- package/platforms/atomcode/agents/a2h-executor.frontmatter.md +6 -0
- package/platforms/codebuddy/agents/a2h-executor.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
- package/platforms/deveco/agents/a2h-executor.frontmatter.md +7 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +0 -2
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +0 -2
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +0 -2
- package/platforms/deveco/agents/model-worker.frontmatter.md +0 -2
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +0 -2
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
- package/platforms/opencode/agents/a2h-executor.frontmatter.md +7 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +0 -2
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +0 -2
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +0 -2
- package/platforms/opencode/agents/model-worker.frontmatter.md +0 -2
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +0 -2
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
- package/skills/a2h-app-migrate/SKILL.md +29 -3
- package/skills/a2h-app-migrate/references/host-rules.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +24 -4
- package/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
- package/skills/a2h-app-migrate/test/test_executor_header_sync.mjs +78 -0
- package/skills/a2h-app-migrate/test/test_opencode_depth.mjs +312 -0
- package/skills/a2h-app-migrate/tools/dag.mjs +267 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/skills/a2h-batch-ui-align/SKILL.md +7 -7
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
- package/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +5 -5
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
- package/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
- package/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +3 -2
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +139 -23
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +32 -8
- package/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +82 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +184 -2
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +33 -0
- package/skills/a2h-batch-ui-align/scripts/tests/interactions.test.mjs +258 -0
- package/skills/a2h-page-specgen/SKILL.md +1 -1
- package/skills/a2h-page-specgen/references/evidence.md +15 -0
- package/skills/a2h-page-specgen/references/gates.md +3 -1
- package/skills/a2h-page-specgen/references/scenario-authoring.md +10 -10
- package/skills/a2h-page-specgen/references/spec-template.md +2 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
- package/skills/a2h-page-specgen/scripts/gate.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +104 -3
- package/skills/a2h-resource-convert/references/conversion-rules.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +42 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +5 -1
- 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/document/checker/hometrans/arkui-runtime-pitfall-cn.md +2 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +3 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-cn.md +105 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-en.md +122 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +4 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIV2ObservationCheck.js +1862 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +2 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +15 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +20 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_v2_observation.ts +284 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +32 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +22 -1
- package/skills/a2h-utg-static/SKILL.md +2 -0
- package/skills/a2h-utg-static/references/extractors.md +16 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +22 -1
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +4 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +15 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_attachments.mjs +330 -0
- package/skills/a2h-utg-static/scripts/view_attachments.mjs +465 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +0 -5
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @hometrans/arkui-v2-observation
|
|
2
|
+
|
|
3
|
+
**Purpose.** Detect break points in the V2 observation chain (typical symptom: compiles clean,
|
|
4
|
+
never refreshes).
|
|
5
|
+
|
|
6
|
+
| Sub-code | Level | One line |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `[v2-render-read-unobserved]` | WARN | `build/@Builder` reaches a bare `@ObservedV2` field through one method/getter, and the field has a write path |
|
|
9
|
+
| `[v2-render-shadow-state]` | ERROR / WARN | `@Trace D = plain C.length`, the render layer uses `D` as a branch condition while the branch body reads `C`; WARN when the branch also reads `D` |
|
|
10
|
+
| `[v2-nested-class-unobserved]` | WARN | A nested data class in the state tree is deep-written and UI-read but lacks `@ObservedV2` |
|
|
11
|
+
| `[v2-deep-write-unobserved]` | ERROR | A `@Param/@Provider/@Consumer` deep write lands on a field without `@Trace`, and the field is read on the render path |
|
|
12
|
+
| `[v2-monitor-deep-collection]` | WARN | `@Monitor('a.b')` watches a collection that the class mutates element-by-element |
|
|
13
|
+
| `[v2-plain-object-state]` | WARN | A `@Local/@Param` interface/type state node is assigned a plain object and then deep-written |
|
|
14
|
+
| `[v2-monitor-cycle]` | WARN | Two `@Monitor` methods write each other's watched field, or one writes its own |
|
|
15
|
+
|
|
16
|
+
`[v2-render-shadow-state]` is ERROR when the branch body reads only `C` (the condition only flips
|
|
17
|
+
0 ↔ non-zero, so a second push or `replaceTop` never rebuilds the branch). It is WARN when the
|
|
18
|
+
branch also reads `D`: push/pop refreshes, but a write that changes `C` without changing `D`
|
|
19
|
+
(e.g. `replaceTop` / pop+push) is still stale. `[v2-deep-write-unobserved]` is ERROR only when the
|
|
20
|
+
written field is actually read on a render path; internal marker fields are not reported.
|
|
21
|
+
|
|
22
|
+
## Detection principle
|
|
23
|
+
|
|
24
|
+
One project pass builds: file → import (relative paths, `oh-package.json5` package names,
|
|
25
|
+
`Index.ets` barrels, `export { x } from` / `export * from`) → declarations (class / struct /
|
|
26
|
+
interface / type / const) → decorators (`@ObservedV2`, `@Trace`, `@ComponentV2`, `@Builder`,
|
|
27
|
+
`@Monitor`) → method bodies / field types. Render reads are `@ComponentV2`'s `build` and
|
|
28
|
+
`@Builder` members; method inlining is exactly one level and only for methods/getters that have a
|
|
29
|
+
non-void return type, contain no write, and are **not** inside an `.onXxx(...)` event callback.
|
|
30
|
+
Chains like `this.a.b[0].c` record every `owner#field` (property names around the index; the index
|
|
31
|
+
expression itself is ignored). Write evidence comes from `this.<field> =`, compound assignments
|
|
32
|
+
(`+=`, `-=`, …), `++`/`--`, `this.<path> =` and collection mutators.
|
|
33
|
+
|
|
34
|
+
## Boundaries
|
|
35
|
+
|
|
36
|
+
### v2-render-read-unobserved
|
|
37
|
+
|
|
38
|
+
- Fills the two gaps of the fixed `observedv2-untraced-write`: it only collects direct
|
|
39
|
+
`ArkInstanceFieldRef` reads inside `build`, and discovers target classes from component fields
|
|
40
|
+
only. This sub-code adds one-level method/getter inlining and the
|
|
41
|
+
`export const appRouter: AppRouter = new AppRouter()` singleton form.
|
|
42
|
+
- Direct reads are also reported; a component-field direct read may overlap the fixed
|
|
43
|
+
`observedv2-untraced-write` and can be merged during review.
|
|
44
|
+
- Silent: `private` fields (internal cursors/handles), constants/read-only fields, fields only
|
|
45
|
+
assigned in a constructor, command methods whose body writes, methods without a return type,
|
|
46
|
+
reads inside `.onClick/.onChange` handlers, and unresolvable receivers. The message names the
|
|
47
|
+
source as `build` / `@Builder` / `... -> method`.
|
|
48
|
+
- Fix: add `@Trace`, or derive it with `@Computed` over `@Trace` fields.
|
|
49
|
+
|
|
50
|
+
### v2-render-shadow-state
|
|
51
|
+
|
|
52
|
+
- Exact fingerprint: an `@ObservedV2` class has `@Trace D`, a plain container `C`, a method with
|
|
53
|
+
`this.D = this.C.length` (or `.size`), and the render context uses the same instance's `D` in an
|
|
54
|
+
`if/else if` condition while the branch body (including `@Builder` expansion and one-level method
|
|
55
|
+
inlining) reads `C`.
|
|
56
|
+
- If the branch also reads `D`, it is WARN: push/pop changes D, but a write that changes C without
|
|
57
|
+
changing D (`replaceTop` / pop+push) is still stale. The condition and the branch must resolve to
|
|
58
|
+
the same instance (`routerA.depth` does not pair with `routerB.currentRoute()`). `switch` /
|
|
59
|
+
ternary conditions are not covered yet.
|
|
60
|
+
- Fix: make the container observable (`@Trace stack`), or make `currentRoute` a `@Computed` over
|
|
61
|
+
`@Trace` fields. Do not keep the `length` shadow as the only signal.
|
|
62
|
+
|
|
63
|
+
### v2-nested-class-unobserved
|
|
64
|
+
|
|
65
|
+
- Starts from `@Local/@Param/@Provider/@Consumer` fields or `@ObservedV2` fields, walks the first
|
|
66
|
+
**property-write** path (not a whole replacement, not a collection mutator) to the first custom
|
|
67
|
+
data class that lacks `@ObservedV2`, has no behavior methods (constructor / getter / setter do
|
|
68
|
+
not count, so data classes are still graded; services/handles are excluded), and whose root
|
|
69
|
+
field is read in render. `@Local` is included: the fixed `local-nested-write` reports the write,
|
|
70
|
+
this sub-code reports the unobserved nested class itself.
|
|
71
|
+
- A `@Trace` container does not make the element class observable; `@Trace items: Item[]` with an
|
|
72
|
+
undecorated `Item` still reports.
|
|
73
|
+
- Silent: interfaces/types (they cannot carry `@ObservedV2`; see `[v2-plain-object-state]`),
|
|
74
|
+
whole-array replacements and unresolvable types.
|
|
75
|
+
- Fix: add `@ObservedV2` to the class and `@Trace` to the fields the UI reads.
|
|
76
|
+
|
|
77
|
+
### v2-deep-write-unobserved
|
|
78
|
+
|
|
79
|
+
- Only `@Param/@Provider/@Consumer` roots (`@Local/@State` are covered by the fixed rules), and only
|
|
80
|
+
when the nested class **is** `@ObservedV2` but the written field has no `@Trace`; the written
|
|
81
|
+
field must also be read on a render path, so internal marker fields are not reported.
|
|
82
|
+
- Fix: add `@Trace`, or reassign the whole state object.
|
|
83
|
+
|
|
84
|
+
### v2-monitor-deep-collection
|
|
85
|
+
|
|
86
|
+
- The fixed `monitor-collection` expressly exempts dot paths, and `monitor-nonobservable` only
|
|
87
|
+
checks the last segment, so `@Monitor('obj.arr')` + `push/splice` is currently unguarded.
|
|
88
|
+
Multi-argument `@Monitor('a', 'b')` is split on top-level commas and checked per path.
|
|
89
|
+
- Silent: whole-collection reassignment (legal refresh) and single-segment bare collections
|
|
90
|
+
(already covered).
|
|
91
|
+
- Fix: reassign the whole collection, or watch the element field.
|
|
92
|
+
|
|
93
|
+
### v2-plain-object-state
|
|
94
|
+
|
|
95
|
+
- Only **interface / type-alias** state nodes assigned a direct object literal / `Object.assign` /
|
|
96
|
+
spread, then deep-written and render-read. Class-typed `JSON.parse` / `structuredClone`
|
|
97
|
+
assignments are covered by `state-unactivated-observe` and are not re-reported; `new` and
|
|
98
|
+
`UIUtils.makeObserved(...)` are exempt.
|
|
99
|
+
- Fix: use an `@ObservedV2` class + `new`, or wrap with `UIUtils.makeObserved(...)` and keep the
|
|
100
|
+
returned proxy.
|
|
101
|
+
|
|
102
|
+
### v2-monitor-cycle
|
|
103
|
+
|
|
104
|
+
- Only direct writes inside `@Monitor` bodies (`this.x = ...`, compound assignments, `++`/`--`):
|
|
105
|
+
A writes what B watches, B writes what A watches (including self-write/self-watch). Helper-indirect
|
|
106
|
+
loops are a registered false negative.
|
|
107
|
+
- Only single-segment paths participate in self-loop comparison; a dot path such as
|
|
108
|
+
`@Monitor('profile.name')` is skipped so `this.name = this.profile.name` is not treated as a
|
|
109
|
+
self-loop. Multi-argument `@Monitor('a', 'b')` creates one node per path. A write guarded by
|
|
110
|
+
`if (...)` (an idempotent clamp such as `if (this.value < 0) this.value = 0`) does not participate
|
|
111
|
+
in the cycle graph.
|
|
112
|
+
- Fix: keep one write direction and make the callback idempotent.
|
|
113
|
+
|
|
114
|
+
## Suppression
|
|
115
|
+
|
|
116
|
+
- For a confirmed false positive, write
|
|
117
|
+
`// homecheck-disable-next-line @hometrans/arkui-v2-observation` and record ruleId, file, line,
|
|
118
|
+
reason and evidence in `homecheck-fix-report.md`.
|
|
119
|
+
- Unresolvable packages/types, `any`/`Object` casts, helper-returned values, object spread and
|
|
120
|
+
`oh_modules` dependencies stay silent.
|
|
121
|
+
- This rule does not judge runtime ordering (`@Monitor` → `@Computed`) or the intent of a missing
|
|
122
|
+
`@Event` write-back; those belong to code review or runtime testing.
|
|
@@ -969,12 +969,12 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
969
969
|
cn: '[theme-mode-closure] 这里写入了 ThemeMode(%s),但所有扫描文件里没有任何 setColorMode() 调用,写入的模式到不了渲染管线。若“只持状态、深浅渲染归资源限定词”是有意设计,按预期关闭本告警;否则需要生效——写时调 getApplicationContext().setColorMode(...),并在启动时从存储恢复。',
|
|
970
970
|
},
|
|
971
971
|
foreachKey: {
|
|
972
|
-
en: '[foreach-key-stale-render] %s: ForEach keys on identity only while the row renders %s; a row whose key is unchanged is not rebuilt, so those fields stay stale.
|
|
973
|
-
cn: '[foreach-key-stale-render] %s:ForEach 只用身份字段做 key,却渲染了 %s;key
|
|
972
|
+
en: '[foreach-key-stale-render] %s: ForEach keys on identity only while the row renders %s; a row whose key is unchanged is not rebuilt, so those fields stay stale. HarmonyOS and Android refresh lists differently — Android re-renders content when the list data is replaced with new objects, HarmonyOS reuses the row unless the key changes; do not conclude "no key change needed" because the key generation matches Android. Regenerate the key from the row\'s changing fields (e.g. `${it.id}:${it.status}`) or use LazyForEach + notifyDataChange; a @ComponentV2 + @Param row does not help unless the key also changes. Close a deliberate case with `// FOREACH-KEY: <reason>`.',
|
|
973
|
+
cn: '[foreach-key-stale-render] %s:ForEach 只用身份字段做 key,却渲染了 %s;key 不变时该行不会被重建,这些字段会停留在旧值。鸿蒙与 Android 的列表刷新机制不同(Android 数据换成新对象会重渲染内容,鸿蒙 key 不变只复用旧节点),**不得因 key 的写法与 Android 相同就判定无需改 key**;必须按该行会变的显示字段重新生成 key(如 `${it.id}:${it.status}`)或改用 LazyForEach + notifyDataChange。只改成 @ComponentV2 + @Param 而 key 不变并不解决问题。确属有意为之,写 `// FOREACH-KEY: <理由>` 关闭。',
|
|
974
974
|
},
|
|
975
975
|
foreachKeyWhole: {
|
|
976
|
-
en: '[foreach-key-stale-render] %s: ForEach passes the whole object to %s, which renders %s; while the key is unchanged the row is not rebuilt, so the values it receives stay stale — @ObservedV2/@Trace on the item does not cross a reused row. Key the rendered fields or use LazyForEach + notifyDataChange; close a deliberate static list with `// FOREACH-KEY: <reason>`.',
|
|
977
|
-
cn: '[foreach-key-stale-render] %s:ForEach 把整个对象交给了 %s,由它渲染 %s;key 不变时该行不会被重建,它接收到的值会停留在旧值——条目的 @ObservedV2/@Trace
|
|
976
|
+
en: '[foreach-key-stale-render] %s: ForEach passes the whole object to %s, which renders %s; while the key is unchanged the row is not rebuilt, so the values it receives stay stale — @ObservedV2/@Trace on the item does not cross a reused row. A key that matches Android is not a reason to skip this. Key the rendered fields or use LazyForEach + notifyDataChange; close a deliberate static list with `// FOREACH-KEY: <reason>`.',
|
|
977
|
+
cn: '[foreach-key-stale-render] %s:ForEach 把整个对象交给了 %s,由它渲染 %s;key 不变时该行不会被重建,它接收到的值会停留在旧值——条目的 @ObservedV2/@Trace 跨不过被复用的行。不要把「key 写法与 Android 相同」当作无需修改的理由;把渲染字段拼进 key,或改用 LazyForEach + notifyDataChange;确属静态列表,写 `// FOREACH-KEY: <理由>` 关闭。',
|
|
978
978
|
},
|
|
979
979
|
sqlDdl: {
|
|
980
980
|
en: '[sql-identifier-quoting] table %s declares %s, which SQLite requires to be quoted (keyword or non-regular name). The DDL quotes it, but every statement that references the column must quote it too: store.insert/batchInsert build the INSERT column list from ValuesBucket keys verbatim, so a write through them fails with 14800021. Prefer an executeSql primitive that quotes the table and every column.',
|