The stand-in gc and the server's GcService handler #4

Merged
mikluko merged 2 commits from standin-gc into main 2026-11-16 04:50:40 +00:00
Owner

spec-bb1.34, first part: the stand-in gc and the server's side of GcService. Stacked on #3: until it merges the diff shows its commit; I rebase then.

  • roomcity gc (internal/standin): reads ROOMCITY_SESSION and ROOMCITY_SERVER, sends args, stdin (read to its end), the GC_* variables and the directory through GcService.Run, writes the answer's stdout and stderr, and exits with its code. A server it cannot reach is exit 1 and a line on stderr.
  • internal/gchandler: New(Config{CityDir, GcPath, Env}) *Handler, a roomcityv1connect.GcServiceHandler; roomcity-9a mounts it with roomcityv1connect.NewGcServiceHandler. It runs gc in CityDir (not the session's directory), the server's environment under the session's GC_* (other variables of the request are dropped), and returns a non-zero exit as an answer, a gc that does not start as CodeInternal.

Not here, and open on the ticket: that the three hooks give the right result when the real gc runs on the server's disk.

Verified: go vet ./... and go test ./..., including roomcity gc end to end against the handler with a scripted gc.

spec-bb1.34, first part: the stand-in `gc` and the server's side of `GcService`. **Stacked on #3**: until it merges the diff shows its commit; I rebase then. - `roomcity gc` (`internal/standin`): reads `ROOMCITY_SESSION` and `ROOMCITY_SERVER`, sends args, stdin (read to its end), the `GC_*` variables and the directory through `GcService.Run`, writes the answer's stdout and stderr, and exits with its code. A server it cannot reach is exit 1 and a line on stderr. - `internal/gchandler`: `New(Config{CityDir, GcPath, Env}) *Handler`, a `roomcityv1connect.GcServiceHandler`; roomcity-9a mounts it with `roomcityv1connect.NewGcServiceHandler`. It runs gc in `CityDir` (not the session's directory), the server's environment under the session's `GC_*` (other variables of the request are dropped), and returns a non-zero exit as an answer, a gc that does not start as `CodeInternal`. Not here, and open on the ticket: that the three hooks give the right result when the real gc runs on the server's disk. Verified: `go vet ./...` and `go test ./...`, including `roomcity gc` end to end against the handler with a scripted gc.
cmd: a command gets a context and its process's streams
All checks were successful
image / image (pull_request) Successful in 5s
test / changelog (pull_request) Successful in 4s
test / go (pull_request) Successful in 26s
e7b2613ae9
The commands are to read stdin and write stdout (the stand-in gc), end
with SIGTERM (the host) and read the environment; each had only stderr.
The context ends on SIGINT and SIGTERM.

Assisted-By: Claude <noreply@anthropic.com>
The stand-in gc and the server's GcService handler
Some checks failed
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Failing after 7s
test / go (pull_request) Successful in 25s
d0a359cd57
roomcity gc sends its arguments, stdin, GC_* environment and directory to
the server and ends with the code of what comes back; internal/gchandler
runs the real gc in the city's directory with the session's GC_*
variables, over the server's own environment, and takes nothing else from
the request. A gc that ends non-zero is an answer, one that does not start
is an error.

Assisted-By: Claude <noreply@anthropic.com>
A session proves itself to the server by its token
Some checks failed
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Failing after 7s
test / go (pull_request) Successful in 24s
bd8254420a
The stand-in gc sends the session's token, from ROOMCITY_TOKEN, as a
bearer token; the GcService handler runs gc only for a call whose token
the server's Authorize function says is the named session's, and with no
function refuses every call. internal/sessionauth is the header and the
client option the host uses too.

Assisted-By: Claude <noreply@anthropic.com>
mikluko force-pushed standin-gc from bd8254420a
Some checks failed
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Failing after 7s
test / go (pull_request) Successful in 24s
to 3713291ed0
Some checks failed
image / image (pull_request) Failing after 8s
test / changelog (pull_request) Successful in 4s
test / go (pull_request) Successful in 38s
2026-11-16 04:47:48 +00:00
Compare
mikluko force-pushed standin-gc from 3713291ed0
Some checks failed
image / image (pull_request) Failing after 8s
test / changelog (pull_request) Successful in 4s
test / go (pull_request) Successful in 38s
to 4e331bc96e
All checks were successful
image / image (pull_request) Successful in 3s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 31s
2026-11-16 04:49:21 +00:00
Compare
mikluko deleted branch standin-gc 2026-11-16 04:50:41 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!4
No description provided.