cmd: unify gitea client construction behind ctx-based service constructors #192

Closed
opened 2026-07-17 14:02:28 +00:00 by hexajon · 0 comments
hexajon commented 2026-07-17 14:02:28 +00:00 (Migrated from codeberg.org)

Tidiness follow-up from the separation-of-concerns audit (no logic leak involved):

~14 cmd packages call gitea.NewClient(ctx) only to immediately hand the client to a service.NewXxxService(client) constructor (e.g. internal/cmd/issue/sub.go:18, lock.go:40, time.go:17, comment_extra.go:27). This is why cmd -> gitea edges look noisy in the raw import graph, and it is inconsistent with the cleaner ctx-based service.NewServices(ctx) pattern already used a few lines away (internal/cmd/issue/sub.go:99), which hides gitea construction entirely.

Acceptance criteria:

  • cmd packages obtain services via ctx-based constructors; direct gitea.NewClient calls in cmd drop to the few places that genuinely need the raw client (e.g. the sanctioned api passthrough).
  • The gitea import disappears from most cmd packages; import graph reflects it.
  • Pure refactor: no behavior change, full gate green.

Cosmetic/low priority - worth doing opportunistically, not urgently.

Tidiness follow-up from the separation-of-concerns audit (no logic leak involved): ~14 `cmd` packages call `gitea.NewClient(ctx)` only to immediately hand the client to a `service.NewXxxService(client)` constructor (e.g. `internal/cmd/issue/sub.go:18`, `lock.go:40`, `time.go:17`, `comment_extra.go:27`). This is why `cmd -> gitea` edges look noisy in the raw import graph, and it is inconsistent with the cleaner ctx-based `service.NewServices(ctx)` pattern already used a few lines away (`internal/cmd/issue/sub.go:99`), which hides gitea construction entirely. Acceptance criteria: - `cmd` packages obtain services via ctx-based constructors; direct `gitea.NewClient` calls in `cmd` drop to the few places that genuinely need the raw client (e.g. the sanctioned `api` passthrough). - The `gitea` import disappears from most `cmd` packages; import graph reflects it. - Pure refactor: no behavior change, full gate green. Cosmetic/low priority - worth doing opportunistically, not urgently.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
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
sixfold-space/madtea#192
No description provided.