Repository navigation
fix(access): support ownership migration when enabling enforcement - #2304
happy-v587 wants to merge 26 commits into
Conversation
hidb4ai
left a comment
There was a problem hiding this comment.
Two reproducible ownership/recovery defects remain in the offline and external-store migration paths. Please address the inline findings before merging.
2ff6e32 to
87d7e1f
Compare
|
@happy-v587 please fix the file confliction |
hidb4ai
left a comment
There was a problem hiding this comment.
@happy-v587 Re-reviewed 1ca415f5. The previously reported ownership/audit and Windows-path defects are addressed. A merge probe against current master 90355b8e still reports conflicts in desktop/VALIDATION.md, desktop/src-tauri/src/transport/operations.json, desktop/ui/src/generated/operations.ts, and release/upgrade-support.json. Please integrate current master, regenerate the combined contracts, recheck the Desktop qualification and persistence digest, and complete Main, including the newly added Windows cases, before merging.
hidb4ai
left a comment
There was a problem hiding this comment.
@happy-v587 Re-reviewed cf6741eb. The previously reported ownership/audit and Windows-path defects are fixed, and the merge conflicts reported on 1ca415f5 are resolved. I found no further blocking defect in the reviewed ownership migration paths. The merged Desktop contract has a matching qualification record, and the persistence-policy declaration is consistent. Current-head Main and acceptance checks are still pending; please complete those, including the affected Windows cases, before merging.
hidb4ai
left a comment
There was a problem hiding this comment.
Two ownership-maintenance defects remain: the offline preview schedules processing work, and HTTP migration drops the originating audit context. Please address the inline findings before merging.
The rebase rebuilt the merge commit from its parents, so manual merge resolutions that were not part of either parent were lost. Restore them: - Guard Linux-only peer-credential/socket constants in Source background process control for non-Linux type checking. - Accept the allow_missing_database keyword that the MySQL migration caller passes in the vector admission fixture. - Name the test database explicitly in the code publication fixtures, as the SeekDB store signature now requires. Co-Authored-By: Claude Code <noreply@anthropic.com>
Record sqlite-atomic-bfaff459-v1 for the bundled OpenAPI contract 4aeefdd6... and Server source bfaff45..., built from the clean rebased merge commit as powercontext-1.4.2.dev97+gbfaff4594-py3-none-any.whl (sha256 b8291955...). All 666 packaged runtime files match the recorded source bytes, and the real Server harness passed anonymous loopback, static Bearer, HTTPS with explicit CA/base path, and enforced-access provider modes on macOS ARM64, covering the eleven recorded protocol operations. The superseded 285620a record is removed. Historical records retain their original identities, operation sets and evidence. The bilingual guides now point users at the matching record. Co-Authored-By: Claude Code <noreply@anthropic.com>
Ownership migration only inventoried built-in families, so a registered custom family stayed ownerless and its revision writes stayed denied by ARTIFACT_WRITE. Inventories now include families from persisted plugin declarations. Scope- and Candidate-derived owner keys could exceed the Access limit of 255 characters. One bounded key builder keeps accepted spellings stable and digests longer identities, and every owner write site uses it. Co-Authored-By: Claude Code <noreply@anthropic.com>
The checked-in model order did not match the generator output for the resolved contract. Regenerate so make contract-test stays reproducible. Co-Authored-By: Claude Code <noreply@anthropic.com>
The previous record referenced a commit that no longer exists after the rebase. Rebuilt the wheel from 581be59, checked 667 runtime files byte-for-byte, reran the four SQLite modes, and recompiled the native probe with the locked toolchain. Co-Authored-By: Claude Code <noreply@anthropic.com>
The offline access-ownership-migrate process registers no custom Artifact family profiles. Its recovery preflight therefore inventoried only the built-in families and wrote a competing owner over a pending external intent for a registered custom family; replay then failed with artifact-owner. Migration now passes the family set it accepted from persisted declarations into the recovery inventory, and a family without a local profile reports its evidence instead of raising. Co-Authored-By: Claude Code <noreply@anthropic.com>
67cf232 to
0b39db6
Compare
|
Rebased onto master 22090cd and handled the P2 custom-family recovery finding in 0b39db6.
CI is running on 0b39db6. |
Merge master 5032075 with the ownership migration fixes. Regenerate API bindings and integration bundles from the combined OpenAPI contract, retain both sets of Desktop qualification records, and refresh the persistence compatibility review without removing either rationale. Co-Authored-By: Claude Code <noreply@anthropic.com>
Record four real SQLite Server connection modes for clean source f3a90b2 and the combined OpenAPI contract. Preserve all historical qualification identities and update both locale guides to the executed profile. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
@happy-v587 I have approved this PR. please fix the file confliction. |
|
Conflicts are resolved on Main run 41289931395 completed successfully on this exact head: all 18 workflow jobs passed, including OceanBase acceptance. The PR shows 19 successful checks including CLA, with no pending or failed checks. This run's job selection is the evidence for this head; previous runs have separate matrix results. All eight review threads are resolved. GitHub still reports |
|
@hireview001 @hidb4ai Please re-review current head The Handoff recovery-evidence gap, published-Handoff inventory gap, and static background-permission check are fixed. The static check also preserves revoked grants. All 11 review threads are resolved, with fix details and regression evidence in the relevant replies. Local ownership/authorization/recovery tests, contract checks, and The formal review-request action is unavailable to the current integration/account, so I am requesting re-review here. |
hidb4ai
left a comment
There was a problem hiding this comment.
Re-reviewed 2ee2da386b93e621404a96ac701233452ab19fc0. The previous custom Artifact and Handoff attribution cases are fixed. Two confirmed P2 cases remain:
- Prompt Candidate migration skips recorded owner-recovery evidence and can persist competing attribution: #2304 (comment)
- Static background permission preview falsely rejects supported long Scope IDs: #2304 (comment)
Please address these before merging.
| @@ -1,5 +1,5 @@ | |||
| { | |||
| "contractSha256": "c90024304fa0430c91e63904e992b4828cb2b5467f2d625862973544378aafed", | |||
| "contractSha256": "c1bbeb2af91794fda06d1085d49a4a1654713f392adc432fbbdc60d65fe9925a", | |||
There was a problem hiding this comment.
[P1] 合并 master 后契约摘要再次前移,compatibility.json 没有同摘要记录,CI preflight 在本 head 失败
0ba2f199(merge: sync master into ownership migration,父 126244e9 + 252ecac0)把本行摘要写成 c1bbeb2a…,而 desktop/src-tauri/src/connections/compatibility.json 的 36 条记录里没有一条 contractSha256 等于它。按固定 OID 直接读 blob,三个提交的状态:
| 提交 | 本行 contractSha256 |
compatibility.json 条数 |
命中的记录 |
|---|---|---|---|
f369ea3e(本 PR 合并前的上一提交) |
4aeefdd602a11ebe… |
25 | sqlite-atomic-581be595-v1 |
252ecac0(被并入的 master) |
c90024304fa0430c… |
32 | sqlite-atomic-2d782c2a-v1 |
0ba2f199(本 head) |
c1bbeb2af91794fd… |
36 | 无 |
两个父提交各自自洽,第三个摘要是合并本身造出来的:合并后的契约(master 的 openapi 加上本 PR 新增的 170 行)与两边都不同,摘要因此重算,但资格记录没有跟着重跑。这不是 merge ref 的问题——上表读的是 head 树本身。
CI 同一处失败(job 125134104473,Main / CI preflight):
tests/test_desktop_contract.py ..F [100%]
E AssertionError: The bundled Desktop contract has no qualified profile for save, search and exact reads.
1 failed, 61 passed in 37.68s
make: *** [Makefile:150: contract-test] Error 1
CI preflight 红之后 32 个 job 全部 skipped(tests (*) 八个、desktop-validation 全套、harness-validation、cindy-package、dsh-package 都在其中),Upgrade release gate(job 125143396119)也判红,原因是 SCOPE_RESULT: failure 且 UPGRADE_RESULT: skipped。也就是说本 head 当前没有任何行为测试在执行,desktop-validation 的四个平台都没有跑过。
修复方向:在合并后的 head 上按仓库既有流程重跑 desktop/tests/fixture_qualification.py --server-commit <sha> 与 real_server.py,把产出的 sqlite-atomic-<sha>-v1 记录追加进 compatibility.json 并同步 desktop/VALIDATION.md 指向新 id;本 PR 上一版(f369ea3e)已经做过一次同样的资格重跑,这次是合并 master 后没有重做。如果这 170 行 openapi 变更不属于本 PR 的范围,把它移出可以避免每次同步 master 都要重算摘要与资格。
Which issue or RFC does this PR close?
Closes #2299.
Rationale for this change
Data accepted with
ACCESS_MODE=disabledhas no Artifact owner or Candidate owner attestation. Enabling enforcement preserves reads but blocks old Artifact updates with403and Candidate approval with503 artifact_owner_pending. Administrators need explicit attribution and a check of the background Principal's permissions.What changes are included in this PR?
powercontext server access-ownership-migrateplan/apply, explicit ownership, Scope selection, maintenance confirmation, and a pre-switch--background-principalcheck.Are there any user-facing changes?
Administrators can preview and assign missing ownership before or after enabling enforcement. HTTP apply requires enforcement and
server.admin. Background checks without an Access store return an explicit unavailable error; the offline command supports this check before enforcement.Ownership assignments are immutable. Back up the database and select the correct Principal for each Scope before applying. Rolling back application code does not undo ownership assignments. The migration changes authorization metadata, preserves domain history, and uses the existing ownership recovery schema.
How was this change tested?
uv run --frozen pytest -q tests/e2e/test_access_ownership_migration.py tests/e2e/test_owner_recovery_http.py tests/test_owner_recovery.py tests/e2e/test_recall_manifest.py tests/e2e/test_atomic_memory_description_upgrade.py— 67 passed. These cover ownership migration, external recovery/audit retry, long identities, the merged manifest API, and description upgrades.make contract-test— 56 passed. Python, integration and Desktop artifacts were regenerated from the combined OpenAPI;pnpm --dir desktop generate:checkalso passes with the installed OpenJDK on PATH.UV_NO_SYNC=1 make check— passed, including lock checks, the combined persistence compatibility review, hooks, type checks and 61 integration-manifest tests.make js-test cindy-testwith Node 24.14.1 / pnpm 11.13.1 — passed, including 439 DSH unit tests, 9 DSH integration tests, 20 Cindy tests, package creation and committed-bundle drift checks.The existing
desktop/tests/real_server.pynative harness passed all four SQLite HTTP/TLS connection modes on clean Server sourcesdb9c8d6edc49166504b39e0d8038dd0082368dee. All 625 packaged runtime source files match that commit byte for byte, excluding generated version metadata. The immutable source/contract/wheel evidence is recorded underdesktop/VALIDATION.md#server-db9c8d6e-protocol-qualification; historical qualification records retain their original identities.Migration tests use temporary SQLite databases with fault-injected external relationship/audit delivery. Protocol qualification uses independent built-wheel Server processes on macOS ARM64. These results do not establish native Windows/Intel execution, installed Desktop UI/credential acceptance, seekDB/OceanBase upgrade acceptance or real spawned Worker migration acceptance. Windows CI retains the three offline path cases; new remote CI results are separate from local validation.
AI usage statement
Codex (GPT-6.1 and GPT-6 family models) assisted with implementation, code review, regression tests, documentation, and PR preparation. Validation commands and their results are listed above.