This is an automated email from the ASF dual-hosted git repository.

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 25fa8a70da1 Improve MCP readwrite-splitting status planning (#39164)
25fa8a70da1 is described below

commit 25fa8a70da12ac6897d0af9880398a33c3021faf
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jul 17 15:13:35 2026 +0800

    Improve MCP readwrite-splitting status planning (#39164)
    
    - fail status plans early when Proxy is not in Cluster mode
    - return terminal guidance and document the Cluster requirement
    - cover Cluster and Standalone paths with unit and Proxy E2E tests
---
 AGENTS.md                                            |  4 ++++
 .../service/ReadwriteSplittingInspectionService.java |  7 +++++++
 ...dwriteSplittingStatusWorkflowPlanningService.java | 18 +++++++++++++++++-
 .../mcp-descriptor-readwrite-splitting.yaml          |  8 +++++---
 .../prompts/plan-readwrite-splitting-status.md       |  4 +++-
 .../ReadwriteSplittingInspectionServiceTest.java     | 14 ++++++++++++++
 ...adwriteSplittingWorkflowPlanningServicesTest.java | 20 +++++++++++++++++++-
 .../support/workflow/model/WorkflowIssueCode.java    |  2 ++
 .../service/WorkflowGuidancePayloadBuilder.java      |  3 +++
 .../service/WorkflowPlanPayloadBuilderTest.java      | 19 +++++++++++++++++++
 ...roductionProxyFeatureWorkflowContractE2ETest.java | 16 +++++++++-------
 11 files changed, 102 insertions(+), 13 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md
index 21ebcf9c2f8..4414b9ad287 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -125,6 +125,10 @@ This guide is written **for AI coding agents only**. 
Follow it literally; improv
       Record the reason in the plan, review note, final response, or nearby 
code rationale.
 - **Complete Implementation**: no MVPs/placeholders/TODOs—deliver fully 
runnable solutions.
 
+### Dead Code Verification
+- Before declaring code unused, use semantic Find Usages; otherwise search the 
entire repository, covering direct calls, method references, generated 
accessors, overrides, reflection, SPI/framework registrations, tests, E2E, and 
external consumers.
+- Inspect every match; one regex or production-only search is insufficient 
evidence.
+
 ### Constructor Design Rules
 - Before adding or changing a constructor, inspect nearby production code and 
follow the module's existing conventions for visibility, Lombok, validation, 
and tests.
 - Keep only constructors with distinct production semantics or real framework, 
SPI, reflection, or serialization requirements.
diff --git 
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionService.java
 
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionService.java
index c8eb70a1344..ff509704a18 100644
--- 
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionService.java
+++ 
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionService.java
@@ -20,6 +20,7 @@ package 
org.apache.shardingsphere.mcp.feature.readwritesplitting.tool.service;
 import 
org.apache.shardingsphere.mcp.api.protocol.exception.MCPQueryFailedException;
 import 
org.apache.shardingsphere.mcp.support.database.spi.MCPFeatureQueryFacade;
 import 
org.apache.shardingsphere.mcp.support.workflow.service.WorkflowDistSQLQueryUtils;
+import 
org.apache.shardingsphere.mcp.support.workflow.service.WorkflowRuleValueUtils;
 import org.apache.shardingsphere.mcp.support.workflow.service.WorkflowSQLUtils;
 
 import java.util.LinkedHashMap;
@@ -32,6 +33,12 @@ import java.util.Map;
  */
 public final class ReadwriteSplittingInspectionService {
     
+    String queryProxyMode(final MCPFeatureQueryFacade queryFacade, final 
String databaseName) {
+        String result = queryFacade.query(databaseName, "SHOW COMPUTE NODE 
INFO").stream().findFirst()
+                .map(each -> WorkflowRuleValueUtils.getRuleValue(each, 
"mode_type")).orElse("");
+        return result.isEmpty() ? "unknown" : result;
+    }
+    
     /**
      * Query readwrite-splitting rules.
      *
diff --git 
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingStatusWorkflowPlanningService.java
 
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingStatusWorkflowPlanningService.java
index fa8d9884a0c..08170cae6d7 100644
--- 
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingStatusWorkflowPlanningService.java
+++ 
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingStatusWorkflowPlanningService.java
@@ -39,9 +39,11 @@ import java.util.Map;
  */
 public final class ReadwriteSplittingStatusWorkflowPlanningService {
     
+    private static final String CLUSTER_MODE = "Cluster";
+    
     private static final List<String> INTERACTION_STEPS = List.of(
             "Confirm database, rule, read storage unit and target status",
-            "Inspect DistSQL-visible readwrite-splitting status",
+            "Confirm Cluster mode and inspect DistSQL-visible 
readwrite-splitting status",
             "Generate readwrite-splitting status DistSQL artifact",
             "Review artifacts and choose execution mode",
             "Execute or export artifacts",
@@ -75,6 +77,9 @@ public final class 
ReadwriteSplittingStatusWorkflowPlanningService {
             return workflowSessionContext.persist(result, 
WorkflowLifecycle.STEP_CLARIFYING, result.getStatus());
         }
         queryFacade.checkDatabaseCapability(mergedRequest.getDatabase());
+        if (!ensureClusterMode(inspectionService.queryProxyMode(queryFacade, 
mergedRequest.getDatabase()), result)) {
+            return workflowSessionContext.persist(result, 
WorkflowLifecycle.STEP_FAILED, WorkflowLifecycle.STATUS_FAILED);
+        }
         List<Map<String, Object>> statuses = 
inspectionService.queryRuleStatus(queryFacade, mergedRequest.getDatabase(), 
mergedRequest.getRuleName());
         if (!ensureTargetStatusRow(mergedRequest, statuses, result, 
queryFacade)) {
             return workflowSessionContext.persist(result, 
WorkflowLifecycle.STEP_FAILED, WorkflowLifecycle.STATUS_FAILED);
@@ -130,6 +135,17 @@ public final class 
ReadwriteSplittingStatusWorkflowPlanningService {
         return true;
     }
     
+    private boolean ensureClusterMode(final String proxyMode, final 
WorkflowContextSnapshot snapshot) {
+        if (CLUSTER_MODE.equalsIgnoreCase(proxyMode)) {
+            return true;
+        }
+        snapshot.getIssues().add(new 
WorkflowIssue(WorkflowIssueCode.CLUSTER_MODE_REQUIRED, "error", 
WorkflowLifecycle.STEP_DISCOVERING,
+                String.format("Readwrite-splitting storage-unit status changes 
require Cluster mode; current Proxy mode is `%s`.", proxyMode),
+                "Connect MCP to a Cluster-mode ShardingSphere Proxy, then 
start a new readwrite-splitting status plan.", false,
+                Map.of("required_mode", CLUSTER_MODE, "actual_mode", 
proxyMode)));
+        return false;
+    }
+    
     private void addMissingInput(final List<String> missingInputs, final 
String value, final String fieldName) {
         if (value.isEmpty()) {
             missingInputs.add(fieldName);
diff --git 
a/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/mcp-descriptors/mcp-descriptor-readwrite-splitting.yaml
 
b/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/mcp-descriptors/mcp-descriptor-readwrite-splitting.yaml
index 7db6b9f21e2..4c423c0ce4a 100644
--- 
a/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/mcp-descriptors/mcp-descriptor-readwrite-splitting.yaml
+++ 
b/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/mcp-descriptors/mcp-descriptor-readwrite-splitting.yaml
@@ -183,7 +183,7 @@ prompts:
         - "Ask before applying generated readwrite-splitting rule DistSQL that 
changes runtime state."
   - name: plan_readwrite_splitting_status
     title: Plan Readwrite-Splitting Status
-    description: "Guide the model to plan a readwrite-splitting storage-unit 
enable or disable workflow by reading current status first."
+    description: "Guide the model to plan a Cluster-mode readwrite-splitting 
storage-unit enable or disable workflow by reading current status first."
     binding:
       templateResource: 
META-INF/shardingsphere-mcp/prompts/plan-readwrite-splitting-status.md
     arguments:
@@ -218,6 +218,7 @@ prompts:
       org.apache.shardingsphere/stop-conditions:
         - "Stop after database_gateway_plan_readwrite_splitting_status returns 
a planned workflow with plan_id and reviewable artifacts."
         - "Stop after a clarifying response lists missing inputs instead of 
guessing storage unit status."
+        - "Stop and report the Cluster-mode requirement after a failed plan 
returns WF-MODE-002; do not call apply or repeat the planning tool."
       org.apache.shardingsphere/ask-user-conditions:
         - "Ask when database, rule name, read storage unit, or target status 
is unclear."
         - "Ask before applying generated readwrite-splitting status DistSQL 
that changes runtime state."
@@ -563,8 +564,9 @@ tools:
   - name: database_gateway_plan_readwrite_splitting_status
     title: Plan Readwrite-Splitting Status
     description: >-
-      Plan a ShardingSphere readwrite-splitting read storage-unit enable or 
disable workflow. This tool creates reviewable status DistSQL artifacts
-      but does not execute them; use database_gateway_apply_workflow only 
after user review.
+      Plan a ShardingSphere readwrite-splitting read storage-unit enable or 
disable workflow. The current Proxy must run in Cluster mode;
+      otherwise this tool returns a failed plan without DistSQL artifacts. It 
does not execute generated artifacts;
+      use database_gateway_apply_workflow only after user review.
     inputSchema:
       type: object
       properties:
diff --git 
a/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/prompts/plan-readwrite-splitting-status.md
 
b/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/prompts/plan-readwrite-splitting-status.md
index 5949a60f111..52a74260bc8 100644
--- 
a/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/prompts/plan-readwrite-splitting-status.md
+++ 
b/mcp/features/readwrite-splitting/src/main/resources/META-INF/shardingsphere-mcp/prompts/plan-readwrite-splitting-status.md
@@ -9,5 +9,7 @@ Inputs:
 
 Before calling the planning tool, read current status from 
shardingsphere://features/readwrite-splitting/databases/{database}/rules/{rule}/status.
 Ask the user for the rule name, read storage unit, or target status when any 
input is missing.
-Return after database_gateway_plan_readwrite_splitting_status produces a 
plan_id or a clarification response.
+The status change requires a Cluster-mode ShardingSphere Proxy; the planning 
tool verifies the current Proxy mode before generating DistSQL.
+Return after database_gateway_plan_readwrite_splitting_status produces a 
planned, failed, or clarification response.
+If the plan reports `WF-MODE-002`, explain that Cluster mode is required and 
stop without calling apply or repeating the planning tool.
 Do not create, alter, unregister, or repair storage units, and do not generate 
physical DDL, index DDL, migration, backfill, data probes, or physical metadata 
probes.
diff --git 
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionServiceTest.java
 
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionServiceTest.java
index bd79df94e5b..1e9d25c654c 100644
--- 
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionServiceTest.java
+++ 
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingInspectionServiceTest.java
@@ -38,6 +38,20 @@ import static org.mockito.Mockito.when;
 
 class ReadwriteSplittingInspectionServiceTest {
     
+    @Test
+    void assertQueryProxyMode() {
+        MCPFeatureQueryFacade queryFacade = mock(MCPFeatureQueryFacade.class);
+        when(queryFacade.query("logic_db", "SHOW COMPUTE NODE 
INFO")).thenReturn(List.of(Map.of("mode_type", "Cluster")));
+        assertThat(new 
ReadwriteSplittingInspectionService().queryProxyMode(queryFacade, "logic_db"), 
is("Cluster"));
+    }
+    
+    @Test
+    void assertQueryProxyModeWhenComputeNodeInfoIsEmpty() {
+        MCPFeatureQueryFacade queryFacade = mock(MCPFeatureQueryFacade.class);
+        when(queryFacade.query("logic_db", "SHOW COMPUTE NODE 
INFO")).thenReturn(List.of());
+        assertThat(new 
ReadwriteSplittingInspectionService().queryProxyMode(queryFacade, "logic_db"), 
is("unknown"));
+    }
+    
     @Test
     void assertQueryRules() {
         MCPFeatureQueryFacade queryFacade = mock(MCPFeatureQueryFacade.class);
diff --git 
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingWorkflowPlanningServicesTest.java
 
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingWorkflowPlanningServicesTest.java
index c725cd6314d..2d75964bfee 100644
--- 
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingWorkflowPlanningServicesTest.java
+++ 
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/tool/service/ReadwriteSplittingWorkflowPlanningServicesTest.java
@@ -33,10 +33,13 @@ import java.util.Map;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 class ReadwriteSplittingWorkflowPlanningServicesTest {
@@ -177,6 +180,20 @@ class ReadwriteSplittingWorkflowPlanningServicesTest {
         assertThat(actual.getIssues().getFirst().getCode(), 
is(WorkflowIssueCode.DROP_TARGET_RULE_NOT_FOUND));
     }
     
+    @Test
+    void assertPlanStatusFailsInStandaloneMode() {
+        MCPFeatureQueryFacade queryFacade = mock(MCPFeatureQueryFacade.class);
+        when(queryFacade.query("logic_db", "SHOW COMPUTE NODE 
INFO")).thenReturn(List.of(Map.of("mode_type", "Standalone")));
+        WorkflowContextSnapshot actual = createStatusService().plan(new 
TestWorkflowSessionContext(), queryFacade, createStatusRequest("disable"));
+        assertThat(actual.getStatus(), is(WorkflowLifecycle.STATUS_FAILED));
+        assertThat(actual.getIssues().getFirst().getCode(), 
is(WorkflowIssueCode.CLUSTER_MODE_REQUIRED));
+        assertThat(actual.getIssues().getFirst().getStage(), 
is(WorkflowLifecycle.STEP_DISCOVERING));
+        assertFalse(actual.getIssues().getFirst().isRetryable());
+        assertThat(actual.getIssues().getFirst().getDetails(), 
is(Map.of("required_mode", "Cluster", "actual_mode", "Standalone")));
+        assertTrue(actual.getRuleArtifacts().isEmpty());
+        verify(queryFacade, never()).query("logic_db", "SHOW STATUS FROM 
READWRITE_SPLITTING RULE readwrite_ds FROM logic_db");
+    }
+    
     private ReadwriteSplittingRuleWorkflowPlanningService createRuleService() {
         return new ReadwriteSplittingRuleWorkflowPlanningService();
     }
@@ -196,7 +213,8 @@ class ReadwriteSplittingWorkflowPlanningServicesTest {
         MCPFeatureQueryFacade result = mock(MCPFeatureQueryFacade.class);
         when(result.isSameIdentifier("logic_db", IdentifierScope.TABLE, 
"readwrite_ds", "readwrite_ds")).thenReturn(true);
         when(result.isSameIdentifier("logic_db", IdentifierScope.TABLE, 
"read_ds_0", "read_ds_0")).thenReturn(true);
-        when(result.query(eq("logic_db"), any())).thenReturn(statuses);
+        when(result.query("logic_db", "SHOW COMPUTE NODE 
INFO")).thenReturn(List.of(Map.of("mode_type", "Cluster")));
+        when(result.query("logic_db", "SHOW STATUS FROM READWRITE_SPLITTING 
RULE readwrite_ds FROM logic_db")).thenReturn(statuses);
         return result;
     }
     
diff --git 
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/model/WorkflowIssueCode.java
 
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/model/WorkflowIssueCode.java
index 035e15f2cef..b6bb5e974c5 100644
--- 
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/model/WorkflowIssueCode.java
+++ 
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/model/WorkflowIssueCode.java
@@ -64,6 +64,8 @@ public final class WorkflowIssueCode {
     
     public static final String MANUAL_EXECUTION_PENDING = "WF-MODE-001";
     
+    public static final String CLUSTER_MODE_REQUIRED = "WF-MODE-002";
+    
     public static final String UNSUPPORTED_IDENTIFIER = "WF-SQL-001";
     
     public static final String RULE_STATE_MISMATCH = "WF-VAL-002";
diff --git 
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowGuidancePayloadBuilder.java
 
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowGuidancePayloadBuilder.java
index f9b7af67cbe..71731c2c33b 100644
--- 
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowGuidancePayloadBuilder.java
+++ 
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowGuidancePayloadBuilder.java
@@ -281,6 +281,9 @@ public final class WorkflowGuidancePayloadBuilder {
     }
     
     private static List<Map<String, Object>> 
createRecoveryPlanningActions(final WorkflowContextSnapshot snapshot) {
+        if (hasIssue(snapshot, WorkflowIssueCode.CLUSTER_MODE_REQUIRED)) {
+            return List.of(MCPNextActionUtils.stop("Connect to a Cluster-mode 
ShardingSphere Proxy, then start a new workflow plan."));
+        }
         String planningTool = resolvePlanningTool(snapshot);
         if (hasIssue(snapshot, WorkflowIssueCode.RULE_INPUT_CONFLICT)) {
             return planningTool.isEmpty()
diff --git 
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowPlanPayloadBuilderTest.java
 
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowPlanPayloadBuilderTest.java
index 99252ac2dbb..3cd715a8f87 100644
--- 
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowPlanPayloadBuilderTest.java
+++ 
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/workflow/service/WorkflowPlanPayloadBuilderTest.java
@@ -206,6 +206,25 @@ class WorkflowPlanPayloadBuilderTest {
         assertThat(actualNextAction.get("tool_name"), 
is("database_gateway_plan_encrypt_rule"));
     }
     
+    @Test
+    void assertBuildStopsAfterClusterModeFailure() {
+        WorkflowContextSnapshot snapshot = new WorkflowContextSnapshot();
+        snapshot.setPlanId("plan-1");
+        snapshot.setWorkflowKind(WorkflowKind.valueOf("readwrite.status"));
+        snapshot.setStatus(WorkflowLifecycle.STATUS_FAILED);
+        snapshot.setClarifiedIntent(new ClarifiedIntent());
+        WorkflowRequest request = new WorkflowRequest();
+        snapshot.setRequest(request);
+        snapshot.setInteractionPlan(InteractionPlan.create("plan-1", request, 
"Readwrite-splitting status workflow plan.", List.of("Review"), 
List.of("status")));
+        snapshot.getIssues().add(new 
WorkflowIssue(WorkflowIssueCode.CLUSTER_MODE_REQUIRED, "error", 
WorkflowLifecycle.STEP_DISCOVERING,
+                "Cluster mode is required.", "Connect to a Cluster-mode 
ShardingSphere Proxy.", false,
+                Map.of("required_mode", "Cluster", "actual_mode", 
"Standalone")));
+        Map<String, Object> actual = 
WorkflowPlanPayloadBuilder.build(snapshot);
+        Map<?, ?> actualNextAction = (Map<?, ?>) ((List<?>) 
actual.get("next_actions")).getFirst();
+        assertThat(actualNextAction.get("type"), is("terminal"));
+        assertThat(actualNextAction.get("reason"), is("Connect to a 
Cluster-mode ShardingSphere Proxy, then start a new workflow plan."));
+    }
+    
     @Test
     void assertBuildStartsNewPlanAfterInputConflict() {
         WorkflowContextSnapshot snapshot = new WorkflowContextSnapshot();
diff --git 
a/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/runtime/production/HttpProductionProxyFeatureWorkflowContractE2ETest.java
 
b/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/runtime/production/HttpProductionProxyFeatureWorkflowContractE2ETest.java
index b6bd30b54c2..56c778b54e5 100644
--- 
a/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/runtime/production/HttpProductionProxyFeatureWorkflowContractE2ETest.java
+++ 
b/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/runtime/production/HttpProductionProxyFeatureWorkflowContractE2ETest.java
@@ -151,14 +151,16 @@ class HttpProductionProxyFeatureWorkflowContractE2ETest 
extends AbstractProducti
             
assertTrue(String.valueOf(actualRule.get("read_storage_unit_names")).contains("ds_1"));
             
assertThat(String.valueOf(actualRule.get("transactional_read_query_strategy")).toUpperCase(Locale.ENGLISH),
 is("DYNAMIC"));
             
assertThat(String.valueOf(actualRule.get("load_balancer_type")).toUpperCase(Locale.ENGLISH),
 is("ROUND_ROBIN"));
-            Map<String, Object> actualStatusPlan = 
planWorkflow(interactionClient, READWRITE_SPLITTING_STATUS_PLAN_TOOL_NAME,
+            Map<String, Object> actualStatusPlan = 
interactionClient.call(READWRITE_SPLITTING_STATUS_PLAN_TOOL_NAME,
                     Map.of("database", getLogicalDatabaseName(), "rule", 
"readwrite_ds", "storage_unit", "ds_1", "target_status", "disable"));
-            Map<String, Object> actualStatusApply = 
applyReviewedWorkflow(interactionClient, 
String.valueOf(actualStatusPlan.get("plan_id")));
-            assertThat(String.valueOf(actualStatusApply.get("status")), 
is("failed"));
-            assertThat(getIssueCodes(actualStatusApply), 
hasItem(WorkflowIssueCode.RULE_EXECUTION_FAILED));
-            
assertTrue(String.valueOf(actualStatusApply.get("issues")).contains("Mode must 
be 'cluster'"));
-            
assertThat(getStringListOrEmpty(actualStatusApply.get("executed_distsql")).size(),
 is(0));
-            assertModelFacingPayloadContract(actualStatusApply);
+            assertThat(String.valueOf(actualStatusPlan.get("status")), 
is("failed"));
+            assertThat(getIssueCodes(actualStatusPlan), 
hasItem(WorkflowIssueCode.CLUSTER_MODE_REQUIRED));
+            Map<String, Object> actualIssueDetails = 
getObjectOrEmpty(getObjectListOrEmpty(actualStatusPlan.get("issues")).getFirst().get("details"));
+            assertThat(actualIssueDetails.get("required_mode"), is("Cluster"));
+            assertThat(actualIssueDetails.get("actual_mode"), 
is("Standalone"));
+            
assertTrue(getObjectListOrEmpty(actualStatusPlan.get("distsql_artifacts")).isEmpty());
+            
assertThat(getObjectListOrEmpty(actualStatusPlan.get("next_actions")).getFirst().get("type"),
 is("terminal"));
+            assertModelFacingPayloadContract(actualStatusPlan);
         }
     }
     

Reply via email to