Skip to content

fix(mcp): reject misleading ADR sections writes#1141

Open
M-Marbouh wants to merge 2 commits into
DeusData:mainfrom
M-Marbouh:fix/manage-adr-sections-guard
Open

fix(mcp): reject misleading ADR sections writes#1141
M-Marbouh wants to merge 2 commits into
DeusData:mainfrom
M-Marbouh:fix/manage-adr-sections-guard

Conversation

@M-Marbouh

Copy link
Copy Markdown

Summary

  • remove the dead sections input from the manage_adr schema
  • explicitly reject legacy requests that still pass sections before opening a store
  • label successful update responses as whole-document replacement
  • add a regression proving rejected legacy requests leave the ADR byte-identical

Why

The schema advertised sections as an update argument, but the handler never consumed it. A caller could therefore believe it was performing a scoped update while replacing the complete ADR document.

Closes #1140.

Related context only: #516 and #507.

Verification

  • ASan/UBSan focused MCP suite: 166 passed
  • production code compiled with warnings as errors as part of the test-runner build
  • git diff --check clean

LeakSanitizer was disabled for the focused run because it is incompatible with the sandbox ptrace wrapper; AddressSanitizer and UndefinedBehaviorSanitizer remained enabled.

@M-Marbouh
M-Marbouh requested a review from DeusData as a code owner July 16, 2026 17:49
@M-Marbouh
M-Marbouh force-pushed the fix/manage-adr-sections-guard branch from 60b8587 to ae255d2 Compare July 16, 2026 20:03
@DeusData DeusData added this to the 0.9.1-rc milestone Jul 18, 2026
@DeusData DeusData added bug Something isn't working ux/behavior Display bugs, docs, adoption UX priority/high Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker. labels Jul 18, 2026
@DeusData

Copy link
Copy Markdown
Owner

Thanks for pairing the report with a focused fail-closed regression. I’ve classified this as a high-priority 0.9.1-rc bug. Exact-head review will verify that stale sections requests are rejected before store access, the schema no longer advertises scoped writes, and existing whole-document callers retain an explicit, unambiguous contract.

@DeusData

Copy link
Copy Markdown
Owner

Thanks for this, and sorry for the delay in acknowledging it. Queued for review.

Currently CONFLICTING against main — CI is green across all 20 checks, so a rebase is the only mechanical thing standing in the way. Worth doing before I read it so I am reviewing the intended diff.

Rejecting misleading ADR section writes is a correctness-of-contract fix rather than a feature, which is the kind I like receiving.

Signed-off-by: Mustapha <m88e54ik@gmail.com>
@M-Marbouh
M-Marbouh force-pushed the fix/manage-adr-sections-guard branch from ae255d2 to 2934800 Compare July 25, 2026 12:09
Signed-off-by: Mustapha <m88e54ik@gmail.com>
@M-Marbouh
M-Marbouh force-pushed the fix/manage-adr-sections-guard branch from 2934800 to 58ab633 Compare July 25, 2026 12:22
@M-Marbouh

Copy link
Copy Markdown
Author

No worries. Thanks for the clear review criteria.

I’ve rebased the PR onto current main, and it’s conflict-free now. The resolution keeps the newer manage_adr lifecycle intact while ensuring legacy sections requests are rejected before mutation coordination or store access. I also tightened the regression to confirm the existing ADR remains byte-identical and that the mutation guard is never entered.

Local verification passed with 179 MCP tests and 2 platform-only skips. I also removed the guard temporarily as a negative control, and the new regression failed as expected, so the test is proven to catch the old behavior.

One heads-up, GitHub cancelled two CI attempts across all active runners with a “runner received a shutdown signal” message. The checks that finished beforehand were green, but I don’t have permission to rerun the upstream workflow from the fork. When convenient, could you please rerun the cancelled checks?

The diff remains limited to the original contract fix and its regression, nothing else was bundled in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority/high Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker. ux/behavior Display bugs, docs, adoption UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manage_adr sections argument silently permits whole-document replacement

2 participants