Skip to content

Update rope plugin and weaverd for rename-symbol capability#74

Merged
leynos merged 4 commits intomainfrom
update-weaver-plugin-rope-manifest-4kvzqk
Mar 6, 2026
Merged

Update rope plugin and weaverd for rename-symbol capability#74
leynos merged 4 commits intomainfrom
update-weaver-plugin-rope-manifest-4kvzqk

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Mar 5, 2026

Summary

  • Introduces the rename-symbol capability across rope plugin and weaverd workflow; legacy rename pathway is deprecated in favor of rename-symbol.
  • Adds contract-conforming request handling with stable ReasonCode diagnostics.

Changes

Core changes

  • Added new module crates/weaver-plugin-rope/src/arguments.rs with RenameSymbolArgs and parse_rename_symbol_arguments.
  • Introduced PluginFailure struct carrying a message and an optional ReasonCode, with Display impl and constructors; updated error handling and failure_response to propagate reason codes as diagnostics.
  • Updated plugin request execution to accept operation "rename-symbol" and to parse arguments via parse_rename_symbol_arguments; map errors to PluginFailure with appropriate ReasonCode (IncompletePayload, SymbolNotFound, OperationNotSupported).
  • Refined rope adapter invocation to pass offset via args.offset() using the new RenameSymbolArgs type.

Refactor handshake and messaging

  • In weaverd, manifest updated to include CapabilityId::RenameSymbol; the handler translates legacy "rename" to "rename-symbol", injects uri from --file, and maps offset to position.
  • PluginRequest construction now uses "rename-symbol" with uri/position/new_name.

Tests

  • rope plugin tests updated to reflect new argument keys (uri, position) and operation name; added tests for incomplete payloads and reason code presence.
  • Behavior tests updated; new test to verify reason codes.
  • Weaverd tests updated to verify the plugin request uses rename-symbol and argument mapping; new contract conformance test added.
  • Feature text updated from "Rename" to "Rename-symbol" in rope_plugin.feature.

Documentation and roadmap

  • docs/roadmap.md: 5.2.2 marked done.
  • docs/users-guide.md: add note that the weaverd handler maps --refactoring rename to rename-symbol and position-mapping; rope-manifest exposes RenameSymbol capability.

Validation plan

  • Build and tests: run cargo check and cargo test across crates:
    • cargo check -p weaver-plugin-rope
    • cargo test -p weaver-plugin-rope
    • cargo test -p weaverd
    • cargo test (workspace)
  • Lint/format: make check-fmt; make lint; make markdownlint (if docs touched).

Acceptance criteria mapping

  • Plugin advertises rename-symbol in capability probes: manifest updated with CapabilityId::RenameSymbol; tests inspect operation name.
  • Request payloads conform to schema: rope plugin now accepts rename-symbol with uri, position, and new_name.
  • Response payloads conform to schema: failure diagnostics carry stable ReasonCode values (IncompletePayload, SymbolNotFound, OperationNotSupported).
  • Legacy provider routing retired: old operation name "rename" is rejected with OperationNotSupported; tests verify this behavior.
  • Weaverd maps user-facing CLI to contract: --refactoring rename maps to rename-symbol; offset -> position mapping is performed in handler.

Quick notes

  • The changes are structured to preserve a 400-line budget by extracting argument parsing into a new arguments module and by centralizing failure diagnostics through PluginFailure.
  • All updated tests exercise reason codes and contract-conformance behavior to ensure robust error reporting.

◳ Generated by DevBoxer


ℹ️ Tag @devboxerhub to ask questions and address PR feedback

📎 Task: https://www.devboxer.com/task/c3aa7b37-2ae5-4c67-a142-80785dc9c47b

Summary by Sourcery

Adopt the new rename-symbol capability end-to-end for the rope plugin and weaverd refactor handler, including contract-conforming arguments, capability metadata, and reason-coded diagnostics, while updating tests and documentation accordingly.

New Features:

  • Add rename-symbol argument parsing module for the rope plugin and switch the plugin operation from rename to rename-symbol with contract-conforming uri/position/new_name arguments.
  • Expose the rope actuator’s rename-symbol capability via the weaverd plugin manifest and translate CLI rename requests to the rename-symbol contract in the daemon handler.

Bug Fixes:

  • Return structured failure diagnostics from the rope plugin with stable ReasonCode values for unsupported operations, incomplete payloads, and symbol-not-found scenarios.

Enhancements:

  • Introduce a PluginFailure error type in the rope plugin to carry messages and optional reason codes through the request/response pipeline.
  • Improve weaverd refactor tests to capture and assert on the exact PluginRequest sent to the runtime for contract conformance.
  • Tidy several markdown documents for formatting consistency and clarity.

Documentation:

  • Document the mapping from --refactoring rename and offset arguments to the rename-symbol capability and position field in the user guide, and mark roadmap item 5.2.2 as complete.
  • Add an execution plan documenting the design, risks, and validation steps for updating the rope plugin manifest and handshake to use rename-symbol.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 5, 2026

Reviewer's Guide

Implements the new rename-symbol capability end-to-end for the rope plugin and weaverd: argument parsing is refactored into a new module, failures now carry structured ReasonCode diagnostics, weaverd advertises the capability and maps CLI rename requests into contract-conforming rename-symbol PluginRequests, tests/BDD/features are updated accordingly, and docs/roadmap/execplans are aligned.

Sequence diagram for CLI rename mapped to rename_symbol plugin request

sequenceDiagram
    actor User
    participant WeaverCli as WeaverCli
    participant Weaverd as WeaverdDaemon
    participant Refactor as SandboxRefactorRuntime
    participant Rope as RopePlugin
    participant Adapter as PythonRopeAdapter

    User->>WeaverCli: run act_refactor --provider rope --refactoring rename --file path new_name=X offset=N
    WeaverCli->>Weaverd: HTTP request act_refactor(provider=rope, refactoring=rename, file, extra_args)
    Weaverd->>Refactor: handle(provider, refactoring, file, extra_args)

    Note over Refactor: Build plugin_args from extra_args
    Refactor->>Refactor: apply_rename_symbol_mapping(plugin_args, file)
    Refactor->>Refactor: effective_operation = rename_symbol

    Refactor->>Rope: PluginRequest(operation=rename_symbol, files=[FilePayload(path,file_content)], arguments={uri,position,new_name})

    Rope->>Rope: run_with_adapter(stdin,stdout,adapter)
    Rope->>Rope: read_request() -> PluginRequest
    Rope->>Rope: execute_request(adapter,request)
    Rope->>Rope: match operation rename_symbol
    Rope->>Rope: execute_rename(adapter,request)
    Rope->>Rope: parse_rename_symbol_arguments(arguments)

    Rope->>Adapter: rename(file, offset, new_name)
    Adapter-->>Rope: modified_content or error

    alt success and content changed
        Rope->>Rope: build_search_replace_patch()
        Rope-->>Weaverd: PluginResponse.success(Diff)
    else adapter error or unchanged
        Rope->>Rope: map error to PluginFailure(reason_code)
        Rope->>Rope: failure_response(PluginFailure)
        Rope-->>Weaverd: PluginResponse.failure(diagnostic with ReasonCode)
    end

    Weaverd-->>WeaverCli: refactor result (diff or diagnostics)
    WeaverCli-->>User: show diff or error with reason_code
