migration: preserve heaven trend fortune and heart slice
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# 切片 08:问天、观势、观气与观心
|
||||
|
||||
> 基线:`2919229`(切片 07)
|
||||
> 回档标签:`xiaobai-preservation-slice-08-20260731`
|
||||
> 结论:源码、API、数据库、真实页面、动画与全量回归通过;最终视觉仍等待全站人工验收
|
||||
|
||||
## 1. 原实现归位
|
||||
|
||||
本切片只移动原版问天 Agent、历法/卦象引擎、服务、持久化与三个 HTTP 入口,没有从
|
||||
`next/`取用代码,也没有改写六爻、安全门、五运六气、个人合参、铜钱起卦、历史去重或
|
||||
LLM 解读逻辑。
|
||||
|
||||
| 原位置 | 新的唯一实现位置 | 兼容方式 |
|
||||
|---|---|---|
|
||||
| `app/heaven_agent.py` | `app/backend/features/heaven/agent.py` | 根级模块指向同一模块对象 |
|
||||
| `app/heaven_engine.py` | `app/backend/features/heaven/engine.py` | 根级模块指向同一模块对象 |
|
||||
| `DashboardService`问天方法 | `app/backend/features/heaven/service.py` | `HeavenServiceMixin` |
|
||||
| 问天历史持久化 | `app/backend/features/heaven/repository.py` | `HeavenRepositoryMixin` |
|
||||
| 三个问天 POST 入口 | `app/backend/features/heaven/http.py` | `HeavenHttpMixin` |
|
||||
|
||||
历法引擎搬迁后仍从`app/vendor`及`app/data/iching_zh.json`读取原资源;这是唯一资源路径适配,
|
||||
顶层函数与类定义未变。旧测试依赖的根级模块继续有效。
|
||||
|
||||
## 2. 源码等价
|
||||
|
||||
- `heaven_agent.py`与原版文件 SHA-256 一致。
|
||||
- `heaven_engine.py`所有顶层函数和类与原版无位置信息 AST 一致。
|
||||
- 20个问天服务方法中19个与原版 AST 一致;`_heaven_reading_identity`仅将旧巨型类名
|
||||
`DashboardService`替换为已归位的`MarketServiceMixin`静态日期格式化方法。
|
||||
- 5个问天 Repository 方法与原版 AST 一致。
|
||||
- 三个 HTTP 方法只把全局`SERVICE`改为 Mixin 的`self.application_service`,状态码、字段和异常语义不变。
|
||||
- `DashboardService`、`ReviewDatabase`与`RequestHandler`不再重复保留已迁移实现。
|
||||
|
||||
## 3. API 与数据库差分
|
||||
|
||||
- 原版`8788`和迁移版`8789`使用同一正式数据库的两个临时副本。
|
||||
- 固定日期的问天初始化、三类历史读取、六爻成卦和个人五行计算共6个接口,状态码与业务 JSON 完全一致。
|
||||
- 未调用真实`/api/heaven/interpret`,避免外部模型波动及测试记录写入;提示词和调用链由源码等价与单元测试覆盖。
|
||||
- 两版均为62个 schema 对象;`heaven_readings`、`users`、`system_settings`、`llm_usage`、
|
||||
`user_birth_profiles`和`sector_phase_overrides`逐行一致。
|
||||
- 差分只在系统临时目录副本运行,正式数据库未写入问天记录或 LLM 用量。
|
||||
|
||||
## 4. 真实浏览器与动画检查
|
||||
|
||||
- 1920×1080视口逐页检查观势、观气、观心,无横向溢出,页面滚动边界可用。
|
||||
- 观势保留星空、三才六爻与八卦待载入场景;观气生成100个星点,五运六气环动画名为`wt-spin`,
|
||||
五行行业默认折叠;观心呼吸波纹、香火燃烧和阶段文字均持续运行。
|
||||
- 夜间模式问天背景为`rgb(11, 17, 32)`,全页无控制台错误。
|
||||
- 没有触发真实解势、解运或解卦调用,加载动画的静态资产及脚本未改动。
|
||||
- 截图 SHA-256:
|
||||
- `heaven-trend-1080.png`:`9e70d9cbfd741e74d3c4511c0e76ef8e625a6a31fd5d6bde014103f807bcc76e`
|
||||
- `heaven-fortune-1080.png`:`e4cdf0e0fc1d9325724654a781febed1d509e49ddccecb3355803b5e9f1d2f5c`
|
||||
- `heaven-heart-breathing-1080.png`:`3493a59b9032c1a8a1ba7da609b499c736170d2c7947b3aa0ac4c8b95d981ff5`
|
||||
- `heaven-heart-dark-1080.png`:`3d346fea6b593fa4e43037f5fc68eda1a3f3446a223c2022d9084922f646a088`
|
||||
|
||||
## 5. 自动验证与保留边界
|
||||
|
||||
| 验证 | 结果 |
|
||||
|---|---:|
|
||||
| 原版`python -m unittest discover -s tests -q` | 231项通过 |
|
||||
| 迁移版`python -m unittest discover -s tests -q` | 280项通过 |
|
||||
| `python -m unittest tests.test_preservation_slice_heaven -q` | 7项通过 |
|
||||
| `npx.cmd playwright test --reporter=dot` | 45项通过(2.2分钟) |
|
||||
| `git diff --check` | 通过 |
|
||||
|
||||
- 复盘助手、交易日志、自选、笔记与提醒属于切片09,本切片不提前移动。
|
||||
- 前端 DOM、页面 JS、CSS和移动端行为未改动,统一归档延至切片10。
|
||||
- `static/heaven-loading.js`是否失效仍不确定,继续保留到切片11试删。
|
||||
- 没有删除待定代码、没有修改正式数据库、没有测试或切换 Docker/NAS。
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"all_equal": true,
|
||||
"endpoints": [
|
||||
{
|
||||
"name": "heaven setup awaiting stock selection",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/setup?trade_date=2026-07-29",
|
||||
"original_status": 200,
|
||||
"migrated_status": 200,
|
||||
"original_sha256": "b72f2e972c3993717d639d1ccc68a9f1fb716a5846823a485a05458103465b92",
|
||||
"migrated_sha256": "b72f2e972c3993717d639d1ccc68a9f1fb716a5846823a485a05458103465b92",
|
||||
"equal": true,
|
||||
"first_difference": null
|
||||
},
|
||||
{
|
||||
"name": "trend interpretation history",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/readings?mode=trend&limit=20",
|
||||
"original_status": 200,
|
||||
"migrated_status": 200,
|
||||
"original_sha256": "2aa83ea177bd5cb2351ac4f3a60fdcd17e02cfc14b5753e157e515f03fc2c6c1",
|
||||
"migrated_sha256": "2aa83ea177bd5cb2351ac4f3a60fdcd17e02cfc14b5753e157e515f03fc2c6c1",
|
||||
"equal": true,
|
||||
"first_difference": null
|
||||
},
|
||||
{
|
||||
"name": "fortune interpretation history",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/readings?mode=fortune&limit=20",
|
||||
"original_status": 200,
|
||||
"migrated_status": 200,
|
||||
"original_sha256": "e60debaad54c58ad34fc7f025bfeaba7d2349aee2531b3f507c6e1968dbdcbf0",
|
||||
"migrated_sha256": "e60debaad54c58ad34fc7f025bfeaba7d2349aee2531b3f507c6e1968dbdcbf0",
|
||||
"equal": true,
|
||||
"first_difference": null
|
||||
},
|
||||
{
|
||||
"name": "heart interpretation history",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/readings?mode=heart&limit=20",
|
||||
"original_status": 200,
|
||||
"migrated_status": 200,
|
||||
"original_sha256": "1fe13531909c83c645b4fbb6740f46f2590adb346ab6e43414023967bb51b072",
|
||||
"migrated_sha256": "1fe13531909c83c645b4fbb6740f46f2590adb346ab6e43414023967bb51b072",
|
||||
"equal": true,
|
||||
"first_difference": null
|
||||
},
|
||||
{
|
||||
"name": "six-line hexagram calculation",
|
||||
"method": "POST",
|
||||
"endpoint": "/api/heaven/hexagram",
|
||||
"original_status": 200,
|
||||
"migrated_status": 200,
|
||||
"original_sha256": "9773a9f288ea5fbe063b778fc47c613972fd7747f8fc6f80333316f33923c960",
|
||||
"migrated_sha256": "9773a9f288ea5fbe063b778fc47c613972fd7747f8fc6f80333316f33923c960",
|
||||
"equal": true,
|
||||
"first_difference": null
|
||||
},
|
||||
{
|
||||
"name": "personal five-phase calculation",
|
||||
"method": "POST",
|
||||
"endpoint": "/api/heaven/personal",
|
||||
"original_status": 200,
|
||||
"migrated_status": 200,
|
||||
"original_sha256": "3b179ea4e3e0b43d12e929b4057a51264772fadcf41e5c87573dc5d18873bc9e",
|
||||
"migrated_sha256": "3b179ea4e3e0b43d12e929b4057a51264772fadcf41e5c87573dc5d18873bc9e",
|
||||
"equal": true,
|
||||
"first_difference": null
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"name": "heaven setup awaiting stock selection",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/setup?trade_date=2026-07-29",
|
||||
"payload": null
|
||||
},
|
||||
{
|
||||
"name": "trend interpretation history",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/readings?mode=trend&limit=20",
|
||||
"payload": null
|
||||
},
|
||||
{
|
||||
"name": "fortune interpretation history",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/readings?mode=fortune&limit=20",
|
||||
"payload": null
|
||||
},
|
||||
{
|
||||
"name": "heart interpretation history",
|
||||
"method": "GET",
|
||||
"endpoint": "/api/heaven/readings?mode=heart&limit=20",
|
||||
"payload": null
|
||||
},
|
||||
{
|
||||
"name": "six-line hexagram calculation",
|
||||
"method": "POST",
|
||||
"endpoint": "/api/heaven/hexagram",
|
||||
"payload": {
|
||||
"lines": [7, 8, 9, 6, 7, 8]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "personal five-phase calculation",
|
||||
"method": "POST",
|
||||
"endpoint": "/api/heaven/personal",
|
||||
"payload": {
|
||||
"trade_date": "2026-07-29"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"all_equal": true,
|
||||
"schema": {
|
||||
"object_count": 62,
|
||||
"original_sha256": "60a4e044f0ddb6502e44b45f65bedc1a0a31d4bd596f386d4ccfe153a6c8ddd1",
|
||||
"migrated_sha256": "60a4e044f0ddb6502e44b45f65bedc1a0a31d4bd596f386d4ccfe153a6c8ddd1",
|
||||
"equal": true
|
||||
},
|
||||
"tables": [
|
||||
{
|
||||
"table": "heaven_readings",
|
||||
"original_count": 31,
|
||||
"migrated_count": 31,
|
||||
"original_sha256": "e6cfc86f010fb182d7522bb99e5d268e826f93896035172120df51a011590951",
|
||||
"migrated_sha256": "e6cfc86f010fb182d7522bb99e5d268e826f93896035172120df51a011590951",
|
||||
"equal": true
|
||||
},
|
||||
{
|
||||
"table": "users",
|
||||
"original_count": 3,
|
||||
"migrated_count": 3,
|
||||
"original_sha256": "4a0f135bef8ebae454693d3f40e1157d84d814d18d849f33e2e760ed1d8a7f89",
|
||||
"migrated_sha256": "4a0f135bef8ebae454693d3f40e1157d84d814d18d849f33e2e760ed1d8a7f89",
|
||||
"equal": true
|
||||
},
|
||||
{
|
||||
"table": "system_settings",
|
||||
"original_count": 1,
|
||||
"migrated_count": 1,
|
||||
"original_sha256": "86d333a5c7feaf7111cd79b2db29513326a9b0d3781607f78bf633579e2ca8e9",
|
||||
"migrated_sha256": "86d333a5c7feaf7111cd79b2db29513326a9b0d3781607f78bf633579e2ca8e9",
|
||||
"equal": true
|
||||
},
|
||||
{
|
||||
"table": "llm_usage",
|
||||
"original_count": 72,
|
||||
"migrated_count": 72,
|
||||
"original_sha256": "03a070316a125cef904bbfb2bb06b06e792242d5713142e70354402c741393c3",
|
||||
"migrated_sha256": "03a070316a125cef904bbfb2bb06b06e792242d5713142e70354402c741393c3",
|
||||
"equal": true
|
||||
},
|
||||
{
|
||||
"table": "user_birth_profiles",
|
||||
"original_count": 1,
|
||||
"migrated_count": 1,
|
||||
"original_sha256": "2a74d4b2edd3a730a46f17fb6ab3926575c42662c1d968643b0d54586ab68b13",
|
||||
"migrated_sha256": "2a74d4b2edd3a730a46f17fb6ab3926575c42662c1d968643b0d54586ab68b13",
|
||||
"equal": true
|
||||
},
|
||||
{
|
||||
"table": "sector_phase_overrides",
|
||||
"original_count": 0,
|
||||
"migrated_count": 0,
|
||||
"original_sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
|
||||
"migrated_sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
|
||||
"equal": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"updated_at": "2026-07-31T04:17:23+08:00",
|
||||
"updated_at": "2026-07-31T08:55:17+08:00",
|
||||
"status": "active",
|
||||
"migration_mode": "behavior_preserving_source_migration",
|
||||
"source_of_truth": "current_original_webapp_runtime_and_source",
|
||||
@@ -9,10 +9,10 @@
|
||||
"failed_roots": [
|
||||
"next"
|
||||
],
|
||||
"current_slice": "slice-08-heaven-trend-fortune-heart",
|
||||
"last_completed_slice": "slice-07-mentor-skills-llm-streaming",
|
||||
"last_checkpoint": "xiaobai-preservation-slice-07-20260731",
|
||||
"next_action": "capture_slice-08_heaven_trend_fortune_heart_and_animation_contracts_then_move_original_implementations",
|
||||
"current_slice": "slice-09-review-watchlist-notes-journal-alerts-assistant",
|
||||
"last_completed_slice": "slice-08-heaven-trend-fortune-heart",
|
||||
"last_checkpoint": "xiaobai-preservation-slice-08-20260731",
|
||||
"next_action": "capture_slice-09_review_private_data_and_assistant_contracts_then_move_original_implementations",
|
||||
"authoritative_documents": [
|
||||
"AGENTS.md",
|
||||
"docs/migration/原版保真迁移总纲.md",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 小白复盘保真迁移账本
|
||||
|
||||
> 当前状态:正式迁移,切片07“问师、模型 Skill 与 LLM 流式链路”已完成
|
||||
> 当前状态:正式迁移,切片08“问天、观势、观气与观心”已完成
|
||||
|
||||
本账本是上下文恢复和人工审计的连续记录。任何迁移提交必须在同一提交中更新本文件及
|
||||
`保真迁移状态.json`。
|
||||
@@ -27,6 +27,7 @@
|
||||
| 2026-07-31 | `xiaobai-preservation-slice-05-20260731` | 集合竞价、题材库、人气热榜与龙虎榜原实现归位 | 自动、API、数据库与浏览器差分通过,进入切片06 |
|
||||
| 2026-07-31 | `xiaobai-preservation-slice-06-20260731` | 智能选股、自定义选股与策略持续跟踪原实现归位 | 自动、API、数据库与浏览器差分通过,进入切片07 |
|
||||
| 2026-07-31 | `xiaobai-preservation-slice-07-20260731` | 问师、模型Skill与LLM流式链路原实现归位 | 自动、API、数据库、Skill与浏览器差分通过,进入切片08 |
|
||||
| 2026-07-31 | `xiaobai-preservation-slice-08-20260731` | 问天、观势、观气与观心原实现归位 | 自动、API、数据库、动画与浏览器差分通过,进入切片09 |
|
||||
|
||||
## 资产处置登记
|
||||
|
||||
@@ -58,6 +59,8 @@
|
||||
| 问师消息与偏好方法 | 持久化 | 用户对话、置顶和排序 | 按职责机械移动并保持Mixin原接口 | `app/backend/features/mentor/repository.py` | 5个方法AST一致;相关表逐行一致 | 已移动 |
|
||||
| `llm_stream.py`与模型访问方法 | 公共模型能力 | 问师、问天、复盘助手与策略编译 | 移入唯一模型边界并保留兼容别名 | `app/backend/llm/` | 流式文件哈希一致;21个服务方法与既有用户边界一致 | 已移动 |
|
||||
| 公开`游资skills` | 运行资产 | 问师模型库 | 原样保留 | `app/游资skills/` | 190个文件逐路径和SHA-256一致 | 已复制 |
|
||||
| `heaven_agent.py`、`heaven_engine.py`与问天服务 | 业务计算 | 观势、观气、观心 | 机械移动并保留兼容别名 | `app/backend/features/heaven/` | Agent文件哈希、引擎定义AST、20个服务方法、6个API及真实动画页面等价 | 已移动 |
|
||||
| 问天历史方法 | 持久化 | 三类解读历史与当日解运复用 | 按职责机械移动 | `app/backend/features/heaven/repository.py` | 5个方法AST一致;62个schema对象及6张关键表逐行一致 | 已移动 |
|
||||
|
||||
处置只允许:`原样保留`、`移动`、`合并重复`、`待定`、`确认废弃`。
|
||||
|
||||
@@ -145,6 +148,16 @@
|
||||
- 回档:标签`xiaobai-preservation-slice-07-20260731`。
|
||||
- 完整证据:`docs/migration/evidence/slice-07/README.md`。
|
||||
|
||||
已完成切片:`slice-08-heaven-trend-fortune-heart`。
|
||||
|
||||
- 原版基线:提交`2919229`,即切片07回档点。
|
||||
- 迁移范围:问天Agent、历法/卦象引擎、20个服务方法、5个持久化方法及3个HTTP入口。
|
||||
- 兼容边界:根级`heaven_agent.py`和`heaven_engine.py`指向正式模块对象;原动画、DOM、JS与CSS未改动。
|
||||
- API与数据库:6个固定输入真实API完全一致;62个schema对象及6张关键表逐行一致。
|
||||
- 验收:原版231项、迁移版280项Python测试、7项切片源码等价测试、45项Playwright及1080P三模式动画页面通过。
|
||||
- 回档:标签`xiaobai-preservation-slice-08-20260731`。
|
||||
- 完整证据:`docs/migration/evidence/slice-08/README.md`。
|
||||
|
||||
## 决策记录
|
||||
|
||||
| 日期 | 决策 | 原因 |
|
||||
|
||||
Reference in New Issue
Block a user