Skip to content

Commit c19d7af

Browse files
authored
ci: add Scalpel shadow comparison to PR CI comments
Add a Scalpel shadow comparison section to PR CI comments, showing what Maveniverse Scalpel's skip-tests mode would have tested — without affecting actual test execution. Changes: - Shadow comparison after a separator at the end of the CI comment, with a one-line diff summary (e.g. "compile: +51, test: +22") showing what Scalpel would add vs the current grep-based detection - Scalpel upgraded to 0.3.7 (fixes inflated count for parent POM property changes and skipTestsForDownstreamModules) - Fix CI comment artifact overwrite race between JDK matrix entries - Always pass baseBranch explicitly to Scalpel (fragile in reruns) - Progressive fetch deepening (200 → 1000 → unshallow) for merge-base reachability, with || true guards on all fetches (both pr-build-main and sonar-build workflows) - Updated CI-ARCHITECTURE.md with dual detection strategy docs
1 parent c12157c commit c19d7af

4 files changed

Lines changed: 295 additions & 40 deletions

File tree

.github/CI-ARCHITECTURE.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,30 @@ Both methods run in parallel. Results are merged (union) before testing. This le
154154
2. **No regression** — If Scalpel fails, grep results are still used
155155
3. **Gradual migration** — Once Scalpel is validated, grep can be removed
156156

157-
Scalpel is configured permanently in `.mvn/extensions.xml` (version `0.1.0`). On developer machines it is a no-op — without CI environment variables (`GITHUB_BASE_REF`), no base branch is detected and Scalpel returns immediately. The `mvn validate` with report mode adds ~60-90 seconds in CI.
158-
159-
Note: the script overrides `fullBuildTriggers` to empty (`-Dscalpel.fullBuildTriggers=`) because Scalpel's default (`.mvn/**`) would trigger a full build whenever `.mvn/extensions.xml` itself changes (e.g., Dependabot bumping Scalpel).
157+
Scalpel is configured permanently in `.mvn/extensions.xml`. On developer machines it is a no-op (disabled via `-Dscalpel.enabled=false` in `.mvn/maven.config`). The CI script overrides this with `-Dscalpel.enabled=true`. The `mvn validate` with report mode adds ~60-90 seconds in CI.
160158

161159
Scalpel is only invoked when a **subdirectory** `pom.xml` is changed (e.g. `parent/pom.xml`, `components/camel-kafka/pom.xml`). Changes to the **root** `pom.xml` are excluded because it contains build-infrastructure config (license plugin, checkstyle, etc.) that does not affect module compilation or test behavior. Without this filter, Scalpel would report every module as affected since they all inherit from the root POM.
162160

161+
#### Scalpel features used for shadow comparison
162+
163+
- **Source-set-aware propagation**: Distinguishes test-jar dependencies from regular dependencies. A module that depends only on another module's test-jar (e.g., `camel-core`'s test-jar with test utilities) is propagated through the `TEST` source set, not the `MAIN` source set. This prevents a change to test utilities from triggering tests in all ~500 modules that depend on `camel-core`.
164+
- **`skipTestsForDownstreamModules`**: Allows specifying modules whose tests should be skipped when they appear as downstream dependents (mirrors the `EXCLUSION_LIST` in `incremental-build.sh`). This gives Scalpel an accurate picture of what skip-tests mode would actually test.
165+
166+
#### Shadow comparison
167+
168+
Scalpel runs in **shadow mode**: it observes what skip-tests mode *would* have done and reports it in a collapsible section of the PR comment, without affecting actual test execution. This allows the team to validate Scalpel's decisions across many PRs before switching to Scalpel-driven test execution.
169+
170+
The shadow comparison section shows:
171+
- How many modules Scalpel would test (direct + downstream)
172+
- How many downstream modules would have tests skipped (generated code, meta-modules)
173+
- The full list of modules in each category
174+
175+
#### Configuration notes
176+
177+
The script overrides `fullBuildTriggers` to empty (`-Dscalpel.fullBuildTriggers=`) because Scalpel's default (`.mvn/**`) would trigger a full build whenever `.mvn/extensions.xml` itself changes (e.g., Dependabot bumping Scalpel).
178+
179+
The grep-based script fetches the PR diff via the GitHub REST API (unchanged). Scalpel uses local git history to compare effective POM models — the CI workflow pre-fetches the base branch (`git fetch --deepen=200` + fetch of `origin/main`) so Scalpel's JGit can find the merge-base. Scalpel disables its built-in JGit fetch (`-Dscalpel.fetchBaseBranch=false`) to avoid JGit issues in shallow CI clones. The `--deepen=200` fetches only commit metadata (not file blobs), adding ~2-3 seconds to the job.
180+
163181
## Manual Integration Test Advisories
164182

165183
Some modules are excluded from CI's `-amd` expansion (the `EXCLUSION_LIST`) because they are generated code, meta-modules, or expensive integration test suites. When a contributor changes one of these modules, CI cannot automatically test all downstream effects.

0 commit comments

Comments
 (0)