Split admin.go by subsystem (audit M-11) #148

Merged
qwc merged 1 commit from refactor/split-admin-handlers into main 2026-08-30 20:43:20 +02:00
Owner

Audit item M-11. Stacked on #146 — base branch is fix/user-facing-errors, since both touch admin.go and rebasing a 1200-line move afterwards is no fun. Merge #146 first and this retargets to main.

Why now

The audit filed this at 982 lines. It's 1166 today — I added to it myself with the access-list work before moving those handlers out. Two of this week's bugs (#126's dead revoke button, #129's rename) were traced through this file, and M-10 has to start here.

The split

File Lines Holds
admin_projects.go 460 Project CRUD, edit page, per-project access grant/revoke
admin_robots.go 299 Robot users, tokens, password reset
admin_groups.go 191 LDAP/OAuth2 group mappings
admin_users.go 140 User accounts
admin_global_access.go 103 The global access list
admin.go 32 Built-in docs deploy

The boundaries are the five subsystems the audit named — they fell out cleanly because the handlers were already grouped that way inside the file.

Verifying it's only a move

Reviewing 1200 moved lines by eye is exactly where a real change hides, so I checked mechanically rather than claiming it. Comparing the old admin.go against the concatenation of the new files:

same function set: True
same code lines: True

Every non-comment, non-import line is present, unchanged, and no function gained or lost. The only differences are which file each block lives in and the per-file import lists (written by goimports).

Full suite green, unchanged — no test needed editing, which is the other signal that nothing moved but the code.

What's left after this

M-10 (split Handler into Public + Admin) is the last audit item that isn't blocked. It's more invasive than this one — it changes the type every handler hangs off, so it touches every handler file and the test setup — so I'd rather land it against a clear tree than stack it six deep. Say the word once the queue drains and I'll take it.

H-12 stays blocked on CI Docker access, as you noted.


Assisted by Claude Opus 5.

Audit item **M-11**. **Stacked on #146** — base branch is `fix/user-facing-errors`, since both touch `admin.go` and rebasing a 1200-line move afterwards is no fun. Merge #146 first and this retargets to `main`. ## Why now The audit filed this at 982 lines. It's **1166** today — I added to it myself with the access-list work before moving those handlers out. Two of this week's bugs (#126's dead revoke button, #129's rename) were traced through this file, and M-10 has to start here. ## The split | File | Lines | Holds | |---|---|---| | `admin_projects.go` | 460 | Project CRUD, edit page, per-project access grant/revoke | | `admin_robots.go` | 299 | Robot users, tokens, password reset | | `admin_groups.go` | 191 | LDAP/OAuth2 group mappings | | `admin_users.go` | 140 | User accounts | | `admin_global_access.go` | 103 | The global access list | | `admin.go` | 32 | Built-in docs deploy | The boundaries are the five subsystems the audit named — they fell out cleanly because the handlers were already grouped that way inside the file. ## Verifying it's only a move Reviewing 1200 moved lines by eye is exactly where a real change hides, so I checked mechanically rather than claiming it. Comparing the old `admin.go` against the concatenation of the new files: ``` same function set: True same code lines: True ``` Every non-comment, non-import line is present, unchanged, and no function gained or lost. The only differences are which file each block lives in and the per-file import lists (written by `goimports`). Full suite green, unchanged — no test needed editing, which is the other signal that nothing moved but the code. ## What's left after this **M-10** (split `Handler` into Public + Admin) is the last audit item that isn't blocked. It's more invasive than this one — it changes the type every handler hangs off, so it touches every handler file and the test setup — so I'd rather land it against a clear tree than stack it six deep. Say the word once the queue drains and I'll take it. **H-12** stays blocked on CI Docker access, as you noted. --- Assisted by Claude Opus 5.
admin.go had grown to 1166 lines holding five unrelated subsystems, and
two of this week's bugs — the dead revoke button and the rename that
lost documentation — were traced through it. It is also where M-10 has
to start.

The handlers move to admin_projects.go, admin_users.go,
admin_robots.go, admin_groups.go and admin_global_access.go; admin.go
keeps the built-in docs deploy action. Nothing else changes: the
function set and every line of code are identical to before, only the
file they live in differs.

Assisted-by: Claude Opus 5

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel M. Otte <marcel.otte@mmo.to>
qwc changed target branch from fix/user-facing-errors to main 2026-08-30 20:43:01 +02:00
qwc merged commit cb0c78ae86 into main 2026-08-30 20:43:20 +02:00
qwc deleted branch refactor/split-admin-handlers 2026-08-30 20:43:20 +02:00
Sign in to join this conversation.
No reviewers
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
qwc-open/asiakirjat!148
No description provided.