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

A test pins contributing when the fork never arrives or its mirror fails: the answer says so and nothing is half-made #7161

opened this

Merged 38d 20h ago, live in production

Two new tests pin both fork failures. The clone-failure test found a bug, which I fixed in the same pull. What the tests cover (test/contribute-fork-failures.test.ts, run against the fake origin): forktimeout: the fake origin accepts the fork but never shows it.

Notes

opened this

Two new tests pin both fork failures. The clone-failure test found a bug, which I fixed in the same pull.

What the tests cover (test/contribute-fork-failures.test.ts, run against the fake origin):

  • fork_timeout: the fake origin accepts the fork but never shows it. The API answers 504 fork_timeout with a message in words. No branch, commit or pull is made at the origin, and no repository, pull or directory is added here.
  • mirror_failed: the fork exists at the origin but its git host is unreachable. The API answers 502 mirror_failed with a message in words, and no local mirror row or directory is left behind. After the fork's git works again, the same contribute call succeeds with 201, so nothing blocks a retry.

The bug: a clone failure never reached mirror_failed. forkOrigin returned the half-made, empty mirror, and contribute went on and failed at the branch step. The caller got a misleading 422 branch_failed, and an empty alice/gears stayed behind. In src/actions/contribute.ts, when the awaited mirror job fails, forkOrigin now deletes the repository it just made. contribute then answers mirror_failed. Mirrors that people ask for directly keep their existing behaviour.

Test seam: the 30 s fork wait is now a mutable forkDeadline export, the same pattern as firstFetchRetry. The test shortens it to 100 ms and restores it afterwards. Production keeps 30 s.

Not done: I did not add a per-request override for the wait, and I did not touch the direct (push-rights) path's mirror_failed.

Checks run: tsc --noEmit is clean, the new test passes, and the 17 neighbouring suites that mention contribute or fork pass (257 tests). I did not run the whole bun test.

Closes #7152

commented

Two new tests pin both fork failures. The clone-failure test found a bug, which I fixed in the same pull.

What the tests cover (test/contribute-fork-failures.test.ts, run against the fake origin):

  • fork_timeout: the fake origin accepts the fork but never shows it. The API answers 504 fork_timeout with a message in words. No branch, commit or pull is made at the origin, and no repository, pull or directory is added here.
  • mirror_failed: the fork exists at the origin but its git host is unreachable. The API answers 502 mirror_failed with a message in words, and no local mirror row or directory is left behind. After the fork's git works again, the same contribute call succeeds with 201, so nothing blocks a retry.

The bug: a clone failure never reached mirror_failed. forkOrigin returned the half-made, empty mirror, and contribute went on and failed at the branch step. The caller got a misleading 422 branch_failed, and an empty alice/gears stayed behind. In src/actions/contribute.ts, when the awaited mirror job fails, forkOrigin now deletes the repository it just made. contribute then answers mirror_failed. Mirrors that people ask for directly keep their existing behaviour.

Test seam: the 30 s fork wait is now a mutable forkDeadline export, the same pattern as firstFetchRetry. The test shortens it to 100 ms and restores it afterwards. Production keeps 30 s.

Not done: I did not add a per-request override for the wait, and I did not touch the direct (push-rights) path's mirror_failed.

Checks run: tsc --noEmit is clean, the new test passes, and the 17 neighbouring suites that mention contribute or fork pass (257 tests). I did not run the whole bun test.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs