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


##########
kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/MigrationOperationsContractTest.java:
##########
@@ -46,6 +46,39 @@ void installedMigrationSkillsRetainTheQuestionRelay(@TempDir 
Path tempDir) throw
         }
     }
 
+    @Test
+    void redHatBomSelectionUsesDestinationNotSource(@TempDir Path tempDir) 
throws Exception {
+        for (String agentName : List.of("claude", "codex", "opencode")) {
+            var agent = AgentRegistry.get(agentName);
+            Path projectDir = tempDir.resolve(agentName);
+            Path skillsDir = projectDir.resolve(agent.skillsDirectory());
+            Path commandsDir = agent.generatesCommandStubs()
+                    ? projectDir.resolve(agent.commandDirectory())
+                    : skillsDir;
+            InitContext context = new InitContext(
+                    agent, agentName, commandsDir, skillsDir, projectDir, 
"camel-kit", Printer.noop());
+            AgentGeneratorFactory.create(agentName).generate(context);
+
+            String installedMigrate = 
Files.readString(skillsDir.resolve("camel-migrate/SKILL.md"));
+            String installedBrainstorm = 
Files.readString(skillsDir.resolve("camel-brainstorm/guides/version-selection.md"));
+
+            // Both guides must check destination, not source
+            assertContainsAll(installedMigrate,
+                    "When the user selects Red Hat Build of Apache Camel on 
Spring Boot as the migration destination",
+                    
"com.redhat.camel.springboot.platform:camel-spring-boot-bom");
+            assertFalse(installedMigrate.contains("When migrating from Red 
Hat")
+                    && 
installedMigrate.substring(installedMigrate.indexOf("When migrating from Red 
Hat"))
+                            .contains("use BOM-first selection"),
+                    agentName + " SKILL.md must gate Red Hat BOM selection on 
destination, not source");

Review Comment:
   **P1 — Check the sentence that selects the BOM.** In the installed Claude 
guide, `When migrating from Red Hat` starts the ActiveMQ discovery paragraph at 
line 313. The substring extends through line 375, where the selected 
destination correctly triggers `use BOM-first selection`. That makes 
`assertFalse` fail on this commit before the loop reaches Codex or OpenCode. 
Checking the trigger and the action in the same sentence lets both instructions 
coexist.
   
   ```suggestion
               assertContainsAll(installedMigrate,
                       "When the user selects Red Hat Build of Apache Camel on 
Spring Boot as the migration destination, "
                                                   + "use BOM-first selection",
                       
"com.redhat.camel.springboot.platform:camel-spring-boot-bom");
   ```
   
   _AI-generated by Codex on behalf of @luigidemasi._



##########
kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/MigrationOperationsContractTest.java:
##########
@@ -46,6 +46,39 @@ void installedMigrationSkillsRetainTheQuestionRelay(@TempDir 
Path tempDir) throw
         }
     }
 
+    @Test
+    void redHatBomSelectionUsesDestinationNotSource(@TempDir Path tempDir) 
throws Exception {
+        for (String agentName : List.of("claude", "codex", "opencode")) {
+            var agent = AgentRegistry.get(agentName);
+            Path projectDir = tempDir.resolve(agentName);
+            Path skillsDir = projectDir.resolve(agent.skillsDirectory());
+            Path commandsDir = agent.generatesCommandStubs()
+                    ? projectDir.resolve(agent.commandDirectory())
+                    : skillsDir;
+            InitContext context = new InitContext(
+                    agent, agentName, commandsDir, skillsDir, projectDir, 
"camel-kit", Printer.noop());
+            AgentGeneratorFactory.create(agentName).generate(context);
+
+            String installedMigrate = 
Files.readString(skillsDir.resolve("camel-migrate/SKILL.md"));
+            String installedBrainstorm = 
Files.readString(skillsDir.resolve("camel-brainstorm/guides/version-selection.md"));
+
+            // Both guides must check destination, not source
+            assertContainsAll(installedMigrate,
+                    "When the user selects Red Hat Build of Apache Camel on 
Spring Boot as the migration destination",
+                    
"com.redhat.camel.springboot.platform:camel-spring-boot-bom");
+            assertFalse(installedMigrate.contains("When migrating from Red 
Hat")
+                    && 
installedMigrate.substring(installedMigrate.indexOf("When migrating from Red 
Hat"))
+                            .contains("use BOM-first selection"),
+                    agentName + " SKILL.md must gate Red Hat BOM selection on 
destination, not source");
+
+            assertContainsAll(installedBrainstorm,
+                    "Red Hat Build of Apache Camel (BOM-First Selection)",

Review Comment:
   **P2 — Assert Brainstorm’s destination condition.** Its section heading, 
Maven coordinate, and target-property examples all survive a switch to 
source-based selection. With the Migrate false positive removed, changing only 
Brainstorm’s “When to use” sentence to trigger on a Red Hat source still passed 
all 78 focused tests. Checking that sentence catches the regression.
   
   ```suggestion
                       "After the user selects Red Hat Build of Apache Camel on 
Spring Boot as the migration destination",
   ```
   
   _AI-generated by Codex on behalf of @luigidemasi._



##########
kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/MigrationOperationsContractTest.java:
##########
@@ -46,6 +46,39 @@ void installedMigrationSkillsRetainTheQuestionRelay(@TempDir 
Path tempDir) throw
         }
     }
 
+    @Test
+    void redHatBomSelectionUsesDestinationNotSource(@TempDir Path tempDir) 
throws Exception {
+        for (String agentName : List.of("claude", "codex", "opencode")) {
+            var agent = AgentRegistry.get(agentName);
+            Path projectDir = tempDir.resolve(agentName);
+            Path skillsDir = projectDir.resolve(agent.skillsDirectory());
+            Path commandsDir = agent.generatesCommandStubs()
+                    ? projectDir.resolve(agent.commandDirectory())
+                    : skillsDir;
+            InitContext context = new InitContext(
+                    agent, agentName, commandsDir, skillsDir, projectDir, 
"camel-kit", Printer.noop());
+            AgentGeneratorFactory.create(agentName).generate(context);
+
+            String installedMigrate = 
Files.readString(skillsDir.resolve("camel-migrate/SKILL.md"));
+            String installedBrainstorm = 
Files.readString(skillsDir.resolve("camel-brainstorm/guides/version-selection.md"));

Review Comment:
   **Formatting gate — Wrap this assignment.** The local `./mvnw -B 
-Psourcecheck validate` run stops on this file. This is the wrap produced by 
the project's formatter.
   
   ```suggestion
               String installedBrainstorm
                       = 
Files.readString(skillsDir.resolve("camel-brainstorm/guides/version-selection.md"));
   ```
   
   _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