round-12: migrate P8 registries + P12 audit to AppStateStore
- app_state.py: host_state_db_path() (host-level DB, distinct from per-VM state_db_path); kv_get/kv_put/kv_delete on meta (namespaced keys; kv_put skips the no-secrets guard by design — registry docs hold user prompts, documented); audit_trail table (P12 record shape + hash chain, seq explicit); counts()/backup() gain audit_trail. - swarm.py / presentation.py / browser_tasks.py: JSON-file backends replaced by KV rows (p8-swarm / p8-ledger / p8-browser-tasks); legacy JSON imported once on first load (renamed .migrated); corrupt row / unreadable store returns empty (fail-safe, same semantics as before; next successful save self-heals). - audit_trail.py: StoreAuditTrail (same record shape, hash chain, filters, export as JSONL version, backed by audit_trail table); migrate_jsonl_to_store() moves a chain verbatim (broken chain refused, divergent seq refused, re-run idempotent). JSONL class kept for reading old files. - P12 dict contracts now run against real P3/P5 code (ApprovalQueue.record -> build_approval_card -> card_matches_channel; CapabilityIssuer.issue -> describe -> PermissionRegistry.record_grant). - P6->P3 local protocol test: real PrivsepClient + real worker server + real git status; worker git argv carries the real P3 helper + useHttpPath; no token in argv/env/audit. runuser + HTTP pull stay real-machine-only (see gap docs). - Gap docs updated: P8 migration done, guest-side browser follow-up explicitly left for the real-machine track (no task_id in the browser protocol yet; lifecycle needs a real VM to verify); P6 wiring + P12 migration marked done; production-readiness.md gains §20 (round-12 integration). - Tests: new cloud/tests/test_chv_muse_round12.py, 24/24 OK; test_chv_muse_p8.py ledger corrupt test rewritten for the KV backend (+ legacy-import test). P7+P8: 95+1 tests OK.
This commit is contained in:
1 parent
466cf7eae7
commit
d4cef29cdb
11 files changed
+1147
-63
No files matched your search
@@ -76,14 +76,20 @@
|
||||
字段;任务简报允许二选一。
|
||||
- 审计持久化先用独立 JSONL 文件(`audit_trail.jsonl`,0600),
|
||||
待 P7 状态库就绪后迁移,迁移接口是 `from_legacy_row()` 同款
|
||||
转换(本文件行 → P7 记录)。
|
||||
转换(本文件行 → P7 记录)。**迁移已完成(round-12)**:
|
||||
`StoreAuditTrail` 走宿主级 AppStateStore 的 `audit_trail` 表,
|
||||
与 JSONL 版同一记录形状与哈希链;`migrate_jsonl_to_store()`
|
||||
原样搬链(坏链拒绝、分叉拒绝、重跑幂等);JSONL 版保留读旧
|
||||
文件,新写一律走 Store 版。测试钉在
|
||||
`cloud/tests/test_chv_muse_round12.py`。
|
||||
- project_id 强制:`list()`/`export()` 必须传 project_id,只返
|
||||
回该项目记录;跨项目读取返回空,不抛错(与现有 `list_audit`
|
||||
行为一致,不泄露“存在别的项目记录”这一事实)。
|
||||
|
||||
## 6. 真机待验证清单(未做,排队在 round-11 之后)
|
||||
|
||||
1. 审计 JSONL 在真实 VM 生命周期(wake/pause/resume/shutdown)
|
||||
1. 审计轨迹(round-12 起走 StoreAuditTrail / SQLite,不再是
|
||||
JSONL)在真实 VM 生命周期(wake/pause/resume/shutdown)
|
||||
下的追加与 `verify()` 表现。
|
||||
2. 活动摘要与真实任务派发/完成事件的对应(正在做是否及时变
|
||||
更、计划状态流转是否与 worker 终态一致)。
|
||||
@@ -91,5 +97,5 @@
|
||||
(签发→使用→过期→撤销全程)。
|
||||
4. 审批卡数据与 P5 对话外通道在真机上的端到端一致(卡上点的
|
||||
接受/拒绝与通道答复同一 pending_id)。
|
||||
5. 审计文件落盘权限(0600)与多进程追加(worker + host.py)
|
||||
下的完整性。
|
||||
5. 审计库落盘权限(0600)与多进程追加(worker + host.py)
|
||||
下的完整性(SQLite WAL + 30 秒 busy 超时)。
|
||||
Reference in new issue
Block a user