docs: fold what implementation found back into the plan
The README carries a hand-written production DDL template that no test ever compares against COLUMNS, so it can fall a column behind and stay green. Downstream deploying from it would get a table without the new column and the library would silently trim it — the same silence this issue exists to remove. Task 9 now fixes the template and adds the same-source assertion. Also records two things the implementation disproved: caplog cannot see loguru output, and reconcile_thinking has to be defined after the dataclass it annotates, since this module evaluates annotations eagerly. And the column-count table was incomplete — six more spots go red.
This commit is contained in:
@@ -244,7 +244,9 @@ def reconcile_thinking(
|
||||
|
||||
`tests/unit/test_thinking.py`:矩阵四行各断言返回非 `None` 且文案含模型名;三种不表态组合(`False`×UNKNOWN、`None`×OBSERVED、`True`×OBSERVED)断言返回 `None`;已登记 vs 未登记两行的文案**必须不同**(不得对未登记模型说"能力表声称可关闭")。
|
||||
|
||||
`tests/unit/test_openai_compat.py`:用 `caplog` 断言同一 `(model, direction)` 连调两次只出现一条 warning;换 direction 后再出一条。
|
||||
`tests/unit/test_openai_compat.py`:断言同一 `(model, direction)` 连调两次只出现一条 warning;换 direction 后再出一条。**不能用 `caplog`**——本项目日志走 loguru,不经标准 `logging`,`caplog` 抓不到;复用 `tests/unit/test_thinking.py` 的 `_warnings()`(`logger.add` 收集)。
|
||||
|
||||
> `reconcile_thinking` 必须定义在 `ThinkingCapability` **之后**:本模块没有 `from __future__ import annotations`,注解在 `def` 时求值,放在文件上部会 `NameError`。
|
||||
|
||||
### 验证
|
||||
|
||||
@@ -323,6 +325,8 @@ conda run -n PolyGateway pytest tests/unit/test_cache.py -v
|
||||
| `tests/unit/test_telemetry.py:645` docstring | `25 个物理列` → `26 个` |
|
||||
| `tests/integration/test_postgres_telemetry.py:764` 注释 | `22 → 24 个 recorder 字段(加 created_at 共 25 个物理列)` 改为 `24 → 25 个(共 26 个物理列)` |
|
||||
|
||||
> 上表**不完整**——实施时实测另有 6 处漏改会当场把测试跑红:`_FROZEN_SQLITE_INSERT`(计划只点了 PG 那条)、`:586` 的 `_EXPECTED_COLUMNS[:-2]` → `[:-3]`、`TestBackendColumnParity` 的 `COLUMNS[-2:]` 断言、两处 `_CURRENT` 假列表(稳态不发 ALTER 的断言)、`PG_BACKFILL[-1]` 末位断言,以及 integration 侧 `:608` 的 `_PRE_TENANT_COLUMNS` 派生式。另有四处注释/docstring 的字段数会过期。**结论: 不要照表逐条打勾就收工,以"全套件绿"为准**。
|
||||
|
||||
> **不要改 `tests/unit/test_telemetry.py:1787`**:那里的"共 24 字"是 OCR 占位串 `<ocr:text image_bytes=3>` 的**字符数**,与遥测列数无关。全局替换"24"会误伤它。
|
||||
|
||||
### 测试要求(先失败后通过)
|
||||
@@ -439,6 +443,8 @@ conda run -n PolyGateway pytest tests/unit/test_thinking.py -q
|
||||
|
||||
**`README.md:21`**:`必录 24 字段` → `25 字段`。数字取 Task 6 验证步骤里 `inspect.signature` 的实测输出,**不凭记忆**(发布清单第 1 步点名的失败模式)。同时核对安装命令的版本约束是否需要跟进,以及能力表是否要提及推理裁定这一新行为。
|
||||
|
||||
**`README.md` 的 `<!-- pg-template:table -->` 生产部署 DDL 模板**(Task 6 实施时发现,计划原本完全没覆盖):那段 SQL 是**独立于 `schema.py` 手写的另一份**,而 `TestProductionTemplate` 只跑它建表与权限/RLS/分区行为,**从不拿它与 `COLUMNS` 比对**——少一列照样全绿。照该模板部署的下游会得到一张没有 `thinking_observation` 的表,manual 档下库会静默裁掉这一列,正是本 issue 要消灭的那种静默。补上该列,**并加一条同源断言**(模板里的列集合必须等于 `COLUMNS`)把这个缺口机械化堵住——它不是顺手清理,是本次改动直接暴露的风险,且没有断言就一定会再次漂移。
|
||||
|
||||
**`research-wiki/ARCHITECTURE.md`**:§8 模块结构树补 `thinking.py` 一行并说明职责;§8 依赖纪律段补 `thinking.py` 的层位;D11 段说明推理决策已从 `providers.py` 拆出;§5.1 响应字段表补 `thinking_observation`;§7.8 遥测字段补新列。
|
||||
|
||||
**`research-wiki/schemas/llm-calls.md`**:标题与正文的"遥测 22 字段"已过期两轮,订正为 25;补 `thinking_observation` 的列定义与查询口径(示例:按模型统计各观测态占比,用于发现某模型何时开始观测不到推理)。
|
||||
|
||||
Reference in New Issue
Block a user