Files
PlantAI-dev/docs/validation/2026-07-21-string-ppi-task0-baseline.md
2026-08-03 18:42:47 +08:00

132 lines
6.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# STRING PPI 生产接线纠偏:Task 0 基线与 RED 证据
范围:只采集基线并增加失败测试。未修改生产代码,未重启 Web/worker,未提交真实分析任务。
## Gate 0 结论
Gate 0 通过:三个根因均可稳定、独立重现,可以进入后续实现任务。这里的“通过”只表示失败基线成立,不表示功能已修复。
| Gate 0 项 | 判断 | 证据 |
|---|---:|---|
| 9010 指向计划目标目录 | 通过 | Web/worker `/proc/<pid>/cwd`、环境变量和模块 `__file__` 一致 |
| Redis/队列隔离 | 通过 | Redis DB 11,队列前缀 `plantai_4090_9010` |
| 真实 Sv 问题定位 | 通过 | job、conversation、scope 和 03:21 消息链已锁定 |
| Sv/科学名未接 resolver | 通过 | RED 1 因缺 `species_resolution` 失败 |
| registry-only 执行被旧 map 拒绝 | 通过 | RED 2 对 TaxID 3708 抛出 `ValueError` |
| 无参考仍要求 Ortholog | 通过 | RED 3 得到 `required_next_stage=ortholog` |
## 9010 运行身份
- 主机:`planai5090` / `xzq-Rack-Server`
- 目标根目录:`/home/xzq/5090/PlantAI-dev4090-7/PlantAI-dev`
- systemd:没有发现匹配 `plantai/9010/celery` 的 unit;9010 由 shell 父进程 PID `2391849` 启动。
- Web:PID `2391890`,命令为 `python -m uvicorn apps.web.vue3.main:app --host 0.0.0.0 --port 9010`。
- worker 主进程:`2391860/2391866/2391873/2391880/2391891`,对应 default/heavy/medium/light/rnaseq。
- 所有上述进程 cwd 均为目标根目录。
- Web/worker 环境均包含:
- `BBAV5_PROJECT_ROOT=/home/xzq/5090/PlantAI-dev4090-7/PlantAI-dev`
- `PLANTAI_PROJECT_ROOT=/home/xzq/5090/PlantAI-dev4090-7/PlantAI-dev`
- `BBAV5_QUEUE_PREFIX=plantai_4090_9010`
- `BBAV5_REDIS_URL=redis://localhost:6379/11`
- `celery_app.app.conf.broker_url` 和 `result_backend` 均为 DB 11。
- 进程同上下文 import probe 确认 `main.py`、`pipeline_backend.py`、`ppi_string_policy.py`、`skills/ppi/run.py`、`celery_app.py` 全部来自目标根目录。
`/api/celery/overview` 同时看到了一个不属于 9010 的 GWAS worker;本任务只把五个 `plantai_4090_9010_*` worker 计入 9010 基线。
## 真实 03:21 请求
- conversation:`memory_storage/conversations/202607/conv_20260720_210554_default.json`
- job:`job_1784552755238_b8762f`
- 用户消息:`2026-07-21 03:21:36.987480`,`执行ppi分析`
- target scope:`workspace/job_1784552755238_b8762f/final/Sv.HKL.HKL.target-Sv.target_only.scope.json`
- scope identity:`HKL.target-Sv.target_only`,target=`Sv`,reference=[]。
- job config 的真实身份行:`Species_Code=Sv`、`Species_Name=Setaria_viridis`、`Species_Role=target`。
消息链:
1. `03:21:40.525445`:前端宣称“前置数据检查通过”,自动插入 Ortholog。
2. `03:21:50.359623`:提交 Ortholog。
3. `03:21:56.230245`:随后又报告参考物种未选择、缺 PEP、无近源推荐。
4. `03:21:58.536206`:Ortholog/PPI 均暂停,`ppi_reference_data_missing`。
真实 9010 API 只读重放:
```json
{
"status": "needs_reference_data",
"issue_code": "ppi_reference_data_missing",
"target_species": ["Sv"],
"target_string_supported": false,
"selected_taxon_id": "",
"reference_species": "",
"required_next_stage": "ortholog",
"decision": "needs_reference_species",
"reference_recommendations": []
}
```
生产 `data/string/v12.0` 当前不存在。
## registry-only TaxID 到执行层的断点
具体链路与断点:
1. `gfa_core/string_species_registry.py:320-382` 的 resolver 已能返回数字 `selected_string_taxon_id`;fixture 中 `Brassica napus → 3708`。
2. `apps/web/pipeline_backend.py:1764-1765` 生产预检仍调用旧 `species_to_string_code()` 和 Ft 静态推荐,没有调用新 resolver。
3. `apps/web/pipeline_backend.py:2024-2042` 响应没有 `species_resolution` 或 target tree/selection mode。
4. `apps/web/pipeline_backend.py:8839-8843` 真正 PPI 执行先用旧 `species_to_string_code()` 校验显式值,数字 `3708` 会被拒绝。
5. `apps/web/pipeline_backend.py:9070,9080` ID map 路径和 CLI `--species` 均继续传旧 code 槽位。
6. `skills/ppi/run.py:102-107` 的 `StringAPI.resolve_species_id()` 调用 `string_taxon_id()`。
7. `gfa_core/ppi_string_policy.py:126-128` 又将输入通过旧 code map 查询,非旧表 TaxID 返回空。
8. `skills/ppi/run.py:618,649-652` 因此在真正 STRING mapping/network 请求前已经失败。
硬验收点:fixture registry member `3708` 必须按同一个数字依次通过 preflight → execute/task params → backend `run_stage` → CLI `--species` → `StringAPI.species_id` → STRING request species → Manifest。任一层回到旧三字母 map,Gate 4 失败。
## RED 测试与失败输出
新增文件:`tests/unit/test_string_ppi_production_wiring_red.py`。
运行环境:9010 目标主机,目标目录,`/home/xzq/miniconda3/envs/test4py311/bin/python -m pytest`。
### RED 1:Sv/Setaria 未接 snapshot resolver
```text
tests/unit/test_string_ppi_production_wiring_red.py::test_setaria_scientific_name_reaches_snapshot_resolver
E KeyError: 'species_resolution'
1 failed
```
失败原因正确:backend 预检响应仍无 snapshot resolver 决策对象。
### RED 2:registry-only TaxID 被执行层旧 map 拒绝
```text
tests/unit/test_string_ppi_production_wiring_red.py::test_registry_only_numeric_taxon_reaches_string_execution
skills/ppi/run.py:106
E ValueError: Unsupported or empty STRING species: '3708'
1 failed
```
失败原因正确:resolver fixture 已证明 3708 是 registry member,但 `StringAPI` 仍要求旧 code 映射。
### RED 3:无确认参考仍请求 Ortholog
```text
tests/unit/test_string_ppi_production_wiring_red.py::test_preflight_without_confirmed_reference_never_requests_ortholog
E AssertionError: assert 'ortholog' == ''
1 failed
```
失败原因正确:`reference_species` 和 mapping 均为空,API 却返回 `required_next_stage=ortholog`。
## Sources / confidence / gaps
高置信 sources:`/proc` 进程信息、9010 live API、conversation JSON、job scope、config.xlsx、实际 pytest failure、关键源码和 SHA256。
剩余 gaps:
- Web access log 不记录请求 JSON,真实 preflight payload是依据 conversation/job/scope重放;原始 UI 请求体无法从现有日志逐字恢复。
- 计划要求的完整 STRING snapshot 尚未部署,因此当前不能判定完整 v12 数据中 Setaria viridis 最终是 `exact_string` 还是 `tree_nearest`;RED 测试刻意允许两者,但不允许 unresolved。
- 本地共享目录不是完整 Git repository(`.git` 仅含 `info/`),因此无法给出可靠 commit/dirty-state;已改用目标主机绝对路径与 SHA256 冻结基线。
- 本轮未做生产修改、服务重启或真实 PPI 提交,符合 Task 0 边界。