From cdb81c06ec5a46a9ace0b3c4b6cbbcd1c9e3f878 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Sun, 8 Nov 2026 03:26:16 +0100 Subject: [PATCH] aep export: note what the concurrency test covers and why a failed template build is not kept (#3277) --- crates/aep/src/export/emit.rs | 6 ++++-- crates/aep/src/export/template.rs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/aep/src/export/emit.rs b/crates/aep/src/export/emit.rs index 0f49f995f..25d69d7bb 100644 --- a/crates/aep/src/export/emit.rs +++ b/crates/aep/src/export/emit.rs @@ -930,8 +930,10 @@ mod tests { } } - /// Exports running at the same time on several threads, the first of them possibly building - /// the shared template, all give the single-threaded bytes. + /// Exports running at the same time on several threads all give the single-threaded bytes. + /// This checks concurrent exports from a template that is already built: other tests in this + /// binary usually fill the shared template first, so the race on the first build is not + /// reliably exercised here (the `static OnceLock` makes that race safe by construction). #[test] fn concurrent_exports_give_the_same_bytes() { let plans: Vec = ["", " x", " y", " z"].iter().map(|t| plan_of(&varied(t))).collect(); diff --git a/crates/aep/src/export/template.rs b/crates/aep/src/export/template.rs index 608fa75e1..f26be4c84 100644 --- a/crates/aep/src/export/template.rs +++ b/crates/aep/src/export/template.rs @@ -94,6 +94,7 @@ pub(crate) fn shared() -> R<&'static Template> { if let Some(t) = SHARED.get() { return Ok(t); } + // A failed build returns here, before `get_or_init`, so it is never kept. let t = Template::load()?; Ok(SHARED.get_or_init(|| t)) }