Skip to content

test(mcp): prove tracedecay_multi_str_replace behavior - #1723

Merged
ScriptedAlchemy merged 4 commits into
masterfrom
cursor/prove-multi-str-replace-9d0f
Sep 19, 2026
Merged

ScriptedAlchemy merged 4 commits into
masterfrom
cursor/prove-multi-str-replace-9d0f

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Prove tracedecay_multi_str_replace through a production JSON-RPC tools/call, not call_tool_for_test.
  • Lock the caller-visible result: preview diff and message, applied file bytes, idempotent replay, and refusals that leave the file unchanged.

Motivation

The tool is all-or-nothing and apply is bound to the preview expected_state. These tests send the arguments a client sends and assert the JSON-RPC payload and the bytes left on disk.

Changes

  • crates/tracedecay/tests/mcp_suite/mcp_handler_test/multi_str_replace_behavior_test.rs exercises only this tool over the production server connection:
    • dry run writes nothing and returns the exact two-line diff
    • apply then replay of the same key keeps new-a / new-b and the same receipt; replay reports durable metadata on effect.payload, not a fresh edit body
    • a reused key with different replacements is an idempotency conflict (-32603, source_edit.idempotency_conflict) and does not rewrite the file
    • an earlier replacement that inserts a later match edits the original span; the preview hunk is fn keep() {} / fn target() {} / +fn target_renamed() {}
    • a miss, a duplicate match, overlapping ranges, a path outside the project, a malformed pair, a missing path, an apply without preview state, a stale expected_state, and a multi-byte miss all leave the original bytes in place

Test plan

  • cargo test -p tracedecay --test mcp_suite --features test-transport mcp_handler_test::multi_str_replace_behavior_test -- --test-threads=1 reports 3 passed; 0 failed (350 filtered out)
  • No production code changed
  • Do not merge
Open in Web Open in Cursor 

Lock preview, apply, replay, and refusal results to the bytes and
messages the production MCP dispatch returns.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4882a2f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

cursoragent and others added 3 commits September 18, 2026 08:29
…str-replace-9d0f

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Drive tracedecay_multi_str_replace through the production JSON-RPC
connection and lock the wire result a client reads: preview, apply,
replay, and the refusals that leave the file unchanged.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Replay returns durable metadata on the effect payload, and the insertion
preview diff is the unified hunk the server actually writes.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review September 18, 2026 08:56
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@ScriptedAlchemy
ScriptedAlchemy merged commit 27a63bd into master Sep 19, 2026
33 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants