Commit Graph
218 Commits
Author SHA1 Message Date
zhanghongyu_0626 c6a2bfd4f7 feat(milvus): Introduce Milvus vector database API for read-only access
- Added a new API endpoint to list collections in the Milvus vector database, providing metadata such as titles, descriptions, and sample data.
- Integrated the new Milvus router into the main application, ensuring it is accessible through the API.
- Updated the JSON serialization logic to handle decimal precision for financial data, maintaining accuracy in API responses.
- Enhanced the frontend with a new Knowledge Base page to display vector collections, including sample previews and collection details.
- Updated routing and menu structures to include the new Knowledge Base feature, improving navigation within the application.
2026-09-14 10:27:02 +08:00
zhanghongyu_0626 c790387717 docs: Update README and presentation materials for defense preparation
- Revised README.md to clarify the roles of various documents in the defense process, emphasizing the new structure for the presentation script and demo materials.
- Added a new print-friendly README.md for the defense script, detailing the steps for printing and PDF generation.
- Introduced a new HTML file for the presentation, enhancing the visual layout and ensuring consistency with the updated content.
- Updated the content in existing documents to reflect the latest changes in the presentation flow and materials, ensuring all resources are aligned for the upcoming defense.
2026-09-14 09:07:59 +08:00
zhanghongyu_0626 01db9af32b fix(memory): Resolve multi-turn dialogue defects and address existing test bugs
- Fixed three key defects in multi-turn dialogue handling: improved RAG to utilize merged messages, enhanced intent classification with recent memory, and ensured proper merging of chat and consultation memories.
- Closed five existing test bugs unrelated to the current round, including parameter adjustments and assertion corrections in various test files.
- Finalized adjustments in the F-β selection process to align race condition handling in test cases, ensuring all relevant tests pass successfully.

This update enhances the coherence of multi-turn dialogues and improves the reliability of the testing framework.
2026-09-14 00:59:25 +08:00
zhanghongyu_0626 7dadec279d fix(memory): Address multi-turn dialogue defects and enhance context handling
- Implemented `_merged_items` and `_merged_memory_text` functions to consolidate consult and chitchat memories, improving context awareness in intent classification and response generation.
- Updated intent prompts to include recent dialogue history, aiding in the resolution of ambiguous user queries.
- Enhanced `search_knowledge` tool to utilize context window for better query understanding, addressing issues with omitted references in user inputs.
- Fixed existing test cases to reflect changes in intent constants and ensure accurate context handling during tests.

This update significantly improves the handling of multi-turn dialogues, ensuring a more coherent and contextually aware interaction for users.
2026-09-14 00:59:14 +08:00
zhanghongyu_0626 9e1a9b2a7e docs: Update MEMORY and TODO files for clarity and accuracy in project deliverables
- Revised MEMORY.md to correct the status of kb_product_rules, clarifying that it has not been populated in the vector database as previously stated.
- Enhanced TODO.md with detailed descriptions of completed tasks and their corresponding documentation paths for better tracking of project deliverables.
- Added new files for daily meeting minutes, development plans, table design documents, API documentation, presentation materials, and requirements documentation, ensuring all necessary materials are indexed and easily accessible for the upcoming defense.
- Updated README files to reflect the latest changes and provide a comprehensive overview of submission materials for the defense, aligning with client requirements.
2026-09-14 00:18:31 +08:00
zhanghongyu_0626 f856ab4aa6 fix(tests): Resolve pytest session binding issues and update test cases
- Updated test files to import `AgentSessionLocal` from `advisor_db` instead of directly, preventing session binding to the real database during tests.
- Fixed 6 test cases to use the new login token utility, ensuring consistency across authentication methods.
- Adjusted customer risk codes in `test_convert_confirm.py` to reflect changes in customer classification (C3 to C4).
- Verified that changes resulted in zero database pollution during test runs, maintaining integrity of the testing environment.
- Documented findings and updates in the relevant test logs and memory files, ensuring clarity on the current state of tests and defects.
2026-09-13 23:21:34 +08:00
zhanghongyu_0626 188bf6a438 feat(analyst_agent): Add support for recent days queries and enhance SQL hint generation
- Introduced `_recent_days_series_hint` to handle queries related to "最近N天" for time series data aggregation.
- Added `_cn_num_to_int` function to convert Chinese numerals to integers for better query parsing.
- Updated `_nl_sql_hints` to incorporate the new hint generation logic, ensuring accurate SQL output for recent days queries.
- Enhanced documentation to reflect these changes and improve clarity on the new functionalities.
2026-09-13 22:36:19 +08:00
zhanghongyu_0626 5c18164d34 fix(trade): close CT-001 P0/P1/L1 and align customer-trade E2E
Dev login no longer honors injected roles; self-service simulate/convert
blocks R4 disclosure grades like the UI and chat already do. Reuse of a
convert idempotency key with a different body returns 409. CT6 redeem qty
is derived from T+2 lots instead of a fixed 35000; CT7-05 and CT10-07
assertions follow. Update project memory and v1.1 post-fix test artifacts.
2026-09-13 20:04:41 +08:00
zhanghongyu_0626 02a4f35c79 feat(tests): Conduct fourth round of end-to-end testing for customer trade functionality
- Completed 203 test cases with 162 passing, 6 failing, and 2 skipped, identifying 2 critical defects (P0: authentication privilege escalation, P1: suitability disclosure not enforced).
- Enhanced test coverage by verifying front-end rendering values against back-end raw responses, addressing previous gaps in validation.
- Documented findings and defects in the new test log and README files, ensuring clarity on test outcomes and areas for improvement.
- Updated the TODO list to reflect the current state of defects and testing priorities, emphasizing the need for immediate attention to identified issues.

This round of testing significantly improves the robustness of the customer trade functionality, ensuring compliance and security standards are met.
2026-09-13 18:51:52 +08:00
zhanghongyu_0626 647c07062e feat(trade): Enhance trade processing and context handling in customer service
- Introduced `pending_trade` handling in the chat API to manage trade requests more effectively.
- Updated the `submit_trade_api` to allow advisors to access customer trades based on assigned roles.
- Added new methods in `GatewayRepository` for managing core holdings during trade subscriptions and redemptions.
- Implemented context-aware trade dialogue management in the customer service layer to improve user experience during multi-turn interactions.
- Enhanced the tool service to support trade actions and suitability checks, ensuring accurate processing of user requests.

This update significantly improves the trade interaction flow, providing a more robust and user-friendly experience for customers engaging in trading activities.
2026-09-13 17:45:04 +08:00
zhanghongyu_0626 b04af6e701 feat(docs): Update demo SOP and enhance documentation for advisor agent
- Added new entry for "STAFF-20003" role in `jwt_service.py` to support additional user permissions.
- Revised the demo SOP documentation to reflect updated processes and clarify the presentation flow, including changes to the demo script and internal guidelines.
- Enhanced the presentation materials with a new HTML slide deck for the advisor agent demo, ensuring a cohesive visual representation of the features and capabilities.
- Updated various documentation files to align with recent changes in the advisor agent functionalities and testing baselines.

This update improves the clarity and usability of the demo materials while ensuring that the documentation accurately reflects the current state of the project.
2026-09-13 17:44:09 +08:00
zhanghongyu_0626 2296a4a002 feat(api): Add convert_meta_api for retrieving latest NAV date and enhance created_at field handling
- Introduced `convert_meta_api` endpoint to fetch the latest NAV date for conversion processes, restricted to users with the "risk_officer" role.
- Updated `created_at` field in `AgentMessage` to use UTC timezone for consistency in timestamp handling.
- Added `get_max_product_nav_date` method in `CoreReadOnlyRepository` to support the new API functionality.
- Enhanced Milvus template loading in `MilvusTemplateVectorStore` to ensure collections are loaded when they exist.

This update improves the API's capability to handle conversion metadata and ensures accurate timestamp management across the application.
2026-09-13 12:40:44 +08:00
zhanghongyu_0626andCursor c09b987ffe feat(web): 基金转换演示页与 agent 镜像表迁移; Core seed 修复
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 17:59:10 +08:00
zhanghongyu_0626andCursor 03fce883d4 merge(risk-control-agent): fund convert T+1 on merger base (plan A)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 17:52:17 +08:00
GaoYiYuan_0626 88cdfe6ad8 文档:合并请求订正为 PR #3(base=merger,用户指出 PR #2 分支错误已关闭)· 冲突按 merger 重测 15 文件 2026-09-12 17:41:23 +08:00
zhanghongyu_0626 c7fa32ef62 docs(advisor): 顾问线已合入 merger,同步记忆与 E2E 日志
- MEMORY/TODO/合并说明:integrate/advisor-agent 已通过 fast-forward 并入 merger(4be27c5)
- ADV-001:补充 4be27c5 与 64c5db7 后端结论仍成立,无需重跑
2026-09-12 17:23:09 +08:00
zhanghongyu_0626 4be27c589c 合并一下 2026-09-12 17:16:15 +08:00
zhanghongyu_0626 64c5db73a9 refactor(kyc): Remove ApiResponse response model from KYC session endpoints
- Updated KYC session endpoints to remove the ApiResponse response model, simplifying the API structure.
- Enhanced clarity in the KYC session creation, retrieval, chat, and completion methods by focusing on the payload and response data directly.
- Improved code readability and maintainability by streamlining the endpoint definitions.
2026-09-12 16:48:25 +08:00
zhanghongyu_0626 d394686a3b feat(advisor-agent): Integrate advisor agent functionalities and migration scripts
- Merged the `integrate/advisor-agent` branch into the `merger`, enhancing the advisor agent's capabilities with compliance, KYC, and script templates.
- Updated the testing baseline to reflect 926 passed tests, with 65 failures concentrated in the advisor agent's `test_sprint*` cases.
- Introduced new migration scripts for advisor-related database structures, ensuring smooth integration and data management.
- Enhanced documentation to include the new API structure and integration details, providing clarity for future development.

This update significantly advances the advisor agent's functionality while maintaining a structured approach to integration and testing.
2026-09-12 16:37:29 +08:00
zhanghongyu_0626 70aa861983 feat(advisor-agent): Introduce advisor agent functionalities with compliance, KYC, and script templates
- Added new modules for advisor compliance, KYC sessions, and script templates, enhancing the advisor agent's capabilities.
- Implemented a comprehensive API structure under the `/api/advisor-agent` prefix, ensuring clear organization and access to new features.
- Established database models and repositories for compliance rules and KYC sessions, facilitating robust data management.
- Integrated exception handling and response models to improve error management and user feedback.
- Updated settings to include new configurations for compliance and KYC features, ensuring flexibility and adaptability.

This update significantly expands the advisor agent's functionality, providing essential tools for compliance and customer interaction while maintaining a structured API design.
2026-09-12 16:33:07 +08:00
zhanghongyu_0626 282f21932c Merge remote-tracking branch 'xinghuo/advisor-agent' into integrate/advisor-agent 2026-09-12 16:32:48 +08:00
GaoYiYuan_0626 2453e73ad0 文档:PR #2 创建留痕(风控+基金转换并入 main · 中文描述 · 冲突实测 23 文件) 2026-09-12 16:27:14 +08:00
GaoYiYuan_0626 08389371a7 文档:里程碑 tag convert-m1 落账(指向收官提交 292770f · 已推送远程 · MEMORY 对照表更新) 2026-09-12 15:19:59 +08:00
GaoYiYuan_0626 292770f1fb README:最新更新章节(转换线收官/集成测试/种子补拉)+ 前端已留接口契约(chat 四端点 + 基金转换四端点)+ 全仓文档推送状态回写 convert-m1 2026-09-12 15:15:51 +08:00
zhanghongyu_0626 973bf1b834 feat(advisor-agent): Integrate advisor agent into merger with new API structure
- Merged `xinghuo/advisor-agent` into the `merger` branch, establishing a new API prefix `/api/advisor-agent` to avoid conflicts with existing endpoints.
- Implemented a comprehensive implementation plan detailing the integration steps, including conflict resolution, database migrations, and service adaptations.
- Introduced new files for advisor compliance, script templates, KYC, and market alerts, ensuring a cohesive addition to the existing architecture.
- Updated documentation to reflect the new structure and integration process, enhancing clarity for future development and maintenance.

This integration significantly expands the capabilities of the merger, providing a robust framework for advisor-related functionalities while maintaining compliance and operational integrity.
2026-09-12 15:14:29 +08:00
zhanghongyu_0626 601ed258f3 feat(analyst): Enhance asset management and ambiguity detection features
- Added new endpoints to the analyst API for managing assets, including `GET /assets` to list assets and `POST /assets/{kind}/{asset_id}/publish` to publish assets.
- Introduced `DictAmbiguityCheckRequest` schema for checking metric ambiguities, enhancing the analyst's ability to clarify definitions and aliases.
- Implemented `detect_dict_ambiguity` function to analyze potential ambiguities in metrics, providing structured feedback for users.
- Updated `AnalystAgent` to support the new asset management functionalities and ambiguity detection logic, improving overall user experience.
- Enhanced existing schemas and services to accommodate new features, ensuring robust data handling and validation.

This update significantly improves the analyst API's capabilities, allowing for better asset management and clarity in metric definitions.
2026-09-12 15:14:01 +08:00
GaoYiYuan_0626 d2d00dd50c 种子:净值补拉至 2026-09-11(fetch_nav 重抓 60 日窗口 · 14 产品 · 历史值零修订 · 重测 849 绿 / CONVERT_STRESS 7/7 / 真库 9/9) 2026-09-12 15:03:39 +08:00
GaoYiYuan_0626 eac6b61ce4 文档:第 6 步集成测试收官(转换线 AIcoding 六步全流程完成 · 849 绿 / CONVERT_STRESS 7/7 / 真库 9/9 / 紧池 100% 重测) 2026-09-12 14:52:01 +08:00
GaoYiYuan_0626 b411d5a087 T-14/T-17 开口闭环:PRD §2.5.3 修订 + truncate 舍去法接入 + R-12 定稿(用户三项拍板 · 849 绿 / 真库 9/9)
① PRD §2.5.3 修订:删「易方达 ETF 场外取整数位」(无证据且有反证,真实整数位载体为场内),改记「2 位主流 + 舍去型真实存在」,版本块加注记
② rounding_mode=truncate 消费接入(用户拍板补做):
   - core_ro.get_share_rounding = 位数+模式回退链单点(规则行 → core_product → 默认 2/half_up,mode 白名单读取即校验,get_share_digits 转薄包装)
   - calc.product_round/in_qty 加 mode 参数(truncate → ROUND_DOWN)
   - 确认段 + 申购折算两处透传;载体 09-seed-org.sql ⑦ 段 PROD-005828(product 层回退,零转换场景引用)
   - 测试 +7(842→849):calc 4 + 确认段 2(truncate 34945.53 vs half_up .54 分化 + 回退链遮蔽语义)+ 申购段 1
   - 突变:两调用点同拆 mode 透传 → 2 红,还原绿;真库 9/9(seed 新增 ⑫ 载体在位断言)
③ R-12 口径裁定追认定稿:条目回写开发计划(NULL 不参与 A/C 判定 / 同类走一般转换规则)

审核教训留痕:PRD 独立 AI 三轮审查未抓出外部事实断言无出处 —— 联网核实铁律再添例证
文档:开发计划 T-14 开口闭环段 + 基线 849 · 日志新节 · TODO/MEMORY/AGENTS/交接文档开口清零
2026-09-12 14:31:35 +08:00
仝勋敏 68df13c10b feat: add auth/compliance/kyc/market/template modules, alembic migrations, tests and docs 2026-09-12 14:27:37 +08:00
GaoYiYuan_0626 cde0c226fe 基金转换 T+1 模型:T-15/T-16/T-17 收官(842 绿 / 真库 9/9 / 转换线第 5 步完成)
T-15 D28 部分成交专项:
- sqlite +1 终态单幂等 skipped 口径裁定(ConfirmConflict 仅限读后状态才变窗口)
- 真库 confirm +3 组 19 项(E2 占用释放双向 / G2 actual_qty=0 → rejected / H2 撤单后确认)→ 102/102
- CONVERT_STRESS Barrier(2) 窄窗争批:恰 1 confirmed + 1 rejected
- 突变实证防御纵深:④可用量复核 / ⑤plan_lots / 事务内哨兵三道防线拆任一道仍收敛 rejected

T-16 D29 资金流中转:
- _insert_cash_flows 全仓唯一写入点(out/redeem 费前 + in/subscribe 净转入,remark=convert:{gid} 同事务)
- test_confirm_writes_no_cash_flow 反转为恰 2 条 + 金额对账(T-7 登记闭环)
- 真库 apply A2 组 + B 组 0 残留 → 30/30;confirm 反转断言 → 103/103
- FK 坑(core_cash_flow.fk_cf_customer 挡客户删除):5 处清理段补删

T-17 D30 share_class + A/C 互转:
- _validate_products 纯新增拦截分支:两端 share_class 非空且不同才查 allow_ac_convert(任一端=1 两向放行)
- 口径裁定 2 条(R-12 字面偏差,待用户追认):NULL 不参与 A/C 判定 / 同类走一般转换规则
- 联网核实(用户铁律):A/C 互转需管理人开通(摩根 2025-11 公告)= 开关真实载体;持有期重新起算与本仓一致
- 种子 ⑥ 段(双开对/双关对照/同类对照);sqlite +4 → 842 passed / 8 skipped;真库 accept H 组 → 43/43
- 突变:分支失效 → closed 红,还原绿

文档:开发计划 T-15~T-17 DoD 全勾 + 执行记录 · 基线 842 · TODO/MEMORY/AGENTS/交接文档 v4.5 终态(第 5 步收官 → 下一步第 6 步集成测试)
2026-09-12 13:42:49 +08:00
GaoYiYuan_0626 1a615bbbef 基金转换 T+1 模型:T-14 D27 产品舍入真正接入 + 联网核实纠偏(837 绿 / 真库 9/9 / 种子 v1.1 全 2 位)
- 接入面 4 处单点收敛:core_ro.get_share_digits(唯一回退链:规则行→core_product.share_digits→PLACES=2)· calc.in_qty 加 digits=PLACES 可选参数 · 确认段(business_type=convert)· 网关申购折算(subscribe);redeem 份额申报无折算无消费方
- 边界裁定:只接落库侧(开发计划 DoD 即边界),响应展示维持 q(D2) 收敛(2 位产品逐字节零漂移);PRD §2.5.2 展示按产品覆盖为登记开口
- 联网核实(用户铁律):主流 2 位 ✅ · 位数按各基金合同配置 ✅(南方 2012 调整公告)· 舍去 TRUNCATE 型真实存在 ✅ · 货基 2 位 ✅ · 「指数基金份额 4 位」证伪 ❌(ETF 联接/指数合同全 2 位)→ 11-seed-share-rule.sql v1.1:3 产品 9 行 4→2 + 头注重写为核实出处;「易方达 ETF 场外整数位」无证据有反证(登记开口待拍板)
- 测试 +7(830→837 零回归):calc 层 2 + confirm 段 3(回退链三层各 1 + business_type 干扰行)+ 申购段 2;4 位种子行 = D27 机制验证载体(docstring 钉明)
- 突变验证 2 组(confirm/gateway digits 改固定 2 → 各 2 红,还原零残留);真库 9/9 退出码 0(seed 重灌 42 行全 2 位生效)
- 开口 2 项待用户拍板:① PRD §2.5.3 易方达句修订 ② rounding_mode=truncate 消费接入(真实存在、T-14 范围外)
2026-09-12 12:41:20 +08:00
zhanghongyu_0626 a0f550646e feat(analyst): Add analyze endpoint and chart specification validation
- Introduced a new `/analyze` endpoint in the analyst API to process analysis requests, allowing users to receive textual interpretations and chart specifications based on provided prompts.
- Enhanced `analyst_schemas.py` with `AnalyzeRequest` and `ChartSpec` models to structure analysis requests and validate chart specifications.
- Implemented chart validation logic in a new `analyst_chart.py` service, ensuring that chart types and fields are correctly specified and conform to allowed values.
- Updated `AnalystAgent` to handle analysis requests, integrating the new logic for generating responses based on user prompts and data availability.
- Added unit tests to verify the functionality of the new endpoint and validation mechanisms, ensuring robustness and reliability.

This update significantly enhances the analytical capabilities of the application, providing users with improved tools for data interpretation and visualization.
2026-09-12 12:33:37 +08:00
GaoYiYuan_0626 a7d50386b2 T-13 补修:verify_convert_lots/apply 字面造数日期改真库日历链式回推(用户指出硬编码 · 全仓排查留痕) 2026-09-12 12:09:57 +08:00
GaoYiYuan_0626 5f7ad9180b 文档:T-13 回写 + 全仓进度一致性(开发计划 DoD 6/6 全勾 + 执行记录 · PRD §9 第 18/31 条实测回填 · 交接文档 v4.3) 2026-09-12 11:58:42 +08:00
GaoYiYuan_0626 3bc84a093d 基金转换 T+1 模型:T-13 convert_fund 退役 + 并发面重写 + 全量门禁(830 绿 / 真库 9/9 / 紧池 100%) 2026-09-12 11:52:27 +08:00
GaoYiYuan_0626 9ad8a90de1 文档:T-12 回写 + 全仓进度一致性(开发计划 DoD 全勾 + 执行记录)
- 开发计划 v2.0 T-12 节:DoD 4/4 全勾 + 执行记录(三改动面 / 联网核实留痕 /
  confirm_one 留痕修复 / 真库 56/56 / 突变 4 组 / rebuild_alerts 路径勘误)
- 交接文档 v4.2(T-12 完成块 + 基线 849,.gitignore 内不入库)
- TODO.md / MEMORY.md / AGENTS.md:T-1~T-12 ✅ / T-13~T-17 ⬜,基线 849
- 2026-09-12.md 追加 T-12 执行记录(含用户铁律:外部真实业务事实必须联网核实)
2026-09-12 10:55:01 +08:00
GaoYiYuan_0626 03feacf173 基金转换 T+1 模型:T-12 补偿 + SLA 清理切 Core 链路 + confirm_one 引擎异常留痕修复
- cleanup_pending_convert.py 整体重写:扫描对象迁 Core(list_inflight_before 扫
  accepted/nav_pending 严格早于 cutoff → 条件 UPDATE 置 expired,S2 不硬删、
  幂等不加锁);SLA 边界 = 当前业务日上推 convert_confirm_sla_days 个交易日
  00:00(previous_biz_day 链式,与 confirm_batch._window_start 同口径);
  --days/--dry-run;不动 agent 镜像(T-4 契约)
- compensate_convert 从 v1.0 Deprecated 组救回在役:详情侧 Core 三件套前置校验
  (流水≥2 → confirmed → 明细非空,任一不满足 missing 零写入),补写与确认段
  第⑧步同口径 sync_mirror + confirmed 审计 phase=confirm-compensate
