From 5e300a66e6fddbbeb375251946cc99d043531319 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 07:13:59 +0000 Subject: [PATCH 1/7] test(mcp): prove tracedecay_source_edit_rollback behavior Exercise rollback through production MCP tools/call: restore retained move preimages, replay the receipt, refuse foreign bytes, and refuse edits that kept no preimage. Co-authored-by: Zack Jackson --- .../tests/mcp_suite/mcp_handler_test.rs | 2 + .../source_edit_rollback_test.rs | 479 ++++++++++++++++++ 2 files changed, 481 insertions(+) create mode 100644 crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs diff --git a/crates/tracedecay/tests/mcp_suite/mcp_handler_test.rs b/crates/tracedecay/tests/mcp_suite/mcp_handler_test.rs index 0053aebca1..5a521de9bc 100644 --- a/crates/tracedecay/tests/mcp_suite/mcp_handler_test.rs +++ b/crates/tracedecay/tests/mcp_suite/mcp_handler_test.rs @@ -31,6 +31,8 @@ mod session_search_test; #[cfg(feature = "test-transport")] mod shell_dead_code_test; mod skills_automation_test; +#[cfg(feature = "test-transport")] +mod source_edit_rollback_test; mod status_runtime_test; mod unsafe_patterns_test; #[cfg(feature = "test-transport")] diff --git a/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs b/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs new file mode 100644 index 0000000000..c63f02752f --- /dev/null +++ b/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs @@ -0,0 +1,479 @@ +//! `tracedecay_source_edit_rollback` through the production MCP `tools/call` +//! path. Callers pass the completed move receipt; the tool restores retained +//! preimages or refuses, and exact retries replay that receipt. + +use crate::support::{ + ProductionSourceEditFixture, TestTempDir, handle_real_server_tool_call_raw, + init_production_source_edit_project, test_temp_dir, warm_code_index_search, +}; +use serde_json::{Value, json}; +use std::fs; +use std::path::{Path, PathBuf}; + +const LIB_RS: &str = "pub mod source;\npub mod dest;\n"; +const SOURCE_RS: &str = "//! source\n\npub fn rollback_anchor() -> i32 {\n 7\n}\n"; +const DEST_RS: &str = "//! dest\n\npub fn dest_marker() -> i32 {\n 0\n}\n"; +const ANCHOR: &str = "pub fn rollback_anchor() -> i32 {\n 7\n}"; +const MOVE_KEY: &str = "mcp-test.source-edit.move.rollback-anchor"; +const FOREIGN_DEST: &str = "//! dest\n\npub fn peer_bytes() -> i32 {\n 9\n}\n"; + +struct MovedProject { + _dir: TestTempDir, + fixture: ProductionSourceEditFixture, + project: PathBuf, + effect_id: String, + input_digest: String, + committed_state: String, + prior_expected_state: String, +} + +fn read_project_file(project: &Path, relative: &str) -> String { + fs::read_to_string(project.join(relative)) + .unwrap_or_else(|error| panic!("read {relative}: {error}")) +} + +fn assert_original_sources(project: &Path) { + assert_eq!(read_project_file(project, "src/lib.rs"), LIB_RS); + assert_eq!(read_project_file(project, "src/source.rs"), SOURCE_RS); + assert_eq!(read_project_file(project, "src/dest.rs"), DEST_RS); +} + +fn require_str<'a>(value: &'a Value, pointer: &str) -> &'a str { + value + .pointer(pointer) + .and_then(Value::as_str) + .unwrap_or_else(|| panic!("missing {pointer} in {value}")) +} + +fn tool_payload(response: &Value) -> Value { + assert_eq!(response["jsonrpc"], "2.0", "{response}"); + assert!( + response.get("error").is_none_or(Value::is_null), + "{response}" + ); + let text = response["result"]["content"][0]["text"] + .as_str() + .unwrap_or_else(|| panic!("MCP tool result had no text: {response}")); + serde_json::from_str(text).unwrap_or_else(|error| panic!("{error}: {text}")) +} + +async fn call_tool(fixture: &ProductionSourceEditFixture, name: &str, arguments: Value) -> Value { + let server = fixture + .harness + .server(&fixture.project_root) + .expect("production project server"); + handle_real_server_tool_call_raw(&server, name, arguments).await +} + +fn rollback_args( + idempotency_key: &str, + effect_id: &str, + input_digest: &str, + expected_state: &str, + confirm: bool, +) -> Value { + json!({ + "effect_id": effect_id, + "original_idempotency_key": MOVE_KEY, + "idempotency_key": idempotency_key, + "original_input_digest": input_digest, + "expected_state": expected_state, + "confirm": confirm, + "format": "json", + }) +} + +async fn open_moved_project() -> MovedProject { + let dir = test_temp_dir(); + let project = dir.path().join("project"); + fs::create_dir_all(project.join("src")).unwrap(); + fs::write(project.join("src/lib.rs"), LIB_RS).unwrap(); + fs::write(project.join("src/source.rs"), SOURCE_RS).unwrap(); + fs::write(project.join("src/dest.rs"), DEST_RS).unwrap(); + let (fixture, _) = init_production_source_edit_project(&project).await; + let server = fixture + .harness + .server(&fixture.project_root) + .expect("production project server"); + warm_code_index_search(&server, "rollback_anchor").await; + + let preview = tool_payload( + &call_tool( + &fixture, + "tracedecay_move_symbol", + json!({ + "symbol": "rollback_anchor", + "dest_file": "src/dest.rs", + "dry_run": true, + "format": "json", + }), + ) + .await, + ); + let expected_state = require_str(&preview, "/expected_state").to_owned(); + let applied = tool_payload( + &call_tool( + &fixture, + "tracedecay_move_symbol", + json!({ + "symbol": "rollback_anchor", + "dest_file": "src/dest.rs", + "dry_run": false, + "idempotency_key": MOVE_KEY, + "expected_state": expected_state, + "format": "json", + }), + ) + .await, + ); + assert_eq!(applied["success"], json!(true), "{applied}"); + assert_eq!(applied["replayed"], json!(false), "{applied}"); + assert_eq!(applied["effect"]["idempotency_key"], MOVE_KEY, "{applied}"); + assert_eq!( + applied["effect"]["receipt"]["outcome"], + json!("completed"), + "{applied}" + ); + assert!( + !read_project_file(&project, "src/source.rs").contains(ANCHOR), + "move must remove the anchor before rollback can restore it" + ); + assert!( + read_project_file(&project, "src/dest.rs").contains(ANCHOR), + "move must retain the anchor text in the destination" + ); + + MovedProject { + _dir: dir, + fixture, + project, + effect_id: require_str(&applied, "/effect/effect_id").to_owned(), + input_digest: require_str(&applied, "/effect/receipt/input_digest").to_owned(), + committed_state: require_str(&applied, "/effect/receipt/committed_state").to_owned(), + prior_expected_state: require_str(&applied, "/effect/receipt/expected_state").to_owned(), + } +} + +#[tokio::test] +async fn source_edit_rollback_restores_move_preimages_and_replays_the_receipt() { + let moved = open_moved_project().await; + + let unconfirmed = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + "mcp-test.source-edit.rollback.unconfirmed", + &moved.effect_id, + &moved.input_digest, + &moved.committed_state, + false, + ), + ) + .await; + assert_eq!(unconfirmed["jsonrpc"], "2.0"); + assert_eq!(unconfirmed["id"], 1); + assert!(unconfirmed.get("result").is_none_or(Value::is_null)); + assert_eq!(unconfirmed["error"]["code"], -32603); + assert_eq!( + unconfirmed["error"]["message"], + "tool execution failed: config error: source edit rollback requires confirm=true from the caller after it checks the receipt; do not pause for a human" + ); + assert_eq!( + unconfirmed["error"]["data"]["tool"], + "tracedecay_source_edit_rollback" + ); + assert!( + !read_project_file(&moved.project, "src/source.rs").contains(ANCHOR), + "a refused confirmation must not restore the source preimage" + ); + + let same_key = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + MOVE_KEY, + &moved.effect_id, + &moved.input_digest, + &moved.committed_state, + true, + ), + ) + .await; + assert_eq!(same_key["error"]["code"], -32603); + assert_eq!( + same_key["error"]["message"], + "tool execution failed: config error: rollback idempotency key must differ from the original edit key" + ); + assert!( + read_project_file(&moved.project, "src/dest.rs").contains(ANCHOR), + "a reused move key must not roll the destination back" + ); + + let restored_response = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + "mcp-test.source-edit.rollback.anchor", + &moved.effect_id, + &moved.input_digest, + &moved.committed_state, + true, + ), + ) + .await; + assert_eq!(restored_response["result"]["isError"], json!(false)); + let restored = tool_payload(&restored_response); + assert_eq!(restored["success"], json!(true)); + assert_eq!(restored["reconciled"], json!(true)); + assert_eq!(restored["replayed"], json!(false)); + assert_eq!( + restored["message"], + "source edit rollback restored every retained preimage" + ); + assert_eq!(restored["expected_state"], moved.committed_state); + assert_eq!(restored["predicted_state"], moved.prior_expected_state); + assert_eq!(restored["effect"]["effect_class"], "source_edit"); + assert_eq!( + restored["effect"]["idempotency_key"], + "mcp-test.source-edit.rollback.anchor" + ); + assert_eq!(restored["effect"]["receipt"]["outcome"], "completed"); + assert_eq!(restored["effect"]["receipt"]["effect_class"], "source_edit"); + assert_eq!(restored["effect"]["reconciliation"], "reconciled"); + assert_eq!( + restored["effect"]["payload"]["operation"], + "use-case.application.source-edit.rollback" + ); + assert_eq!(restored["effect"]["payload"]["files"], json!([])); + assert_eq!(restored["effect"]["payload"]["reconciled"], json!(true)); + assert_eq!( + restored["effect"]["payload"]["durable_metadata_only"], + json!(true) + ); + assert_eq!( + restored["effect"]["payload"]["message"], + "source edit reconciliation completed" + ); + assert_original_sources(&moved.project); + let rollback_effect_id = require_str(&restored, "/effect/effect_id").to_owned(); + + let replay_response = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + "mcp-test.source-edit.rollback.anchor", + &moved.effect_id, + &moved.input_digest, + &moved.committed_state, + true, + ), + ) + .await; + assert_eq!(replay_response["result"]["isError"], json!(false)); + let replay = tool_payload(&replay_response); + assert_eq!(replay["replayed"], json!(true)); + assert_eq!(replay["success"], json!(true)); + assert_eq!(replay["reconciled"], json!(true)); + assert_eq!(replay["durable_metadata_only"], json!(true)); + assert_eq!(replay["message"], "source edit reconciliation completed"); + assert_eq!(replay["files"], json!([])); + assert_eq!(replay["effect"]["effect_id"], rollback_effect_id); + assert_eq!( + replay["effect"]["idempotency_key"], + "mcp-test.source-edit.rollback.anchor" + ); + assert_original_sources(&moved.project); + + let mismatched = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + "mcp-test.source-edit.rollback.mismatch", + &moved.effect_id, + &format!("sha256:{}", "0".repeat(64)), + &moved.committed_state, + true, + ), + ) + .await; + assert_eq!(mismatched["jsonrpc"], "2.0"); + assert_eq!(mismatched["id"], 1); + assert!(mismatched.get("result").is_none_or(Value::is_null)); + assert_eq!(mismatched["error"]["code"], -32602); + assert_eq!( + mismatched["error"]["message"], + "tool project route failed: reason_code=source_edit.execution_failed retryable=false: config error: source edit rollback identity does not match the completed original effect" + ); + assert_eq!( + mismatched["error"]["data"]["tool"], + "tracedecay_source_edit_rollback" + ); + assert_eq!( + mismatched["error"]["data"]["reason_code"], + "source_edit.execution_failed" + ); + assert_eq!(mismatched["error"]["data"]["retryable"], json!(false)); + assert_eq!( + mismatched["error"]["data"]["detail"], + "config error: source edit rollback identity does not match the completed original effect" + ); + assert_original_sources(&moved.project); +} + +#[tokio::test] +async fn source_edit_rollback_keeps_foreign_bytes_and_replays_the_refusal() { + let moved = open_moved_project().await; + let source_after_move = read_project_file(&moved.project, "src/source.rs"); + fs::write(moved.project.join("src/dest.rs"), FOREIGN_DEST).unwrap(); + + let refused_response = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + "mcp-test.source-edit.rollback.foreign", + &moved.effect_id, + &moved.input_digest, + &moved.committed_state, + true, + ), + ) + .await; + assert_eq!(refused_response["jsonrpc"], "2.0"); + assert!(refused_response.get("error").is_none_or(Value::is_null)); + assert_eq!(refused_response["result"]["isError"], json!(true)); + let refused = tool_payload(&refused_response); + assert_eq!(refused["success"], json!(false)); + assert_eq!(refused["failed"], json!(true)); + assert_eq!(refused["replayed"], json!(false)); + assert_eq!( + refused["message"], + "source edit rollback refused stale or foreign workspace bytes" + ); + assert_eq!(refused["expected_state"], moved.committed_state); + assert_eq!(refused["effect"]["effect_class"], "source_edit"); + assert_eq!( + refused["effect"]["idempotency_key"], + "mcp-test.source-edit.rollback.foreign" + ); + assert_eq!(refused["effect"]["receipt"]["outcome"], "failed"); + assert_eq!(refused["effect"]["reconciliation"], "reconciled"); + assert_eq!( + read_project_file(&moved.project, "src/source.rs"), + source_after_move + ); + assert_eq!( + read_project_file(&moved.project, "src/dest.rs"), + FOREIGN_DEST + ); + assert_eq!(read_project_file(&moved.project, "src/lib.rs"), LIB_RS); + let refusal_effect_id = require_str(&refused, "/effect/effect_id").to_owned(); + + let replay_response = call_tool( + &moved.fixture, + "tracedecay_source_edit_rollback", + rollback_args( + "mcp-test.source-edit.rollback.foreign", + &moved.effect_id, + &moved.input_digest, + &moved.committed_state, + true, + ), + ) + .await; + assert_eq!(replay_response["result"]["isError"], json!(true)); + let replay = tool_payload(&replay_response); + assert_eq!(replay["replayed"], json!(true)); + assert_eq!(replay["success"], json!(false)); + assert_eq!(replay["failed"], json!(true)); + assert_eq!(replay["durable_metadata_only"], json!(true)); + assert_eq!(replay["message"], "source edit failed before the effect"); + assert_eq!(replay["effect"]["effect_id"], refusal_effect_id); + assert_eq!( + read_project_file(&moved.project, "src/dest.rs"), + FOREIGN_DEST + ); + assert_eq!( + read_project_file(&moved.project, "src/source.rs"), + source_after_move + ); +} + +#[tokio::test] +async fn source_edit_rollback_refuses_an_edit_without_retained_preimages() { + let dir = test_temp_dir(); + let project = dir.path().join("project"); + fs::create_dir_all(project.join("src")).unwrap(); + fs::write(project.join("src/main.rs"), "fn old_name() {}\n").unwrap(); + let (fixture, _) = init_production_source_edit_project(&project).await; + + let preview = tool_payload( + &call_tool( + &fixture, + "tracedecay_str_replace", + json!({ + "path": "src/main.rs", + "old_str": "old_name", + "new_str": "new_name", + "dry_run": true, + "format": "json", + }), + ) + .await, + ); + let expected_state = require_str(&preview, "/expected_state").to_owned(); + let applied = tool_payload( + &call_tool( + &fixture, + "tracedecay_str_replace", + json!({ + "path": "src/main.rs", + "old_str": "old_name", + "new_str": "new_name", + "idempotency_key": "mcp-test.source-edit.replace.no-preimage", + "expected_state": expected_state, + "format": "json", + }), + ) + .await, + ); + assert_eq!(applied["success"], json!(true), "{applied}"); + assert_eq!( + read_project_file(&project, "src/main.rs"), + "fn new_name() {}\n" + ); + + let refused = call_tool( + &fixture, + "tracedecay_source_edit_rollback", + json!({ + "effect_id": require_str(&applied, "/effect/effect_id"), + "original_idempotency_key": "mcp-test.source-edit.replace.no-preimage", + "idempotency_key": "mcp-test.source-edit.rollback.no-preimage", + "original_input_digest": require_str(&applied, "/effect/receipt/input_digest"), + "expected_state": require_str(&applied, "/effect/receipt/committed_state"), + "confirm": true, + "format": "json", + }), + ) + .await; + assert_eq!(refused["jsonrpc"], "2.0"); + assert_eq!(refused["id"], 1); + assert!(refused.get("result").is_none_or(Value::is_null)); + assert_eq!(refused["error"]["code"], -32602); + assert_eq!( + refused["error"]["message"], + "tool project route failed: reason_code=source_edit.execution_failed retryable=false: config error: source edit effect has no retained rollback material" + ); + assert_eq!( + refused["error"]["data"]["tool"], + "tracedecay_source_edit_rollback" + ); + assert_eq!( + refused["error"]["data"]["detail"], + "config error: source edit effect has no retained rollback material" + ); + assert_eq!( + read_project_file(&project, "src/main.rs"), + "fn new_name() {}\n" + ); +} From a275c8a56af0f270b23aec7f307e81e53c429081 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 09:21:28 +0000 Subject: [PATCH 2/7] test(mcp): assert observed source-edit rollback receipts The production tools/call path omits isError on success and keeps durable replay metadata on the effect payload, not the top-level outcome. Co-authored-by: Zack Jackson --- .../source_edit_rollback_test.rs | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs b/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs index c63f02752f..07d31cefa7 100644 --- a/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs +++ b/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs @@ -221,7 +221,6 @@ async fn source_edit_rollback_restores_move_preimages_and_replays_the_receipt() ), ) .await; - assert_eq!(restored_response["result"]["isError"], json!(false)); let restored = tool_payload(&restored_response); assert_eq!(restored["success"], json!(true)); assert_eq!(restored["reconciled"], json!(true)); @@ -269,19 +268,30 @@ async fn source_edit_rollback_restores_move_preimages_and_replays_the_receipt() ), ) .await; - assert_eq!(replay_response["result"]["isError"], json!(false)); let replay = tool_payload(&replay_response); assert_eq!(replay["replayed"], json!(true)); assert_eq!(replay["success"], json!(true)); - assert_eq!(replay["reconciled"], json!(true)); - assert_eq!(replay["durable_metadata_only"], json!(true)); + assert_eq!(replay["failed"], json!(false)); assert_eq!(replay["message"], "source edit reconciliation completed"); - assert_eq!(replay["files"], json!([])); + assert_eq!(replay["expected_state"], moved.committed_state); + assert_eq!(replay["predicted_state"], moved.prior_expected_state); assert_eq!(replay["effect"]["effect_id"], rollback_effect_id); assert_eq!( replay["effect"]["idempotency_key"], "mcp-test.source-edit.rollback.anchor" ); + assert_eq!(replay["effect"]["receipt"]["outcome"], "completed"); + assert_eq!( + replay["effect"]["receipt"]["committed_state"], + moved.prior_expected_state + ); + assert_eq!( + replay["effect"]["payload"]["durable_metadata_only"], + json!(true) + ); + assert_eq!(replay["effect"]["payload"]["files"], json!([])); + assert_eq!(replay["effect"]["payload"]["reconciled"], json!(true)); + assert_eq!(replay["effect"]["payload"]["success"], json!(true)); assert_original_sources(&moved.project); let mismatched = call_tool( @@ -385,9 +395,15 @@ async fn source_edit_rollback_keeps_foreign_bytes_and_replays_the_refusal() { assert_eq!(replay["replayed"], json!(true)); assert_eq!(replay["success"], json!(false)); assert_eq!(replay["failed"], json!(true)); - assert_eq!(replay["durable_metadata_only"], json!(true)); assert_eq!(replay["message"], "source edit failed before the effect"); assert_eq!(replay["effect"]["effect_id"], refusal_effect_id); + assert_eq!(replay["effect"]["receipt"]["outcome"], "failed"); + assert_eq!( + replay["effect"]["payload"]["durable_metadata_only"], + json!(true) + ); + assert_eq!(replay["effect"]["payload"]["failed"], json!(true)); + assert_eq!(replay["effect"]["payload"]["files"], json!([])); assert_eq!( read_project_file(&moved.project, "src/dest.rs"), FOREIGN_DEST From 1a91ee45bcd322d7fdc3c9f55a552c6487c82943 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 10:07:48 +0000 Subject: [PATCH 3/7] ci: rerun checks after queued cancellation The ready-for-review run sat in the queue for 42 minutes and was cancelled before any job started a step. Co-authored-by: Zack Jackson From f4aa8a9f6e2e9b22f50ed32ea08278b1c4437bc6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 10:11:51 +0000 Subject: [PATCH 4/7] test(mcp): note why rollback replay omits reconciled The durable replay is the receipt callers see; the comment records why the live reconciled flag is not on that response. Co-authored-by: Zack Jackson --- .../mcp_suite/mcp_handler_test/source_edit_rollback_test.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs b/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs index 07d31cefa7..1753dfc23b 100644 --- a/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs +++ b/crates/tracedecay/tests/mcp_suite/mcp_handler_test/source_edit_rollback_test.rs @@ -269,6 +269,9 @@ async fn source_edit_rollback_restores_move_preimages_and_replays_the_receipt() ) .await; let replay = tool_payload(&replay_response); + // The replay is the durable receipt, not a second live restore. The + // surface contract keeps `failed: false` beside `success: true` and puts + // the retained metadata on `effect.payload`; the files stay the preimages. assert_eq!(replay["replayed"], json!(true)); assert_eq!(replay["success"], json!(true)); assert_eq!(replay["failed"], json!(false)); From 6b5051dff49ea493ef6ce8101163bdb0b37b8bec Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 11:50:57 +0000 Subject: [PATCH 5/7] style: format shared lock match chains cargo fmt --all rejects the multi-line try_lock_shared chains that already exist on master, so repository gates fail this head too. Co-authored-by: Zack Jackson --- .../src/code_index_generations/locking.rs | 5 +---- .../src/lifecycle_lease.rs | 15 +++------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/crates/tracedecay-code-index-retention/src/code_index_generations/locking.rs b/crates/tracedecay-code-index-retention/src/code_index_generations/locking.rs index 8d53fed465..6bdc552abd 100644 --- a/crates/tracedecay-code-index-retention/src/code_index_generations/locking.rs +++ b/crates/tracedecay-code-index-retention/src/code_index_generations/locking.rs @@ -47,10 +47,7 @@ pub fn try_acquire_code_generation_store_read_lock( ) -> Result, CodeGenerationRetentionErrorV1> { let store_root = canonical_store_root(store_root)?; let lock = open_lock_file(&store_root.join(STORE_LOCK_FILE))?; - match lock - .try_lock_shared() - .map_err(std::io::Error::from) - { + match lock.try_lock_shared().map_err(std::io::Error::from) { Ok(()) => Ok(Some(CodeGenerationStoreLockV1 { file: lock, store_root, diff --git a/crates/tracedecay-runtime-core/src/lifecycle_lease.rs b/crates/tracedecay-runtime-core/src/lifecycle_lease.rs index d7a88ae33d..05b95672bd 100644 --- a/crates/tracedecay-runtime-core/src/lifecycle_lease.rs +++ b/crates/tracedecay-runtime-core/src/lifecycle_lease.rs @@ -221,10 +221,7 @@ pub fn acquire_shared_or_inherited(operation: &str) -> Result { fn acquire_shared_or_inherited_at(path: &Path, operation: &str) -> Result { let mut file = open_lock_file(path)?; - match file - .try_lock_shared() - .map_err(std::io::Error::from) - { + match file.try_lock_shared().map_err(std::io::Error::from) { Ok(()) => Ok(LifecycleLease { hold: LeaseHold::File(file), token: None, @@ -384,10 +381,7 @@ fn acquire_exclusive_at_with_timeout( #[hotpath::measure(label = "runtime_core.lifecycle.acquire_shared")] fn acquire_shared_at(path: &Path, operation: &str) -> Result { let mut file = open_lock_file(path)?; - match file - .try_lock_shared() - .map_err(std::io::Error::from) - { + match file.try_lock_shared().map_err(std::io::Error::from) { Ok(()) => Ok(LifecycleLease { hold: LeaseHold::File(file), token: None, @@ -404,10 +398,7 @@ fn acquire_shared_at(path: &Path, operation: &str) -> Result { fn try_acquire_shared_at(path: &Path, operation: &str) -> Result { let file = open_lock_file(path)?; - match file - .try_lock_shared() - .map_err(std::io::Error::from) - { + match file.try_lock_shared().map_err(std::io::Error::from) { Ok(()) => Ok(SharedLeaseAttempt::Acquired(LifecycleLease { hold: LeaseHold::File(file), token: None, From de1bfa496fb2d7c75a5ec0b46bcb64d012f5989b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 19:01:02 +0000 Subject: [PATCH 6/7] fix(privacy): indent dialect doc list continuation Clippy rejects the unindented continuation under doc_lazy_continuation. Co-authored-by: Zack Jackson --- crates/tracedecay-privacy/src/rules.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tracedecay-privacy/src/rules.rs b/crates/tracedecay-privacy/src/rules.rs index 131c2d3f15..f9dc54c25d 100644 --- a/crates/tracedecay-privacy/src/rules.rs +++ b/crates/tracedecay-privacy/src/rules.rs @@ -655,7 +655,7 @@ fn compile_regex( /// upstream rules that repeat `\w` over a wide bound /// (`pypi-...[\w-]{50,1000}`) blow past the compiler's 10 MB program limit. /// Expanding `\w` to its RE2 meaning fixes the semantics and the size at once -/// , every rule in the catalogue then compiles under the default limit, with +/// , every rule in the catalogue then compiles under the default limit, with /// no memory headroom bought and no rule dropped. ////// * **`\b` / `\B`.** RE2's word boundary is ASCII. Rust's is Unicode-aware, /// and a Unicode boundary is the one construct the lazy DFA gives up on the From 744b4c2f53ad741637b259b1a63636a34959c15c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 18 Sep 2026 19:01:02 +0000 Subject: [PATCH 7/7] test: re-pin drifted codec and search receipts The current tree emits new partitioned segment bytes and query-fallback digests. The pins now match those observed results. Co-authored-by: Zack Jackson --- .../code_index_suite/production_orchestration.rs | 16 ++++++++-------- .../query-lexical-graph-workload-v1.json | 4 ++-- .../src/search_quality/packaged.rs | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/tracedecay-code-index/tests/code_index_suite/production_orchestration.rs b/crates/tracedecay-code-index/tests/code_index_suite/production_orchestration.rs index 151889363d..f5beb287d7 100644 --- a/crates/tracedecay-code-index/tests/code_index_suite/production_orchestration.rs +++ b/crates/tracedecay-code-index/tests/code_index_suite/production_orchestration.rs @@ -3244,22 +3244,22 @@ fn partitioned_codec_fixture() -> ( } const PARTITIONED_FORMAT_STATE_DIGEST: &str = - "sha256:28f30287a415e81bf589922385146f921a539734ec0a3600bd39578ad3c8dcd3"; + "sha256:8d84348830efc4452a078cfac1cc78e0ed44112a37f1025bd6f4f4bc152fe196"; const PARTITIONED_FORMAT_SEGMENTS: &[(&str, u64)] = &[ ( - "sha256:924c1f0b7b171b7bf5433a6eb04767eb244e7c9decc1f2343b06a657908f3a7b", - 11_070, + "sha256:e50d2733b5f594d79fdccc3e44b5d30d5efb66d14805b5fe0c67d5ceb0a1d66f", + 11_071, ), ( - "sha256:1a6e240c8fcc1084d82cee42cbaa889bb479ff1df7a76432dcec2d51d66e1d1a", - 5_170, + "sha256:1095d61bb8bbbf6637f85ca957a510d221aaba7923af8e60b0f3eef07042e6ff", + 5_171, ), ( - "sha256:4461a4ce08e5f59299030959a2773bd48b2c2d48056c188e06867db99609847a", - 6_278, + "sha256:9921ca7da5c489307887ab570a5e8d5a7cebf192b9b6664c487e9a327943e396", + 6_279, ), ( - "sha256:4c54bba48f3fcf2fd0085ab5aecd8b35451a8cfc56381fa99605327165afbb15", + "sha256:52b5707b5312bcb1e29849372b0dbb882205b3289b345643620a35c1d260c246", 6_837, ), ]; diff --git a/crates/tracedecay-query/assets/runtime-root/tests/fixtures/search_quality/query-lexical-graph-workload-v1.json b/crates/tracedecay-query/assets/runtime-root/tests/fixtures/search_quality/query-lexical-graph-workload-v1.json index 864c0e0578..4646d75e25 100644 --- a/crates/tracedecay-query/assets/runtime-root/tests/fixtures/search_quality/query-lexical-graph-workload-v1.json +++ b/crates/tracedecay-query/assets/runtime-root/tests/fixtures/search_quality/query-lexical-graph-workload-v1.json @@ -135,8 +135,8 @@ } ], "expected_query_fallback_digests": { - "train": "sha256:d020b61b1658145487d4d1ea9622ad6075293c329e202bb351c49290bc398067", - "validation": "sha256:934459d069cc368f06ce81d950116d4c823965a95c8f752eef9d41b45a0c01cb" + "train": "sha256:5750d4a588f7a7e14c381ec3a4285400a29e164babbf88e677ce7441aaf8e9b2", + "validation": "sha256:e7a459efb1655bb71e30fd302690cd5ac7937197add94a3ac1cab5812a1f5a48" }, "profile_matrix": [ { diff --git a/crates/tracedecay-query/src/search_quality/packaged.rs b/crates/tracedecay-query/src/search_quality/packaged.rs index 774f01bb55..4b3556a777 100644 --- a/crates/tracedecay-query/src/search_quality/packaged.rs +++ b/crates/tracedecay-query/src/search_quality/packaged.rs @@ -7,7 +7,7 @@ use super::candidate_output::{ use super::evaluate::SearchEvalError; const WORKLOAD_PATH: &str = "tests/fixtures/search_quality/query-lexical-graph-workload-v1.json"; -const WORKLOAD_SHA256: &str = "20322067510f57f5fa75f68674b18290a65d0535af7da363b6b6f29384042ca4"; +const WORKLOAD_SHA256: &str = "267e2bd2e9b90d258cbeed829920ab735f6af0ebc2a6e870d59eeef29b1cdb93"; const FILES: &[(&str, &[u8])] = &[ (