~bigbes/sr-ht-dolt

ref: 12c7ff77f8281cd0ca61177bcf07b9c031a04c97 sr-ht-dolt/remoteapi/integration_test.go -rw-r--r-- 22.5 KiB
3843eb55 — Eugene Blikh 3 days ago
remoteapi: prove an empty store takes an unrelated first push

This file had not compiled since the logrus->slog migration removed the
package-level `logger` its serve goroutines still called. The
`integration` build tag keeps it out of every default build, test and vet
run, so nothing ever said so — the suite simply never ran again.

With it compiling, add the scenario the storage layer's contract is
actually about: a database provisioned empty ahead of its first push (the
web create form, or git.sr.ht's hook through /internal/repos) accepts a
push from a local database with a root commit of its own, with no
--force. Mutating the provisioning to InitStore fails it exactly as a
user hits it today: "unknown push error; no common ancestor".
c978521e — Eugene Blikh 5 days ago
remoteapi: gofmt the integration test
27823bb6 — Eugene Blikh 9 days ago
log: replace logrus with slog behind auxilia's scribe handler

Every logger field this service owned was a *logrus.Entry threaded
through a constructor, which is what logrus costs for want of a usable
default. They are slog.Default().With("component", ...) now, and the
threading is gone with them; the shared middleware's panic reports land
in the same handler, which is why the daemon sets the default before
anything that can fail.

The handler is scribe's tint handler: level from [dolt.sr.ht]log-level,
source positions, and masks keyed on the attribute path for the three
credentials this service handles — the unified-login cookie, the
Internal fernet token and the Authorization header the remotesapi reads
a PAT or a keypair JWT out of. Errors go through scribe.Err, so a culpa
error's hint reaches the operator on its own line.

logrus stays in go.mod: dolt's remotesrv.ServerArgs takes a
*logrus.Entry and nothing else. It is now confined to Config.DoltLogger,
which is the only place this service names it.

dolt-git-hook is deliberately untouched: what it writes to stderr is the
notice a pushing user reads through git, not a log.
ba344433 — Eugene Blikh 30 days ago
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.
2dfab043 — Eugene Blikh 30 days ago
rename module to sourcecraft.dev/bigbes/sr-ht-dolt; depend on sourcecraft sr-ht-core
2b781a27 — Eugene Blikh 30 days ago
remoteapi: authz interceptors, remotesrv assembly, credentials service