Loading

Updated class diagram for rope plugin rename_symbol arguments and failures

classDiagram
    class RenameSymbolArgs {
        -usize offset
        -String new_name
        +offset() usize
        +new_name() &str
    }

    class PluginFailure {
        -String message
        -Option~ReasonCode~ reason_code
        +plain(message String) PluginFailure
        +with_reason(message String, reason ReasonCode) PluginFailure
        +fmt(self, f Formatter) fmtResult
    }

    class RopeAdapter {
        <<interface>>
        +rename(file FilePayload, offset usize, new_name &str) Result~String, RopeAdapterError~
    }

    class RopeAdapterError {
        <<enum>>
    }

    class ReasonCode {
        <<enum>>
        SymbolNotFound
        MacroGenerated
        AmbiguousReferences
        UnsupportedLanguage
        IncompletePayload
        NameConflict
        OperationNotSupported
    }

    class PluginRequest {
        +operation() &str
        +arguments() &HashMap~String, Value~
        +files() &[FilePayload]
    }

    class PluginResponse {
        +failure(diagnostics Vec~PluginDiagnostic~) PluginResponse
    }

    class PluginDiagnostic {
        +new(severity DiagnosticSeverity, message String) PluginDiagnostic
        +with_reason_code(self, code ReasonCode) PluginDiagnostic
    }

    class Functions {
        <<static>>
        +parse_rename_symbol_arguments(arguments &HashMap~String, Value~) Result~RenameSymbolArgs, String~
        +execute_request(adapter RopeAdapter, request &PluginRequest) Result~PluginResponse, PluginFailure~
        +execute_rename(adapter RopeAdapter, request &PluginRequest) Result~PluginResponse, PluginFailure~
        +failure_response(failure PluginFailure) PluginResponse
        +read_request(stdin BufRead) Result~PluginRequest, PluginFailure~
    }

    RenameSymbolArgs ..> PluginRequest : parsed_from_arguments
    PluginFailure --> ReasonCode : optional_reason_code
    PluginFailure ..> PluginResponse : used_by_failure_response
    Functions ..> RenameSymbolArgs : creates
    Functions ..> PluginFailure : returns_on_error
    Functions ..> RopeAdapter : calls_rename
    Functions ..> PluginRequest : reads_operation_and_arguments
    Functions ..> PluginResponse : constructs
    PluginResponse o--> PluginDiagnostic : contains
    PluginDiagnostic --> ReasonCode : optional
Loading

File-Level Changes

Change Details Files
Refactor rope plugin to use rename-symbol operation with structured PluginFailure errors and ReasonCode-aware diagnostics.
  • Introduce PluginFailure struct carrying message and optional ReasonCode, with Display impl and helper constructors for plain vs. reason-coded failures.
  • Change run/read_request/execute_request/execute_rename to return PluginFailure on error, mapping unsupported operations to OperationNotSupported, argument/path issues to IncompletePayload, and adapter/no-change outcomes to SymbolNotFound.
  • Update failure_response to build PluginDiagnostic with attached ReasonCode when present, and switch dispatch to accept only the rename-symbol operation instead of legacy rename.
crates/weaver-plugin-rope/src/lib.rs
Extract rename-symbol argument parsing into a dedicated module and adjust tests/BDD to new uri/position/new_name contract.
  • Add arguments.rs with RenameSymbolArgs and parse_rename_symbol_arguments, validating uri presence, parsing position to usize from string/number, and enforcing non-empty new_name.
  • Update unit tests to build requests using operation rename-symbol with uri/position/new_name, add helpers/assertions for PluginFailure, cover missing/invalid args and ReasonCode expectations.
  • Adjust behaviour tests and rope_plugin.feature steps/scenarios to use rename-symbol wording, require uri/position in requests, and assert presence of reason codes in failure diagnostics.
crates/weaver-plugin-rope/src/arguments.rs
crates/weaver-plugin-rope/src/tests/mod.rs
crates/weaver-plugin-rope/src/tests/behaviour.rs
crates/weaver-plugin-rope/tests/features/rope_plugin.feature
Update weaverd refactor handler and runtime registration to advertise RenameSymbol capability and map CLI rename to contract-conforming rename-symbol PluginRequests.
  • Extend rope PluginManifest construction to call with_capabilities with CapabilityId::RenameSymbol so capability probes see rename-symbol support.
  • In handle(), derive effective_operation that maps --refactoring rename to rename-symbol, apply apply_rename_symbol_mapping to inject uri from --file and rename offset to position, then construct PluginRequest with the effective operation.
  • Introduce apply_rename_symbol_mapping helper plus an InspectingRuntime-based test that asserts the outgoing PluginRequest uses rename-symbol, includes uri/position/new_name, and no longer has offset.
crates/weaverd/src/dispatch/act/refactor/mod.rs
crates/weaverd/src/dispatch/act/refactor/tests.rs
Align documentation, exec plans, roadmap, and repository layout with rename-symbol capability and formatting tweaks.
  • Mark roadmap item 5.2.2 as complete and add a dedicated execplan document describing the manifest/handshake update and validation strategy.
  • Update users-guide act refactor docs to explain that the handler maps --refactoring rename to rename-symbol and offset to position, and that rope now exposes a rename-symbol capability.
  • Apply minor wording/formatting cleanups in execplans, repository-layout, jacquard design docs, and related markdown tables/links for consistency.
docs/roadmap.md
docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md
docs/users-guide.md
docs/execplans/4-1-1-scaffold-sempai-core-and-sempai.md
docs/execplans/5-2-1-define-the-rename-symbol-capability-contract.md
docs/repository-layout.md
docs/jacquard-card-first-symbol-graph-design.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