- convert_request_repository +list_inflight_before(T-12 专用捞单,R-2 守卫复用)
- 修复 confirm_one 第⑦步引擎异常只 log 不留痕(全仓唯一不落痕路径,补偿侧
  「人工核对」保护对主链路失效):except 补写 decision='engine_error' 审计 +
  engine_error 标志贯穿审计与响应(D17 不阻断保留;三链路与 v1.0/gateway 对齐)
- verify_convert_compensate.py 整体重写 T+1 链路:受理→确认双失败→Core 三件套
  对表→补偿/cleanup,真库 56/56 退出码 0 残留 0(受理日/SLA 边界走真库交易日历
  链式推算,A 股最长连续休市 2020 春节 10 天已联网核实留痕)
- 测试:补偿用例 4 改 + 2 增、cleanup 段重写 + 窗口等价新用例、并发补偿 T+1 造数
  + 真库清场补 core_convert_request(FK 1451)、engine 异常用例断言翻转
  (不阻断但留痕+标记);全量 849 passed / 10 skipped(846+3 零回归);
  突变 4 组全被抓还原(cleanup 窗口反转 5 红 / 前置守卫 1 红 / 真库
  expired→cancelled 2 红 / 真库 nav_stale 1 红)
2026-09-12 10:54:49 +08:00
GaoYiYuan_0626 b4a61dc306 文档:T-11 回写 + 全仓进度一致性(开发计划 DoD 全勾 + 执行记录 / 交接文档 v4.1 / TODO / MEMORY / AGENTS / 当日日志) 2026-09-12 09:35:13 +08:00
GaoYiYuan_0626 b2d8a90ad2 基金转换 T+1 模型:T-11 core_tools 汇总去重 + 持仓过滤(确认段场景补用例,生产代码零改动) 2026-09-12 09:35:13 +08:00
zhanghongyu_0626 d4a2461ba4 feat(nav): Enhance product API with historical NAV tracking and new charting features
- Updated `ready.py` to include a health check for the new `products_nav_history` endpoint, ensuring system readiness.
- Enhanced the `ProductNavChartPanel` component to visualize historical NAV data with various charting options, including line and column charts.
- Introduced new utility functions for filtering and aggregating NAV data, improving data handling in the frontend.
- Updated tests to verify the inclusion of the new `products_nav_history` check in the API response.
- Improved documentation to reflect recent changes and the new testing baseline of 833 passed tests, indicating enhanced stability.

This update significantly improves the product API by providing access to historical NAV data and enhancing user insights through visualizations.
2026-09-11 21:38:54 +08:00
GaoYiYuan_0626 5a784dc185 文档:T-10 回写 + 全仓进度一致性(开发计划 DoD 全勾 + 执行记录)
- 开发计划 v2.0:T-10 六项 DoD 全勾(申购落批次 / 哨兵不超扣 / T+2 半开区间
  双向 / 金额公式 D26 / 转换后不超扣验收 9 / rebuild 无漂移)+ 新增执行记录
  (改法、验证证据 844 passed、真库 89/89、突防验证、3 处断点与口径)
- 交接文档 v4.0(gitignore 不入库,本轮未提交)
- AGENTS.md 入口引用 → T-1~T-10 ✅ / 844 / 89/89 / 下一步 T-11
- docs/memory/TODO.md:T-10 完成条目 + 待办行 T-11~T-17
- docs/memory/MEMORY.md:进度 + 自检第 5/6 问 → 844 / T-1~T-10
2026-09-11 21:24:40 +08:00
GaoYiYuan_0626 34c7d0840d 基金转换 T+1 模型:T-10 普通申赎批次维护 + T+2 校验 + rebuild_lots
FR-C16 份额批次全生命周期 + FR-C25 T+2 可赎回 + redeem 份额申报 D26 落地普通赎回侧:

- trade_gateway:_redeem_quote 走 available_qty_with_inflight 硬校验(R-3,
  申报超可赎抛 InsufficientShares 不静默裁剪);_maintain_lots redeem 分支
  三重裁剪 = T+2 过滤 → D8 补建 → 在途占用 → 哨兵 FIFO 扣减;subscribe 落新批次
- core_ro.list_share_lots / share_lot_repository.select_for_convert 加
  available_from T+2 半开区间过滤(R-4,日历缺行降级不过滤,金额/扣减同口径)
- gateway_repository 扣批次加哨兵 remain_qty >= :q(rowcount!=1 回滚防超扣)

验证:test_share_lot +10 / test_trade_gateway +1 → 全量 844 passed / 10 skipped
(基线 834 + 11 零回归);真库 verify_convert_api 89/89(H 节提前 + H2 在途
占用拦截断言);rebuild_lots --dry-run 58 持仓 0 补建 0 写入;突防验证区分度成立
2026-09-11 21:24:32 +08:00
zhanghongyu_0626 2b4eaa9725 feat(nav): Implement historical NAV tracking and enhance product API
- Added `list_nav_history` method in `CoreReadOnlyRepository` to retrieve historical NAV data for products over a specified number of days.
- Introduced `get_nav_history` endpoint in `product_service` to return historical NAV sequences, improving product data accessibility.
- Updated `products.py` to include new API endpoint for fetching NAV history, ensuring compliance with access control.
- Enhanced `ready.py` to include a health check for the new functionality, ensuring system readiness.
- Updated documentation to reflect the new testing baseline of 833 passed tests, indicating improved stability and functionality across the application.

This update significantly enhances the product API by providing access to historical NAV data, improving user insights into product performance.
2026-09-11 20:47:18 +08:00
GaoYiYuan_0626 6ecde37885 文档:convert_fund 退役并入 T-13(用户 2026-09-11 裁定)
开发计划 T-13 目标/改法 6/DoD/风险补「convert_fund 退役 + 清理 v1.0 依赖链」;
TODO 待办行补注裁定。本地提交,未推送远程
2026-09-11 20:42:37 +08:00
GaoYiYuan_0626 2277d61568 文档:T-9 回写 + 全仓进度一致性(开发计划 DoD 全勾 + 执行记录 / 交接文档 v3.9 / TODO / 两份 MEMORY / AGENTS.md)
开发计划 T-9 新增执行记录(附 2 处口径缺陷细节);各入口进度统一
T-1~T-9 ✅ / 834 passed / 真库 verify_convert_api 88/88 / 下一步 T-10
2026-09-11 20:37:51 +08:00
GaoYiYuan_0626 e04b44c44a 基金转换 T+1 模型:T-9 api 层(受理 202 + 撤单/确认/查询接口 + 网关分派 + redeem 份额申报)
三接口路径以 PRD 为准(裁定 11/12):
- app/api/convert_admin.py 新增 POST /api/simulate/trade/convert/{gid}/cancel(交易 owner 闸门)
  + POST /api/admin/convert/confirm?accept_date=(risk_officer)+ GET /api/simulate/trade/convert/{gid}(查询 scope 闸门)
- simulate.py convert 分支受理 202 + 受理回执(两类 202 分辨 accepted/processing)
- trade_gateway 分派改调 accept_convert(SUPPORTED_TRADE_TYPES 维持 2 类型)
- redeem 份额申报(D26/R-6:qty 入参,_redeem_quote = qty * T 净值 - 赎回费)
- errors.py 新增 CANCEL_NOT_ALLOWED / CONCURRENT_CONFLICT(均 409)

修正 2 处口径缺陷(测试打穿揭示,非只改测试):
- _rebuild_quote 的 out_nav 改直读 core_convert_lot_detail.nav(反推致 1.3604 -> 1.3600 漂移)
- _accept_idempotent 字段面扩展与受理回执对齐(幂等重试客户端可取到预计确认日)

验证:端到端 13 passed(T+1 两段链路重写);全量 834 passed / 10 skipped;
真库 verify_convert_api.py 88/88,存量 4 脚本零回归;3 组突变验证命中后还原
2026-09-11 20:37:45 +08:00
GaoYiYuan_0626 9f28633e55 文档:T-8 回写 + 全仓进度一致性复核(订正 5 处漏同步)
本轮在 T-8 提交(57f16a5)后做文档回写,并对全仓「同一事实的副本」做一致性扫描,
发现并当场订正 5 处漏同步(均属上次改了主状态位、漏改副本):

- AGENTS.md 入口引用(最重要,属项目记忆已强调的「全仓同步入口引用」漏项):
  T-1~T-6 ✅/797 基线/下一步 T-7 → T-1~T-8 ✅/829 基线/下一步 T-9;
  T-6 真库 verify_convert_accept.py 36/36 → 37/37,并并列 83/83、39/39。
- docs/memory/TODO.md:汇总待办行「T-8 ~ T-17(含已完成之引擎时机)」→「T-9 ~ T-17」;
  为 v0.x 线引用块加编号歧义提示(其 T-11/T-12 与新线同号且均涉 amount_view,易混)。
- docs/memory/MEMORY.md:自检问答第 6 问进度 T-1~T-7 ✅/827 → T-1~T-8 ✅/829。
- 开发计划(T-8 执行期订正,承 57f16a5 代码提交):
  就地订正 T-7 执行记录第 2 条「T-8 剩余仅为 rules.amount_view」之误(F-10 明确 T-8 不动去重口径,属 T-11);
  新增 T-8「执行记录」5 条差异裁定;DoD 全勾。

