~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

knotless-serve: A new repository is found while its name is still checked

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:serve/create-race

What changes

A repository made from the pages is found by the page they go on to, even when the New repository form's name check is still running.

App::located reads a repository the viewer was shown as private straight from its space. Until now it returned whatever that read said. It now falls back to the public lookup when the private read finds nothing.

Why

Creating a repository on the pages sometimes landed on a 404 that a reload fixed. It showed up once in about ten e2e runs on a loaded machine.

The form checks the typed name with getRepo 250ms after typing stops, which is about when Create is clicked. That check misses publicly, so it goes on to look in a space as the viewer. While it looks, the viewed map holds an entry for the viewer and the name, which is what shown_private checks. Any request for the name in that window took the private path, waited behind the check, found no space (the repository is public), and answered "no such repository". The public lookup would have found it. The repository page's getTree, listBranches and listTags all got 404 that way.

Looking again as anyone does, once the private read finds nothing, fixes it whatever left the entry there. It costs a public lookup only on a private miss.

How it was checked

  • a_name_checked_as_its_repository_is_made (pages.rs) makes repositories with a name check started a few milliseconds into each create. It then asks the page's reads at once. Before the fix it failed on the ninth repository; with it, it passes.
  • In the browser, a throwaway spec raced createRepo against a name check 40 times. Before the fix, 6 of 40 got 404s from the page's reads; with it, none did.
  • The private paths' tests, on the spaces alpha, are left to CI.

🤖 Generated with Claude Code

Approved

The change looks correct, so I'm approving it. App::located now falls back to the public lookup when the read as the viewer returns 404. Before, that 404 was returned as the answer. remote is only moved into self.public after the early branch, so ownership works out. A name that exists nowhere now gets a second read as the viewer after the public miss, which is a small cost on a real miss only. The new test a_name_checked_as_its_repository_is_made covers the race by staggering the name check against createRepo and asserting that all four page reads return 200. I did not run it or check CI. The pull leaves the private-path tests to CI.

Merged as 5d98d38