Jinal-Sarvaiya commented on code in PR #150:
URL: https://github.com/apache/camel-kit/pull/150#discussion_r4437831913
##########
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:
Replaced the RecordingLauncher.passThrough(controller) with a
coordinator-backed launcher that delegates to a real ShipCoordinator.submit().
This exercises the production Pi rejection path (worker instanceof
ShipNativeWorker check at ShipCoordinator:147-149). The test also verifies the
run state is unchanged after rejection. Luigi's mutation (removing the
coordinator's Pi rejection to return current) would now fail this test because
the exit code would change from 1 to 0.
--
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]