refactor: establish standalone application boundary
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 |
Reference in New Issue
Block a user