Repository navigation
fix(mcp): Censure the MCP surface's in-process durable writes - #5442
Conversation
The mutation-authority ratchet covered polylogue/cli and (since decision D1) polylogue/api, but never polylogue/mcp. The writes finished moving there: at eab6e85 all twenty surviving _execute_facade_mutation call sites in polylogue/api/archive.py are reached from polylogue/mcp and none from polylogue/cli, so the entire remaining in-process writer population sat behind the one surface no rule watched. polylogue/mcp/server_cutover.py:2229 also imports polylogue.annotations.importer directly -- the MCP twin of the CLI writer #5310 recorded -- and passed every gate, because the existing polylogue/mcp rule disallows only storage/pipeline/sources. Adds the third mutation-authority rule and records that import in the baseline with its reviewed reason (decision D2, still blocked: _resolve_user_state_target remains on the facade at archive.py:6721; PR #5370 moved resolve_ref, not this). An import rule cannot see the facade-routed spelling of the same write, so tests/unit/api/test_facade_mutation_census.py pins the half it structurally misses: the twenty caller methods, shrink-only, plus their surface reach. A CLI command re-routed through Polylogue.add_tag goes red there while the import ratchet stays green, since the CLI is allowed to import polylogue.api. Verification: devtools gate layering -> exit 0, count:0, baselined_count:215 (before the baseline entry: exit 1, violations:[polylogue/mcp/ server_cutover.py -> polylogue.annotations.importer] -- the rule fires) devtools verify --quick -> PASSED devtools test tests/unit/api/test_facade_mutation_census.py tests/unit/devtools/test_layering_gates.py -> PASSED devtools render all --check -> 0 "out of sync" Anti-vacuity, executed: planted polylogue/cli/commands/wave_t_probe.py calling poly.add_tag -> test_no_cli_module_reaches_a_facade_mutation FAILED naming the file. The probe was untracked and still detected (rglob, not git ls-files). dropped "add_mark" from _EXPECTED_FACADE_MUTATIONS -> test_the_facade_mutation_inventory_is_the_pinned_one FAILED naming it. No production Python changed, so the derived schema identity cannot move. Refs: polylogue-gjwto, polylogue-r29bv Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 34 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10482e4dd9
ℹ️ 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".
|
Closing out open Codex review threads on this PR (evidence checked against master at 5d56c3a):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
polylogue/mcphad no mutation-authority rule at all, so an in-process durable write from that surface passed every gate. Beads: polylogue-gjwto, polylogue-r29bv (both advanced, neither closed).Problem
The only layering rule for
polylogue/mcpdisallowsstorage|pipeline|sources. Somcp/server_cutover.py:2229importingpolylogue.annotations.importer— the module the CLI rule explicitly names as an executor driver, drivingOperationExecutoragainstuser.dbin-process — passed cleanly.That is the MCP twin of the CLI writer recorded in #5310: the same defect, one surface over from where it was fixed.
Premise corrections, by measurement
_execute_facade_mutationhas 20 call sites, not 9. The figure I briefed this lane with was the first nine of twenty — a truncated scan reported as a complete population. A 2026-09-22 bead note saying "twenty… +1" is also wrong. AST census ateab6e8507: 20 call sites in 20 distinct methods, 1:1 —All 20 are MCP-reached; zero are CLI-reached. The three r29bv CLI writers (setting / note / annotations) landed before this base, and the layering baseline shrank 3 -> 2 accordingly. The remaining work is an MCP-side question, not a CLI one.
Solution
docs/plans/layering.yaml— a third mutation-authority rule forpolylogue/mcp. Proven to fire: before baselining,gate layeringexited 1 with the exact violation._resolve_user_state_targetis still on the facade atarchive.py:6721with 5 call sites; PR refactor(operations): Move ref resolution and anchor reads on every surface #5370 movedresolve_ref, not this).tests/unit/api/test_facade_mutation_census.py— pins the 20-method inventory shrink-only, plus surface reach. This covers the facade-routed spelling that an import rule structurally cannot see.Verification
Both mutations executed with real failures: a planted CLI caller failed
test_no_cli_module_reaches_a_facade_mutationnaming the file; droppingadd_markfailed the inventory test naming it. The probe file was untracked and still caught, because the census walks withrglobrather thangit ls-files— the exact failure mode that let a recent ui ratchet stay green with a live violating file on disk.No production Python changed, so the derived identity cannot move.
Two AC-REWRITEs
1. "Growing the baseline is refused by the ratchet" is false (r29bv AC6, gjwto AC2).
verify_layering.py:142-144says so plainly: the count shrinks "without an explicit edit to this file (and that edit is the thing code review looks at)." It is a review convention, not a mechanical refusal — confirmed by history (2 -> 3 -> 2) and by this edit.2. gjwto AC2 contradicts gjwto item 1. AC2 wants the baseline to shrink to zero; item 1 wants the rule extended so facade writes become visible. Making a previously-invisible write visible necessarily adds an entry — D1 itself grew the baseline 0 -> 2, and this change grows it 2 -> 3 for the same reason and by the same intent. Read as a prohibition on growth, AC2 forbids the rule extension its own bead demands. It should read: no entry may be added for a write that was already visible.
Residual
This covers the direct-import half at MCP. The 20 facade-routed writes remain, gated on D2 — an MCP-owner decision about requiring a running daemon — which both beads explicitly instruct a lane not to attempt.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy