ci: add Scalpel shadow comparison and upgrade to 0.3.7#22524
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
ℹ️ CI did not run targeted module tests. |
77a5579 to
1834e34
Compare
|
Claude Code on behalf of Guillaume Nodet @apupier Thanks for the review!
Done — just merged latest
No, the Scalpel extension can be updated independently — that PR (#22572) was already merged and is included in the merge we just did. The CI script is version-agnostic: it uses |
apupier
left a comment
There was a problem hiding this comment.
Please launch it on a branch so that we ensure that it doesn't break the curren tflow and have a better idea of what will be the output
|
|
||
| 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). | ||
|
|
||
| The base branch is pre-fetched by the CI workflow (`git fetch --deepen=200` + fetch of `origin/main`) rather than by Scalpel's built-in JGit fetch (`-Dscalpel.fetchBaseBranch=false`). This avoids JGit issues in shallow CI clones. |
There was a problem hiding this comment.
why do we need 200 hundreds commits from git history to detect dependencies?
What is the performance impact?
There was a problem hiding this comment.
The 200 commits are not for detecting dependencies — they're for finding the git merge-base between the PR branch and main.
GitHub Actions checks out with depth=1 (a single commit). Scalpel needs the merge-base to compute which files changed, then maps those changed files to Maven modules and walks Maven's dependency graph to find affected downstream modules.
Why local git instead of the GitHub API? The existing grep-based script fetches the diff via the GitHub REST API (application/vnd.github.v3.diff), so it doesn't need local history at all. Scalpel uses local git instead because:
- It's a Maven extension (JVM-based), so using local git via JGit is the natural approach
- CI-provider-agnostic — works on GitLab, Jenkins, etc., not just GitHub
- No diff truncation risk (GitHub API truncates large diffs)
Performance impact: git fetch --deepen=200 fetches only commit metadata (not file blobs). It adds ~2-3 seconds to the job — negligible compared to the Maven build.
I've updated CI-ARCHITECTURE.md to clarify this.
Claude Code on behalf of Guillaume Nodet
There was a problem hiding this comment.
Also note that the end goal is to switch to Scalpel completely and remove the grep-based custom mechanism, which will then remove the dependency on the GitHub API for diff fetching entirely.
Claude Code on behalf of Guillaume Nodet
There was a problem hiding this comment.
I've pushed a follow-up commit that switches the grep-based script itself to use local git (git merge-base + git diff) instead of the GitHub API for diff fetching. Both mechanisms now share the same --deepen=200 fetch step, which makes the git fetch justified by both and removes the GitHub API dependency for diffs entirely.
Claude Code on behalf of Guillaume Nodet
There was a problem hiding this comment.
Updated test PRs — now with POM changes to trigger Scalpel's shadow comparison (the previous ones only had Java file changes, which don't invoke Scalpel's POM analysis):
- PR #23062 —
kafka-version(narrow managed dep). Grep finds 0 modules, Scalpel should find camel-kafka. - PR #23063 —
junit-jupiter-version(test-scoped managed dep). Grep finds 0, Scalpel should detect test scope. - PR #23064 —
jackson2-version(widely-used managed dep). Grep finds 0, Scalpel should find many modules.
All three demonstrate grep's blind spot for <dependencyManagement>-inherited versions. Throwaway PRs — will be closed after validation.
Claude Code on behalf of Guillaume Nodet
New validation PRs created with Scalpel 0.3.7 (clean CI history):
Previous test PRs (#23070–#23072, #24250) used Scalpel 0.3.0–0.3.6 which had inflated module counts (scalpel#39). That's fixed in 0.3.7. Preliminary result (from #24250 with 0.3.7):
CI runs for the new PRs are in progress — results will appear in the Scalpel shadow comparison section of each PR's CI comment. Claude Code on behalf of @gnodet |
73a8203 to
faaf5da
Compare
a54d6a3 to
ae44f53
Compare
Scalpel 0.3.7 validation resultsCreated 3 clean test PRs to validate the shadow comparison with different types of managed dependency changes:
Scalpel distinguishes between modules that need recompilation and those that need retesting:
Key observations
All 3 test PRs passed CI ✅ with no regression to the existing grep-based test execution. Claude Code on behalf of @gnodet |
Validation results (Scalpel 0.3.7)Three test PRs were created to validate the shadow comparison across different dependency change scenarios:
Key observations
Results for #24272 and #24274 will appear in their CI comments once builds complete. See also: the last comment above with links to all validation PRs. |
Add a shadow comparison section to CI PR comments showing what Maveniverse Scalpel's skip-tests mode would have tested — without affecting actual test execution. Changes: - incremental-build.sh: configure Scalpel with skipTestsForDownstreamModules and fetchBaseBranch=false, add writeScalpelComparison() for collapsible PR comment section with failure reporting - pr-build-main.yml / sonar-build.yml: add base branch fetch step for Scalpel's merge-base detection in shallow CI clones, restore checkout v7 - CI-ARCHITECTURE.md: document shadow comparison approach and configuration - Scalpel upgraded to 0.3.7: fixes inflated affectedModules count for parent POM property changes (scalpel#39) and skipTestsForDownstreamModules
d106d61 to
4585eeb
Compare
Summary
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.
This lets the team validate Scalpel's module detection across many PRs before switching from grep-based to Scalpel-driven test selection.
Changes
skipTestsForDownstreamModules: derived fromEXCLUSION_LISTvia sed (no duplication) — tells Scalpel which downstream modules to skip in shadow modeaffectedModulescount for parent POM property changes (scalpel#39) andskipTestsForDownstreamModulesnot taking effectHow Scalpel skip-tests mode works
Scalpel distinguishes between modules that need recompilation and modules that need retesting:
EXCLUSION_LIST(generated code, meta-modules likecamel-allcomponents,camel-catalog,camel-endpointdsl…) are recompiled with-DskipTests— no test executionFor example, a
junit-jupiter-versionchange affects 42 modules: 13 are recompiled and tested, 29 are recompiled only (tests skipped).Regression safety
fetchDiff()still uses the GitHub REST API (no local git dependency for grep)git fetch --deepen=200) for Scalpel's JGit merge-base — guarded by!inputs.skip_full_build(same as Scalpel itself)checkout@v7.0.0andpersist-credentials: falsekept in bothpr-build-main.ymlandsonar-build.ymlValidation
Tested with 3 clean PRs on Scalpel 0.3.7 — each bumps a different managed dependency property:
kafka-versionjunit-jupiter-versionjackson2-version<dependencyManagement>, invisible to grep)CI architecture docs
Updated
CI-ARCHITECTURE.mdto document the dual detection strategy, shadow comparison behavior, and Scalpel configuration.Claude Code on behalf of @gnodet