Summary by CodeRabbit

  • New Features

    • Operation renamed to "rename-symbol" with required uri and position fields; position is a byte-offset.
    • Structured error diagnostics with reason codes (incomplete payload, symbol_not_found, operation_not_supported) for clearer failure feedback.
  • Bug Fixes / Validation

    • Improved argument validation for rename requests and clearer failure messages when arguments are missing or invalid.
  • Documentation

    • User guide and capability docs updated to reflect the rename-symbol contract and new argument semantics.

Walkthrough

Summarise the addition of structured argument parsing and failure modelling for the rename-symbol capability, update the runtime refactor handler to map legacy rename requests to the new contract, and propagate structured PluginFailure diagnostics through plugin execution and tests. (≤50 words)

Changes

Cohort / File(s) Summary
Argument Parsing
crates/weaver-plugin-rope/src/arguments.rs
Add RenameSymbolArgs and parse_rename_symbol_arguments; validate uri, parse position (string/number → usize), require non-empty new_name; private helpers encapsulate parsing and error messages.
Error Handling & Request Execution
crates/weaver-plugin-rope/src/lib.rs
Introduce PluginFailure (message + optional ReasonCode); change read_request, execute_request, execute_rename, run_with_adapter and failure_response to use PluginFailure; map errors to ReasonCode values (OperationNotSupported, IncompletePayload, SymbolNotFound).
Unit Tests (behaviour & mod)
crates/weaver-plugin-rope/src/tests/behaviour.rs, crates/weaver-plugin-rope/src/tests/mod.rs
Update tests to use rename-symbol, inject uri/position, assert ReasonCode values; add assert_any_diagnostic and assert_failure_contains helpers; adapt test world types to carry PluginFailure.
Feature Specs
crates/weaver-plugin-rope/tests/features/rope_plugin.feature
Rename scenarios to "Rename-symbol", require position, update failure assertions to check reason_code and position wording.
Weaverd refactor handler
crates/weaverd/src/dispatch/act/refactor/mod.rs
Declare rope plugin RenameSymbol capability via with_capabilities; add apply_rename_symbol_mapping to convert legacy args (inject uri, map offsetposition); map operation "rename""rename-symbol" before dispatch.
Refactor handler tests
crates/weaverd/src/dispatch/act/refactor/tests.rs
Add InspectingRuntime to capture outgoing PluginRequest; implement RefactorPluginRuntime; add tests verifying URI injection, position mapping, and omission when offset absent.
Documentation & Roadmap
docs/execplans/*, docs/users-guide.md, docs/roadmap.md
Document rename-symbol capability contract and mapping, mark 5.2.2 done, update examples and user-guide to describe uri, position, and structured failures; minor prose reflow.

Sequence Diagram(s)

sequenceDiagram
    actor Client
    participant weaverd as "weaverd\nRefactor Handler"
    participant plugin as "weaver-plugin-rope"
    participant adapter as "Rope Adapter"
    participant lsp as "LSP"

    Client->>weaverd: invoke rename refactoring (may supply offset)
    weaverd->>weaverd: apply_rename_symbol_mapping\n(map rename→rename-symbol,\ninject uri, offset→position)
    weaverd->>plugin: PluginRequest (rename-symbol with uri, position, new_name)
    plugin->>plugin: parse_rename_symbol_arguments\n(validate uri, parse position, check new_name)
    plugin->>adapter: request rename (offset/new_name)
    adapter->>lsp: query symbol/location
    lsp-->>adapter: symbol location
    adapter-->>plugin: diff result or error
    alt Success with diff
        plugin-->>weaverd: PluginResponse (diff)
        weaverd->>Client: apply-patch and return result
    else No change or adapter error
        plugin-->>plugin: produce PluginFailure (ReasonCode::SymbolNotFound)
        plugin-->>weaverd: PluginResponse with failure + reason_code
        weaverd->>Client: surface failure diagnostics
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🔤 Parse the URI, map the place,
Position set, new name in place,
Failures wear a reasoned coat,
Tests and docs join the same note,
Rename-symbol sails, precise and ace.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the primary change: introducing the rename-symbol capability across rope plugin and weaverd. It is specific, avoids vagueness, and directly reflects the main objective of the changeset.
Description check ✅ Passed The description comprehensively relates to the changeset, covering core changes, refactor handshake updates, test modifications, documentation updates, and validation plans. It provides sufficient detail about the rename-symbol capability implementation and contract conformance whilst documenting structural decisions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-weaver-plugin-rope-manifest-4kvzqk

Comment @coderabbitai help to get the list of available commands and usage tips.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Mar 6, 2026

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix:

crates/weaver-plugin-rope/src/tests/behaviour.rs

Comment on file

fn then_failure_has_reason_code(world: &mut World, code: String) {
    let needle = code.trim_matches('"');
    let response = resolved_response(world);
    let diagnostics = response.diagnostics();
    assert!(
        diagnostics
            .iter()
            .any(|d| d.reason_code().is_some_and(|rc| rc.as_str() == needle)),
        "expected reason code '{needle}' in diagnostics: {diagnostics:?}",
    );
}

❌ New issue: Code Duplication
The module contains 2 functions with similar structure: then_failure_contains,then_failure_has_reason_code

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Mar 6, 2026

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix:

crates/weaver-plugin-rope/src/tests/mod.rs

Comment on file

#[test]
fn unsupported_operation_returns_error() {
fn unsupported_operation_returns_error_with_reason_code() {

❌ New issue: Code Duplication
The module contains 2 functions with similar structure: old_rename_operation_rejected_with_operation_not_supported,unsupported_operation_returns_error_with_reason_code

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Mar 6, 2026

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix:

crates/weaverd/src/dispatch/act/refactor/mod.rs

Comment on file

    // Map rename operations to the rename-symbol capability contract.
    // The CLI still accepts `--refactoring rename`; the handler translates
    // to the contract operation name and argument schema.
    let effective_operation = match args.refactoring.as_str() {
        "rename" => {
            plugin_args
                .entry(String::from("uri"))
                .or_insert_with(|| serde_json::Value::String(args.file.clone()));
            if let Some(offset_val) = plugin_args.remove("offset") {
                plugin_args
                    .entry(String::from("position"))
                    .or_insert(offset_val);
            }
            String::from("rename-symbol")
        }
        _ => args.refactoring.clone(),
    };

❌ New issue: Bumpy Road Ahead
handle has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@leynos leynos marked this pull request as ready for review March 6, 2026 11:09
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 6 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="crates/weaver-plugin-rope/src/tests/mod.rs" line_range="133-140" />
<code_context>
+    );
+}
+
 #[rstest]
-#[case::missing_offset(remove_offset as fn(&mut _), Some("offset"))]
-#[case::boolean_offset(set_boolean_offset as fn(&mut _), Some("offset"))]
-#[case::negative_offset(set_negative_offset as fn(&mut _), Some("non-negative integer"))]
-#[case::numeric_offset_succeeds(set_numeric_offset as fn(&mut _), None)]
+#[case::missing_uri(remove_uri as fn(&mut _), Some("uri"))]
+#[case::missing_position(remove_position as fn(&mut _), Some("position"))]
+#[case::boolean_position(set_boolean_position as fn(&mut _), Some("position"))]
+#[case::negative_position(set_negative_position as fn(&mut _), Some("non-negative integer"))]
+#[case::numeric_position_succeeds(set_numeric_position as fn(&mut _), None)]
 #[case::numeric_new_name(set_numeric_new_name as fn(&mut _), Some("new_name argument must be a string"))]
 #[case::empty_new_name(set_empty_new_name as fn(&mut _), Some("new_name"))]
 fn rename_argument_validation(
</code_context>
<issue_to_address>
**suggestion (testing):** Add tests for invalid `uri` values (non-string and empty) to fully exercise `rename-symbol` argument validation

`parse_rename_symbol_arguments` now validates `uri` as required, string-typed, and non-empty, but tests only cover the missing `uri` case. Please add cases for:

- `uri` present but non-string (e.g., boolean/number), asserting the error mentions `"uri argument must be a string"`.
- `uri` present but empty/whitespace-only, asserting the error mentions `"uri argument must not be empty"`.

These can mirror the existing negative cases for `position`/`new_name` and should still surface `ReasonCode::IncompletePayload` via `execute_request`.

Suggested implementation:

```rust
#[rstest]
#[case::missing_uri(remove_uri as fn(&mut _), Some("uri"))]
#[case::boolean_uri(set_boolean_uri as fn(&mut _), Some("uri argument must be a string"))]
#[case::empty_uri(set_empty_uri as fn(&mut _), Some("uri argument must not be empty"))]
#[case::missing_position(remove_position as fn(&mut _), Some("position"))]
#[case::boolean_position(set_boolean_position as fn(&mut _), Some("position"))]
#[case::negative_position(set_negative_position as fn(&mut _), Some("non-negative integer"))]
#[case::numeric_position_succeeds(set_numeric_position as fn(&mut _), None)]
#[case::numeric_new_name(set_numeric_new_name as fn(&mut _), Some("new_name argument must be a string"))]
#[case::empty_new_name(set_empty_new_name as fn(&mut _), Some("new_name"))]
fn rename_argument_validation(

```

You will also need to:
1. Define `set_boolean_uri` and `set_empty_uri` helpers in this test module, following the existing pattern used by `set_boolean_position`, `set_negative_position`, `set_numeric_position`, `set_numeric_new_name`, and `set_empty_new_name`. For example:
   - `set_boolean_uri(args: &mut Value)` should set `args["uri"]` to a boolean (e.g. `Value::Bool(true)`).
   - `set_empty_uri(args: &mut Value)` should set `args["uri"]` to an empty or whitespace-only string (e.g. `Value::String("".into())` or `"   ".into()`), matching how emptiness is validated in `parse_rename_symbol_arguments`.
2. Ensure these helpers are wired into whatever commonrename argumentsbuilder you have (likely something like `rename_arguments` or similar) so that `request_with_args(rename_arguments)` plus the helper mutation produces the invalid payload sent to `execute_request`.
3. If the error messages in `parse_rename_symbol_arguments` differ slightly from those referenced here, adjust the `"uri argument must be a string"` and `"uri argument must not be empty"` substrings to exactly match the implementation so the tests pass.
</issue_to_address>

### Comment 2
<location path="crates/weaverd/src/dispatch/act/refactor/tests.rs" line_range="267-276" />
<code_context>
+    );
+}
+
 #[rstest]
-#[case::missing_offset(remove_offset as fn(&mut _), Some("offset"))]
-#[case::boolean_offset(set_boolean_offset as fn(&mut _), Some("offset"))]
</code_context>
<issue_to_address>
**suggestion (testing):** Extend refactor handler tests to cover pre-existing `uri`/missing `offset` edge cases in the rename-symbol mapping

The current test only covers the happy-path mapping from `--refactoring rename` to a `rename-symbol` request. Please also add coverage for:

- Calls where `plugin_args` already includes a `uri`, to confirm it is not overwritten by `--file`.
- Calls where `offset` is omitted, to confirm the mapping does not introduce a `position` key.

These cases will lock in the contract of `apply_rename_symbol_mapping` and help prevent regressions in future changes.
</issue_to_address>

### Comment 3
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="485" />
<code_context>
+from the beginning of that stage. No destructive operations are involved. The
+new `arguments.rs` file is additive; existing files are edited in place.
+
+## Artifacts and notes
+
+### Line budget analysis
</code_context>
<issue_to_address>
**nitpick (typo):** Align "Artifacts" spelling with the enGB Oxford spelling convention stated earlier in the document.

Per constraint 7 (enGBoxendict), this heading should useArtefacts and notes”.

Suggested implementation:

```
## Artefacts and notes

```

Search the rest of `docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md` (and related execplan documents) for any other occurrences of “Artifacts” or “artifact” and adjust them to “Artefacts/ “artefact” as required by the en‑GB‑oxendict convention, to keep the terminology consistent throughout the documentation set.
</issue_to_address>

### Comment 4
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="63" />
<code_context>
+   items have `///` rustdoc comments.
+7. **en-GB-oxendict spelling.** Comments and documentation use British English
+   with Oxford "-ize" / "-yse" / "-our" spelling.
+8. **rstest-bdd v0.5.0.** BDD tests use v0.5.0 with mutable world fixtures
+   (`&mut`). The fixture parameter must be named exactly `world` (not
+   `_world`). Use `let _ = world;` to suppress unused warnings.
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronymBDDis used here without being expanded on first use in this document.

To follow the style guidance, expand the acronym on first use, for example: `Behaviour-driven development (BDD) tests use v0.5.0 with mutable world fixtures`.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 5
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="69" />
<code_context>
+9. **Lint suppressions must use `#[expect]` with reason**, not `#[allow]`.
+10. **Do not modify `crates/weaver-plugins/`.** The capability contract types
+    from roadmap item 5.2.1 are complete and must not be changed.
+11. **CLI backward compatibility.** Users still pass `--refactoring rename`,
+    `offset=N`, and `new_name=X`. The handler does the translation internally.
+12. **`str_to_string` denied.** Use `String::from()` or `.into()`, not
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “CLI” is introduced without being defined on first use in this document.

Consider expanding this to something like `Command-line interface (CLI) backward compatibility` so the acronym is defined when first introduced.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 6
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="223" />
<code_context>
+  updated in roadmap item 5.2.1 and must NOT be modified in 5.2.2.
+
+- `crates/weaver-plugin-rope/` — The Python rope-backed actuator plugin. A
+  standalone binary crate that reads one JSONL request from stdin and writes
+  one JSONL response to stdout. Main logic is in `src/lib.rs` (384 lines).
+  Tests are in `src/tests/mod.rs` (224 lines) and `src/tests/behaviour.rs` (176
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “JSONL” is used without being expanded on first use in this document.

Please expand JSONL when first mentioned, for example `JSON Lines (JSONL) request`, to comply with the acronym guidance.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread crates/weaver-plugin-rope/src/tests/mod.rs
Comment thread crates/weaverd/src/dispatch/act/refactor/tests.rs Outdated
Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md Outdated
Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md
Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md
Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/weaver-plugin-rope/src/lib.rs`:
- Around line 293-297: The adapter.rename call currently maps all errors to
PluginFailure::with_reason(..., ReasonCode::SymbolNotFound); change the map_err
closure to match on the RopeAdapterError variants returned by adapter.rename:
map semantic misses (e.g., RopeAdapterError::EngineFailed { .. } or whatever
indicates a true rename miss) to PluginFailure::with_reason(...,
ReasonCode::SymbolNotFound), map path/validation errors (e.g.,
RopeAdapterError::InvalidPath { .. }) to PluginFailure::with_reason(...,
ReasonCode::IncompletePayload), and map any other infrastructure faults to
PluginFailure::plain(error.to_string()) so adapter.rename(...) returns the
correct domain vs non-domain diagnostics.

In `@crates/weaverd/src/dispatch/act/refactor/mod.rs`:
- Around line 336-343: In apply_rename_symbol_mapping, stop preserving
caller-supplied "uri" and "position" by replacing the entry-based or_insert
behavior with direct insertion: always set plugin_args["uri"] to
serde_json::Value::String(file.to_owned()) via plugin_args.insert(...), and when
an "offset" value is present (the removed offset_val), set
plugin_args["position"] by inserting that value with plugin_args.insert(...),
ensuring CLI-provided file/offset overwrite any existing fields.

In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md`:
- Around line 151-152: Change the phrase "the acceptance criteria says" to "the
acceptance criteria say" in the rationale sentence (the fragment shown as "the
acceptance criteria says") to fix subject–verb agreement and ensure the sentence
follows en-GB-oxendict grammar conventions; update that single sentence in the
rationale paragraph while keeping the rest of the wording and dual-support
rationale intact.

In `@docs/jacquard-card-first-symbol-graph-design.md`:
- Around line 834-839: The single-line reference chain "[1]: weaver-design.md
[2]: ../crates/weaverd/src/dispatch/router.rs [3]:
../crates/weaverd/src/backends.rs [4]:
../crates/weaverd/src/semantic_provider/mod.rs [5]:
../crates/weaver-graph/src/provider.rs [6]:
<https://github.com/GlitterKill/sdl-mcp> [7]:
../crates/weaverd/src/dispatch/request.rs [8]:
../crates/weaver-graph/src/uri.rs" must be split so each reference definition is
on its own line (e.g., "[1]: weaver-design.md" on one line, then "[2]:
../crates/weaverd/src/dispatch/router.rs" on the next, etc.), and ensure each
resulting line is wrapped to <=80 columns to satisfy markdownlint and paragraph
wrapping rules.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a5315461-d135-408c-806b-f523504d2a89

📥 Commits

Reviewing files that changed from the base of the PR and between 596fff2 and b04dc17.

📒 Files selected for processing (14)
  • crates/weaver-plugin-rope/src/arguments.rs
  • crates/weaver-plugin-rope/src/lib.rs
  • crates/weaver-plugin-rope/src/tests/behaviour.rs
  • crates/weaver-plugin-rope/src/tests/mod.rs
  • crates/weaver-plugin-rope/tests/features/rope_plugin.feature
  • crates/weaverd/src/dispatch/act/refactor/mod.rs
  • crates/weaverd/src/dispatch/act/refactor/tests.rs
  • docs/execplans/4-1-1-scaffold-sempai-core-and-sempai.md
  • docs/execplans/5-2-1-define-the-rename-symbol-capability-contract.md
  • docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md
  • docs/jacquard-card-first-symbol-graph-design.md
  • docs/repository-layout.md
  • docs/roadmap.md
  • docs/users-guide.md

Comment thread crates/weaver-plugin-rope/src/lib.rs
Comment thread crates/weaverd/src/dispatch/act/refactor/mod.rs Outdated
Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md Outdated
Comment thread docs/jacquard-card-first-symbol-graph-design.md Outdated
leynos and others added 3 commits March 6, 2026 12:25
…tructured failures

- Extract argument parsing for rename-symbol to a new `arguments` module
- Validate and parse `uri`, `position`, and `new_name` arguments per contract
- Introduce `PluginFailure` struct to carry error messages with optional reason codes
- Update plugin dispatch to accept `rename-symbol` operation and reject old `rename` with proper reason code
- Return failure diagnostics with stable ReasonCode values
- Update `weaverd` refactor handler to register rename-symbol capability and translate CLI `rename` to `rename-symbol` with argument mapping
- Adapt tests and BDD scenarios for the new contract and failure semantics
- Update documentation and roadmap entries accordingly

This completes rename-symbol capability conformance and enhances diagnostic structure with reason codes.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
…d map rename args in refactor handler

- Introduce assert_any_diagnostic helper to centralize diagnostic assertions in plugin-rope tests.
- Parametrize unsupported operations test with rstest and merge similar test cases.
- Refactor rename argument handling in weaverd refactor handler to map `rename` to `rename-symbol` contract and transform args accordingly.
- Clean up imports and simplify code comments for clarity.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
- Differentiate infrastructure vs semantic adapter failures in
  execute_rename: only EngineFailed emits SymbolNotFound reason code
- Force-overwrite uri/position in apply_rename_symbol_mapping via insert
- Add boolean_uri and empty_uri validation test cases
- Add handler tests for pre-existing uri overwrite and missing offset
- Fix spelling: Artifacts → Artefacts, criteria says → criteria say
- Expand acronyms on first use: BDD, CLI, JSONL
- Restore one-per-line reference definitions in jacquard doc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@devboxerhub devboxerhub Bot force-pushed the update-weaver-plugin-rope-manifest-4kvzqk branch from b04dc17 to e147b36 Compare March 6, 2026 12:27
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md`:
- Line 335: The doc line containing "Update parameterised
`rename_argument_validation` test cases for new" uses British spelling
"parameterised"; update that occurrence to the repository's Oxford -ize form
"parameterized" so the line reads "Update parameterized
`rename_argument_validation` test cases for new", keeping the surrounding text
and the `rename_argument_validation` identifier unchanged.
- Around line 42-43: The long bullet beginning "Behaviour-driven development
(BDD) scenarios cover happy path, missing arguments, unsupported operation,
adapter failure, unchanged output, and reason code verification." must be
wrapped to 80 columns or less to satisfy MD013; edit the bullet in the
docs/execplans entry (the list item text) and split it into multiple
continuation lines (breaking after commas or logical phrase boundaries) so each
line is ≤80 characters while preserving the same content and punctuation.

In `@docs/users-guide.md`:
- Around line 574-580: The docs are inconsistent about the refactor contract's
position semantics (some places say UTF-8 byte offset, others say line:column).
Update the contract section so "position" consistently means the UTF-8 byte
offset integer (matching the `offset` field behavior), change any examples like
`10:5` to numeric offsets, and update descriptions and validation rules for
`position` and `offset` (e.g., "Non-negative integer, provided as a number or
numeric string") so callers use a single semantic model; search for occurrences
of `position`, `offset`, `--refactoring`, and `rename` in the refactor docs and
harmonize them accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 92eca7bc-f4ba-470f-ad25-a6aa06e75806

📥 Commits

Reviewing files that changed from the base of the PR and between b04dc17 and e147b36.

📒 Files selected for processing (11)
  • crates/weaver-plugin-rope/src/arguments.rs
  • crates/weaver-plugin-rope/src/lib.rs
  • crates/weaver-plugin-rope/src/tests/behaviour.rs
  • crates/weaver-plugin-rope/src/tests/mod.rs
  • crates/weaver-plugin-rope/tests/features/rope_plugin.feature
  • crates/weaverd/src/dispatch/act/refactor/mod.rs
  • crates/weaverd/src/dispatch/act/refactor/tests.rs
  • docs/execplans/5-2-1-define-the-rename-symbol-capability-contract.md
  • docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md
  • docs/roadmap.md
  • docs/users-guide.md

Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md Outdated
Comment thread docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md Outdated
Comment thread docs/users-guide.md
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Mar 6, 2026

@coderabbitai Have the following now been resolved?

Annul any requirements that violate the en-GB-oxendict spelling (-ize / -yse / -our) conventions, or where the requirement unnecessarily increases cyclomatic complexity.

Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="crates/weaver-plugin-rope/src/tests/mod.rs" line_range="133-140" />
<code_context>
+    );
+}
+
 #[rstest]
-#[case::missing_offset(remove_offset as fn(&mut _), Some("offset"))]
-#[case::boolean_offset(set_boolean_offset as fn(&mut _), Some("offset"))]
-#[case::negative_offset(set_negative_offset as fn(&mut _), Some("non-negative integer"))]
-#[case::numeric_offset_succeeds(set_numeric_offset as fn(&mut _), None)]
+#[case::missing_uri(remove_uri as fn(&mut _), Some("uri"))]
+#[case::missing_position(remove_position as fn(&mut _), Some("position"))]
+#[case::boolean_position(set_boolean_position as fn(&mut _), Some("position"))]
+#[case::negative_position(set_negative_position as fn(&mut _), Some("non-negative integer"))]
+#[case::numeric_position_succeeds(set_numeric_position as fn(&mut _), None)]
 #[case::numeric_new_name(set_numeric_new_name as fn(&mut _), Some("new_name argument must be a string"))]
 #[case::empty_new_name(set_empty_new_name as fn(&mut _), Some("new_name"))]
 fn rename_argument_validation(
</code_context>
<issue_to_address>
**suggestion (testing):** Add tests for invalid `uri` values (non-string and empty) to fully exercise `rename-symbol` argument validation

`parse_rename_symbol_arguments` now validates `uri` as required, string-typed, and non-empty, but tests only cover the missing `uri` case. Please add cases for:

- `uri` present but non-string (e.g., boolean/number), asserting the error mentions `"uri argument must be a string"`.
- `uri` present but empty/whitespace-only, asserting the error mentions `"uri argument must not be empty"`.

These can mirror the existing negative cases for `position`/`new_name` and should still surface `ReasonCode::IncompletePayload` via `execute_request`.

Suggested implementation:

```rust
#[rstest]
#[case::missing_uri(remove_uri as fn(&mut _), Some("uri"))]
#[case::boolean_uri(set_boolean_uri as fn(&mut _), Some("uri argument must be a string"))]
#[case::empty_uri(set_empty_uri as fn(&mut _), Some("uri argument must not be empty"))]
#[case::missing_position(remove_position as fn(&mut _), Some("position"))]
#[case::boolean_position(set_boolean_position as fn(&mut _), Some("position"))]
#[case::negative_position(set_negative_position as fn(&mut _), Some("non-negative integer"))]
#[case::numeric_position_succeeds(set_numeric_position as fn(&mut _), None)]
#[case::numeric_new_name(set_numeric_new_name as fn(&mut _), Some("new_name argument must be a string"))]
#[case::empty_new_name(set_empty_new_name as fn(&mut _), Some("new_name"))]
fn rename_argument_validation(

```

You will also need to:
1. Define `set_boolean_uri` and `set_empty_uri` helpers in this test module, following the existing pattern used by `set_boolean_position`, `set_negative_position`, `set_numeric_position`, `set_numeric_new_name`, and `set_empty_new_name`. For example:
   - `set_boolean_uri(args: &mut Value)` should set `args["uri"]` to a boolean (e.g. `Value::Bool(true)`).
   - `set_empty_uri(args: &mut Value)` should set `args["uri"]` to an empty or whitespace-only string (e.g. `Value::String("".into())` or `"   ".into()`), matching how emptiness is validated in `parse_rename_symbol_arguments`.
2. Ensure these helpers are wired into whatever common “rename arguments” builder you have (likely something like `rename_arguments` or similar) so that `request_with_args(rename_arguments)` plus the helper mutation produces the invalid payload sent to `execute_request`.
3. If the error messages in `parse_rename_symbol_arguments` differ slightly from those referenced here, adjust the `"uri argument must be a string"` and `"uri argument must not be empty"` substrings to exactly match the implementation so the tests pass.
</issue_to_address>

### Comment 2
<location path="crates/weaverd/src/dispatch/act/refactor/tests.rs" line_range="267-276" />
<code_context>
+    );
+}
+
 #[rstest]
-#[case::missing_offset(remove_offset as fn(&mut _), Some("offset"))]
-#[case::boolean_offset(set_boolean_offset as fn(&mut _), Some("offset"))]
</code_context>
<issue_to_address>
**suggestion (testing):** Extend refactor handler tests to cover pre-existing `uri`/missing `offset` edge cases in the rename-symbol mapping

The current test only covers the happy-path mapping from `--refactoring rename` to a `rename-symbol` request. Please also add coverage for:

- Calls where `plugin_args` already includes a `uri`, to confirm it is not overwritten by `--file`.
- Calls where `offset` is omitted, to confirm the mapping does not introduce a `position` key.

These cases will lock in the contract of `apply_rename_symbol_mapping` and help prevent regressions in future changes.
</issue_to_address>

### Comment 3
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="485" />
<code_context>
+from the beginning of that stage. No destructive operations are involved. The
+new `arguments.rs` file is additive; existing files are edited in place.
+
+## Artifacts and notes
+
+### Line budget analysis
</code_context>
<issue_to_address>
**nitpick (typo):** Align "Artifacts" spelling with the en‑GB Oxford spelling convention stated earlier in the document.

Per constraint 7 (en‑GB‑oxendict), this heading should use “Artefacts and notes”.

Suggested implementation:

```
## Artefacts and notes

```

Search the rest of `docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md` (and related execplan documents) for any other occurrences of “Artifacts” or “artifact” and adjust them to “Artefacts” / “artefact” as required by the en‑GB‑oxendict convention, to keep the terminology consistent throughout the documentation set.
</issue_to_address>

### Comment 4
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="63" />
<code_context>
+   items have `///` rustdoc comments.
+7. **en-GB-oxendict spelling.** Comments and documentation use British English
+   with Oxford "-ize" / "-yse" / "-our" spelling.
+8. **rstest-bdd v0.5.0.** BDD tests use v0.5.0 with mutable world fixtures
+   (`&mut`). The fixture parameter must be named exactly `world` (not
+   `_world`). Use `let _ = world;` to suppress unused warnings.
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “BDD” is used here without being expanded on first use in this document.

To follow the style guidance, expand the acronym on first use, for example: `Behaviour-driven development (BDD) tests use v0.5.0 with mutable world fixtures`.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 5
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="69" />
<code_context>
+9. **Lint suppressions must use `#[expect]` with reason**, not `#[allow]`.
+10. **Do not modify `crates/weaver-plugins/`.** The capability contract types
+    from roadmap item 5.2.1 are complete and must not be changed.
+11. **CLI backward compatibility.** Users still pass `--refactoring rename`,
+    `offset=N`, and `new_name=X`. The handler does the translation internally.
+12. **`str_to_string` denied.** Use `String::from()` or `.into()`, not
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “CLI” is introduced without being defined on first use in this document.

Consider expanding this to something like `Command-line interface (CLI) backward compatibility` so the acronym is defined when first introduced.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 6
<location path="docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md" line_range="223" />
<code_context>
+  updated in roadmap item 5.2.1 and must NOT be modified in 5.2.2.
+
+- `crates/weaver-plugin-rope/` — The Python rope-backed actuator plugin. A
+  standalone binary crate that reads one JSONL request from stdin and writes
+  one JSONL response to stdout. Main logic is in `src/lib.rs` (384 lines).
+  Tests are in `src/tests/mod.rs` (224 lines) and `src/tests/behaviour.rs` (176
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “JSONL” is used without being expanded on first use in this document.

Please expand JSONL when first mentioned, for example `JSON Lines (JSONL) request`, to comply with the acronym guidance.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 6, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

I'll read the relevant files to determine the current state before evaluating each comment.


🏁 Script executed:

#!/bin/bash
echo "=== weaver-plugin-rope/src/tests/mod.rs ==="
cat crates/weaver-plugin-rope/src/tests/mod.rs

echo ""
echo "=== weaver-plugin-rope/src/arguments.rs ==="
cat crates/weaver-plugin-rope/src/arguments.rs

echo ""
echo "=== weaverd/src/dispatch/act/refactor/tests.rs (last 150 lines) ==="
tail -n 150 crates/weaverd/src/dispatch/act/refactor/tests.rs

echo ""
echo "=== docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md (first 80 lines) ==="
head -n 80 docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md

echo ""
echo "=== docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md: grep Artifact/artifact/JSONL/BDD/CLI ==="
grep -n "Artifact\|artifact\|JSONL\|BDD\|CLI" docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md | head -40

Length of output: 23020


@leynos: All six comments are resolved in the current state of the branch. Here is the full accounting, plus one observation worth verifying.


Comment 1 — invalid uri test cases ✅ Resolved

set_boolean_uri, set_empty_uri, and the two new #[case] rows are already present:

#[case::boolean_uri(set_boolean_uri as fn(&mut _), Some("uri argument must be a string"))]
#[case::empty_uri(set_empty_uri as fn(&mut _), Some("uri argument must not be empty"))]

The expected substrings match the error messages produced by validate_uri in arguments.rs exactly.


Comment 2 — refactor handler edge-case tests ✅ Addressed

Both tests exist in tests.rs:

  • handler_overwrites_pre_existing_uri_with_file_path — covers the pre-existing uri case.
  • handler_omits_position_when_offset_not_provided — covers the missing offset case.

One point to verify: Comment 2 asked to confirm that a pre-existing uri is not overwritten by --file, but the test name and assertion say the opposite — that --file does overwrite any uri=stale_value extra arg. If the production apply_rename_symbol_mapping still uses .or_insert_with(...), that assertion will fail. Check whether mod.rs was updated to force-assign uri unconditionally; if the or_insert_with variant is still in place, the test will need its assertion (or the implementation) corrected.


Comment 3 — "Artefacts" spelling ✅ Resolved

grep finds no occurrences of Artifact or artifact in the document; the en-GB-oxendict form is in use throughout.


Comment 4 — "BDD" acronym ✅ Resolved

Line 42 of the document reads:

"Behaviour-driven development (BDD) scenarios cover happy path…"

The acronym is expanded on first use.


Comment 5 — "CLI" acronym ✅ Resolved

Line 41 reads:

"…preserving command-line interface (CLI) backward compatibility."

Expanded on first use.


Comment 6 — "JSONL" acronym ✅ Resolved

Line 223 reads:

"…reads one JSON Lines (JSONL) request from stdin…"

Expanded on first use.


Annulments

No comments need to be annulled. None introduce en-GB-oxendict violations (Comments 3–6 actively enforce the convention), and none require production-code changes that would increase cyclomatic complexity (Comment 2's additions are test-only).

…scriptions

- Rename operation from `rename` to `rename-symbol` for clarity.
- Change argument `offset` to `position` and add new `uri` argument.
- Update user guide and execution plan docs to reflect these changes.
- Clarify `position` is a UTF-8 byte offset.
- Fix typos and improve formatting in BDD scenarios descriptions.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (3)
docs/users-guide.md (1)

753-753: ⚠️ Potential issue | 🟠 Major

Fix the position field type to match byte-offset semantics.

Replace string with the contract’s numeric offset typing, or explicitly document dual acceptance (number and numeric string). Keep one model throughout the guide; the current type cell conflicts with the neighbouring parameter rules and will cause incompatible payloads.

🛠️ Proposed doc fix
-| `position` | string | Position of the symbol as a UTF-8 byte offset.   |
+| `position` | integer \| string | UTF-8 byte offset of the symbol (for example `4` or `"4"`). |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/users-guide.md` at line 753, Update the docs to make the `position`
field's type consistent with the contract byte-offset semantics: change the
table cell that currently lists `position` as "string" to use a numeric offset
type (e.g., "number" or "integer (byte offset)"), or explicitly state that
`position` accepts both a numeric value and a numeric string (and normalize
which one the API expects). Ensure this single model is used everywhere the
`position` symbol appears (including the parameter rules and examples) so
payloads are compatible and unambiguous.
docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md (2)

42-44: ⚠️ Potential issue | 🟡 Minor

Wrap the overlong bullet to satisfy MD013 and coding guidelines.

Split this bullet into continuation lines breaking after commas. Each line must not exceed 80 characters.

🛠️ Proposed fix
-- Behaviour-driven development (BDD) scenarios cover happy path,
-  missing arguments, unsupported operation, adapter failure,
-  unchanged output, and reason code verification.
+- Behaviour-driven development (BDD) scenarios cover happy path, missing
+  arguments, unsupported operation, adapter failure, unchanged output, and
+  reason code verification.
🤖 Prompt for AI agents
Verify each finding against the current code and fix only if needed.

In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md` at lines 42-44, wrap the bullet beginning "Behaviour-driven development (BDD) scenarios cover happy path, missing arguments, unsupported operation, adapter failure, unchanged output, and reason code verification." to 80 columns by inserting line breaks after commas while preserving the list item formatting and all content.

As per coding guidelines, Markdown paragraphs and bullet points must be wrapped at 80 columns.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md` around lines 42 -
44, Locate the bullet that starts "Behaviour-driven development (BDD) scenarios
cover happy path, missing arguments, unsupported operation, adapter failure,
unchanged output, and reason code verification." and wrap it to 80 columns by
inserting line breaks after commas so each continuation line is <=80 characters,
preserving the leading list marker and indentation and keeping the full original
text and commas intact; ensure no other content changes.

89-89: ⚠️ Potential issue | 🟡 Minor

Fix subject–verb agreement in the Ambiguity tolerance.

Replace "The acceptance criteria states" with "The acceptance criteria state". The noun "criteria" is plural and requires the plural verb form.

🛠️ Proposed fix
-- **Ambiguity:** The acceptance criteria states "Legacy provider routing is not
+- **Ambiguity:** The acceptance criteria state "Legacy provider routing is not
🤖 Prompt for AI agents
Verify each finding against the current code and fix only if needed.

In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md` at line 89, change "The acceptance criteria states" to "The acceptance criteria state" to fix the subject–verb disagreement (criteria is plural).

As per coding guidelines, documentation must use en-GB-oxendict spelling and grammar.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md` at line 89, Fix
the subject–verb agreement in the "Ambiguity" line where the phrase reads "The
acceptance criteria states" — change it to "The acceptance criteria state"
(criteria is plural); update the sentence in the Ambiguity section of the
5-2-2-update-weaver-plugin-rope-manifest document and ensure the rest of the
sentence follows en-GB-oxendict spelling and grammar conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md`:
- Around line 42-44: Locate the bullet that starts "Behaviour-driven development
(BDD) scenarios cover happy path, missing arguments, unsupported operation,
adapter failure, unchanged output, and reason code verification." and wrap it to
80 columns by inserting line breaks after commas so each continuation line is
<=80 characters, preserving the leading list marker and indentation and keeping
the full original text and commas intact; ensure no other content changes.
- Line 89: Fix the subject–verb agreement in the "Ambiguity" line where the
phrase reads "The acceptance criteria states" — change it to "The acceptance
criteria state" (criteria is plural); update the sentence in the Ambiguity
section of the 5-2-2-update-weaver-plugin-rope-manifest document and ensure the
rest of the sentence follows en-GB-oxendict spelling and grammar conventions.

In `@docs/users-guide.md`:
- Line 753: Update the docs to make the `position` field's type consistent with
the contract byte-offset semantics: change the table cell that currently lists
`position` as "string" to use a numeric offset type (e.g., "number" or "integer
(byte offset)"), or explicitly state that `position` accepts both a numeric
value and a numeric string (and normalize which one the API expects). Ensure
this single model is used everywhere the `position` symbol appears (including
the parameter rules and examples) so payloads are compatible and unambiguous.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1f4d9bbd-b945-49ea-bc8b-511d37e89946

📥 Commits

Reviewing files that changed from the base of the PR and between e147b36 and df701c1.

📒 Files selected for processing (2)
  • docs/execplans/5-2-2-update-weaver-plugin-rope-manifest.md
  • docs/users-guide.md

@leynos leynos merged commit d3984ec into main Mar 6, 2026
11 checks passed
@leynos leynos deleted the update-weaver-plugin-rope-manifest-4kvzqk branch March 6, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant