Repository navigation
Description
Summary
Three tests pass in isolation but fail in full-suite runs because each depends on a process-global cache that some other test populates with real (non-test) data and never resets. They share one root-cause pattern — an append-only or first-writer-wins global that has no per-test teardown — so they are grouped here. These currently report as failures on every contributor's full-suite PR gate.
Affected tests
experiments::tests::test_create_experiment_layer_mappings—app/src/experiments/mod_tests.rs:152server::telemetry::tests::test_persist_events_doesnt_include_ugc_events—app/src/server/telemetry/mod_tests.rs:46terminal::bootstrap::tests::test_trims_whitespace—app/src/terminal/bootstrap_tests.rs:46
Reproduction
Full suite (fails; these three appear among the 12-14 failures):
cargo test -p warp --lib
Each passes in isolation:
cargo test -p warp --lib -- --exact experiments::tests::test_create_experiment_layer_mappings
cargo test -p warp --lib -- --exact server::telemetry::tests::test_persist_events_doesnt_include_ugc_events
cargo test -p warp --lib -- --exact terminal::bootstrap::tests::test_trims_whitespace
# => each: ok. 1 passed
--test-threads=1 does not fix them: these are cumulative process-global caches carried across sequential tests, not data races. A full single-threaded run still fails with the same set.
Root cause
1. experiments — EXPERIMENT_LAYER_MAPPINGS never cleared
// app/src/experiments/mod.rs:77
static ref EXPERIMENT_LAYER_MAPPINGS: DashMap<&'static str, &'static Layer> = DashMap::new();create_experiment_layer_mappings only inserts, never clears the map. The public experiments::init maps the four real layers into this same global. Any test that runs app.update(experiments::init) — e.g. workspace/view_tests.rs:229, pane_group/mod_tests.rs:202, terminal/input_tests.rs:314, and the shared helper test_util/terminal.rs:186 — leaves the real layers behind. test_create_experiment_layer_mappings then asserts EXPERIMENT_LAYER_MAPPINGS.len() == 2 (mod_tests.rs:152) and sees more than 2. In isolation the map only holds the 2 test experiments.
2. telemetry — global TELEMETRY event queue drained wholesale
// crates/warpui_core/src/telemetry/mod.rs:13
static ref TELEMETRY: Mutex<EventStore> = Mutex::new(EventStore::new());EventStore.events is a 1024-cap BoundedVecDeque. record_event / create_event push onto this shared queue with no auto-flush, so any prior test that emits telemetry (e.g. ExperimentTriggered, emitted from experiments::mod.rs:337) leaves events queued. test_persist_events_doesnt_include_ugc_events records 2 events then calls flush_and_persist_events_at_path(max=10, ...), which drains the entire global queue and persists the last 10 non-UGC events, so assert_eq!(file_content.len(), 1) (mod_tests.rs:46) sees more than 1. The run log line "More telemetry events in queue than the limit to persist" is that exact overflow branch firing when the queue is already polluted past 10.
3. bootstrap — BOOTSTRAP_CACHE keyed on ShellType only, ignoring the asset provider
// app/src/terminal/bootstrap.rs:23
static ref BOOTSTRAP_CACHE: MemoMap<ShellType, Vec<u8>> = Default::default();script_for_shell memoizes on ShellType alone; the AssetProvider argument is not part of the cache key:
// app/src/terminal/bootstrap.rs:129
BOOTSTRAP_CACHE.get_or_insert(&shell_type, || {
let file_path = format!("bundled/bootstrap/{file}");
...
})First writer for a given ShellType wins for the rest of the process. Production PtyController::initialize_shell calls script_for_shell(shell_type, &crate::ASSETS) (pty_controller.rs:381), so any terminal/session test that drives a Zsh shell to ready populates BOOTSTRAP_CACHE[Zsh] with the real bundled zsh.sh. test_trims_whitespace (bootstrap_tests.rs:46) passes a TestAssetProvider but gets the cached real-asset script instead, so its exact-string assertion fails. In isolation it is the sole Zsh writer and sees its own fixture. (Sibling bootstrap tests use Bash/Fish/PowerShell keys, so they do not collide with each other — only a real-ASSETS Zsh writer breaks this one.)
Fix direction
- experiments: clear
EXPERIMENT_LAYER_MAPPINGSat the start of the test (or havecreate_experiment_layer_mappingsreplace rather than append), and#[serial]it so a concurrentexperiments::initcannot repopulate mid-test. - telemetry: drain the shared queue at the top of the test —
warpui::telemetry::clear_event_queue()already exists (crates/warpui_core/src/telemetry/mod.rs:47) — and mark the test#[serial]. - bootstrap: include the asset-provider identity in the
BOOTSTRAP_CACHEkey, or expose a test-only cache reset / bypass.#[serial]alone will not help here because the pollution is cumulative first-writer-wins, not concurrent.
Related
Related: #13853 (warp_editor render::tests Once-poisoning — same class, different crate) and the sibling flake tickets filed alongside this one: #13972, #13973, #13975
Activity
warp-for-oss commentedon Jul 19, 2026
@fbartho
Here's what I found while triaging this issue:
The report includes concrete full-suite and isolated-test reproduction commands, and code inspection supports the shared-process-state failure mode. No reporter follow-up is needed for initial routing.
Maintainer details
I concluded that full-suite app tests appear to fail because several process-global caches or queues persist state across test cases while the affected tests assume isolated state..
Triage summary
This looks like a reproducible test-suite bug rather than a user-environment issue. The report provides exact failing full-suite and passing isolated-test commands, and the current code supports the shared process-global state explanation.
Observed/code-supported findings:
app/src/experiments/mod.rsdefinesEXPERIMENT_LAYER_MAPPINGSas a process-globalDashMap, andcreate_experiment_layer_mappingsinserts entries without clearing or replacing unrelated previous entries.app/src/experiments/mod_tests.rsthen asserts an exact map length of 2 after inserting the test layer.crates/warpui_core/src/telemetry/mod.rsstores telemetry events in a process-globalTELEMETRYqueue.app/src/server/telemetry/mod_tests.rsrecords two events and thenapp/src/server/telemetry/mod.rsflushes the entire global queue before filtering/persisting, so earlier queued events can affect the assertion.app/src/terminal/bootstrap.rsmemoizesscript_for_shellresults inBOOTSTRAP_CACHEbyShellTypeonly. Production shell initialization inapp/src/terminal/writeable_pty/pty_controller.rscalls it with real assets, whileapp/src/terminal/bootstrap_tests.rscalls it withTestAssetProvider; whichever Zsh script is cached first wins for later calls in the same process.I did not find enough duplicate evidence to mark this as a duplicate. Open issues #13972, #13973, and #13975 look related as sibling full-suite/global-state flakes, but they cover different globals and affected tests rather than the same failure.
No reporter follow-up is needed for initial routing; the remaining work is implementation/validation of isolated test state or cache-key/reset behavior.
This is my automated analysis and may be incorrect. A maintainer will verify the details.
Powered by Oz
szgupta commentedon Jul 20, 2026
@oz-agent can you repro this issue? Our CI uses cargo nextest - is it possible that is behaving differently than vanilla cargo test?
warp-for-oss commentedon Jul 20, 2026
@szgupta
I could not run a live repro in this sandbox because
cargois not installed here, so this is based on code inspection plus nextest behavior.Yes —
cargo nextestis expected to behave differently fromcargo test -p warp --libfor this report. Nextest runs each test in a separate process by default, while vanilla libtest runs manywarplib tests in one test-binary process; these three failures depend on process-global state being populated by earlier tests in that same process.So the issue still looks valid for shared-process
cargo test, but CI that only usescargo nextest runis likely to mask this exact class of leak. If CI is seeing these failures, I would first check whether another CI step still invokes vanillacargo testor whether the failing log is from a non-nextest runner.Reasoning
Code inspection supports the reporter's shared-process root-cause pattern. In
app/src/experiments/mod.rs,EXPERIMENT_LAYER_MAPPINGSis a lazy staticDashMap(mod.rs:77) andcreate_experiment_layer_mappingsonly inserts into it (mod.rs:384-390);app/src/experiments/mod_tests.rs:148-152then asserts the global map length is exactly 2, which is order-dependent ifexperiments::initalready populated real layers.Telemetry also uses process-global state:
crates/warpui_core/src/telemetry/mod.rs:13defines staticTELEMETRY,record_eventappends to itsEventStore(mod.rs:75-90), andflush_eventsdrains it (mod.rs:106-108).app/src/server/telemetry/mod_tests.rs:8-46records two events and expects only one persisted non-UGC event, butapp/src/server/telemetry/mod.rs:161-181drains the entire global queue before filtering/persisting. There is an app-levelclear_event_queuehelper atapp/src/server/telemetry/mod.rs:37-43, but this test does not call it before recording.Bootstrap has the first-writer-wins cache described in the issue:
app/src/terminal/bootstrap.rs:23definesBOOTSTRAP_CACHE: MemoMap<ShellType, Vec<u8>>, andscript_for_shellkeysget_or_insertonly byShellType(bootstrap.rs:129) even though the generated script depends on theAssetProvider.app/src/terminal/bootstrap_tests.rs:47expects Zsh output fromTestAssetProvider, so any earlier same-process Zsh bootstrap using real assets can poison that assertion.For the maintainer's nextest question:
.config/nextest.tomlonly configures timeouts, integration-test thread weight, CI output, JUnit, and some retries; it does not configure these unit tests into a shared process. The cargo-nextest docs state that the default execution model is process-per-test and exposeNEXTEST_EXECUTION_MODE=process-per-test, so these append-only/first-writer-wins globals should reset between individual tests under nextest. I attemptedcargo nextest --version, but the sandbox returnedbash: cargo: command not found, so I could not verify by executing the suite here.Duplicate scan: fetched all open repository issues via
gh api --paginate, excluding PRs and #13974, plus recently closed issues updated since 2026-07-13. Related sibling app-test flake issues found included #13972, #13973, #13975, #13979, #13980, and recently closed #13853, but they cover different globals/tests or same-class failures rather than this exact three-cache issue. Fewer than two likely duplicates were identified.This is my automated analysis and may be incorrect. A maintainer will verify the details.
Powered by Oz
fbartho commentedon Jul 20, 2026
@szgupta I root caused some of these flakes, and in some cases they were examples of code that wasn't using the
must_usedrop-guards. (Due to a weirdness in how cargo merges things with the integration crate, the must_use wasn't presenting an issue to the developers)So I'm in progress of spinning up some PRs to clean up the clearly incorrectly written test-cases (the vast majority of call-sites do the right thing).
(I'm also switching to using
cargo nextestin my local environment which would have hidden these flakes for me personally).fbartho commentedon Jul 21, 2026
I proactively attempted an implementation based on the ticket as it's currently written: #14041.
If the ticket changes, I'm happy to update the PR to match a maintainer's guidance, just let me know!
fbartho commentedon Jul 28, 2026
Just nudging @oss-maintainers that this is still a real flake, and that I have a proposed fix here: #14041
szgupta commentedon Jul 29, 2026
@fbartho sorry for the delay - we will be looking at this today (cc @acarl005)
warp-for-oss commentedon Jul 29, 2026
This issue has been labeled
ready-to-implementand is open for contributions involving code changes. If you'd like to tackle it, feel free to open a pull request against this issue. You can also comment@oz-agenton this issue to have the bot draft an implementation PR automatically.warp-agent-staging commentedon Jul 29, 2026
Your GitHub account is not connected to Warp. Connect it here.
warp-agent-staging commentedon Jul 29, 2026
Picked this up via a factory automation (issue assigned) and started the factory loop.
Noted that #14041 is already open for this issue (currently
CHANGES_REQUESTED), so the loop is pointed at that PR rather than opening a second one. I'll report back here when triage finishes.warp-agent-staging commentedon Jul 29, 2026
Routing complete — triage dispatched.
GitHub
issue_assignedon https://github.com/warpdotdev/warp/issues/13974|warpdotdev/warp#13974 (real engineering issue, not an automation wiring test). No factory gate label existed, so it routes to triage — the default loop entry.• Ticket: https://linear.app/warpdotdev/issue/APP-5044/app-tests-three-append-only-process-global-caches-leak-across-tests|APP-5044 (Eng-App FA, In Progress, related to the CSAT-10195 GHUR mirror)
• Triage run: <https://oz.staging.warp.dev/runs/019faea2-8b39-7eb0-8df1-34b2ad702731|Oz run>
• Posted back on the issue: https://github.com/warpdotdev/warp/issues/13974#issuecomment-5120430825|comment
Flagged as critical context: <https://github.com/warpdotdev/warp/pull/14041|PR #14041> is already open for this issue (human-authored,
CHANGES_REQUESTED), so downstream must continue on that PR rather than open a duplicate.Waiting for triage to report.
warp-agent-staging commentedon Jul 29, 2026
Triage complete.
triage-donewarpdotdev/warp(single repo)Root cause confirmed on
masterby code inspection for all three globals (EXPERIMENT_LAYER_MAPPINGS, theTELEMETRYqueue, andBOOTSTRAP_CACHE). Triage's conclusion: the remaining work is finishing and landing #14041, not new greenfield work — that PR already implements clear+#[serial]for experiments/telemetry and the(ShellType, TypeId)bootstrap cache key.No spec recommended, so this auto-advances straight to implementation, scoped to continuing on #14041 (branch
fb/13974-global-cache-test-isolation). No second PR will be opened.warp-agent-staging commentedon Jul 29, 2026
Implementation dispatched, scoped to continuing #14041 — Oz run.
warp-agent-staging commentedon Jul 29, 2026
Triage complete → implementation dispatched (auto-advance).
• Ticket https://linear.app/warpdotdev/issue/APP-5044/app-tests-three-append-only-process-global-caches-leak-across-tests|APP-5044 — status Todo, estimate S (2), label
triage-done, repowarpdotdev/warp•
spec_recommended: false→ no spec gate; straight to implementation• Triage run: <https://oz.staging.warp.dev/runs/019faea2-8b39-7eb0-8df1-34b2ad702731|Oz run>
• Implementation run: <https://oz.staging.warp.dev/runs/019faeb1-d57d-7b6d-acfd-660694bfe1ac|Oz run>
Triage's key finding: the remaining work is finishing and landing the already-open <https://github.com/warpdotdev/warp/pull/14041|PR #14041>, not greenfield work. The implementation child is scoped to that branch (
fb/13974-global-cache-test-isolation) and explicitly told not to open a second PR.warp-agent-staging commentedon Jul 29, 2026
Factory loop started for https://github.com/warpdotdev/warp/issues/13974|warpdotdev/warp#13974 (GitHub
issue_assignedautomation).What I did
• Confirmed this was a real engineering request, not a
factory-automation-verifywiring test.• Found no factory gate label on the issue, so routed it to triage — the default loop entry. Searched Linear first: only the Customer Support GHUR mirror CSAT-10195 existed, so I created the factory ticket https://linear.app/warpdotdev/issue/APP-5044/app-tests-three-append-only-process-global-caches-leak-across-tests|APP-5044 in Eng-App FA and linked it as
relatedto CSAT-10195 rather than clobbering the support mirror.• Dispatched triage (https://oz.staging.warp.dev/runs/019faea2-8b39-7eb0-8df1-34b2ad702731|run). It came back: status Todo, estimate S (2), label
triage-done, repo confirmedwarpdotdev/warp,spec_recommended: false.•
spec_recommended: falsemeans no spec gate, so I auto-advanced straight to implementation (https://oz.staging.warp.dev/runs/019faeb1-d57d-7b6d-acfd-660694bfe1ac|run) after running the mandatory pre-dispatch PR check.The key finding
There is already an open, human-authored PR for this issue — https://github.com/warpdotdev/warp/pull/14041|#14041 by
fbarthoon branchfb/13974-global-cache-test-isolation, currentlyCHANGES_REQUESTED. Triage confirmed the remaining work is finishing and landing that PR, not greenfield implementation. I scoped the implementation child to that branch and explicitly forbade opening a second PR; I verified no duplicate PR was created.Where it stands
Implementation is still running — the
warpcrate's Rust build is heavy and triage already hit an OOM on a fullcargo test -p warpin this runner class. My bounded wait (3 polls) expired with no completion: no factory PR mapping yet, PR #14041 still at headb70f042with 3 commits, ticket stilltriage-done/Todo.Reply
continueto resume the loop — I'll pick up from the ticket's gate label and auto-dispatch code review onceimpl-donelands. Step results are posted on the GitHub issue (https://github.com/warpdotdev/warp/issues/13974#issuecomment-5120430825|routing, <https://github.com/warpdotdev/warp/issues/13974#issuecomment-5120588400|triage result>, <https://github.com/warpdotdev/warp/issues/13974#issuecomment-5120616359|impl dispatch>) and on APP-5044.acarl005 commentedon Aug 13, 2026
Closing as only
cargo nextestis supported.