fix(assistant): single use under racing requests, a cap on registering, Caddy reloaded

A connect code, an authorization code and a refresh token are each
consumed by deleting their row and going on only if that deleted it, so
of two requests racing with the same one only one succeeds (as OAuth
requires); tests race them. Registration, open to anyone, takes at most
200 clients an hour (429 after), so a flood can't fill the table before
pruning. The deploy reloads Caddy in place when deploy/Caddyfile changed,
as `docker compose up` doesn't restart it for a file it mounts: without
it the connector's paths wouldn't reach the web server.

Also formats the app's fake assistant gateway, new and so unchecked by
the last commit's check (tool/check.sh formats tracked files only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-10 12:20:47 +02:00
commit 9f1716f16d
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -67,6 +67,12 @@ main() {
# schema; migrations that only add, as they should, keep that harmless.)
docker compose run --rm --no-deps -e role=maintenance server --apply-migrations
docker compose up -d --remove-orphans
# Caddy reads its Caddyfile when it starts, and `up` doesn't restart it for a
# changed file it mounts: a changed one is reloaded in place, without dropping
# connections.
if ! git diff --quiet "$deployed" "$commit" -- Caddyfile; then
docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile
fi
wait_until_answering
trap - EXIT
docker image prune -f >/dev/null