Flaky failure investigation
Send the failure logs, the relevant code and the test configuration to Kimi K3, and have it find the issue that only shows up under certain conditions, with the evidence and a way to reproduce it. After the fix, rerun many times under those conditions to confirm it is gone.
Example: Why does this test only fail sometimes?
Material
- CI log
- export.test.ts fails about 1 run in 10, with the error: contents of /tmp/export.csv were overwritten.
- export.test.ts
- const out = '/tmp/export.csv'; await exportOrders(out);
- Test config
- Jest runs 4 workers in parallel, and report.test.ts also writes to /tmp/export.csv.
PromptUsing the logs, code and test configuration, find why the test fails intermittently, explain the evidence, and give the fix and how to verify it.
Sample answer · written by hand to show the reasoning
Both test files write to the same fixed path, and when the parallel workers happen to run them at the same time, the later write overwrites the earlier file, which is why the failure is intermittent. Give each test its own temporary directory, for example a path from fs.mkdtemp, then run the suite 50 times in parallel mode to confirm it no longer fails.