You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky unit test: compute-ledger migration-trigger check depends on readdir order #2170
backend/test/compute-ledger.test.ts has a test whose result depends on the order in which the operating system lists a directory, so it fails intermittently on Linux runners.
The test: "migration 0114 creates the triggers on compute_pools, and migration 0130 only replaces the identity one with its anonymizing exception".
It collects the files that create a trigger on compute_pools through the helper sources(), which walks backend/src, backend/scripts, src, shared and scripts with readdirSync(dir, { withFileTypes: true }) and appends entries in the order returned. readdirSync does not sort: the order is whatever the filesystem returns (sorted on macOS APFS, not guaranteed on Linux).
The assertion then expects the two migrations in a fixed order: expect(files.map((f) => f.path)).toEqual([0114_compute_ledger.sql, 0130_compute_anonymise.sql]).
Observed: one failure on a pull request run in the unit-pure shard 1/6 (run 43618622350 on nemarOrg/nemar-cli, 2026-11-14), where the files arrived with 0130 first; the rerun of the same job passed, the same test passed in five other recent runs, and it passes locally on macOS.
Suggested fix: sort the entries inside walk (for example readdirSync(...).sort((a, b) => a.name.localeCompare(b.name))), or sort files by path before comparing, so the assertion tests the migrations and not the filesystem.
Activity