Skip to content

fix: disable Copilot by default in the mock Vaadin environment (#280) (CP: 25.3) - #289

Merged
mcollovati merged 1 commit into
25.3from
cherry-pick-280-to-25.3
Oct 14, 2026
Merged

mcollovati merged 1 commit into
25.3from
cherry-pick-280-to-25.3

Conversation

@mcollovati

Copy link
Copy Markdown
Contributor

This PR cherry-picks changes from the original PR #280 to branch 25.3.

Original PR description

Review risk: two-way door — changes a default in the mock environment only; tests that relied on Copilot initializing (unlikely) now need copilot.enable=true.

Summary

Every mock Vaadin environment initializes a real servlet, and when Copilot is on the test classpath its service init listener scans the classpath on each initialization, i.e. once per test. There is no browser and no Copilot UI in a browserless test, so that only slows the suite down. Copilot is now disabled by default in the mock environment, and a test that needs it can enable it again through the regular test configuration.

Refs #278 (Spring is not covered yet, see below)

What changed

  • MockVaadin.setupServlet sets copilot.enable=false on the mock context and servlet init parameters before the test's BrowserlessConfiguration application properties. It is a default, not an enforced value: @BrowserlessTestConfig(applicationProperties = "copilot.enable=true") or withApplicationProperty("copilot.enable", "true") re-enables Copilot.
  • The key is copilot.enable without a vaadin. prefix, because that is what Copilot reads from ApplicationConfiguration outside Spring. Flow adds the vaadin. prefix only when it looks up JVM system properties.
  • Behavior change: Copilot no longer initializes in plain JUnit, extension, BrowserlessApplicationContext and Quarkus based tests unless enabled.
  • Not covered: with Spring, Copilot reads vaadin.copilot.enable from the Spring Environment and ignores init parameters, so SpringBrowserlessTest is unaffected. The README explains how to set it there. Options for a framework-level default are discussed on the issue.
  • README documents the default and how to override it.

Test summary

  • Without configuration, the application configuration reports Copilot disabled (fails without the change).
  • A method-level @BrowserlessTestConfig with copilot.enable=true turns it back on, proving the test configuration wins over the default.
  • Full build passes (junit6: 1503 tests).

Fixes #278

… (CP: 25.3)

This PR cherry-picks changes from the original PR #280 to branch 25.3.
---
#### Original PR description
> **Review risk:** two-way door — changes a default in the mock environment only; tests that relied on Copilot initializing (unlikely) now need `copilot.enable=true`.
>
> ## Summary
> Every mock Vaadin environment initializes a real servlet, and when Copilot is on the test classpath its service init listener scans the classpath on each initialization, i.e. once per test. There is no browser and no Copilot UI in a browserless test, so that only slows the suite down. Copilot is now disabled by default in the mock environment, and a test that needs it can enable it again through the regular test configuration.
>
> Refs #278 (Spring is not covered yet, see below)
>
> ## What changed
> - `MockVaadin.setupServlet` sets `copilot.enable=false` on the mock context and servlet init parameters *before* the test's `BrowserlessConfiguration` application properties. It is a default, not an enforced value: `@BrowserlessTestConfig(applicationProperties = "copilot.enable=true")` or `withApplicationProperty("copilot.enable", "true")` re-enables Copilot.
> - The key is `copilot.enable` without a `vaadin.` prefix, because that is what Copilot reads from `ApplicationConfiguration` outside Spring. Flow adds the `vaadin.` prefix only when it looks up JVM system properties.
> - Behavior change: Copilot no longer initializes in plain JUnit, extension, `BrowserlessApplicationContext` and Quarkus based tests unless enabled.
> - Not covered: with Spring, Copilot reads `vaadin.copilot.enable` from the Spring `Environment` and ignores init parameters, so `SpringBrowserlessTest` is unaffected. The README explains how to set it there. Options for a framework-level default are discussed on the issue.
> - README documents the default and how to override it.
>
> ## Test summary
> - Without configuration, the application configuration reports Copilot disabled (fails without the change).
> - A method-level `@BrowserlessTestConfig` with `copilot.enable=true` turns it back on, proving the test configuration wins over the default.
> - Full build passes (`junit6`: 1503 tests).
>
> Fixes #278

(cherry picked from commit d490289)
@mcollovati
mcollovati enabled auto-merge (squash) October 13, 2026 13:01
@mcollovati
mcollovati merged commit 8a1d55e into 25.3 Oct 14, 2026
6 checks passed
@mcollovati
mcollovati deleted the cherry-pick-280-to-25.3 branch October 14, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants