From fa28d090aab94b68dcc65e3a1548579453ee0c04 Mon Sep 17 00:00:00 2001 From: clz Date: Thu, 30 Jul 2026 12:40:33 +0800 Subject: [PATCH] fix(ai-pick): derive tab count from detail list --- AGENTS.md | 39 +++++++++++----------- src/main/ets/ai-pick/AiPickDataFetcher.ets | 2 +- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index a5df0b7..d91f980 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,29 +1,28 @@ # AGENTS.md -## Repository +## Repository and validation -- This is the HarmonyOS stage-mode HAR `@b2c/first_page` (`biz_firstpage`), not a host app. The host supplies several hoisted dependencies and runtime services. -- There is no standalone build: `hvigorw`, `oh_modules`, and the sibling `../biz_quote` dependency are absent here. Do not add undeclared host dependencies or claim build/test success; verify ArkTS changes by inspection and in the host project. -- Load the `arkts-grammar-standards` skill before modifying `.ets` files. +- Stage-mode HAR `@b2c/first_page`: main module `biz_firstpage`, with a separate `src/ohosTest` Hypium test module. Root `Index.ets` is the host-facing export surface. +- This checkout is not independently runnable: `hvigorfile.ts` defines HAR tasks, but `hvigorw`, `oh_modules`, and sibling `../biz_quote` are absent. Sources also use host-provided modules beyond the root manifest's `biz_quote` and theme-manager dependencies. +- Do not claim local build or test success, add host dependencies, or invent standalone commands. Validate integration, including `src/ohosTest` scaffolding where applicable, in the host project. -## Wiring +## Feed wiring -- The public package entrypoint is root `Index.ets`; export new host-facing symbols there. -- `FirstPage.createNodeView` dispatches feed cards by `FirstPageConstant.KEY_*`. A new feed card needs its key, component, and dispatch branch; card metadata is normally read from `src/main/resources/rawfile/first_page_cards_config.json`. -- `market-ranking` is a special feed card under `src/main/ets/market-ranking/`, inserted with `KEY_MARKET_RANKING` and rendered directly by `FirstPage`. Its config key is `marketRanking`, loaded by `FirstPageCardsConfigLoader`. +- Export new host-facing symbols from root `Index.ets`. +- A normal feed card needs a datacenter `FirstPageConstant.KEY_*`, model insertion, and a `FirstPage.createNodeView` dispatch branch; metadata normally comes from `src/main/resources/rawfile/first_page_cards_config.json`. +- `market-ranking` is special: `FirstPage` inserts and renders it directly under `KEY_MARKET_RANKING`; its loader config key is `marketRanking`. +- The two `FirstPageConstant.ets` files differ: `datacenter/` defines card `KEY_*` values; `util/` exports `TITLE_BAR_HEIGHT` only. -## Market Ranking +## Market ranking -- `MarketRankingDataFetcher` first fetches the recommended contract list over `@kit.NetworkKit`; `MarketRankingHqRequestClient` then subscribes those contracts through the host `TableRequestClient`/4106 infrastructure. Do not replace either path with mock data or a second quote client. -- `MarketRankingConstant.ets` is currently shared by UI, HTTP, and HQ code: `TAB_METRICS`/`PERIOD_RANGES` contain labels, HTTP parameters, and 4106 field IDs. Changing order, IDs, or child-tab semantics affects both request paths; update them together and consult `doc/market-ranking-known-issues.md` before refactoring. -- HQ requests use 4106, frame `2201`, scenario `qht_qihuo_sort`, and `pushtime=2.5`; subscriptions must be released on page invisibility, Tab changes, refresh, and component destruction. TCP reconnect rebuilds the subscription from the original HTTP contract list. -- The component guards asynchronous HTTP and quote callbacks with request/subscription versions; preserve those guards when changing refresh or Tab behavior. Row clicks use host `jumpToQuote()` and must preserve contract, market, and name list ordering. -- Market-ranking host integration still requires validation of 4106 field IDs, standard-price fields, HTTP environment/auth, lifecycle/reconnect behavior, and quote-page routing; see `doc/market-ranking-known-issues.md`. +- Keep the two-stage data path: `MarketRankingDataFetcher` obtains recommended contracts through `@kit.NetworkKit`, then `MarketRankingHqRequestClient` subscribes them through the host `TableRequestClient`/4106 path. Do not substitute mock data or another quote client. +- `MarketRankingConstant.ets` couples UI labels, HTTP parameters, and 4106 fields in `TAB_METRICS` and `PERIOD_RANGES`; update ordering, IDs, and child-tab semantics together. +- Keep 4106 frame `2201`, scenario `qht_qihuo_sort`, and `pushtime=2.5` aligned with the subscription path. Release subscriptions on invisibility, tab changes, refresh, and destruction; reconstruct on TCP reconnect from the original HTTP contract list. +- Preserve HTTP/quote request and subscription version guards. Preserve contract, market, and name ordering when rows call host `jumpToQuote()`. +- Validate 4106 IDs and standard-price fields, HTTP environment/auth, lifecycle/reconnect behavior, and quote routing in the host; see `doc/market-ranking-known-issues.md` before changing this area. -## Conventions +## Resources and release -- Use `$r('app.color.*')` and the light/dark resource qualifiers for colors; do not hardcode theme colors. Put user-facing strings in `src/main/resources/{base,zh_CN,en_US}/element/string.json`. -- `FirstPageDebugUtil.isMarketRankingUseTestUrl` and other test URL switches default to `false`; leave them disabled in commits. -- Two files are named `FirstPageConstant.ets`: `datacenter/FirstPageConstant.ets` holds `KEY_*` card-dispatch constants, while `util/FirstPageConstant.ets` only exports `TITLE_BAR_HEIGHT`. Import the correct one. -- `biz_quote` is imported both from its package root and deep paths; preserve the existing import style when touching quote code. -- Release builds enable ArkGuard through `build-profile.json5`; keep `obfuscation-rules.txt` and `consumer-rules.txt` in mind when adding public or reflective symbols. +- Put user-facing text in `src/main/resources/{base,zh_CN,en_US}/element/string.json`; use `$r('app.color.*')` with light/dark qualifiers rather than hardcoded theme colors. +- Keep `FirstPageDebugUtil.isMarketRankingUseTestUrl` and other test-URL switches `false` in commits. +- Preserve existing root/deep `biz_quote` import style. For public or reflective symbols, account for release ArkGuard rules in `obfuscation-rules.txt` and `consumer-rules.txt`. diff --git a/src/main/ets/ai-pick/AiPickDataFetcher.ets b/src/main/ets/ai-pick/AiPickDataFetcher.ets index 72658d3..4f816ba 100644 --- a/src/main/ets/ai-pick/AiPickDataFetcher.ets +++ b/src/main/ets/ai-pick/AiPickDataFetcher.ets @@ -46,7 +46,7 @@ function parseRawTab(item: RawPickTabItem): PickTabData { imgs: isSystemPeriod ? [strategyDetail.white_img ?? '', strategyDetail.black_img ?? ''] : [], - count: strategyItem.detail_count ?? 0, + count: resData.list.length, }; const tabData: PickTabData = { strategy: strategy,