Skip to content

fix: wrong existence check in getStaticResource (CP: 25.0) (#24285) (CP: 24.10)#24286

Merged
vaadin-bot merged 1 commit into24.10from
cherry-pick-24285-to-24.10-1778152531215
May 7, 2026
Merged

fix: wrong existence check in getStaticResource (CP: 25.0) (#24285) (CP: 24.10)#24286
vaadin-bot merged 1 commit into24.10from
cherry-pick-24285-to-24.10-1778152531215

Conversation

@vaadin-bot
Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #24285 to branch 24.10.

Original PR description

This PR cherry-picks changes from the original PR #24283 to branch 25.0.

A conflict in flow-server/src/test/java/com/vaadin/flow/server/VaadinServletServiceTest.java was resolved manually: the new getStaticResource_jarUrlOnJetty12_returnsUrlInsteadOfThrowing test was rewritten in JUnit 4 idioms (@Rule TemporaryFolder, Assert.*) since 25.0 has not adopted the JUnit 5 migration that landed on main.


On Jetty 12.1.9, requests for static resources packaged inside a JAR (e.g. vaadinPush.js from flow-push) fail with
FileSystemNotFoundException. VaadinServletService.getStaticResource verifies the URL returned by ServletContext.getResource via Path.of(url.toURI()), which for a jar:file:...!/entry URI requires the JAR's NIO FileSystem to already be mounted in the JVM-wide cache. Jetty 12.1.8 incidentally kept those filesystems mounted during resource resolution; 12.1.9 no longer does, so getFileSystem throws and the existing catch (URISyntaxException) lets the unchecked exception escape, producing HTTP 500.

Probe the URL with URL.openStream() instead. JarURLConnection and FileURLConnection use java.util.jar.JarFile / java.io.File directly and are independent of the NIO FileSystems cache, so the check works uniformly for file: and jar:file: URLs and on every Jetty 12 build. The catch is broadened to IOException, covering both missing files (the original Jetty 12 workaround) and missing JAR entries.

This PR cherry-picks changes from the original PR #24283 to branch 25.0.

A conflict in
`flow-server/src/test/java/com/vaadin/flow/server/VaadinServletServiceTest.java`
was resolved manually: the new
`getStaticResource_jarUrlOnJetty12_returnsUrlInsteadOfThrowing` test was
rewritten in JUnit 4 idioms (`@Rule TemporaryFolder`, `Assert.*`) since
25.0 has not adopted the JUnit 5 migration that landed on `main`.
@github-actions github-actions Bot added the +0.0.1 label May 7, 2026
@vaadin-bot
Copy link
Copy Markdown
Collaborator Author

This PR is eligible for auto-merging policy, so it has been approved automatically. If there are pending conditions, auto merge (with 'squash' method) has been enabled for this PR [Message is sent from bot]

@vaadin-bot vaadin-bot enabled auto-merge (squash) May 7, 2026 11:18
@vaadin-bot
Copy link
Copy Markdown
Collaborator Author

This PR is eligible for auto-merging policy, so it has been approved automatically. If there are pending conditions, auto merge (with 'squash' method) has been enabled for this PR[Message is sent from bot]

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@vaadin-bot vaadin-bot merged commit 30cf92c into 24.10 May 7, 2026
25 of 27 checks passed
@vaadin-bot vaadin-bot deleted the cherry-pick-24285-to-24.10-1778152531215 branch May 7, 2026 11:49
ZheSun88 added a commit that referenced this pull request May 8, 2026
…4290)

## Summary

Cherry-pick PRs targeting release branches were being merged even when
a matrix `it-tests (N, ...)` shard had been cancelled (e.g. by the
30-min job timeout when CI hung). Example:
[#24286](#24286)
merged at 11:49 UTC two seconds after `it-tests (2)` was cancelled at
11:48:58, with `test-results` showing as `SKIPPED`.

## Why this happened

`test-results` is registered as a required status check on the 24.10
branch protection. The intent is that it acts as the single chokepoint
representing "all matrix it-tests passed" (since the matrix job names
include the dynamic module list and can't be required individually).

The job's gate today is:

```yaml
test-results:
  ...
  if: ${{ failure() || success() }}
  needs: [unit-tests, it-tests]
```

GitHub Actions `if:` semantics on a `needs:` chain treat
`failure() || success()` as covering only success and failure — **not
cancellation**. So when any matrix shard is cancelled, the
`test-results` job's gate evaluates to false → SKIPPED.

A skipped required status check
[satisfies the requirement in GitHub's
evaluation](https://github.com/orgs/community/discussions/13690),
so the auto-merge bot proceeds and merges the PR.

The job's existing `Set Failure Status` step (line 268) is already
written correctly with `if: always() && (... .result != 'success')` —
it just never gets a chance to run because the whole job is skipped
first.

## Fix

Change the job-level gate to `if: ${{ always() }}` so `test-results`
always runs (success / failure / cancelled / timed out). The existing
`Set Failure Status` step then explicitly fails the job when any
upstream needs entry is in a non-success state, including
`cancelled`. The required check turns **red** instead of grey,
auto-merge correctly blocks on it.

Tiny one-liner; comment added so the next person to touch this gate
understands why `always()` is required.

## Test plan

- [ ] Push a draft PR with an artificially cancelled it-tests shard
      (or wait for the next natural occurrence) and confirm
      `test-results` runs and reports failure rather than being
      skipped.
- [ ] Confirm the auto-merge bot does *not* merge a cherry-pick PR
      while `test-results` is failing.

## Follow-up

This change should be cherry-picked to `25.0`, `25.1`, and `main`
once verified here. The same one-liner applies on every branch that
carries `validation.yml`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Zhe Sun <zhe@vaadin.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
vaadin-bot added a commit that referenced this pull request May 8, 2026
…4290) (CP: 25.0) (#24301)

This PR cherry-picks changes from the original PR #24290 to branch 25.0.
---
#### Original PR description
> ## Summary
> 
> Cherry-pick PRs targeting release branches were being merged even when
> a matrix `it-tests (N, ...)` shard had been cancelled (e.g. by the
> 30-min job timeout when CI hung). Example:
[#24286](#24286)
> merged at 11:49 UTC two seconds after `it-tests (2)` was cancelled at
> 11:48:58, with `test-results` showing as `SKIPPED`.
> 
> ## Why this happened
> 
> `test-results` is registered as a required status check on the 24.10
> branch protection. The intent is that it acts as the single chokepoint
> representing "all matrix it-tests passed" (since the matrix job names
> include the dynamic module list and can't be required individually).
> 
> The job's gate today is:
> 
> ```yaml
> test-results:
>   ...
>   if: ${{ failure() || success() }}
>   needs: [unit-tests, it-tests]
> ```
> 
> GitHub Actions `if:` semantics on a `needs:` chain treat
> `failure() || success()` as covering only success and failure — **not
> cancellation**. So when any matrix shard is cancelled, the
> `test-results` job's gate evaluates to false → SKIPPED.
> 
> A skipped required status check
> [satisfies the requirement in GitHub's
evaluation](https://github.com/orgs/community/discussions/13690),
> so the auto-merge bot proceeds and merges the PR.
> 
> The job's existing `Set Failure Status` step (line 268) is already
> written correctly with `if: always() && (... .result != 'success')` —
> it just never gets a chance to run because the whole job is skipped
> first.
> 
> ## Fix
> 
> Change the job-level gate to `if: ${{ always() }}` so `test-results`
> always runs (success / failure / cancelled / timed out). The existing
> `Set Failure Status` step then explicitly fails the job when any
> upstream needs entry is in a non-success state, including
> `cancelled`. The required check turns **red** instead of grey,
> auto-merge correctly blocks on it.
> 
> Tiny one-liner; comment added so the next person to touch this gate
> understands why `always()` is required.
> 
> ## Test plan
> 
> - [ ] Push a draft PR with an artificially cancelled it-tests shard
>       (or wait for the next natural occurrence) and confirm
>       `test-results` runs and reports failure rather than being
>       skipped.
> - [ ] Confirm the auto-merge bot does *not* merge a cherry-pick PR
>       while `test-results` is failing.
> 
> ## Follow-up
> 
> This change should be cherry-picked to `25.0`, `25.1`, and `main`
> once verified here. The same one-liner applies on every branch that
> carries `validation.yml`.
> 
> 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Zhe Sun <zhe@vaadin.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
vaadin-bot added a commit that referenced this pull request May 8, 2026
…4290) (CP: 24.9) (#24302)

This PR cherry-picks changes from the original PR #24290 to branch 24.9.
---
#### Original PR description
> ## Summary
> 
> Cherry-pick PRs targeting release branches were being merged even when
> a matrix `it-tests (N, ...)` shard had been cancelled (e.g. by the
> 30-min job timeout when CI hung). Example:
[#24286](#24286)
> merged at 11:49 UTC two seconds after `it-tests (2)` was cancelled at
> 11:48:58, with `test-results` showing as `SKIPPED`.
> 
> ## Why this happened
> 
> `test-results` is registered as a required status check on the 24.10
> branch protection. The intent is that it acts as the single chokepoint
> representing "all matrix it-tests passed" (since the matrix job names
> include the dynamic module list and can't be required individually).
> 
> The job's gate today is:
> 
> ```yaml
> test-results:
>   ...
>   if: ${{ failure() || success() }}
>   needs: [unit-tests, it-tests]
> ```
> 
> GitHub Actions `if:` semantics on a `needs:` chain treat
> `failure() || success()` as covering only success and failure — **not
> cancellation**. So when any matrix shard is cancelled, the
> `test-results` job's gate evaluates to false → SKIPPED.
> 
> A skipped required status check
> [satisfies the requirement in GitHub's
evaluation](https://github.com/orgs/community/discussions/13690),
> so the auto-merge bot proceeds and merges the PR.
> 
> The job's existing `Set Failure Status` step (line 268) is already
> written correctly with `if: always() && (... .result != 'success')` —
> it just never gets a chance to run because the whole job is skipped
> first.
> 
> ## Fix
> 
> Change the job-level gate to `if: ${{ always() }}` so `test-results`
> always runs (success / failure / cancelled / timed out). The existing
> `Set Failure Status` step then explicitly fails the job when any
> upstream needs entry is in a non-success state, including
> `cancelled`. The required check turns **red** instead of grey,
> auto-merge correctly blocks on it.
> 
> Tiny one-liner; comment added so the next person to touch this gate
> understands why `always()` is required.
> 
> ## Test plan
> 
> - [ ] Push a draft PR with an artificially cancelled it-tests shard
>       (or wait for the next natural occurrence) and confirm
>       `test-results` runs and reports failure rather than being
>       skipped.
> - [ ] Confirm the auto-merge bot does *not* merge a cherry-pick PR
>       while `test-results` is failing.
> 
> ## Follow-up
> 
> This change should be cherry-picked to `25.0`, `25.1`, and `main`
> once verified here. The same one-liner applies on every branch that
> carries `validation.yml`.
> 
> 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Zhe Sun <zhe@vaadin.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
vaadin-bot added a commit that referenced this pull request May 8, 2026
…4290) (CP: 25.1) (#24300)

This PR cherry-picks changes from the original PR #24290 to branch 25.1.
---
#### Original PR description
> ## Summary
> 
> Cherry-pick PRs targeting release branches were being merged even when
> a matrix `it-tests (N, ...)` shard had been cancelled (e.g. by the
> 30-min job timeout when CI hung). Example:
[#24286](#24286)
> merged at 11:49 UTC two seconds after `it-tests (2)` was cancelled at
> 11:48:58, with `test-results` showing as `SKIPPED`.
> 
> ## Why this happened
> 
> `test-results` is registered as a required status check on the 24.10
> branch protection. The intent is that it acts as the single chokepoint
> representing "all matrix it-tests passed" (since the matrix job names
> include the dynamic module list and can't be required individually).
> 
> The job's gate today is:
> 
> ```yaml
> test-results:
>   ...
>   if: ${{ failure() || success() }}
>   needs: [unit-tests, it-tests]
> ```
> 
> GitHub Actions `if:` semantics on a `needs:` chain treat
> `failure() || success()` as covering only success and failure — **not
> cancellation**. So when any matrix shard is cancelled, the
> `test-results` job's gate evaluates to false → SKIPPED.
> 
> A skipped required status check
> [satisfies the requirement in GitHub's
evaluation](https://github.com/orgs/community/discussions/13690),
> so the auto-merge bot proceeds and merges the PR.
> 
> The job's existing `Set Failure Status` step (line 268) is already
> written correctly with `if: always() && (... .result != 'success')` —
> it just never gets a chance to run because the whole job is skipped
> first.
> 
> ## Fix
> 
> Change the job-level gate to `if: ${{ always() }}` so `test-results`
> always runs (success / failure / cancelled / timed out). The existing
> `Set Failure Status` step then explicitly fails the job when any
> upstream needs entry is in a non-success state, including
> `cancelled`. The required check turns **red** instead of grey,
> auto-merge correctly blocks on it.
> 
> Tiny one-liner; comment added so the next person to touch this gate
> understands why `always()` is required.
> 
> ## Test plan
> 
> - [ ] Push a draft PR with an artificially cancelled it-tests shard
>       (or wait for the next natural occurrence) and confirm
>       `test-results` runs and reports failure rather than being
>       skipped.
> - [ ] Confirm the auto-merge bot does *not* merge a cherry-pick PR
>       while `test-results` is failing.
> 
> ## Follow-up
> 
> This change should be cherry-picked to `25.0`, `25.1`, and `main`
> once verified here. The same one-liner applies on every branch that
> carries `validation.yml`.
> 
> 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Zhe Sun <zhe@vaadin.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants