oh-my-muse/docs/memorys/2026-06-11-P1RAccount状态推进.md
zizi f18116a1f5 test(p1r): 收口 Account 第一批 completed approval 门禁
Account first-batch approval promotes only the 10 verified profile, entitlement, balance snapshot, and quota adjustment operations to completed while keeping the rest of Account in needs_verification.
2026-06-11 13:47:13 +08:00

254 lines
8.1 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.

# P1R Account 状态推进
日期2026-06-11
## 结论
本轮只推进 Account 第一批 10 个 operation-level completed approval没有把 `account` 加入 domain-level completed allowlist。
coverage summary 从:
```text
233 117 116 0 0 0
```
推进为:
```text
233 127 106 0 0 0
```
Account 状态从 33 个 `dedicated / needs_verification` 推进为:
```text
completed=10
needsVerification=23
```
本轮不代表 Account 33/33 completed不代表 Market / Content / 总 P1R completed。
## 已批准 completed 的 Account operation
```text
account:getCurrentUser
account:getProfile
account:updateProfile
account:adminListAccountUsers
account:adminGetUserEntitlements
account:getAppEntitlements
account:adminGetBalanceSnapshots
account:getAppBalanceSnapshots
account:adminCreateQuotaAdjustment
account:adminListQuotaAdjustments
```
## 继续 needs_verification 的 Account operation
```text
account:adminCreateCallAttributionJob
account:adminGetCallAttributionJob
account:adminGetIntegrationCallByCorrelation
account:adminListNewApiBindings
account:adminListPurchaseRecords
account:adminListUsageRecords
account:adminCreateNewApiBinding
account:adminCreateQuotaRequest
account:appDownloadExport
account:appCreateExportTask
account:appGetExportTask
account:appGetIntegrationCallByCorrelation
account:appListLicenses
account:getAppNewApiBinding
account:appRecheckNewApiBinding
account:appListPublishRecords
account:appListPurchases
account:appCreateQuotaRequest
account:appGetQuotaRequest
account:appListSecurityEvents
account:appGetSecurityEvent
account:appAcknowledgeSecurityEvent
account:getAppUsage
```
主要原因:
- New-API runtime、binding、recheck、quota request、integration correlation 仍缺真实 runtime completed evidence。
- FileService / export download 仍缺真实文件交付、下载字节和对象存储闭环 evidence。
- call attribution external source 仍缺真实外部来源 completed evidence。
- Market purchase / license / publish projection 仍缺跨 owner 上游与 Account projection 一致性 evidence。
- security event 生产路径仍缺 completed-grade source fact。
- `getAppUsage``adminListUsageRecords` 虽有 dedicated 实现和 focused tests但仍依赖 `muse_account_integration_call` / attribution source 的上游事实质量;本轮未纳入第一批。
## 修改范围
本轮修改:
- `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/P1rAccountRealApiGateTest.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`
- `docs/agent-specs/.agent`
- `docs/agent-specs/2026-06-11-P1RAccountCompletedApproval审阅版.md`
- `docs/agent-specs/2026-06-11-P1RAccountCompletedApproval执行版.md`
- `docs/memorys/2026-06-11-P1RAccount状态推进.md`
未修改:
- 7 个 OpenAPI。
- Account 业务实现。
- 数据库迁移。
- Account domain-level completed allowlist。
## TDD evidence
RED
```bash
cd muse-cloud
JAVA_HOME=$(/usr/libexec/java_home -v 21) PATH="$JAVA_HOME/bin:$PATH" \
mvn -o test -pl muse-server -am \
-Dtest=P1rApiCoverageReportTest,P1rAccountRealApiGateTest,P1rEventsRealApiGateTest,P1rAiRealApiGateTest,P1rKnowledgeRealApiGateTest,P1rMarketRealApiGateTest \
-Dsurefire.failIfNoSpecifiedTests=false
```
结果37 tests run10 failuresBUILD FAILURE。
失败点来自旧 report 仍为 `117/116`、Account 仍为 `0 completed / 33 needs_verification`,符合预期。
GREEN 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 127 106 0 0 0
Account Counter({'needs_verification': 23, 'completed': 10})
```
## Verification evidence
### Account focused tests
```bash
cd muse-cloud
JAVA_HOME=$(/usr/libexec/java_home -v 21) PATH="$JAVA_HOME/bin:$PATH" \
mvn -o test -pl muse-module-member/muse-module-member-server,muse-server -am \
-Dtest=AccountProfileServiceTest,AccountEntitlementServiceTest,AccountQuotaServiceTest,AccountAuditServiceTest,AccountCommandServiceTest,AccountOwnerGuardTest,AccountApiVersionGuardTest,AccountQuotaGuardTest,AdminAccountUserControllerTest,AppAccountProfileControllerTest,AppAccountEntitlementControllerTest,P1rAccountEventsPublishMigrationSqlTest,P1rAccountEventsPublishDependencyTest,P1rAccountEventsPublishEndToEndTest,P1rAccountRealApiGateTest,P1rApiCoverageReportTest \
-Dsurefire.failIfNoSpecifiedTests=false
```
结果:
- `muse-module-member-server`: 114/114 pass。
- `muse-server`: 19/19 pass。
- BUILD SUCCESS。
### P1R mixed gates
```bash
cd muse-cloud
JAVA_HOME=$(/usr/libexec/java_home -v 21) PATH="$JAVA_HOME/bin:$PATH" \
mvn -o test -pl muse-server -am \
-Dtest=P1rApiCoverageReportTest,P1rAccountRealApiGateTest,P1rEventsRealApiGateTest,P1rAiRealApiGateTest,P1rKnowledgeRealApiGateTest,P1rMarketRealApiGateTest,P1rContentRealApiGateTest,P1rMetaRealApiGateTest \
-Dsurefire.failIfNoSpecifiedTests=false
```
结果46/46 passBUILD SUCCESS。
### Flyway `_test`
测试库:
```text
muse_p1r_account_completed_approval_test
```
命令:
```bash
source ~/.config/muse-repo/infra.env
export P1R_FLYWAY_PASSWORD="$MUSE_POSTGRES_PASSWORD"
export P1R_ACCOUNT_TEST_DB=muse_p1r_account_completed_approval_test
cd muse-cloud
JAVA_HOME=$(/usr/libexec/java_home -v 21) PATH="$JAVA_HOME/bin:$PATH" \
mvn -o test -pl muse-server -am \
-Dtest=P1rAccountEventsPublishFlywayMigrationIT \
-Dflyway.postgresql.transactional.lock=false \
-Dp1r.flyway.locations=filesystem:sql/muse \
-Dp1r.flyway.url="jdbc:postgresql://$MUSE_POSTGRES_HOST:$MUSE_POSTGRES_PORT/$P1R_ACCOUNT_TEST_DB" \
-Dp1r.flyway.user="$MUSE_POSTGRES_USERNAME" \
-Djava.net.useSystemProxies=false \
-DsocksProxyHost= -DsocksProxyPort= \
-Dhttp.proxyHost= -Dhttp.proxyPort= \
-Dhttps.proxyHost= -Dhttps.proxyPort= \
-Dsurefire.failIfNoSpecifiedTests=false
```
结果4/4 passBUILD SUCCESS。
关键输出:
```text
flyway_success=true
flyway_url=jdbc:postgresql://<host>/muse_p1r_account_completed_approval_test
migrations_executed=20
successful_migration_count=20
target_schema_version=20
flyway_latest=20:extend account events publish outbox
v20_table=muse_account_event_publish_outbox
```
### Account outbox / worker enhanced evidence
```bash
cd muse-cloud
JAVA_HOME=$(/usr/libexec/java_home -v 21) PATH="$JAVA_HOME/bin:$PATH" \
mvn -o test -pl muse-module-member/muse-module-member-server -am \
-Dtest=AccountEventPublishOutboxServiceTest,AccountEventPublishWorkerTest \
-Dsurefire.failIfNoSpecifiedTests=false
```
结果19/19 passBUILD SUCCESS。
### XML 防空跑
读取 25 个目标 Surefire XML
- Account focused XMLProfile、Entitlement、Quota、Audit、Command、Guard、Controller、outbox、worker。
- P1R XMLAccount events SQL / dependency / E2E / Flyway、Coverage、Account、Events、AI、Knowledge、Market、Content、Meta gates。
结果:
```text
XML_TOTAL_OK tests=192
failures=0
errors=0
skipped=0
```
## 当前边界
- Account 不是整域 completed。
- Market 32 个 operation 继续 `dedicated / needs_verification`
- Content 51 个 operation 继续 `dedicated / needs_verification`
- Meta 16 个 operation 继续 `dedicated / completed`
- AI 41、Knowledge 59、Events 1 保持已批准 completed。
- 未修改 OpenAPI 或 Account 业务实现。
## 下一步
必须进行 fresh implementation spec/correctness review + fresh implementation quality/data-integrity/testing review。
双 PASS 前不得提交、push 或宣称总 P1R / Account 33/33 / Market / Content completed。