Move pixad's startup from cmd/pixad into internal/app (closes #206) #215

Merged
clawbot merged 1 commits from issue-206-thin-main into next 2026-10-05 01:07:48 +02:00
Collaborator

REPO_POLICIES.md now requires each main.go under cmd/ to be one call into internal/ or pkg/ (#206).

What cmd/pixad/main.go did (the command line and its --config flag, setting PIXA_CONFIG_PATH from that flag, ignoring SIGPIPE, starting the fx app) moves unchanged to Run in a new package, internal/app. main is now app.Run(Version).

Version stays in main, so the -X main.Version build flags in the Dockerfile and the Makefile do not change. Run passes it on to globals.Version before reading the command line, where main used to do this just before starting the server; nothing reads it in between, so pixad still logs the version first. Flags and exit codes do not change: status 1 for a command line that is not valid, and fx's Run for everything after that, as before.

The comment on globals.Version now names app.Run as what sets it.

Disclosures:

  • Judgement call: a new package, internal/app, as the plan suggested; none of the existing packages under internal/ covers starting the program.
  • No tests: the moved code had none, and it only reads os.Args and starts the server.
  • Left as is: a comment in internal/server/login_rate_limit_internal_test.go still says "the constructors cmd/pixad uses". That is still true, as pixad uses them through internal/app, and the repo's rules say not to edit existing tests without asking.

Model: opus-5-5

`REPO_POLICIES.md` now requires each `main.go` under `cmd/` to be one call into `internal/` or `pkg/` (https://git.eeqj.de/sneak/pixa/issues/206). What `cmd/pixad/main.go` did (the command line and its `--config` flag, setting `PIXA_CONFIG_PATH` from that flag, ignoring `SIGPIPE`, starting the fx app) moves unchanged to `Run` in a new package, `internal/app`. `main` is now `app.Run(Version)`. `Version` stays in `main`, so the `-X main.Version` build flags in the `Dockerfile` and the `Makefile` do not change. `Run` passes it on to `globals.Version` before reading the command line, where `main` used to do this just before starting the server; nothing reads it in between, so pixad still logs the version first. Flags and exit codes do not change: status 1 for a command line that is not valid, and fx's `Run` for everything after that, as before. The comment on `globals.Version` now names `app.Run` as what sets it. Disclosures: - Judgement call: a new package, `internal/app`, as the plan suggested; none of the existing packages under `internal/` covers starting the program. - No tests: the moved code had none, and it only reads `os.Args` and starts the server. - Left as is: a comment in `internal/server/login_rate_limit_internal_test.go` still says "the constructors cmd/pixad uses". That is still true, as pixad uses them through `internal/app`, and the repo's rules say not to edit existing tests without asking. Model: opus-5-5
clawbot added the needs-review label 2026-10-05 00:31:00 +02:00
clawbot self-assigned this 2026-10-05 00:31:00 +02:00
Author
Collaborator

PASS at PR head 8f65fd7b051e2b30697ff9a61202cd52eab2d475, rebased onto next at 23ec4026f65e4f689688769085f8cc1ec3e20765.

Disclosure: TODO.md conflicts with next only because both add an entry at the top of Completed Steps; I resolved it locally by keeping both entries.

Model: opus-5-5

**PASS** at PR head `8f65fd7b051e2b30697ff9a61202cd52eab2d475`, rebased onto `next` at `23ec4026f65e4f689688769085f8cc1ec3e20765`. Disclosure: `TODO.md` conflicts with `next` only because both add an entry at the top of Completed Steps; I resolved it locally by keeping both entries. Model: opus-5-5
clawbot added 1 commit 2026-10-05 00:59:07 +02:00
cmd/pixad/main.go built the command line and its --config flag, set
PIXA_CONFIG_PATH from that flag, ignored SIGPIPE and started the fx
app. REPO_POLICIES.md now requires cmd/ to hold only one call into
internal/ or pkg/, so that code moves unchanged to Run in the new
internal/app package, and main calls app.Run(Version). Version stays
in main, so the -X main.Version build flags in the Dockerfile and the
Makefile do not change.

Model: opus-5-5
clawbot force-pushed issue-206-thin-main from 8f65fd7b05 to 63937ffdaf 2026-10-05 00:59:07 +02:00 Compare
clawbot merged commit 2beba15ae7 into next 2026-10-05 01:07:48 +02:00
clawbot deleted branch issue-206-thin-main 2026-10-05 01:07:48 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#215