379 lines
14 KiB
Markdown
379 lines
14 KiB
Markdown
# P1R Content 状态推进
|
||
|
||
日期:2026-06-12
|
||
|
||
## 结论
|
||
|
||
本轮只推进 Content 第一批 8 个 operation-level completed approval:
|
||
|
||
- `content:listWorks`
|
||
- `content:getWork`
|
||
- `content:listChapters`
|
||
- `content:getChapter`
|
||
- `content:listBlocks`
|
||
- `content:getBlock`
|
||
- `content:saveBlock`
|
||
- `content:getBlockSourceAttribution`
|
||
|
||
Content 仍不是整域 completed。其余 43 个 Content operation 继续 `dedicated/needs_verification`。
|
||
|
||
本轮未修改 OpenAPI,未修改 Content 业务实现,未修改 SQL migration,未把 `content` 加入 domain-level completed allowlist。
|
||
|
||
## 工作区与基线
|
||
|
||
工作区:
|
||
|
||
```text
|
||
/Users/qingse/.config/superpowers/worktrees/oh-my-muse/dev-1.0.0
|
||
```
|
||
|
||
基线 HEAD:
|
||
|
||
```text
|
||
0032774 test(p1r): 收口 Market 第一批 completed approval 门禁
|
||
```
|
||
|
||
实施前 coverage summary:
|
||
|
||
```text
|
||
233 131 102 0 0 0
|
||
```
|
||
|
||
实施后 coverage summary:
|
||
|
||
```text
|
||
233 139 94 0 0 0
|
||
```
|
||
|
||
实施后 Content 状态:
|
||
|
||
```text
|
||
completed=8
|
||
needs_verification=43
|
||
```
|
||
|
||
## 继续 needs_verification 的 Content operation
|
||
|
||
```text
|
||
content:adminListExportTasks
|
||
content:adminListImportTasks
|
||
content:adminListWorks
|
||
content:adminGetWork
|
||
content:adminListChapters
|
||
content:adminRiskAction
|
||
content:confirmChapterParseResult
|
||
content:rejectChapterParseResult
|
||
content:downloadExportPackage
|
||
content:getExportTask
|
||
content:getImportTask
|
||
content:getParseJob
|
||
content:listParseJobChapters
|
||
content:batchConfirmChapters
|
||
content:retryParseJob
|
||
content:createWork
|
||
content:deleteWork
|
||
content:updateWork
|
||
content:deleteBlock
|
||
content:mergeBlocks
|
||
content:splitBlock
|
||
content:mergeBlockSuggestion
|
||
content:createChapter
|
||
content:deleteChapter
|
||
content:updateChapter
|
||
content:createBlock
|
||
content:reorderChapters
|
||
content:validateDynamicFields
|
||
content:exportWork
|
||
content:createExportTask
|
||
content:createImportTask
|
||
content:listMetaProjections
|
||
content:getMetaProjection
|
||
content:createParseJob
|
||
content:getPlanning
|
||
content:listPlanningCandidates
|
||
content:createPlanningCandidate
|
||
content:getPlanningCandidate
|
||
content:confirmPlanningCandidate
|
||
content:discardPlanningCandidate
|
||
content:createStyleCheck
|
||
content:getStyleCheckResult
|
||
content:savePlanningItem
|
||
```
|
||
|
||
主要原因:
|
||
|
||
- 创建、更新、删除、重排、拆分、合并等写命令仍存在 OpenAPI / coverage `requiresCommandId` 与服务端 VO 或实现口径不一致风险,本轮不夹带合同修正。
|
||
- 导入、导出、解析、下载仍缺 FileService、任务产物和真实下载字节闭环 evidence。
|
||
- Meta projection、AI planning candidate、style check、suggestion 等能力仍依赖 Meta / AI / Knowledge 外部 owner closure 和运行时证据。
|
||
- admin read / risk action 需要单独 admin guard、审计和跨 owner 边界 evidence。
|
||
- planning section 虽属 Content 本域,但有 schemaVersion、projectionVersion、CAS、command replay 等独立合同,后续应单独切片。
|
||
|
||
## 修改范围
|
||
|
||
本轮修改:
|
||
|
||
- `muse-cloud/scripts/p1r-audit-api-coverage.py`
|
||
- `docs/superpowers/reports/p1r-api-coverage.json`
|
||
- `docs/superpowers/reports/p1r-api-coverage.md`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rApiCoverageReportTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rContentRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rEventsRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rAiRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rKnowledgeRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rMarketRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rAccountRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rMetaRealApiGateTest.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rContentEventsPublishFlywayMigrationIT.java`
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rContentCoreCompletedApprovalIT.java`
|
||
- `docs/agent-specs/.agent`
|
||
- `docs/agent-specs/2026-06-11-P1RContentCompletedApproval审阅版.md`
|
||
- `docs/agent-specs/2026-06-12-P1RContentCompletedApproval执行版.md`
|
||
- `docs/memorys/2026-06-12-P1RContent状态推进.md`
|
||
|
||
未修改:
|
||
|
||
- 7 个 OpenAPI。
|
||
- Content 业务实现。
|
||
- SQL migration。
|
||
- Content domain-level completed allowlist。
|
||
|
||
## TDD evidence
|
||
|
||
RED 阶段先修改 P1R gate 期望值和 Content 8 个 operation 断言,在旧 scanner/report 下运行 focused P1R gates,预期失败已出现:
|
||
|
||
- 失败点来自旧 report 仍为 `completed=131 / needsVerification=102`。
|
||
- 失败点来自 Content 8 个 operation 仍为 `needs_verification`。
|
||
- 该失败证明 gate 会阻止未获 scanner/report 支撑的 completed 推进。
|
||
|
||
GREEN 阶段完成 scanner operation-level allowlist、report 重新生成、Content HTTP+DB `_test` evidence 和 focused gates 后,目标验证通过。
|
||
|
||
## MockMvc HTTP 入口 + DB 证据
|
||
|
||
新增:
|
||
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rContentCoreCompletedApprovalIT.java`
|
||
|
||
验证方式:
|
||
|
||
- 使用 Spring Mock web context + `MockMvc`。
|
||
- 使用真实 mapper / service。
|
||
- 使用真实 PostgreSQL `_test` 数据库。
|
||
- 使用 Flyway clean/migrate V1-V21。
|
||
- 密码只从环境变量读取,禁止通过 JVM system property 传入。
|
||
|
||
说明:这里的 HTTP 入口证据是执行版要求的 WebApplicationContext + MockMvc 请求路径证据,不是启动真实 socket 端口的 live servlet container 证据。
|
||
|
||
验证数据库:
|
||
|
||
```text
|
||
muse_p1r_content_core_completed_approval_test
|
||
```
|
||
|
||
通过结果:
|
||
|
||
```text
|
||
P1rContentCoreCompletedApprovalIT: tests=12, failures=0, errors=0, skipped=0
|
||
```
|
||
|
||
review 修复:
|
||
|
||
- fresh testing review(Hooke)指出 chapter/block missing 负路径缺显式 HTTP 断言。
|
||
- 已补 `missing work chapter list`、`missing chapter detail`、`missing chapter block list`、`missing block detail`。
|
||
- 已补上述查询负路径的 Content outbox no-write 断言。
|
||
- 修复后已重跑 `P1rContentCoreCompletedApprovalIT`,结果仍为 tests=12、failures=0、errors=0、skipped=0,XML mtime 在本次运行窗口内。
|
||
- fresh implementation review 第一轮中,Bohr correctness review 与 Euclid testing/data-integrity review 均 FAIL,指出 `saveBlock` 缺 `expectedRevision`、缺 `sourceSnapshot` 两个执行版 mandatory 负路径。
|
||
- 已补 `p1r-content-missing-expected-revision` 与 `p1r-content-missing-source-snapshot` 两个 HTTP+DB no-write 断言,并复用 `assertSnapshotUnchanged` 覆盖 block/source/outbox/command 不写入。
|
||
- 修复后已重跑 `P1rContentCoreCompletedApprovalIT`,结果仍为 tests=12、failures=0、errors=0、skipped=0,XML mtime 在本次运行窗口内。
|
||
|
||
覆盖内容:
|
||
|
||
- `listWorks` 分页、状态过滤、owner 隔离、tenant 隔离、空页。
|
||
- `getWork` happy、missing、cross owner、cross tenant。
|
||
- `listChapters` 的 happy、empty、missing work、cross owner、cross tenant。
|
||
- `getChapter` 的 happy、missing chapter、path mismatch、cross owner、cross tenant。
|
||
- `listBlocks` 的 happy、empty、missing chapter、path mismatch、cross owner、cross tenant。
|
||
- `getBlock` 的 happy、missing block、path mismatch、cross owner、cross tenant。
|
||
- `saveBlock` 写入 block revision、source attribution、Content outbox、command log。
|
||
- `saveBlock` command replay 不重复写。
|
||
- `saveBlock` 缺 `commandId`、缺 `expectedRevision`、缺 `sourceSnapshot`、revision conflict、command conflict、path mismatch、cross owner、cross tenant 均断言 no-write 或事务回滚后行数不变。
|
||
- `getBlockSourceAttribution` active/current、empty、path mismatch、cross owner、cross tenant,错误路径不写 DB。
|
||
|
||
## Flyway V21 证据
|
||
|
||
增强:
|
||
|
||
- `muse-cloud/muse-server/src/test/java/cn/iocoder/muse/server/framework/api/P1rContentEventsPublishFlywayMigrationIT.java`
|
||
|
||
验证数据库:
|
||
|
||
```text
|
||
muse_p1r_content_core_completed_approval_test
|
||
```
|
||
|
||
通过结果:
|
||
|
||
```text
|
||
P1rContentEventsPublishFlywayMigrationIT: tests=4, failures=0, errors=0, skipped=0
|
||
```
|
||
|
||
关键输出:
|
||
|
||
```text
|
||
flyway_success=true
|
||
flyway_url=jdbc:postgresql://<host>/muse_p1r_content_core_completed_approval_test
|
||
flyway_locations_effective=filesystem:/Users/qingse/.config/superpowers/worktrees/oh-my-muse/dev-1.0.0/muse-cloud/sql/muse
|
||
migrations_executed=21
|
||
successful_migration_count=21
|
||
target_schema_version=21
|
||
flyway_latest=21:extend content events publish outbox
|
||
v21_table=muse_content_event_publish_outbox
|
||
v21_triggers=trg_muse_content_event_publish_outbox_update_time
|
||
```
|
||
|
||
验证内容:
|
||
|
||
- V1-V21 clean migrate。
|
||
- V21 Content event publish outbox 表存在。
|
||
- claim、owner/status、block/revision 相关索引存在。
|
||
- event type、notification type、source status、publish status、owner、block、block revision、resource ref、attempt count、max attempt 等约束存在。
|
||
- update time trigger 存在。
|
||
- `attempt_count=-1` 被 PostgreSQL check 拒绝。
|
||
- `max_attempt=0` 被 PostgreSQL check 拒绝。
|
||
|
||
## system property 组合验证
|
||
|
||
`P1rContentCoreCompletedApprovalIT` 与 `P1rContentEventsPublishFlywayMigrationIT` 都会保存并在 `@AfterAll` 恢复 `p1r.flyway.url/user`,避免脱敏后的 system property 污染同一 Surefire JVM 后续测试。
|
||
|
||
组合验证使用真实 PostgreSQL `_test` 库:
|
||
|
||
```text
|
||
muse_p1r_content_core_completed_approval_test
|
||
```
|
||
|
||
通过结果:
|
||
|
||
```text
|
||
P1rContentCoreCompletedApprovalIT,P1rContentEventsPublishFlywayMigrationIT: tests=16, failures=0, errors=0, skipped=0
|
||
P1rContentCoreCompletedApprovalIT,P1rContentEventsPublishFlywayMigrationIT with -Dsurefire.runOrder=reversealphabetical: tests=16, failures=0, errors=0, skipped=0
|
||
```
|
||
|
||
Hooke 修复后已重跑上述两组组合验证,结果仍为 16/16 pass,两个目标 XML 均为本次运行窗口内的新产物。
|
||
|
||
Bohr / Euclid P1 修复后已重跑普通组合验证,结果仍为 16/16 pass,两个目标 XML 均为本次运行窗口内的新产物。
|
||
|
||
注意:两次组合验证的实际 Surefire 执行顺序均为 `P1rContentEventsPublishFlywayMigrationIT` 先、`P1rContentCoreCompletedApprovalIT` 后。`-Dsurefire.runOrder=reversealphabetical` 未改变实际顺序,因此本轮只能证明 Flyway IT 脱敏/恢复不会污染后续 Core IT,不能写成已证明 Core IT -> Flyway IT 反向顺序。
|
||
|
||
## focused gates
|
||
|
||
Content focused verification 通过,并已做 XML 防空跑:
|
||
|
||
```text
|
||
ContentAppServiceTest: tests=13, failures=0, errors=0, skipped=0
|
||
ContentSourceServiceTest: tests=23, failures=0, errors=0, skipped=0
|
||
ContentEventPublishOutboxServiceTest: tests=6, failures=0, errors=0, skipped=0
|
||
ContentEventPublishWorkerTest: tests=10, failures=0, errors=0, skipped=0
|
||
AppContentControllerTest: tests=32, failures=0, errors=0, skipped=0
|
||
AppContentSourceControllerTest: tests=5, failures=0, errors=0, skipped=0
|
||
P1rContentEventsPublishMigrationSqlTest: tests=3, failures=0, errors=0, skipped=0
|
||
P1rContentEventsPublishDependencyTest: tests=2, failures=0, errors=0, skipped=0
|
||
P1rContentEventsPublishEndToEndTest: tests=5, failures=0, errors=0, skipped=0
|
||
P1rContentRealApiGateTest: tests=5, failures=0, errors=0, skipped=0
|
||
P1rApiCoverageReportTest: tests=6, failures=0, errors=0, skipped=0
|
||
```
|
||
|
||
P1R mixed gates 通过,并已做 XML 防空跑:
|
||
|
||
```text
|
||
P1rApiCoverageReportTest: tests=6, failures=0, errors=0, skipped=0
|
||
P1rContentRealApiGateTest: tests=5, failures=0, errors=0, skipped=0
|
||
P1rEventsRealApiGateTest: tests=7, failures=0, errors=0, skipped=0
|
||
P1rAiRealApiGateTest: tests=7, failures=0, errors=0, skipped=0
|
||
P1rKnowledgeRealApiGateTest: tests=8, failures=0, errors=0, skipped=0
|
||
P1rMarketRealApiGateTest: tests=6, failures=0, errors=0, skipped=0
|
||
P1rAccountRealApiGateTest: tests=5, failures=0, errors=0, skipped=0
|
||
P1rMetaRealApiGateTest: tests=5, failures=0, errors=0, skipped=0
|
||
```
|
||
|
||
合计:
|
||
|
||
```text
|
||
P1R mixed gates: 49/49 pass
|
||
```
|
||
|
||
## scanner 与 diff 证据
|
||
|
||
scanner:
|
||
|
||
```bash
|
||
python3 muse-cloud/scripts/p1r-audit-api-coverage.py --check
|
||
```
|
||
|
||
结果:
|
||
|
||
```text
|
||
Generated docs/superpowers/reports/p1r-api-coverage.json
|
||
Generated docs/superpowers/reports/p1r-api-coverage.md
|
||
233 139 94 0 0 0
|
||
```
|
||
|
||
Content operation 状态确认:
|
||
|
||
```text
|
||
completed=8
|
||
needs_verification=43
|
||
```
|
||
|
||
completed 清单:
|
||
|
||
```text
|
||
listWorks
|
||
getWork
|
||
listChapters
|
||
getChapter
|
||
listBlocks
|
||
getBlock
|
||
saveBlock
|
||
getBlockSourceAttribution
|
||
```
|
||
|
||
代表性非目标 operation 仍为 `needs_verification`:
|
||
|
||
```text
|
||
adminRiskAction
|
||
createWork
|
||
updateWork
|
||
mergeBlockSuggestion
|
||
createChapter
|
||
exportWork
|
||
getPlanning
|
||
```
|
||
|
||
diff check:
|
||
|
||
```text
|
||
git diff --check: pass
|
||
```
|
||
|
||
protected OpenAPI diff:
|
||
|
||
```text
|
||
empty
|
||
```
|
||
|
||
allowed diff 检查结果:
|
||
|
||
```text
|
||
仅包含执行版允许的 docs/agent-specs、docs/memorys、coverage report、scanner、P1R gate test、Content Core IT 与 Content Flyway IT 文件。
|
||
```
|
||
|
||
## 当前边界
|
||
|
||
- fresh implementation re-review 已双 PASS:Mendel correctness review PASS,确认 Bohr/Euclid P1 已关闭,8 个 Content completed operation、scanner operation-level allowlist、coverage summary、protected diff 与 XML 证据均自洽;Anscombe testing/data-integrity review PASS,无 findings、无 testing gaps,残余风险仅为 raw Surefire XML 可能包含本地 DB host/user,未发现 password 泄露。
|
||
- 本轮只代表 Content 第一批 8 个 operation-level completed approval。
|
||
- 不代表 Content 51/51 completed。
|
||
- 不代表 Account remaining completed。
|
||
- 不代表 Market remaining completed。
|
||
- 不代表总 P1R completed。
|
||
- raw Surefire XML 可能包含 DB host/user,未发现 password 泄露;外发前需清洗。
|
||
- 当前已具备提交条件;提交或 push 仍需用户明确指令。
|