build log --follow: end on restart, re-check access, coalesce reads !463

merged merged by cmc on 2026-09-23 07:12 UTC · krz/gitbay:follow-followups into main

Discussion

cmc

The four follow-ups from !462.

  • Restart: httpd.Server.Stop and sshd.Server.Stop close a channel that the follows run under; gitbayd calls both before the drain, so the drain waits only for work that finishes. Other requests, git transport included, are untouched. Ctx.Stopping lets a follow ended by a restart say so on stderr ("gitbay is restarting; follow the build again in a moment"); ssh, the build page and the API all carry that message, and an ordinary failure during the drain says nothing about a restart.
  • Access: every 2 s a follow re-checks read access by repository id (a rename does not end it) and reloads the account (disabling it does). Losing access ends the follow as not found.
  • Reads: after a wake the follow waits 200 ms before reading, so a burst of appends costs one read of the stored log.
  • Tests: the first internal/sshd unit tests (a closed session channel ends a follow while the connection stays up; Stop ends one with the message; a plain failure during Stop has no message), control tests for lost access, a disabled account and the restart message, and an e2e test that SIGTERMs the daemon during an ssh and a web follow. e2e queueBuild/claimBuild helpers extracted.

Closes #251