Repository navigation
feat(operations): saved-view/recall-pack/workspace family through MutationTransaction (polylogue-t46.9 phase 4) - #3262
Conversation
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e28a433f8a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "polylogue.mcp.server_cutover._dispatch_write", | ||
| "polylogue.operations.mutation_actuators.SavedViewSaveActuator", | ||
| ), | ||
| surfaces=("mcp", "api"), |
There was a problem hiding this comment.
Include the daemon in the mutation surface inventory
The daemon HTTP handlers in polylogue/daemon/user_state_http.py expose all six saved-view, recall-pack, and workspace mutations through these facade methods, but every new spec and census row lists only mcp and api. This makes the canonical mutation inventory incomplete for the process that owns writes; add daemon and the corresponding handler references for the whole family.
AGENTS.md reference: AGENTS.md:L17-L23
Useful? React with 👍 / 👎.
e28a433 to
dd32c81
Compare
…gh MutationTransaction (phase 4) Problem: docs/plans/mutation-census.yaml carried save_saved_view/ delete_saved_view, save_recall_pack/delete_recall_pack, and save_workspace/delete_workspace as declared-not-routed debt since phase 2 (t46.9/kwsb.2) -- each pair still enforced authorization independently of every other destructive route, with jn40's confirm boolean the only interim mitigation for the destructive members. What changed: six new actuators (SavedViewSaveActuator/ SavedViewDeleteActuator, RecallPackSaveActuator/RecallPackDeleteActuator, WorkspaceSaveActuator/WorkspaceDeleteActuator) wrap the existing ArchiveStore.save_view/delete_view, save_recall_pack/delete_recall_pack, save_workspace/delete_workspace primitives -- all reversible class, role_only confirmation (AC4), matching the phase-2/phase-3 pattern exactly: each pair's primitive is a create-or-update upsert paired with a soft-delete (mark_assertion_status ... "deleted"), so undo is always the paired actuator through the same primitive. Six new OperationSpec entries (mutate-save-saved-view, mutate-delete-saved-view, mutate-save-recall-pack, mutate-delete-recall-pack, mutate-save-workspace, mutate-delete-workspace), all executor-routed. api/archive.py's save_view/delete_view, create_recall_pack/ delete_recall_pack, save_workspace/delete_workspace now drive their actuators through OperationExecutor instead of calling ArchiveStore directly -- async validation/item-resolution (which may consult insight-derived indexes for recall-pack/workspace targets) stays in the facade and runs once before the actuator sees already-normalized JSON payloads, mirroring AnnotationSaveActuator's pattern. MCP's write(operation='save_saved_view'/'delete_saved_view'/ 'save_recall_pack'/'delete_recall_pack'/'save_workspace'/ 'delete_workspace') already calls these facade methods, so no MCP tool signature change is needed. Also fixed a pre-existing test_specs.py gap on this branch (mirrors the one fixed on the phase-3 branch, #3258): mutate-add-mark/ mutate-remove-mark, added in the phase-2 PR (#3253, already on master), were never added to test_runtime_operation_catalog_covers_the_current_runtime_paths' expected set -- fixed while touching this file for the six new specs. Anti-vacuity: TestSavedViewActuators/TestRecallPackActuators/ TestWorkspaceActuators in tests/unit/operations/test_mutation_actuators.py drive each actuator against a real seeded user.db (real schema, real SQL) -- they fail if e.g. SavedViewSaveActuator.apply stops calling ArchiveStore.save_view, or if the delete actuators stop marking their assertion rows deleted. Existing facade-contract tests for save_view/ create_recall_pack/save_workspace (tests/unit/api/test_facade_contracts.py) pass unchanged, confirming the executor routing preserves the existing public behavior. Note: this branch is cut from master before phase 3's own PR (#3258, annotation family + raw-authority blocker resolution) merges, so that PR's census rows are not present here; docs/plans/mutation-census.yaml's header explains the ordering. Ref polylogue-t46.9 Ref polylogue-kwsb.2 Co-Authored-By: Claude <[email protected]>
…rface Problem (CodeRabbit #3262): 1. SavedViewSaveActuator/WorkspaceSaveActuator.prepare only targeted the new id, but ArchiveStore.save_view/save_workspace soft-delete whichever row currently owns the target name when a save uses a new id -- so a name collision's plan/receipt/affected_count silently omitted the mutated victim row, and the stale-plan check couldn't detect a changed name binding. 2. The mutation census listed only mcp/api surfaces for the saved-view/ recall-pack/workspace family, but polylogue/daemon/user_state_http.py's six HTTP handlers expose the same mutations through the daemon -- the process that owns writes was missing from its own inventory. What changed: - Added ArchiveStore.get_workspace_by_name (mirrors get_view_by_name). - SavedViewSaveActuator/WorkspaceSaveActuator.prepare now look up the current name-owner; when it differs from the target id, both ids go into target_refs (so the plan hash covers the collision) and the receipt's affected_count/domain_receipt name the resolved victim. - Registered daemon + its six handler adapters across all six saved-view/recall-pack/workspace census rows. Verification: devtools test tests/unit/operations/ (141 passed, including two new name-collision regression tests); devtools verify --quick (pass). Ref polylogue-t46.9 Co-Authored-By: Claude <[email protected]>
dd32c81 to
c8c7cd0
Compare
|
Fixed both P2 findings: (1) |
#3294) ## Summary Migrates the `record_correction` / `delete_correction` / `clear_corrections` learning-corrections family from `declared-not-routed` to `executor-routed` in the t46.9/kwsb.2 mutation-authority migration — phase 5 in the sequence started by #3249/#3253/#3258/#3262. ## Problem `docs/plans/mutation-census.yaml`'s `record_correction / clear_corrections` row was the next `declared-not-routed` family after phase 4 (#3262, saved-view/recall-pack/workspace) landed. These three operations independently mutated `user.db` without going through `OperationExecutor`'s PREPARE -> AUTHORIZE -> EXECUTE protocol, so they had no shared plan-hash staleness check or confirmation-strength floor — the same class of gap kwsb.2's design doc calls a security boundary (one adapter bypassing the proof required by another). ## Solution - `polylogue/operations/mutation_actuators.py`: new `CorrectionRecordActuator`, `CorrectionDeleteActuator`, `CorrectionsClearActuator` — all `reversible` class / `role_only` confirmation (AC4: reversible writes don't need interactive confirmation), following the exact same actuator shape as the annotation and workspace families. `CorrectionsClearActuator.prepare` resolves the *exact live set* of correction kinds for the session at plan time (mirroring `SessionDeleteActuator`'s re-resolve-against-live-state pattern), so a concurrent `record_correction` between AUTHORIZE and EXECUTE changes the plan hash and forces `PlanStaleError` instead of silently clearing a kind the caller never previewed. - `polylogue/operations/specs.py`: `mutate-record-correction`, `mutate-delete-correction`, `mutate-clear-corrections` `OperationSpec` entries, `executor_status="executor-routed"`. - `polylogue/api/archive.py`: `record_correction`/`delete_correction`/`clear_corrections` now build actuator args and drive `OperationExecutor.prepare/authorize/execute` instead of calling `ArchiveStore` directly. Behavior/return types are unchanged (same `LearningCorrection`/`bool`/`int` signatures). - `docs/plans/mutation-census.yaml`: replaced the single `declared-not-routed` row with three `executor-routed` rows citing their specs/actuators/adapters. - `docs/test-quality-workflows.md`: regenerated (the uncovered-runtime-operations list picked up the three new spec names, matching the existing pattern for e.g. `mutate-save-annotation`). Only this one family was migrated — per repo convention, the remaining `declared-not-routed` rows (`capture_assertion_candidate`, `blackboard_post`, `import_annotation_batch`, the `maintenance_execute` family, and the file-tier `ops reset` family) are untouched debt for later phases. ## Verification - `python -m pytest tests/unit/operations/{test_mutation_actuators,test_mutation_census,test_specs}.py -q` -> 56 passed - `devtools test tests/unit/operations/` -> 146 passed - `devtools test tests/unit/mcp/test_query_gap_projections.py tests/unit/api/test_facade_contracts.py` -> 295 passed (these two files exercise `record_correction`/`clear_corrections` through the MCP/API layers) - `python -m mypy polylogue/operations/mutation_actuators.py polylogue/operations/specs.py polylogue/api/archive.py tests/unit/operations/test_mutation_actuators.py` -> `Success: no issues found in 4 source files` - `ruff check` / `ruff format --check` on all changed `.py` files -> clean - `devtools render all --check` -> no `out of sync` surfaces (after regenerating `docs/test-quality-workflows.md`) - `devtools verify --quick` -> exit 0 (ran automatically on push via the pre-push hook too) New test: `tests/unit/operations/test_mutation_actuators.py::TestCorrectionActuators` — 5 cases including the anti-vacuity case `test_concurrent_record_between_authorize_and_execute_makes_clear_plan_stale`, which authorizes a clear-plan, records a new correction kind through a second actuator in between AUTHORIZE and EXECUTE, and asserts the held authorization is refused with `PlanStaleError` before any row is deleted — proving authorization is actually enforced, not just "it still works." Ref polylogue-kwsb.2 Ref polylogue-t46.9 Co-Authored-By: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Phase 4 of polylogue-t46.9/polylogue-kwsb.2 (make
OperationSpecthe executable mutation authority): migrates the saved-view/recall-pack/workspace family ontoOperationExecutor, the next coherent slice ofdeclared-not-routeddebt named in the phase-2 receipt.Problem
docs/plans/mutation-census.yamlcarried three MCP write-operation pairs asdeclared-not-routedsince phase 2:save_saved_view/delete_saved_viewsave_recall_pack/delete_recall_packsave_workspace/delete_workspaceEach pair still enforced authorization independently of every other destructive route, with jn40's interim confirm-boolean sweep the only mitigation for the destructive members (
delete_saved_view,delete_recall_pack,delete_workspace). All six operations share the exact same shape already proven safe for the tag/metadata/mark/annotation families: anArchiveStoreprimitive that is a create-or-update upsert (save_view/save_recall_pack/save_workspace) paired with a soft-delete (delete_view/delete_recall_pack/delete_workspace, each callingmark_assertion_status(..., "deleted")).Solution
polylogue/operations/mutation_actuators.py: six new actuators (SavedViewSaveActuator/SavedViewDeleteActuator,RecallPackSaveActuator/RecallPackDeleteActuator,WorkspaceSaveActuator/WorkspaceDeleteActuator), all reversible class,role_onlyconfirmation (AC4) -- undo is always the paired actuator through the same primitive.polylogue/operations/specs.py: six new executor-routedOperationSpecentries.polylogue/api/archive.py:save_view/delete_view,create_recall_pack/delete_recall_pack,save_workspace/delete_workspacenow drive their actuators throughOperationExecutorinstead of callingArchiveStoredirectly. Async validation and item resolution (recall-pack/workspace targets may consult insight-derived indexes) stays in the facade and runs once before the actuator sees already-normalized JSON payloads -- mirroringAnnotationSaveActuator's pattern from phase 3. MCP'swrite(operation='save_saved_view'/.../'delete_workspace')already calls these facade methods, so no MCP tool signature change is needed.tests/unit/operations/test_specs.py'stest_runtime_operation_catalog_covers_the_current_runtime_pathswas missingmutate-add-mark/mutate-remove-mark(added in the already-merged phase-2 PR refactor(operations): route remaining mutation families through MutationTransaction (polylogue-t46.9 phase 2) #3253) from its expected set -- fixed while touching this file for the six new specs. (The same pre-existing gap was independently found and fixed on the phase-3 branch for PR feat(operations): blocker-resolution operator surface + annotation family through MutationTransaction (polylogue-t46.9 phase 3) #3258.)Routing matrix
mutate-save-saved-viewmutate-delete-saved-viewmutate-save-recall-packmutate-delete-recall-packmutate-save-workspacemutate-delete-workspaceCensus delta (
docs/plans/mutation-census.yaml)save_saved_view / delete_saved_view(combineddeclared-not-routedrow) -> split intomutate-save-saved-view+mutate-delete-saved-view, bothexecutor-routed.save_recall_pack / delete_recall_pack(combineddeclared-not-routedrow) -> split intomutate-save-recall-pack+mutate-delete-recall-pack, bothexecutor-routed.save_workspace / delete_workspace(combineddeclared-not-routedrow) -> split intomutate-save-workspace+mutate-delete-workspace, bothexecutor-routed.Branch-cut note: this branch is cut from
origin/masterbefore phase 3's own PR (#3258 -- annotation family + raw-authority blocker resolution) merges, so phase 3's census rows are not present in this diff; the census file's header comment explains the ordering. No conflict is expected on merge since the two PRs touch disjoint rows/regions of the file, but whichever merges second will need a routine rebase.Verification
Anti-vacuity:
TestSavedViewActuators/TestRecallPackActuators/TestWorkspaceActuatorsintests/unit/operations/test_mutation_actuators.pydrive each actuator against a real seededuser.db(real schema, real SQL) -- they fail if e.g.SavedViewSaveActuator.applystops callingArchiveStore.save_view, or if a delete actuator stops marking its assertion row deleted. Existing facade-contract tests forsave_view/create_recall_pack/save_workspace(tests/unit/api/test_facade_contracts.py) pass unchanged, confirming the executor routing preserves existing public behavior (creation/update/deletion semantics, return values).Not run: full
devtools verify --all(reserved for harness/dependency changes or a final pre-merge diagnostic; the touched surface is fully covered by the focused runs above).Remaining polylogue-t46.9 / polylogue-kwsb.2 scope
Explicitly deferred, not silently dropped (see updated
docs/plans/mutation-census.yaml):record_correction / clear_corrections-- stilldeclared-not-routed(low blast radius / single-target overwrite, per existing census reason).capture_assertion_candidate,blackboard_post,import_annotation_batch-- stilldeclared-not-routed(additive, not destructive).rebuild_index / update_index / rebuild_insights(maintenance_execute family) -- stilldeclared-not-routed.ops reset --database/--index/--blob/--assets/--cache/--auth(file-tier deletions) -- stilldeclared-not-routed; whether to extendMutationPlan's target-ref vocabulary to file-tier targets or keep this a permanent typed exemption is an open decision.bound_tokenconfirmation strength adoption (currently no actuator requires it; all destructive-class actuators useconfirm_flag).MutationReceipts.Ref polylogue-t46.9
Ref polylogue-kwsb.2
Co-Authored-By: Claude [email protected]