不入库但同批完成(交接文档.md 受 .gitignore 忽略):
  - 顶部版本 v3.7 → v3.8;§③ 表格行;§B.11 状态块(T-8 完成 + 两处订正);
  - 开工纪律行 T-1~T-6 → T-1~T-8;
  - §B.11「未落地(T-1 起执行)」立项期清单 → 「已落地」并附实测行号
    (01-ddl.sql 272/297/305 行;已进 reset.ps1 与 verify_convert_seed.py 清单),原文折叠留痕。

复核:全量 pytest -q → 829 passed / 10 skipped(16.37s,零失败)。
2026-09-11 19:53:31 +08:00
GaoYiYuan_0626 57f16a50a1 基金转换 T+1 模型:T-8 引擎时机收口(调用点唯一性守护 + 受理不触引擎 + 真库链路切 T+1)
【范围澄清】
引擎调用点在 T-7 即已迁到确认事务 commit 之后(engine_call.run_convert_engine 唯一出口),
受理段 accept_convert 自实现起就不含引擎调用 → R-7 已满足。本轮补齐**守护与端到端验证**。
注意 F-10 已明确:T-8 **不动**去重口径(amount_view 三处消费方原样不动,那是 T-11 的范围)。

【新增测试】
- test_convert_engine.py:test_process_convert_event_has_single_call_site —— AST 统计
  app/ 下 process_convert_event( 的 Call 节点**恰 1 处**且宿主为 run_convert_engine。
  用 AST 而非字符串匹配:engine_call.py 的说明段含该字样,会被误判。
  **已做突变验证**(临时加第二处调用 → 断言变红,随后还原)。
- test_convert_accept.py:受理无副作用用例补「不触引擎」断言 —— 受理后 risk_alert 0 行、
  无 pass / engine_error 审计(验收 29 前半)。
- test_convert_confirm.py:test_real_engine_on_confirm_dedupes_daily_total —— 确认链路接
  **真引擎**(不注入 hook):正证(阈值夹逼 → RISK-002 不命中,去重生效)+ 反证(阈值下调
  → 命中,证明确认段确实跑过引擎),并断言一张单 / payload.events 两条 / 去重不删行(验收 5/6/7)。
  **已做突变验证**(禁用引擎调用 → 变红,随后还原)。

【真库脚本】
verify_convert_engine.py 整体切换 T+1 链路(此前走 v1.0 convert_fund):
受理 accept_convert → 确认 confirm_one;新增 A0 组「受理不触引擎」;A~F 组保留原断言
(引擎出单 / RISK-002 夹逼 / 去重不删行 / 幂等重放 / 无命中 / 清理自检)。真库 39/39 一致。
- 折算期望改用 T 日净值(未知价法),不再沿用批次买入净值 alloc.nav;
- 基准日取真库日历中位开市日,T+1 = 下一交易日;
- 阈值必须显式传给 confirm_one —— 缺省退回 settings 默认会把 RISK-002 误判为命中,
  症状像「去重失效」,实为口径没传(首轮实跑被 B 组断言捕获,已钉进注释)。

【回归】
全量 829 passed / 10 skipped(827 → +2);复跑 T-6 verify_convert_accept 37/37、
T-7 verify_convert_confirm 83/83、v1.0 链路 verify_convert_service 35/35,均零失败。
2026-09-11 19:48:53 +08:00
GaoYiYuan_0626 0e27fec5cb 文档:T-7 确认段落地回写(开发计划 DoD 全勾 + 执行记录 / 交接文档 §B.11 / TODO / 两处 MEMORY)
- 开发计划 T-7:DoD 9 项勾选 + 新增「执行记录」小节,逐条留痕 6 处与计划的差异裁定:
  ① 确认段不做最低持有重判(计划缺口,强制全转属受理段决策,受理单 remark 传承);
  ② 新增 format/audit/engine_call 三共用模块(后者顺带完成 T-8 的「引擎时机改」);
  ③ nav.py 未改(确认段直调 core_ro.get_nav_on,取 T−1 路径随 v1.0 convert_fund 一并删);
  ④ test_convert_integration 改写推迟到 T-9(需端到端真接口);
  ⑤ 受理单置 confirmed 并入 apply_convert 同事务(防「批次已扣、状态未置」中间态);
  ⑥ MySQL rowcount=changed rows 陷阱(nav_pending 重试不得复用冲突判定)。
- 交接文档 §B.11:T-6→T-7 完成、基线 797→827、真库 36/36→37/37 与 83/83、
  新增 T-7 实施期发现段、下一步 T-8/T-9(并注明 T-8 范围已缩小)。
- docs/memory/TODO.md:进度行 + T-6 真库数 + T-7 条目勾选与详述。
- .workbuddy/memory/MEMORY.md 与 docs/memory/MEMORY.md:进度与关键裁定同步;
  当日工作日志补「续 3:T-7 确认段落地」。
2026-09-11 19:37:30 +08:00