Web app: the offline check with the real app finishes its download (#10368) (#10370)

* claim: 10368

* Web offline test: each copy of a real build gets a file of its own (#10368)

With --site, the six builds were copies of one real build that differed
only in index.html. The overlapping-downloads step holds back the files
the next build lacks, so nothing of v5 was held: its download finished
before v6 launched, v6's worker then retired and deleted it (correctly,
no page used it), and the step waited 240 s to see it complete.

Successive deployments differ in more file names than that (Trunk names
files after their contents). Each copy now gets own-<build>.txt, like
the stand-in's build-named script, so v5's own file is held as the step
intends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Markus Kaltenbrunner <kaltenbrunnermarkus@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-11-02 00:10:42 +00:00
1 parent 27951f40c3
commit eb0cecee31
1 file changed
+7
+7
View File
@@ -47,6 +47,9 @@
//! `cargo xtask web-offline`'s generator and a `data-build` marker on `<html>`. Chrome comes from
//! `CHROME` or the usual install locations; `cargo xtask ci` skips this test when there is none.
//!
//! A real build's copies each get a file of their own, as successive deployments have files
//! named differently.
//!
//! The stand-in app has a content-named script, a `shared.js` whose name is the same in every
//! build (a page must get its own build's), more files under `icons/` than the browser asks for
//! at once, and an on-demand file under `fonts/` (not kept).
@@ -240,6 +243,10 @@ pub fn run(root: &Path, site: Option<&str>, required: bool) -> Result<(), String
check_site(root, Path::new(dir), &work.0.join("check"))?;
for (to, build) in &builds {
copy_dir(Path::new(dir), to)?;
// Trunk names files after their contents, so two real deployments differ in more
// than `index.html`; copies of one build don't. A file of its own per copy lets
// a step hold back what one build has and the next lacks (step 13).
std::fs::write(to.join(format!("own-{build}.txt")), format!("{build}\n")).map_err(|e| format!("{}: {e}", to.display()))?;
let index = to.join("index.html");
let html = std::fs::read_to_string(&index).map_err(|e| format!("{}: {e}", index.display()))?;
std::fs::write(&index, mark(&html, build)?).map_err(|e| format!("{}: {e}", index.display()))?;