From 160cc81741d9ec0df499ad1a7f48b970ad68a21f Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Wed, 17 Jun 2026 22:30:47 +0200 Subject: [PATCH] fix(test): de-flake theme_persistence project-write assertion under load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "persists project.theme into that repo" case asserted the .clide settings file existed after a single pumpEventQueue, but the write is fire-and-forget real I/O — one event-queue drain doesn't guarantee the disk flush, so it flaked in the loaded coverage pool. Poll for the file (bounded) instead. Co-Authored-By: Claude Opus 4.8 (1M context) --- test/kernel/src/theme_persistence_test.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/kernel/src/theme_persistence_test.dart b/test/kernel/src/theme_persistence_test.dart index c409641d..d75e4c7f 100644 --- a/test/kernel/src/theme_persistence_test.dart +++ b/test/kernel/src/theme_persistence_test.dart @@ -61,8 +61,13 @@ void main() { await settings.setProjectDir(repoTmp); theme.select('forest'); expect(settings.get('project.theme'), 'forest'); - await pumpEventQueue(); // let the unawaited file write flush - expect(await File('${repoTmp.path}/.clide/settings.yaml').exists(), isTrue); + // The on-disk write is fire-and-forget; poll for it instead of assuming a + // single event-queue drain flushes the real I/O (flaked under load). + final file = File('${repoTmp.path}/.clide/settings.yaml'); + for (var i = 0; i < 100 && !file.existsSync(); i++) { + await Future.delayed(const Duration(milliseconds: 5)); + } + expect(file.existsSync(), isTrue); }); test('the high-contrast variant persists (the name encodes -hc)', () async {