~bigbes/sr-ht-dolt: ba344433

feat(remoteapi): auto-create databases on first push to own namespace

Push-to-create: an authenticated, non-suspended caller pushing (or
cloning) an unknown repo under their OWN namespace has it transparently
created — a PRIVATE repository row plus a genuinely empty on-disk NBS
store — then proceeds through the normal ACL check as the owner. Any
other case (anonymous, suspended, another user's namespace, invalid
name) still returns NotFound, so a stranger's namespace is never leaked
and nothing is created.

storage.InitEmptyStore creates the store WITHOUT WriteEmptyRepo: an
"Initialize data repository" commit would make the client's first push a
non-fast-forward and be rejected. An empty store (root = empty hash) lets
the initial push land as the repo's first history. The interceptor
auto-create is race-safe (ErrNameTaken re-fetch) and rolls the row back
if the store cannot be created.

Proven end-to-end (integration): a real `dolt push` to a new name
auto-creates PRIVATE + fast-forwards + re-clones; a foreign-namespace
push is denied with no row created. All prior clone/push/ACL scenarios
still pass.

Eugene Blikh <bigbes@gmail.com> — 2026-07-18 20:26:37 UTC

Commit ba34443357cb2471337ae8faa7dee369bdbcae69view raw patch

Parent(s): 8583f3a6

6 changed file(s)

FileStatus+
remoteapi/integration_test.go M +69
remoteapi/interceptors.go M +86 -8
remoteapi/interceptors_test.go M +198 -25
remoteapi/server.go M +6 -4
storage/init.go M +39
storage/initempty_test.go A +48