Skip to content

ci: scope spotless to changed Java files via -DspotlessFiles - #31892

Open
chirag-madlani wants to merge 1 commit into
ci/shallow-fetch-validatefrom
ci/scoped-spotless
Open

ci: scope spotless to changed Java files via -DspotlessFiles#31892
chirag-madlani wants to merge 1 commit into
ci/shallow-fetch-validatefrom
ci/scoped-spotless

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes:

Stacked on #31891. Fixes the timeout-masks-failure hazard we hit while live-testing #31828: mvn -B spotless:apply on the whole reactor was slow enough on a cold Maven cache to hit the 20-min timeout-minutes cap, which produces conclusion=cancelled (not failure), which auto-revert-release.yml correctly does not treat as a revertable signal — so broken cherry-picks slip through silently when the runner is slow.

Scope spotless itself to only the changed Java files via -DspotlessFiles=<regex-list> (supported by spotless-maven-plugin 2.41.1). Drops the step from ~10-15 min to seconds and eliminates the failure mode.

Base branch: ci/shallow-fetch-validate (from #31891). Merge that first, then rebase this.

Type of change:

  • Bug fix

High-level design:

Regex construction. For each changed relative path, escape regex metacharacters ([]().^$+*?|\), prepend .* so the pattern survives Maven's absolute-path resolution, and join with commas. Passed as a single -DspotlessFiles=<list> argument.

spotless:check vs spotless:apply. Switched to check — fails fast on drift, no in-place edits, no post-run git status --porcelain dance. Exit code is authoritative.

Baseline drift is still ignored. The regex only matches files the push touched, so pre-existing formatting drift on other files in the release branch is untouched (matches the same scope-of-check principle #31828 established for lint and prettier).

Alternative considered. Bumping timeout-minutes from 20 → 40. Rejected because it masks the underlying issue (spotless doing 100× the work needed) and doesn't fix cold-cache runs that could still exceed a higher cap.

Tests:

Use cases covered

  • Single-file broken-Java cherry-pick: spotless:check reports the violation, job fails with conclusion=failure, auto-revert fires.
  • Multi-file broken-Java push: regex list contains all N files, any of them failing triggers check to fail.
  • No Java changes: existing steps.files.outputs.any gate skips the step (unchanged).
  • Baseline drift on other Java files: not scanned; only the push's files are asserted (unchanged behavior).

Manual testing performed

  • Verified spotless:check -DspotlessFiles=<regex> is a valid invocation for spotless-maven-plugin 2.41.1 (project version pinned in pom.xml:162).
  • End-to-end will validate once ci: shallow-fetch release-branch-validate checkouts #31891 + this merge, then a push to 9.9.9 reproduces the live smoke — same delta as before but the Java job now finishes in seconds.

Checklist:

🤖 Generated with Claude Code

Greptile Summary

This PR limits release-branch Spotless validation to changed Java files, replacing full-tree formatting and post-format diff inspection with a direct scoped check.

  • Converts spotless:apply followed by git status inspection into spotless:check.
  • Escapes each changed repository-relative Java path and constructs comma-separated absolute-path-compatible patterns.
  • Preserves the existing no-Java-change gate and ignores formatting drift outside the pushed files.

Confidence Score: 5/5

The PR appears safe to merge, with changed Java files still reaching Spotless validation while unrelated baseline drift remains excluded.

Spotless accepts the generated comma-separated regex list, matches each expression against absolute paths, and the workflow escapes repository-relative paths before invoking the non-mutating check goal.

Important Files Changed

Filename Overview
.github/workflows/release-branch-validate.yml Replaces full-reactor Spotless mutation and diff inspection with a correctly constructed changed-file-only Spotless check; no actionable defect was identified.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Changed Java paths] --> B[Escape regex metacharacters]
  B --> C[Prefix each pattern with .*]
  C --> D[Join patterns with commas]
  D --> E[mvn spotless:check]
  E -->|Formatting clean| F[Validation succeeds]
  E -->|Formatting drift| G[Validation fails]
Loading

Reviews (1): Last reviewed commit: "ci: scope spotless to changed Java files..." | Re-trigger Greptile

Previously the Java Checkstyle job ran `mvn -B spotless:apply` across
the whole reactor (~16k Java files, ~10-15 min wall-clock on a cold
Maven cache) and then diffed the changed files to see if spotless had
touched them. On slow runners this hit the 20-min job timeout, which
produces conclusion=cancelled instead of conclusion=failure — so
auto-revert-release.yml silently skips instead of reverting.

spotless-maven-plugin 2.41.1 accepts `-DspotlessFiles=<comma-separated
regex>` matched against absolute paths. Build one anchored `.*<path>`
regex per changed file, with regex metacharacters escaped, and run
`spotless:check` against just those. Fails fast on formatting drift,
no in-place edits, no post-run git diff dance. Drops the step from
minutes to seconds and eliminates the timeout-masks-failure hazard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 21, 2026
@gitar-bot

gitar-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Scopes Maven Spotless checks to changed Java files via -DspotlessFiles and switches to spotless:check to eliminate timeout hazards and speed up CI validation. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 4e659681e8d406edc2b72b97c207aa0eaf83e693 in Playwright run 32488694273, attempt 1.

✅ 553 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 49m 43s

⏱️ Max setup 4m 55s · max shard execution 14m 55s · max shard-job elapsed before upload 19m 51s · reporting 5s

🌐 215.62 requests/attempt · 2.83 app boots/UI scenario · 4.02% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 215.62 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1622 boots / 574 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 103 0 0 0 0 0
✅ Shard chromium-02 103 0 0 0 0 0
✅ Shard chromium-03 91 0 0 0 0 0
✅ Shard chromium-04 102 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant