220 lines
14 KiB
Markdown
220 lines
14 KiB
Markdown
# PROGRESS · 上游能力接入(任务 3–7,2026-09-03)
|
||
|
||
工作树:`/Users/jesse/Downloads/Copse/astrology/.worktrees/upstream-capabilities-20260903`
|
||
分支:`codex/upstream-capabilities-20260903`(当前基线 `origin/staging` @ `49cd66c5`)
|
||
任务书:`docs/tasks/TASK-upstream-sync-20260903.md`
|
||
|
||
未碰 `main`。未改 `.gitea/workflows/**`。
|
||
|
||
| 任务 | 状态 | 说明 |
|
||
| --- | --- | --- |
|
||
| 3 health 三窗 + 个人报告 | 完成 | 三窗、D6/D8/D30、Transit blocked、非医疗边界已进咨询与报告 |
|
||
| 4 VedAstro REST 桥 | 完成(已在 `45d13258`) | REST 默认通路,MCP 仅协议探测 |
|
||
| 5 专业报告导出 | 完成 | API + 报告中心入口;确定性导出,零 writer telemetry |
|
||
| 6 新字段透传 | 完成 | 聊天 + 报告 allowlist;golden 超集 |
|
||
| 7 校正三项 | 完成(历史全套基线红灯见下) | 自适应选题、请求级岁差/交点、出生时间敏感度节 |
|
||
|
||
## 集成验证与发布前状态
|
||
|
||
| 项 | 结果 |
|
||
| --- | --- |
|
||
| 任务 3/5/7 Python 聚焦集合 | **131 passed / 0 failed** |
|
||
| 前端聚焦集合 | **1115 passed / 0 failed**(health/report 118,export 22,ayanamsa/sensitivity 135,rectification 840) |
|
||
| TypeScript | `tsc --noEmit --incremental false` 通过 |
|
||
| 完整 quick quality gate | **通过**:Python、数据库合同、前端测试、lint、Next build、Python compile、关键 JSON 校验均绿 |
|
||
| API 主文件行数 | **11200 / 11363**,未越门 |
|
||
|
||
quick gate 收口过程:实施中先后修复了专业导出内部标识净化(`175e825c`)、journey turn 263→250 pure LOC(`9c987beb`)、VedAstro timeout 真实时钟竞态(`cf6c8a9c`)及新增测试的 TypeScript 类型错误;之后一次完整门禁走到 build 时,Next 16 Turbopack 拒绝 worktree 外的绝对 `frontend/node_modules` 符号链接。最终只把同一依赖复制到 worktree 内,原样重跑通过,退出时已恢复原符号链接。该失败是 worktree 依赖布局,不是产品代码回归。
|
||
|
||
发布前仍缺:登录态浏览器聊天/报告/校正走查、真实 writer `inputTokens`。这两项受当前环境限制,不能写成已验收。
|
||
|
||
## 任务 3
|
||
|
||
### 做了什么
|
||
|
||
1. health 编排器采用 `pressure_windows` / `event_risk_windows` / `recovery_support_windows` 三窗,必需证据含 D6、D8、D30、Narayana Dasha、Functional Benefic-Malefic、Transit 与 `non_medical_boundary`;原误写的 D9 已修正为 D30。
|
||
2. 引擎生成 health 叙事种子;咨询证据包显式携带 Transit 和非医疗边界。Transit 无法执行时保留 `blocked` 行,不再静默缺席。
|
||
3. 个人报告开放 health 主题、最低证据组和静态知识包;假 writer 能到 `PIPELINE-READY`,health conclusion 有真实内容及非医疗声明,`assertionLevel` 防升级规则未改。
|
||
4. 未新增计费项、模型调用或数据库结构。
|
||
|
||
### 测试与 smoke
|
||
|
||
| 项 | 结果 |
|
||
| --- | --- |
|
||
| Python:`test_consultation_consumer_context.py`、`test_health_narrative.py`、`test_unified_consultation_orchestrator.py` | **68 passed / 0 failed** |
|
||
| health / personal report 前端集合 | **118 passed / 0 failed** |
|
||
| `tsc --noEmit --incremental false` | 通过 |
|
||
| 虚构 health workflow | 三窗齐全;D6/D8/D30=`executed`;Transit 缺证据时=`blocked`;非医疗边界在 evidence packet 与报告中可追溯 |
|
||
| 假 writer 验收 | `PIPELINE-READY`;health claim card 非空且含非医疗声明 |
|
||
|
||
### 偏离与环境缺口
|
||
|
||
- 原任务书写 health 必需分盘 D6/D8/D30;实施初版误带 D9,已在 `837bd082` 修正并加真实 workflow 回归。
|
||
- 无登录态浏览器会话,报告中心 health 交互未做真实浏览器走查;代码合同和前端测试已覆盖。
|
||
|
||
## 任务 4
|
||
|
||
### 做了什么
|
||
|
||
1. 引入 `scripts/vedastro_rest_bridge.py`(对齐上游 `a6f47abd` 的 REST Calculate 调用)。**去掉 yn-1993 / Handan / 1993-04-17 14:49 默认值。** 默认改为虚构 smoke:Beijing `39.9042, 116.4074`,`12:00 01/01/1990 +08:00`,`LAHIRI`。
|
||
2. 本地 5 次/分钟限流。HTTP 429 与本地令牌耗尽均降为 `official_blocked`,不抛给调用方当硬错误。`match` 子命令返回 `official_blocked` / `match_subcommand_not_implemented`,不伪造合盘。
|
||
3. `scripts/vedastro_gateway.py`:官方健康改为打 `/api/Calculate` 的 `Status: Pass`;status 输出 `transport=rest`、`rate_limit_per_minute=5`、`mcp_bridge_role=protocol_probe_only`。`JYOTISH_SKIP_LOCAL_ENV=1` 时探测为 `not_probed`。
|
||
4. `scripts/vedastro_parity_matrix.py` 与 fast-path checklist:MCP/API Surface 的 `fastest_path_lane` 改为 `rest_adapter`;MCP 桥文件保留,只作协议探测。
|
||
5. `scripts/diagnose_vedastro_mode.py`、`scripts/vedastro_official_mcp_bridge.py` 文档、`docs/engine/README.md` 同步。
|
||
|
||
### 测试(无网络)
|
||
|
||
未设置 `VEDASTRO_ENABLE_NETWORK=0` 污染进程时:
|
||
|
||
```
|
||
tests/test_vedastro_rest_bridge.py
|
||
tests/test_vedastro_parity_matrix.py
|
||
tests/test_vedastro_gateway.py
|
||
tests/test_vedastro_runtime_mode_diagnostics.py
|
||
tests/test_vedastro_fast_path_checklist.py
|
||
tests/test_vedastro_official_mcp_bridge.py
|
||
```
|
||
|
||
**67 passed**(含任务 0 的 `test_import_yinduzhanxing.py`)。REST 桥测试用录制响应,不打真网。曾有一次 `active_backend=local_fallback` 失败是 pytest 进程被 `VEDASTRO_ENABLE_NETWORK=0` 污染,不是产品回归。
|
||
|
||
`tests/test_vedastro_rest_bridge.py` 断言默认 payload **不含** `14:49`。
|
||
|
||
### 有网络手工跑
|
||
|
||
```
|
||
.venv/bin/python -B scripts/vedastro_rest_bridge.py horoscope
|
||
```
|
||
|
||
虚构 Beijing smoke。**`Status: Pass`,耗时 1.566 s。** 未打到 429。限流路径由单测覆盖:gateway 降 `official_blocked`。
|
||
|
||
### 未做
|
||
|
||
未改 `jyotish_api_server.py` 的咨询路由。`/api/vedastro_gateway/status` 字段已在 gateway 模块与 `tests/test_vedastro_gateway.py` 锁住;本轮未起 Docker 打 staging 该端点。
|
||
|
||
## 任务 5
|
||
|
||
### 做了什么
|
||
|
||
1. 新增 `POST /api/professional_report_reference`,复用 full-reading 计算与 `api_heavy_compute_gate`;支持 `json` / `markdown` 和 pack 选择,不接上游未需要的 authority/archive 路径。
|
||
2. 新增 `scripts/professional_report_reference.py` 薄适配层;对外主名统一为 `professional_report_reference`,旧 `pl9_*` 仅保留兼容。
|
||
3. 报告中心增加「专业参考版」导出入口和 Route Handler;输出是确定性转换,不调用 writer、不扣新增计费项。
|
||
4. 净化器拒绝三类内部信息:raw full-reading/内部对象键、文件路径或 `scripts/*.py::callable`、内部模块/oracle reference 标识。
|
||
|
||
### 测试与 smoke
|
||
|
||
| 项 | 结果 |
|
||
| --- | --- |
|
||
| Python:`test_professional_report_reference_api.py`、`test_api_heavy_compute_gate.py` | **13 passed / 0 failed** |
|
||
| 专业导出 / 报告中心前端集合 | **22 passed / 0 failed** |
|
||
| 确定性与模型遥测回归 | 同输入逐字节稳定;`inputTokens=0`、无 writer 调用 |
|
||
| CLI smoke(虚构 Beijing、Raman、mean node、full Markdown) | exit 0,5.064 s;190,360 bytes / 2,068 lines;标题与多引擎口径说明存在 |
|
||
| API handler smoke(同一虚构数据) | HTTP 200,4.768 s;响应 200,457 bytes,Markdown 188,857 bytes / 2,068 lines |
|
||
| 净化回归与 smoke 扫描 | `raw_full_reading`、代码路径/callable、内部 oracle 标识及绝对路径均 0 命中;公开合同字段与 `internal_reference_omitted` 保留 |
|
||
|
||
### 偏离与环境缺口
|
||
|
||
- 按任务书允许范围未接 `--format authority` 与 `--archive-dir`。
|
||
- 未用登录态浏览器点击真实报告中心下载;Route Handler、组件和 API 合同均已有测试。
|
||
|
||
## 任务 6
|
||
|
||
### 做了什么
|
||
|
||
1. 新模块 `scripts/consultation_engine_field_bridge.py`:把引擎的行星友敌、应期种子、模块执行附录、Pratyantar 当前/下一段挂到咨询盘上。`jyotish_api_server.py` 只加薄钩子(attach、重建 prompt pack、审计三行、响应顶层新键)。`page.tsx` 未动(2041 行)。API 文件 11120 → **11141**(上限 11363)。
|
||
2. 聊天:折叠审计新增 Planetary Friendship / Ashtottari Dasha / Module Execution Audit。Ashtottari 三态仍是 `executed`,说明为 **参数敏感、未验证**。财富方法学主名改为 `finance-timing-strict`。
|
||
3. 报告:`interpretiveFacts.planetaryFriendship`(等级表,无自由文本)与 `pratyantarTimeline`(当前+下一段)。timing 种子读 `timing_narrative`。timing claim card 的 conclusion / timingBoundary 可引用 PD 日期。友谊表不进必选技法组,收据为 `partial`。
|
||
4. golden:在旧夹具上合并稳定新键(`timing_narrative` / `module_execution_audit` / `pratyantar_dasha_timeline`)。未把偶发的 `vedastro_gateway.official_raw_response` 写进夹具。
|
||
|
||
### 测试
|
||
|
||
| 项 | 结果 |
|
||
| --- | --- |
|
||
| `tests/test_consultation_engine_field_bridge.py` | 5 passed |
|
||
| `tests/test_api_server_growth_contract.py` | 3 passed |
|
||
| `tests/test_consultation_contract_golden.py`(非 live HTTP) | 2 passed |
|
||
| `test_consultation_foreground_times_out_vedastro_without_failing_local` | 绿。新增引擎预热 import,**不断言改值**。原值仍是 `official_closure_reason=foreground_optional_evidence_timeout`。原因:attach 首次 import `jyotish_engine` 会超过测试里 0.4s 假延迟,网关会先完成。 |
|
||
| `tsc --noEmit` | 0 错 |
|
||
| 相关前端测试(methodology / audit / interpretive facts / report v2 / plan / telemetry) | **60 pass / 0 fail** |
|
||
| 改动文件 eslint | 0 error |
|
||
|
||
断言改动:无(超时测试只加预热 import)。
|
||
|
||
### 虚构 smoke
|
||
|
||
`1990-01-01 12:00 Beijing` timing 题走 `_compute_consultation_workflow`:
|
||
|
||
| 行 | 状态 | 说明 |
|
||
| --- | --- | --- |
|
||
| Planetary Friendship | executed | 友敌等级表;不得当作确定性结论;9 行 |
|
||
| Ashtottari Dasha | executed | 参数敏感、未验证 |
|
||
| Module Execution Audit | executed | 附录可见;不得升格为确定性结论 |
|
||
| `pratyantar_dasha_timeline` | ready | 当前 PD Rahu `2026-03-26`–`2026-09-07` |
|
||
| `timing_narrative.status` | parameter_sensitive | 有 headline |
|
||
|
||
同输入两次 bundle hash 一致(前端测试)。未跑浏览器聊天,也没有 writer 的真实 `inputTokens`。
|
||
|
||
### 每章体量(过滤后 bundle JSON 字节,代理 inputTokens)
|
||
|
||
无模型凭据,无法打真实 writer。代理:同主题过滤后的 bundle `JSON.stringify` 字节。before = 去掉友敌表、PD、timing 种子。
|
||
|
||
| 主题 | before | after | 比值 |
|
||
| --- | --- | --- | --- |
|
||
| general | 7384 | 7511 | 1.017 |
|
||
| wealth | 9912 | 10039 | 1.013 |
|
||
| education | 8640 | 8767 | 1.015 |
|
||
| timing | 7489 | 8816 | 1.177 |
|
||
|
||
p50 ≈ **1.016**,最大 1.177,低于 1.3 停工线。
|
||
|
||
### 环境缺口
|
||
|
||
- 无登录态 / Chrome:网页聊天折叠表走查留给 `docs/testing/`。
|
||
- 无模型凭据:personal_full writer 的真实 `inputTokens` 未测。
|
||
- 合入前 staging health 可能仍停在任务 2 的 `f2241463` 或更早 SHA;部署后应对齐本提交。
|
||
|
||
### 未做
|
||
|
||
未改 `route_aliases.py`。未把 nadi/classical 接到网页路径。
|
||
|
||
## 任务 7
|
||
|
||
### 7a · 自适应选题
|
||
|
||
- 新增 `active_rectification_selector.py`,每轮只选择能区分当前候选窗口的问题;前端优先采用服务端 `next_round_selection.selected_questions[0]`,服务端无选择时回退既有逻辑。
|
||
- 候选扫描新增 `d1_longitude` 与完整上升对象,旧字段不删;未引入 `regression_hint`、`minute_rankings` 或 `minute_focus`。
|
||
- 虚构三轮验收:
|
||
|
||
| 轮次 | 选题 | 分钟相关度 |
|
||
| ---: | --- | ---: |
|
||
| 1 | `career_split` | 4.35 |
|
||
| 2 | `education_split` | 4.35 |
|
||
| 3 | `relationship_split` | 4.35 |
|
||
|
||
- 同一答案集的旧评分字节不变;legacy SHA-256=`bb1a300606458357b2b8d94a487272f15d82c6f0b51847c660ba20153773fb63`,V5 SHA-256=`23171c47b9746f4b0a440c9b9ac6d8401d622672cd0d6d780789334b732e9d8f`。
|
||
|
||
### 7b · 请求级岁差与交点
|
||
|
||
- Python API、active rectification、candidate scan 与前端 payload 贯通 `ayanamsa` / `node_mode`;默认仍是 Raman,不改 `ALGORITHM_VERSION` / `POLICY`。
|
||
- 默认请求的 V5 输出保持原字节;显式 Lahiri 回执为 `lahiri`,且虚构 smoke 的上升度数与 Raman 有实际差异。
|
||
|
||
### 7c · 报告出生时间敏感度
|
||
|
||
- 引入四个 `flexible_birth_time_*` 模块;`confirmed` 返回 `not_applicable`,`provisional` / `approximate` 只生成 `candidate_window_only`,不得选择或确认出生分钟。
|
||
- 无可信区间时固定半径:`provisional=±15` 分钟、`approximate=±60` 分钟;最多 15 个候选分钟,超出时只取起点、代表分钟、终点。
|
||
- 响应、个人报告 bundle、附录和敏感主题边界提示已贯通;`confirmed` 报告 bundle hash 不变,敏感判断可追溯到分钟层变化。
|
||
|
||
### 测试、红线与环境缺口
|
||
|
||
| 项 | 结果 |
|
||
| --- | --- |
|
||
| Python 校正 / sensitivity 聚焦集合 | **50 passed / 0 failed** |
|
||
| 全部 `test_*rectification*.py` | **39 files / 260 passed / 7 failed**;同 7 项在 `origin/staging @ 49cd66c5` 全部复现,分支无新增失败 |
|
||
| sensitivity 禁止 references 读取 smoke | `candidate_window_only`,3 candidates,读取 references 文件数 **0** |
|
||
| ayanamsa / birth-time sensitivity 前端集合 | **135 passed / 0 failed** |
|
||
| `frontend/tests/rectification-*.test.ts` | **68 files / 840 passed / 0 failed**(基线不少于 62 files) |
|
||
| `tsc --noEmit --incremental false` | 通过 |
|
||
| 隐私扫描 | 产品默认值无真实案例;命中仅为既有校正 fixture、golden 禁止标记及「不得含 14:49」断言 |
|
||
|
||
- 39 文件历史全套的 7 个基线失败为:active rectification 长对话 1、dynamic rectification 3、minute development/holdout 2、日期冻结状态 1;在本分支与 `origin/staging @ 49cd66c5` 逐项相同,因此未扩大范围修改冻结算法、历史 fixture 或日期台账。
|
||
- 未跑 `docs/testing/` 的登录态浏览器校正清单;这是环境缺口,不是代码欠项。
|