fix(ci): force flatten on build-cache hits so installed POMs resolve (#36947) - #36972
fix(ci): force flatten on build-cache hits so installed POMs resolve (#36947)#36972wezell wants to merge 1 commit into
Conversation
…36947) A cache hit was publishing POMs with unresolved CI-friendly placeholders, breaking every downstream consumer: Could not find artifact com.dotcms.core.plugins:dotcms-core-plugins-parent :pom:${revision}${sha1}${changelist} parent/pom.xml uses Maven CI-friendly versions (<revision>1.0.0</revision>) with flatten-maven-plugin's updatePomFile=true, so flatten rewrites the project POM to the resolved version at process-resources and install publishes that. The build cache treats flatten:flatten as a cached execution and skips it on a hit, while alwaysRunPlugins forces install to run anyway -- so install faithfully published the raw pom instead. Observed on run 31235284253: 19 modules restored, 19 "Skipping plugin execution (cached): flatten:flatten", and the entire integration suite unable to resolve dotcms-core's dependencies. This only surfaced once the bucket had been populated by the first merge_group write, which is why every earlier run was green -- a 100% miss never exercises it. Reproduced and verified locally against :com.dotcms.tika-api: cold build -> <version>1.0.0-SNAPSHOT</version> cache hit, previous flags -> <version>${revision}${sha1}${changelist}</version> cache hit, flatten forced -> <version>1.0.0-SNAPSHOT</version> with flatten skipped 4x in the middle case and 0x after the fix. Worth naming the shape of this bug: alwaysRunPlugins is a hand-curated allowlist of "executions that must not be skipped", which is exactly the kind of hand-maintained predicate the caching proposal argued against. install was identified up front; flatten was not, because nothing fails until a hit actually happens. Any other plugin that mutates state install depends on has the same exposure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014a2iJy9JXRBSVdKBbmoZ2S
|
Claude finished @wezell's task in 57s —— View job Code Review
New IssuesNo issues found. The one-line change is correct and well-targeted. Why the fix is right
Minor / non-blocking
On the two follow-ups in the description — both are sound and worth doing, and neither belongs in this PR:
This is a correct, minimal hotfix for an active main outage. LGTM to merge. · branch |
|
⛔ Do not merge as-is — this fix trades one break for another. Converting to draft. The flatten fix does resolve the Mechanism. Evidence is clean:
The real lesson
Each was invisible until a real cache hit occurred, and each fix surfaced the next. That is the failure mode the caching proposal explicitly warned about — a hand-maintained predicate standing in for "what does a correct build actually require". The honest read: the Maven Build Cache Extension does not compose cleanly with this repo's CI-friendly-versions ( Current state
Options, for a decision rather than a guess
I'd take (1) now and open an issue for (3), rather than keep patching under time pressure. |
🔴 Fixes an active CI outage on main. Every PR and merge-queue build is currently publishing broken POMs into its own Maven repo.
Symptom
Cause
parent/pom.xmluses Maven CI-friendly versions (<revision>1.0.0</revision>) withflatten-maven-plugin'supdatePomFile=true. Flatten rewrites the project POM to the resolved version atprocess-resources, andinstallpublishes that.The build cache treats
flatten:flattenas a cached execution and skips it on a hit — whilealwaysRunPluginsforcesinstallto run anyway. Soinstallfaithfully published the rawpom.xml, placeholders and all.On run 31235284253: 19 modules restored, 19
Skipping plugin execution (cached): flatten:flatten, and the whole integration suite unable to resolvedotcms-core's dependencies.Why it passed every previous run
The bucket was empty until the first
merge_groupwrite on #36960's own merge. A 100% cache miss never exercises this path — so every run before that was legitimately green, including the one that merged the cache. The first run to get real hits was the first to break.Verified locally against
:com.dotcms.tika-api1.0.0-SNAPSHOT✅${revision}${sha1}${changelist}❌1.0.0-SNAPSHOT✅Immediate mitigation, independent of this PR
That kill switch (shipped in #36960) turns the cache off repo-wide with no revert and no deploy. Unset it once this lands.
The shape of this bug is worth naming
alwaysRunPluginsis a hand-curated allowlist of "executions that must not be skipped" — precisely the kind of hand-maintained predicate that the caching proposal argued content hashing should replace.installwas identified up front;flattenwas not, because nothing fails until a hit actually happens. Any other plugin that mutates stateinstalldepends on carries the same exposure, and a miss-only run will never reveal it.Two follow-ups worth considering, not done here:
BUILD_CACHE_DISABLED=trueuntil a merge-queue build demonstrates a green run with hits, rather than trusting this fix on a miss-only PR run.<flatten.skip>or narrowing what the cache is allowed to skip is a more durable answer than growing the allowlist.🤖 Generated with Claude Code
https://claude.ai/code/session_014a2iJy9JXRBSVdKBbmoZ2S
This PR fixes: #36947