jamesnetherton opened a new pull request, #8994:
URL: https://github.com/apache/camel-quarkus/pull/8994

   ### Motivation
   
   Reported against https://github.com/apache/camel-quarkus/pull/8985: 
`langchain4j-agent` was tested, but `langchain4j-agent-ql4j` was not. The 
incremental analysis for that PR produced:
   
   ```json
   
{"incrementalBuild":true,"affectedModulesCount":1,"affectedModules":["langchain4j-agent"],
    
"nativeTestMatrix":{"include":[{"name":"group-01","modules":"langchain4j-agent"}]}}
   ```
   
   `integration-tests/langchain4j-agent-ql4j` has no Maven dependency on 
`integration-tests/langchain4j-agent`. It pulls in its sources at 
`generate-sources` time via `tooling/scripts/copy-tests.groovy`. Scalpel 
derives affected modules from the Maven dependency graph, so that file level 
coupling is invisible to it and a change confined to the copied-from module 
never schedules the copying one.
   
   This is the same class of problem the workflow already works around for 
container image properties.
   
   ### Changes
   
   **Resolve source consuming modules from the poms.** `IncrementalBuildMojo` 
scans every `pom.xml` for `copy-tests.source.dir` and `group-tests.source.dir`, 
building a map of consumed source directory to consuming module. Consumers are 
added to the affected set, iterating to a fixpoint so chains resolve. The 
expansion happens when the Scalpel report is read, so the native matrix, JVM 
tests, functional scope and examples detection all pick it up. No module names 
are hardcoded, so future `copy-tests` modules are covered automatically.
   
   **Fix native/JVM classification of grouped modules.** Changes under 
`integration-test-groups/` were mapped to a test module by name, assuming 
`integration-test-groups/<group>` always groups into the native 
`integration-tests/<group>-grouped`. That does not hold for `xml`, which splits 
into `xml/native` and `xml/jvm`, grouped into `integration-tests/xml-grouped` 
and `integration-tests-jvm/xml-grouped` respectively. A change under `xml/jvm` 
therefore ran the native grouped module, which does not contain those tests, 
and never ran the JVM one, which does. Deriving the mapping from what the poms 
declare fixes this, because the consumer's own path says which it is. A change 
at or above a declared source directory pulls in every consumer beneath it, so 
touching `integration-test-groups/xml` still tests both. The name based 
heuristic is kept as a fallback for any group directory no pom declares.
   
   **Stop walking `target`.** The `TestResource.java` and `pom.xml` scans 
backing container image property detection used unfiltered `Files.walk`. In CI 
they run after a full install, so they descended through every module's build 
output. All three source tree scans now share one walker that prunes `target` 
and `.git`. Walking `target` also meant matching sources copied there, so a 
container property referenced by a copied-from module was picked up in the 
copying module only as a side effect of that module having been built; 
container affected modules are now expanded through the same declared source 
consumer map instead.
   
   **Remove dead config.** `integration-test-groups/aws2/aws2-s3` carried a 
`copy-tests` block left over from the removed Quarkus Amazon Services shared 
tests. Its source dir (`integration-test-groups/aws2/aws2-s`, missing the `3`) 
has never existed, so `copy-tests.groovy` silently no-oped on it.
   
   ### Verification
   
   Replaying #8985's Scalpel report now yields 
`["langchain4j-agent","langchain4j-agent-ql4j"]`.
   
   | Scenario | Before | After |
   |---|---|---|
   | `integration-tests/langchain4j-agent` | `langchain4j-agent` | 
`langchain4j-agent`, `langchain4j-agent-ql4j` |
   | `integration-test-groups/xml/jvm/*` | native `xml-grouped`, no JVM | JVM 
`xml-grouped`, no native |
   | `integration-test-groups/xml/native/*` | native `xml-grouped` | unchanged |
   | `integration-test-groups/xml` (aggregator) | native `xml-grouped` only | 
both native and JVM |
   | unrelated module, ql4j alone, JVM only module, aws2/jdbc/http groups, full 
build | | unchanged |
   
   All 13 declared relationships resolve with no warnings. `aws2-s3` still 
builds and produces the same single class, and `integration-tests/aws2-grouped` 
still collects its sources.
   
   Container property detection returns byte-identical output before and after 
the walk pruning, and got faster on a tree with 1769 `target` directories 
present:
   
   ```
   before: real 3.86 / 3.85
   after:  real 3.07 / 3.06
   ```
   
   The empty native matrix that a JVM-only group change now produces is 
handled: `ci-build.yaml:446` guards on `include[0] != null` and `:697` on 
`totalModules > 0`, so those jobs skip cleanly.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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