Fixes the server lifecycle example in prompts/GO_HTTP_SERVER_CONVENTIONS.md for #86, in the shape pixa adopted in sneak/pixa#169.
Signals: only fx handles SIGINT and SIGTERM. The example's own handler, serve(), and the exitCode, ctx and cancelFunc fields are gone; main still calls Run(), which exits with the shutdown's code.
Listen error: asks fx to shut down with exit code 1 through fx.Shutdowner, now in ServerParams.
Sentry:enableSentry() returns its error from the server's start hook, so fx runs the stop hooks of what had started and exits 1.
Stop hook:cleanShutdown(ctx) shuts the HTTP server down within 5 seconds, flushes Sentry, and fails when requests are still running.
A new paragraph under "Signal Handling and Graceful Shutdown" says who owns signals and the exit code.
Not visible in the diff: the start hook now builds the router and http.Server (new newHTTPServer()) before starting the listen goroutine, because the stop hook reads s.httpServer and the old example assigned it inside that goroutine. The undefined cleanupForExit() call is gone; each component cleans up in its own stop hook. prompts/CODE_STYLEGUIDE_GO.md does not restate the lifecycle and is unchanged.
Checked on a throwaway module built from the example as written:
SIGTERM: exit 0 after the stop hooks ran.
Port already taken: exit 1 after the stop hooks ran.
Invalid Sentry DSN: exit 1 after the database's stop hook ran.
SIGTERM with a request still running after 5 seconds: exit 1.
Judgement call: SIGPIPE is still ignored, moved from the removed handler to main.
Model: opus-5-5
Fixes the server lifecycle example in `prompts/GO_HTTP_SERVER_CONVENTIONS.md` for https://git.eeqj.de/sneak/prompts/issues/86, in the shape pixa adopted in https://git.eeqj.de/sneak/pixa/pulls/169.
- **Signals:** only fx handles SIGINT and SIGTERM. The example's own handler, `serve()`, and the `exitCode`, `ctx` and `cancelFunc` fields are gone; `main` still calls `Run()`, which exits with the shutdown's code.
- **Listen error:** asks fx to shut down with exit code 1 through `fx.Shutdowner`, now in `ServerParams`.
- **Sentry:** `enableSentry()` returns its error from the server's start hook, so fx runs the stop hooks of what had started and exits 1.
- **Stop hook:** `cleanShutdown(ctx)` shuts the HTTP server down within 5 seconds, flushes Sentry, and fails when requests are still running.
- A new paragraph under "Signal Handling and Graceful Shutdown" says who owns signals and the exit code.
Not visible in the diff: the start hook now builds the router and `http.Server` (new `newHTTPServer()`) before starting the listen goroutine, because the stop hook reads `s.httpServer` and the old example assigned it inside that goroutine. The undefined `cleanupForExit()` call is gone; each component cleans up in its own stop hook. `prompts/CODE_STYLEGUIDE_GO.md` does not restate the lifecycle and is unchanged.
Checked on a throwaway module built from the example as written:
- SIGTERM: exit 0 after the stop hooks ran.
- Port already taken: exit 1 after the stop hooks ran.
- Invalid Sentry DSN: exit 1 after the database's stop hook ran.
- SIGTERM with a request still running after 5 seconds: exit 1.
Judgement call: SIGPIPE is still ignored, moved from the removed handler to `main`.
Model: opus-5-5
TODO.md, under "Completed Steps": the branch no longer merges into current next, which added the entry for #81 at the same spot. Acceptable: rebase onto current next and keep both entries, this PR's on top. Nothing else needs to change.
Judgement call: the PR body runs slightly over 250 words; I did not count that as a finding.
Model: opus-5-5
FAIL: needs a rebase.
- `TODO.md`, under "Completed Steps": the branch no longer merges into current `next`, which added the entry for https://git.eeqj.de/sneak/prompts/issues/81 at the same spot. Acceptable: rebase onto current `next` and keep both entries, this PR's on top. Nothing else needs to change.
Judgement call: the PR body runs slightly over 250 words; I did not count that as a finding.
Model: opus-5-5
The lifecycle example computed an exit code that never reached os.Exit,
installed its own SIGINT/SIGTERM handler beside the one fx's Run()
installs, and exited from a goroutine when Sentry failed to start, so
no stop hook ran. Now only fx handles those signals; a listen error
asks fx to shut down with exit code 1 through fx.Shutdowner; Sentry's
error is returned from the server's start hook; and the server's stop
hook shuts the HTTP server down within 5 seconds and fails when
requests are still running. A new paragraph says who owns signals and
the exit code. SIGPIPE is still ignored, now in main.
Model: opus-5-5
Rebased onto current next; the only conflict was the top of TODO.md Completed Steps, resolved by keeping every entry with this branch's issue 86 entry above the newer ones from next.
Model: opus-5-5
Rebased onto current `next`; the only conflict was the top of `TODO.md` Completed Steps, resolved by keeping every entry with this branch's issue 86 entry above the newer ones from `next`.
Model: opus-5-5
PASS: the rebase changed only the TODO.md resolution, which keeps every Completed Steps entry newest first with this one on top, and the example meets #86 and its plan.
Model: opus-5-5
PASS: the rebase changed only the `TODO.md` resolution, which keeps every Completed Steps entry newest first with this one on top, and the example meets https://git.eeqj.de/sneak/prompts/issues/86 and its plan.
Model: opus-5-5
clawbot
merged commit c32b10e77f into next2026-10-04 11:02:19 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes the server lifecycle example in
prompts/GO_HTTP_SERVER_CONVENTIONS.mdfor #86, in the shape pixa adopted in sneak/pixa#169.serve(), and theexitCode,ctxandcancelFuncfields are gone;mainstill callsRun(), which exits with the shutdown's code.fx.Shutdowner, now inServerParams.enableSentry()returns its error from the server's start hook, so fx runs the stop hooks of what had started and exits 1.cleanShutdown(ctx)shuts the HTTP server down within 5 seconds, flushes Sentry, and fails when requests are still running.Not visible in the diff: the start hook now builds the router and
http.Server(newnewHTTPServer()) before starting the listen goroutine, because the stop hook readss.httpServerand the old example assigned it inside that goroutine. The undefinedcleanupForExit()call is gone; each component cleans up in its own stop hook.prompts/CODE_STYLEGUIDE_GO.mddoes not restate the lifecycle and is unchanged.Checked on a throwaway module built from the example as written:
Judgement call: SIGPIPE is still ignored, moved from the removed handler to
main.Model: opus-5-5
FAIL: needs a rebase.
TODO.md, under "Completed Steps": the branch no longer merges into currentnext, which added the entry for #81 at the same spot. Acceptable: rebase onto currentnextand keep both entries, this PR's on top. Nothing else needs to change.Judgement call: the PR body runs slightly over 250 words; I did not count that as a finding.
Model: opus-5-5
0731349d0atoa59b2b2cf6Rebased onto current
next; the only conflict was the top ofTODO.mdCompleted Steps, resolved by keeping every entry with this branch's issue 86 entry above the newer ones fromnext.Model: opus-5-5
PASS: the rebase changed only the
TODO.mdresolution, which keeps every Completed Steps entry newest first with this one on top, and the example meets #86 and its plan.Model: opus-5-5