Public: anyone can read this; the crew can change it.

test/pulls-merge-budget.test.ts once answered a conflict where there is none #17700

opened this in answer to

Merged 13h 3m ago, live in production

The flaky test is fixed, and the merge check itself did not answer wrongly. I never got the failure to appear again. The cause below comes from reading the code and the 3.17 s timing, not from a reproduction.

Notes

opened this

The flaky test is fixed, and the merge check itself did not answer wrongly. I never got the failure to appear again. The cause below comes from reading the code and the 3.17 s timing, not from a reproduction.

What happened. The test sets up 50 pulls, with the first 10 touching a.txt. Then main moves, so those 10 now truly conflict. Two lists ask at once, with a 300 ms budget for readings they don't have yet.

  • What the test relied on. At 300 ms, pulls whose reading hasn't finished answer their previous reading, which is "mergeable". The test required at least one of the 10 conflicting pulls to still be in that stale state.
  • Where it broke. In a wide run the process is busy, so the budget timer fires late. Meanwhile the readings carry on, and the first batches finish before the lists answer. All 10 conflicting pulls then answered their fresh, correct conflict on a.txt, the assertion on the stale answer failed, and the test stopped at about 3.2 s.
  • Can a person get a wrong answer? No. A late timer only gives a fresher answer than the budget promises. The same race could also make the two lists answer differently from each other, which would trip expect(again).toEqual(during).

The change. Only test/pulls-merge-budget.test.ts changed. The stand-in merge check now holds every reading until both lists have answered. The test also asserts that every pull answers its stale "mergeable" with no conflicts, which is stricter than the old "at least one". The later checks that each pair is read once, at most four at a time, are unchanged. The test passed 3 of 3 alone, and scripts/gate.ts ran with nothing to fix. I did not run tsc or the whole suite, because the first command in my last step failed.

Not done. No source changes. The merge-reading cache key (head:base) leaves out the repository directory. I found no wrong answer from it, because identical commit ids mean identical content.

Closes #17698

commented

The flaky test is fixed, and the merge check itself did not answer wrongly. I never got the failure to appear again. The cause below comes from reading the code and the 3.17 s timing, not from a reproduction.

What happened. The test sets up 50 pulls, with the first 10 touching a.txt. Then main moves, so those 10 now truly conflict. Two lists ask at once, with a 300 ms budget for readings they don't have yet.

  • What the test relied on. At 300 ms, pulls whose reading hasn't finished answer their previous reading, which is "mergeable". The test required at least one of the 10 conflicting pulls to still be in that stale state.
  • Where it broke. In a wide run the process is busy, so the budget timer fires late. Meanwhile the readings carry on, and the first batches finish before the lists answer. All 10 conflicting pulls then answered their fresh, correct conflict on a.txt, the assertion on the stale answer failed, and the test stopped at about 3.2 s.
  • Can a person get a wrong answer? No. A late timer only gives a fresher answer than the budget promises. The same race could also make the two lists answer differently from each other, which would trip expect(again).toEqual(during).

The change. Only test/pulls-merge-budget.test.ts changed. The stand-in merge check now holds every reading until both lists have answered. The test also asserts that every pull answers its stale "mergeable" with no conflicts, which is stricter than the old "at least one". The later checks that each pair is read once, at most four at a time, are unchanged. The test passed 3 of 3 alone, and scripts/gate.ts ran with nothing to fix. I did not run tsc or the whole suite, because the first command in my last step failed.

Not done. No source changes. The merge-reading cache key (head:base) leaves out the repository directory. I found no wrong answer from it, because identical commit ids mean identical content.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs