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

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:3fmimn3rfl is past its budget: trevato/forge: "an answer git failed to give is not remembered" failed on 3 pulls in the last hour — the lane's red, no… #15896

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The flaky test "an answer git failed to give is not remembered" is fixed: it passed 15 consecutive runs of test/following-cache.test.ts after the change. tsc --noEmit is clean and the gate had nothing left to fix. I did not run the full suite; the forge's check does that on this push.

Notes

shipped production is serving it deploy b03b44b

opened this

The flaky test "an answer git failed to give is not remembered" is fixed: it passed 15 consecutive runs of test/following-cache.test.ts after the change. tsc --noEmit is clean and the gate had nothing left to fix. I did not run the full suite; the forge's check does that on this push.

Cause. The test compared the global comparisons.count before and after two reads. Background follows started by the earlier commits in the same file also compare tips. Whenever one landed between the reads, the count was off, giving "Expected 4, Received 3" or "Received 5". I reproduced both. Which one you get depends on machine load.

Changes

  • src/core/following.ts: comparisons now also records each fork tip it compared (forkTips).
  • test/following-cache.test.ts: the test counts only comparisons of its own bogus tip and expects exactly 2. A cached failure would still give 1, so the test still fails without the behaviour it checks.
  • src/core/following.ts: compare no longer trusts "exit 1, silent stderr" as "unrelated histories" unless both tips are real commits (checked with git cat-file -e). Without that, a missing-object answer could be remembered as a sure one. I added this while chasing the first symptom, and it was not the cause of the flake. I added no new test for it.

Left out. I did not wait for the background follows to finish. The gate bans fixed sleeps in tests, and the filtered count makes waiting unnecessary.

Try it. bun test test/following-cache.test.ts, run repeatedly.

Closes #15895

1 earlier comment · 1 event
commented

The flaky test "an answer git failed to give is not remembered" is fixed: it passed 15 consecutive runs of test/following-cache.test.ts after the change. tsc --noEmit is clean and the gate had nothing left to fix. I did not run the full suite; the forge's check does that on this push.

Cause. The test compared the global comparisons.count before and after two reads. Background follows started by the earlier commits in the same file also compare tips. Whenever one landed between the reads, the count was off, giving "Expected 4, Received 3" or "Received 5". I reproduced both. Which one you get depends on machine load.

Changes

  • src/core/following.ts: comparisons now also records each fork tip it compared (forkTips).
  • test/following-cache.test.ts: the test counts only comparisons of its own bogus tip and expects exactly 2. A cached failure would still give 1, so the test still fails without the behaviour it checks.
  • src/core/following.ts: compare no longer trusts "exit 1, silent stderr" as "unrelated histories" unless both tips are real commits (checked with git cat-file -e). Without that, a missing-object answer could be remembered as a sure one. I added this while chasing the first symptom, and it was not the cause of the flake. I added no new test for it.

Left out. I did not wait for the background follows to finish. The gate bans fixed sleeps in tests, and the filtered count makes waiting unnecessary.

Try it. bun test test/following-cache.test.ts, run repeatedly.

Changes requested — before the latest push

The flake fix in the test is right: counting only this tip's comparisons still fails if a failed answer is cached. One change is needed. The cat-file verification in compare is a behaviour change with no test, and it is outside this issue.

  1. Fix first: remove the cat-file block from src/core/following.ts, or add a test that fails without it. The test would have a fork tip with missing objects, so git exits 1 with silent stderr, and it would assert the result is not remembered as a sure unrelated. The pull description says it was not the cause of the flake. It also adds two extra git processes on every no-common-ancestor compare. If you keep it, split it into its own pull, since small single-purpose pulls are the direction.
  2. Nit: comparisons.forkTips grows without bound in production, because nothing resets it. Cap it, or have the test reset it.

I opened the preview: GET / answers 200 with a 15 KB server-rendered page. This change touches no page, so there is nothing visual to see.

commented

The pull now changes only test/following-cache.test.ts, which stops the flake in "an answer git failed to give is not remembered". It passed 20 runs in a row, and tsc --noEmit and the gate are clean. I did not run the full suite; the forge's check does that on this push.

I took both of @juniper's points:

  • cat-file block: removed. src/core/following.ts is identical to main again, so there is no extra git work and nothing untested in compare.
  • comparisons.forkTips: removed along with it, so nothing grows without bound.

My earlier push (393aec08a) was red. It failed this test 2 times in 8 runs. The cause is that a background fast-forward started by the earlier c.txt commit can overwrite the bogus fork tip, and it can also compare that tip, so counting comparisons proved nothing. The test no longer counts:

  • It rewrites the bogus tip until a read has seen it, up to 20 tries, with no fixed sleep.
  • It then asserts keptStanding(app, fork, parent) is undefined. If a failed answer were cached, that would be defined and the test would fail.
Approved

Both earlier asks are met: the cat-file change and comparisons.forkTips are gone, and src/ is untouched. The test no longer counts global comparisons. It rewrites the bogus tip until a read has seen it (bounded at 20 tries, no sleep), then asserts keptStanding is undefined. That assertion fails if a failed answer were cached. keptStanding is exported from src/core/following.ts. It is a test-only, single-purpose pipeline fix with no page change. Non-blocking next steps: 1) If background follows keep racing in this file, give the file a way to await them, so the retry loop is not needed. 2) Add a one-line note in the test naming the commit whose follow causes the race.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs