Skip to content

Enable native window detection for consumers [#397] - #410

Merged
AM-L merged 3 commits into
developfrom
397-consumer-native-window
Oct 29, 2026
Merged

AM-L merged 3 commits into
developfrom
397-consumer-native-window

Conversation

@ambroise-leclerc

@ambroise-leclerc ambroise-leclerc commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Consumer projects using add_subdirectory or CPM cannot see the native frontend registry or automatically detected options, so the public frontend helpers do not configure their application targets. This enables native detection by default outside test and fuzzing builds, shares the registry and configured results across directories, and adds webfront_use_native_window(target) to select the native frontend with a browser fallback.

The default MSVC detection downloads the pinned WebView2 SDK during configuration; browser-only or offline consumers can disable automatic detection. The helper distinguishes explicitly disabled engines from missing dependencies, and the registry publishes option changes made while loading support modules.

Regression fixtures retain the actual host system while testing parent and sibling scopes, caller overrides, support-module changes and offline configuration. Native desktop jobs also compile a consumer against the real platform frontend, reusing the provisioned SDK.

Fixes #397

Validation:

  • CEF-off Release build and five focused CMake frontend/consumer checks passed under WSL. The complete CTest run passed 353 of 356 tests: two existing browser-command tests assume a Linux launcher rather than WSL PowerShell, and JasmineRunnerArgumentsAndDeadline failed its unrelated-SIGKILL timeout case.
  • GCC 15.3 required the local option -Wno-error=nonnull for an existing React test warning. WebKitGTK development files were unavailable locally; the native desktop CI jobs cover actual native consumer compilation.
  • Windows/MSVC/WebView2, macOS/WKWebView and Linux/WebKitGTK desktop CI passed on the updated head. Both FrontendConsumerConfiguration and AddSubdirectoryNativeConsumer passed on all three platforms.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 18:27
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4af32f89-d6e6-4e07-a4d9-b534a70ade03
Commits

Reviewing files that changed from the base of the PR and between 1cf2327 and e9babe7.

Files selected for processing: 15
  • CMakeLists.txt
  • README.md
  • cmake/Frontends.cmake
  • docs/CHANGELOG.md
  • docs/FRONTENDS.md
  • docs/PROJECT_STATUS.md
  • examples/CMakeLists.txt
  • test/cmake/CheckFrontendConsumer.cmake
  • test/cmake/consumer/CMakeLists.txt
  • test/cmake/consumer/main.cpp
  • test/cmake/frontend-consumer/CMakeLists.txt
  • test/cmake/frontend-consumer/provider/CMakeLists.txt
  • test/cmake/frontend-consumer/provider/ConsumerSupport.cmake
  • test/cmake/frontend-consumer/sibling/CMakeLists.txt
  • test/unit/CMakeLists.txt

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f8051cf-cc9e-4070-a925-1ef87848e1fe
Commits

Reviewing files that changed from the base of the PR and between 22f6795 and 1cf2327.

Files selected for processing: 14
  • CMakeLists.txt
  • README.md
  • cmake/Frontends.cmake
  • docs/CHANGELOG.md
  • docs/FRONTENDS.md
  • docs/PROJECT_STATUS.md
  • test/cmake/CheckFrontendConsumer.cmake
  • test/cmake/consumer/CMakeLists.txt
  • test/cmake/consumer/main.cpp
  • test/cmake/frontend-consumer/CMakeLists.txt
  • test/cmake/frontend-consumer/provider/CMakeLists.txt
  • test/cmake/frontend-consumer/provider/ConsumerSupport.cmake
  • test/cmake/frontend-consumer/sibling/CMakeLists.txt
  • test/unit/CMakeLists.txt

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

L’autodétection du frontend natif s’applique désormais aussi aux projets consommateurs, sauf dans les builds de test et de fuzzing. Une nouvelle fonction CMake configure la cible avec le frontend natif disponible ou signale le recours au navigateur par défaut. Des tests couvrent ces configurations.

Changes: Fenêtre native pour les projets consommateurs

Layer / File(s) Summary
Détection par défaut et registre partagé
CMakeLists.txt, cmake/Frontends.cmake, docs/FRONTENDS.md, docs/PROJECT_STATUS.md
L’autodétection par défaut ne dépend plus de la construction des exemples ni du statut de projet racine. Le registre et les options des frontends sont conservés dans les propriétés globales et rechargés par les fonctions qui les consultent.
Configuration de la fenêtre native
cmake/Frontends.cmake, README.md, docs/FRONTENDS.md, docs/CHANGELOG.md, test/cmake/consumer/CMakeLists.txt, test/cmake/consumer/main.cpp
webfront_use_native_window(target) applique le hook SETUP et définit WEBFRONT_NATIVE_WINDOW lorsque le frontend natif est activé. Dans le cas contraire, la fonction signale le recours au navigateur par défaut. Le projet consommateur de test choisit son type WebFront selon cette définition.
Vérification des projets consommateurs
test/cmake/CheckFrontendConsumer.cmake, test/cmake/frontend-consumer/*, test/unit/CMakeLists.txt
Les tests vérifient l’accès aux API depuis des répertoires parent et frère, le comportement sur une plateforme non prise en charge et les configurations avec ou sans le projet complet. Le test consommateur existant désactive explicitement l’autodétection native.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ConsumerCMake
  participant webfront_use_native_window
  participant NativeFrontendSetup
  participant ConsumerTarget
  ConsumerCMake->>webfront_use_native_window: Configure la cible
  webfront_use_native_window->>webfront_use_native_window: Vérifie l’option native de la plateforme
  alt Frontend natif activé
    webfront_use_native_window->>NativeFrontendSetup: Appelle le hook SETUP
    NativeFrontendSetup->>ConsumerTarget: Configure la cible
    webfront_use_native_window->>ConsumerTarget: Définit WEBFRONT_NATIVE_WINDOW
  else Frontend natif non activé
    webfront_use_native_window-->>ConsumerCMake: Signale le navigateur par défaut
  end
Loading

Possibly related issues

  • WebFront issue 398 : le PR couvre le choix entre fenêtre native et navigateur lors de la configuration, mais pas le repli à l’exécution sans session graphique.

Possibly related PRs

Suggested reviewers: am-l

Merge Risk: Minimal · previous review 1cf23

Native detection is available to consumers, with browser fallback when unavailable. No merge-blocking issue was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed Le titre résume clairement l’objectif principal : activer la détection des fenêtres natives pour les projets consommateurs.
Linked Issues check Passed Les exigences de l’issue #397 sont couvertes. CMakeLists.txt active la détection native pour les consommateurs hors tests et fuzzing. cmake/Frontends.cmake partage le registre et les résultats via…
Out of Scope Changes check Passed Les changements restent dans le périmètre de #397. La documentation, le changelog, le statut du projet et les tests CMake décrivent ou vérifient la détection native pour les consommateurs. Aucun chang…
Description check Passed La description décrit directement les changements du PR : détection native pour les consommateurs add_subdirectory/CPM, partage du registre frontend, ajout de webfront_use_native_window(target), repli…
Full details: Linked Issues check

Explanation

Les exigences de l’issue #397 sont couvertes. CMakeLists.txt active la détection native pour les consommateurs hors tests et fuzzing. cmake/Frontends.cmake partage le registre et les résultats via des propriétés globales. Les helpers publics rechargent ces données depuis les répertoires consommateurs. webfront_use_native_window(target) applique le hook du moteur actif, définit WEBFRONT_NATIVE_WINDOW seulement si le moteur est disponible et conserve le repli navigateur sinon. Les fixtures test/cmake/frontend-consumer vérifient les répertoires parent et frère, les hooks, les moteurs activés ou désactivés et la plateforme non prise en charge.

Full details: Out of Scope Changes check

Explanation

Les changements restent dans le périmètre de #397. La documentation, le changelog, le statut du projet et les tests CMake décrivent ou vérifient la détection native pour les consommateurs. Aucun changement indépendant ou sans lien avec cet objectif n’est démontré.

Full details: Description check

Explanation

La description décrit directement les changements du PR : détection native pour les consommateurs add_subdirectory/CPM, partage du registre frontend, ajout de webfront_use_native_window(target), repli vers le navigateur et tests associés.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. (13 skipped: 13 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two unresolved active findings remain in the change, including grammatical and maintainability issues flagged in the docs and CMake files that still need author attention.

2 open issues
What changed in this PR

This PR resolves #397, where consumers integrating WebFront via add_subdirectory/CPM could not benefit from native-window detection: the frontend registry and detection results lived in WebFront's directory scope (PARENT_SCOPE normal variables), so the public frontend helpers were inert outside WebFront's own directory. The change moves the registry and configured option state into GLOBAL properties (reloaded in each helper via a new _webfront_load_frontends macro), enables native detection by default for any non-test/non-fuzzing build, and adds a single consumer-facing helper webfront_use_native_window(target) that applies the native engine's setup and defines WEBFRONT_NATIVE_WINDOW with a browser fallback and installation guidance.

Changes:

  • Share frontend metadata and the detected/declared option state across directory scopes via GLOBAL properties, so webfront_native_frontend_option/webfront_setup_frontends_for_target work from parent/sibling dirs.
  • Default WEBFRONT_AUTODETECT_NATIVE to ON for all builds except ENABLE_TESTING/ENABLE_FUZZING, and add webfront_use_native_window(target).
  • Add CMake regression fixtures (parent/sibling/unsupported, enabled/disabled engine, full-project offline configure) plus README/FRONTENDS/PROJECT_STATUS/CHANGELOG documentation.
File Description
cmake/​Frontends.cmake Core change: _webfront_load_frontends macro, GLOBAL-property registry/ENABLED publishing, and new webfront_use_native_window helper.
CMakeLists.txt Default native detection to ON outside test/fuzzing builds, regardless of top-level/examples.
test/​cmake/​frontend-consumer/​** New fixture exercising the helpers across parent/sibling/unsupported scopes and offline full-project configure.
test/​cmake/​CheckFrontendConsumer.cmake Driver running the fixture for probe×full-project combinations and asserting the fallback notice.
test/​cmake/​consumer/​{CMakeLists.txt,main.cpp} Smoke consumer now calls webfront_use_native_window and selects the app type via WEBFRONT_NATIVE_WINDOW.
test/​unit/​CMakeLists.txt Registers FrontendConsumerConfiguration and opts the smoke test out of detection.
README.md, docs/​FRONTENDS.md, docs/​PROJECT_STATUS.md, docs/​CHANGELOG.md Document the consumer helper, default detection, and cross-directory behavior.

I verified the global-property sharing, ENABLED republishing, and option-precedence logic are internally consistent, that WebFrontWithFrontend/NativeWebViewFrontend exist as referenced, and that the README anchor resolves. Two findings recorded: a subject–verb grammar error in docs/FRONTENDS.md, and an optional maintainability note about the fallback-advice block being duplicated from examples/CMakeLists.txt.

Review effort: Balanced

Comment thread cmake/Frontends.cmake Resolved
Comment thread docs/FRONTENDS.md Resolved
A parent's ENABLE_TESTING or ENABLE_FUZZING no longer disables native
window detection for its consumers; only a top-level WebFront build keeps
that exclusion. The registry loader leaves ordinary variables untouched
when no registry was published, and the browser-fallback advice is printed
once per configuration. Generic test option names are tracked in #412.
]

webfront_native_window_advice builds the platform guidance once for
webfront_use_native_window and the Life examples, which now also tell an
explicitly disabled engine from a missing dependency. Fix the grammar of
the detection paragraph in FRONTENDS.md.
@AM-L
AM-L merged commit f562bfa into develop Oct 29, 2026
9 checks passed
@AM-L
AM-L deleted the 397-consumer-native-window branch October 29, 2026 20:30
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.

Détection de la fenêtre native inaccessible aux projets consommateurs (CPM / add_subdirectory)

3 participants