Skip to content

Keep the configure downloads once per machine and retry them (#570) - #585

Merged
AM-L merged 6 commits into
developfrom
570-download-cache
Nov 15, 2026
Merged

AM-L merged 6 commits into
developfrom
570-download-cache

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Collaborator

Point 4 de la proposition faite dans #570 : les téléchargements de la configuration.

Problème

Avec WEBFRONT_ENABLE_TESTING=ON, la configuration télécharge l'environnement d'amorçage épinglé (4 Mo), les paquets du registre de test (16 Mo) et, pour les projets consommateurs, jasmine-core. Deux défauts :

  • chaque nouveau répertoire de build les retéléchargeait ;
  • une seule tentative était faite : un incident réseau arrêtait la configuration.

Aucun test ne télécharge quoi que ce soit à l'exécution : seule la configuration est concernée.

Changement

webfront_download_verified() sert désormais les deux mécanismes de téléchargement (webfront_provision_bootstrap et webfront_provision_registry).

  • Cache par machine WEBFRONT_DOWNLOAD_CACHE. Par ordre de priorité : la variable d'environnement de ce nom, sinon $CPM_SOURCE_CACHE/webfront-downloads, sinon le répertoire de cache de l'utilisateur pour le build de WebFront lui-même. Un projet consommateur garde ses téléchargements dans son arbre de build, sauf s'il en définit un. Une valeur vide désactive le cache.
  • Entrées indexées par la première moitié du SHA-512. Le fichier est écrit à côté, puis renommé une fois vérifié : une configuration concurrente ne lit jamais un fichier partiel.
  • Dans l'arbre de build, l'archive est un lien physique vers le cache, ou une copie quand le lien est impossible.
  • Trois tentatives espacées de 5 s, avant le message qui indique les solutions hors ligne.
  • Empreinte fausse : la configuration s'arrête, et rien n'atteint le cache ni l'arbre de build. Une entrée de cache endommagée est retéléchargée, jamais utilisée. Un cache impossible à écrire donne un avertissement, et l'arbre de build garde alors seul sa copie.

Vérification

  • BootstrapProvisioning couvre :

    • le remplissage du cache ;
    • un second arbre servi sans la source ;
    • une entrée endommagée, retéléchargée ;
    • une empreinte fausse, tenue hors du cache ;
    • les nouvelles tentatives.

    Avec l'ancien WebFrontBootstrap.cmake, il échoue sur ces cas.

  • Essai réel sous Windows : deux configurations neuves dans deux répertoires distincts. La première remplit le cache, la seconde prend 13 s au lieu de 20 s, et ses archives sont des liens physiques vers le cache.

  • Suite complète Windows (MSVC Release, WebView2, hors portability) : 175 cas sur 176 passent. Le seul échec, ReleaseDeveloperWorkflowRegression, existait déjà : le bash de WSL ne voit pas le script sous C:/.

  • Non exécuté localement : Linux et macOS, couverts par la CI de la PR. La CI garde son actions/cache des archives : un arbre qui contient déjà l'archive vérifiée n'utilise pas le cache par machine.

Part of #570.

The bootstrap environment, the test registry and jasmine-core were downloaded
again by every new build tree, in one attempt: a network hiccup stopped the
configure, and a second tree on the same machine paid the download again.

webfront_download_verified() now serves both provisioners. A download goes to
WEBFRONT_DOWNLOAD_CACHE (the environment variable of that name, else CPM's
cache, else the user's cache directory for WebFront's own build; a consuming
project keeps its downloads in its build tree unless it sets one), under the
first half of its SHA-512, written aside and renamed once verified. The build
tree then links it, or copies it where a link cannot be made. A failed
download is tried three times; data with another digest never reaches the
cache or the build tree.

BootstrapProvisioning covers the cache: a fill, a second tree served without
the source, a damaged entry downloaded again, a wrong digest kept out, and the
retries before the offline hint.
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

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 12 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: 9ec2dc47-6e0e-4680-8195-d2f76e1a85fc
Commits

Reviewing files that changed from the base of the PR and between c2fb0bd and 6995b06.

Files selected for processing: 6

  • AGENTS.md
  • cmake/WebFrontBootstrap.cmake
  • cmake/WebFrontRegistry.cmake
  • docs/CHANGELOG.md
  • docs/DEVELOPER_ENVIRONMENT.md
  • test/cmake/CheckBootstrapProvisioning.cmake
  • 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

…ling (#570)

- A cache directory that exists but refuses files stopped the configure:
  file(MAKE_DIRECTORY) succeeds on it, and the download then failed to create
  its partial file. A verified entry of such a cache now serves without
  writing, and a download goes to the cache only when a probe file can be
  created there; otherwise it stays in the build tree with a warning.
- The test registry looked for each archive in WEBFRONT_REGISTRY_DIR before
  the verified copy already in the build tree, so a configure failed once the
  offline directory was no longer mounted. The verified copy is kept first,
  as before the cache.

BootstrapProvisioning covers both: a read-only cache, empty then holding the
entry (POSIX, skipped where the process writes through permissions), and a
registry provisioned again after its offline directory went away. Its checks
read CMake's wrapped messages on one line.
…ad cache (#570)

DEFINED ENV{CPM_SOURCE_CACHE} is true for a variable set to nothing: the
default cache then became /webfront-downloads, at the root, even for a
consuming project that asked for no shared cache. Every variable that chooses
the place (WEBFRONT_DOWNLOAD_CACHE, CPM_SOURCE_CACHE, LOCALAPPDATA,
XDG_CACHE_HOME, HOME) now counts only when it has a value, and the choice goes
on to the next; -DWEBFRONT_DOWNLOAD_CACHE= still disables the cache.

BootstrapProvisioning reads the default cache under an empty CPM_SOURCE_CACHE,
an empty WEBFRONT_DOWNLOAD_CACHE and both set.
…570)

The read-only cache keeps the case that stopped the configure, and the default
cache the case of an empty CPM_SOURCE_CACHE; the other combinations repeated
what those prove. All of them stay inside BootstrapProvisioning: no CTest case
is added.
A damaged entry is replaced by the same download that fills the cache, and a
wrong digest is refused by the same verification with or without a cache: the
fill and the second build tree served from the cache remain.
@AM-L
AM-L merged commit a22d8bc into develop Nov 15, 2026
19 of 20 checks passed
@AM-L
AM-L deleted the 570-download-cache branch November 15, 2026 11:15
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