Files
knowledge-governance/docs/P2_PP_INVENTORY_ACCEPTANCE.md
T
zheromiku dcdc8d1ddd feat: 知识治理平台(含已验证发布/回滚契约)
全栈知识治理平台首次入库(P1-P10 + 发布链路模拟验证闭环):

- 治理核心:源目录/变更集/人工审核/发布批次/发布执行(fail-closed 闸口)
- 测试通道:WeKnora 测试 KB 上传/轮询/验收;poll 完成时写入
  parser_generation/index_generation,修复 manual/seed 路径发布闸口永久拦截
- 发布适配器 v071(本地 source=测试角色 / 云端 target=生产角色 模拟验证通过):
  * ES 导出/导入 mapping 自适应(.keyword 子字段、可选 tenant_id)
  * OSS locator 支持嵌套 scheme;chunks.seq_id 由目标序列分配
  * bundle 归档同身份重试原子替换;verifier 按 bundle chunk_type 计数
  * 回滚 job payload 支持 prior_execution_id(strict 解码)
- 三通道发布+回滚演练实测:publish 4/4 verified,检索命中,
  rollback 4/4 rolled_back,目标端 PG is_enabled=false、ES is_enabled=false
- 前端 A·Data-console 风格全站统一,120 用例通过
- 门禁:go vet / go test 全包通过,gofmt 干净
2026-09-30 10:54:06 +08:00

85 lines
2.8 KiB
Markdown
Raw 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.
# P2.3 PP完整来源清单验收
## 交付范围
- 将旧manifest中54个超过50 MiB、未进入旧账本终态的来源建模为阻断对象;
- 形成613个PP来源对象的统一治理快照;
- reconciliation以内容SHA revision为依据,同URL内容变化必须计划上传;
- 历史已同步快照与治理数据库一致时,计划上传数必须为0;
- 提供只读分页/状态筛选API和真实知识资产Web页面。
不在本阶段执行:来源网络访问、文件下载或上传、测试/生产WeKnora连接、生产发布、AList写操作、钉钉授权、commit或push。
## 数据契约
```text
source_items=613
completed=530
content_alias=29
over_limit=54
content_objects=530
source_item_versions=613
test_publications=530
planned_uploads=0
```
54个over_limit版本必须同时满足:
```text
content_state=over_limit
content_object_id IS NULL
download_error=legacy_50_mib_limit
关联TestPublication数量=0
```
## Reconciliation契约
- stable source key相同且SHA revision相同:unchanged;
- stable source key不存在:adopted;
- stable source key相同但SHA revision变化:upload_required;
- over_limit:始终计为阻断,不计划上传;
- 完整真实快照:unchanged=559、over_limit=54、upload_required=0。
## 只读API
```text
GET /api/v1/source-items?state=&limit=50&offset=0
GET /api/v1/source-items?state=over_limit&limit=100&offset=0
```
`state`只接受`completed`、`content_alias`、`over_limit`或空值;`limit`范围1..100;`offset`范围0..1000000。响应只投影安全治理字段,不返回stable external ID、URI hash、raw_record_summary、Knowledge ID、来源URL、签名URL或凭据。
## UI验收
“知识资产”页必须读取真实API,并显示:
- 来源对象613;
- 历史已同步530;
- 内容别名29;
- 超过上限54;
- 状态筛选和服务端分页;
- over_limit项显示“超过旧同步上限”和“阻断”。
桌面宽度1440px必须无页面级横向溢出。多标签工作台、左侧导航和刷新恢复行为保持不变。
## 数据库升级门禁
1. 在唯一临时数据库导入真实613项两次;
2. 首次新增`1/613/530/613/530`;
3. 第二次新增全0;
4. 验证54个阻断版本约束;
5. 当前库升级前创建非空、mode 600且通过`pg_restore --list`的自定义格式备份;
6. 当前库只增量新增54个SourceItem和54个Version;
7. 不重启或删除PostgreSQL卷。
## 自动门禁
```bash
/home/zheromiku/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.0.linux-amd64/bin/go test ./... -count=1
/home/zheromiku/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.0.linux-amd64/bin/go vet ./...
/home/zheromiku/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.0.linux-amd64/bin/go build ./cmd/...
npm --prefix web test -- --run
npm --prefix web run typecheck
npm --prefix web run build
```