luigidemasi commented on code in PR #150:
URL: https://github.com/apache/camel-kit/pull/150#discussion_r4437744320


##########
kit/camel-kit-core/src/test/java/org/apache/camel/kit/command/ship/ShipCommandTest.java:
##########
@@ -199,6 +199,40 @@ void 
nativeStatusRejectsInvalidHandoffsAndExplicitResumesRecoverThem(String back
         assertNotEquals(task.path("taskId"), freshTask.path("taskId"));
     }
 
+    @Test
+    void piRunRejectsNativeBackendOnResumeAndSubmit() throws Exception {
+        Path project = Files.createDirectory(tempDir.resolve("project"));
+        ShipController controller = controller("state");
+        RecordingLauncher launcher = RecordingLauncher.passThrough(controller);
+
+        RunResult started = run(controller, launcher, "--project-dir", 
project.toString());
+        assertEquals(0, started.exitCode(), started.error());
+        String id = runId(started.output());
+        assertEquals(ShipRun.ExecutionMode.PI, 
controller.status(id).executionMode());
+
+        RunResult mismatch = run(controller, rejectingLauncher(),
+                "--project-dir", project.toString(),
+                "--resume", id, "--backend", "bob2-native");
+        assertEquals(1, mismatch.exitCode());
+        assertTrue(mismatch.error().contains("execution-mode-mismatch"), 
mismatch.error());
+
+        RunResult mismatchClaude = run(controller, rejectingLauncher(),
+                "--project-dir", project.toString(),
+                "--resume", id, "--backend", "claude-native");
+        assertEquals(1, mismatchClaude.exitCode());
+        assertTrue(mismatchClaude.error().contains("execution-mode-mismatch"), 
mismatchClaude.error());
+
+        Path fakeResult = Files.writeString(tempDir.resolve("fake.json"), 
"{}");
+        RunResult submitted = run(controller, 
RecordingLauncher.passThrough(controller),
+                "--project-dir", project.toString(),
+                "--submit", id, "--result", fakeResult.toString());

Review Comment:
   [P2] Exercise the production Pi submission path
   
   `RecordingLauncher.passThrough` returns a `Workflow` that does not override 
`submit`, so this assertion only exercises the interface's unconditional 
default exception. The actual `ShipRuntime` overrides it and calls 
`ShipCoordinator.submit`. Replacing that coordinator's Pi rejection with 
`return current` leaves all 148 focused tests green, including this new test; 
an independent probe through the registered `camel-kit ship` command tree then 
changes from exit 1 to exit 0. The unmodified runtime also reports `requires a 
native Ship run`, which none of the three accepted strings matches. Please use 
the real launcher/coordinator with local executable fixtures (no model 
authentication needed for this rejection), assert the actual refusal and 
unchanged state, and ensure the regression fails when that production rejection 
is removed.
   
   _AI-generated by Codex on behalf of @luigidemasi._



##########
kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/ShippedAssetStructureTest.java:
##########
@@ -886,6 +886,16 @@ private static void assertGeneratedShipDelegate(String 
agentName, InitContext ct
             assertFalse(skillContent.contains(guide),
                     agentName + " Ship skill must not reference retired guide 
" + guide);
         }
+        if ("pi".equals(agentName)) {
+            assertFalse(skillContent.contains("--backend pi-native"),
+                    "Pi Ship skill must not reference a pi-native backend");

Review Comment:
   [P2] Guard the actual Pi delegate command against native backend selection
   
   Banning the nonexistent `pi-native` backend and a few dispatch-tool names 
does not protect Pi from selecting an existing native backend. I changed both 
executable invocations in `skills/camel-ship/SKILL.md` from `{COMMAND_PREFIX} 
ship` to `{COMMAND_PREFIX} ship --backend claude-native`: all 9 
`ShippedAssetStructureTest` cases still pass. Independent generation confirms 
that both fresh and reinitialized Pi workspaces emit the wrong backend with 
standalone and JBang-plugin prefixes. This is the backend-selection regression 
#100 explicitly requires preventing. Please pin the intended delegate 
invocation/option forwarding (or otherwise reject injected backend defaults) 
and make this mutation fail.
   
   _AI-generated by Codex on behalf of @luigidemasi._



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to