From the 2026-08 architecture review (recommendation: worth exploring).
What is wrong:internal/webui puts 189 handler methods on *Server (68 fields on Server, 12 storecontract-typed) across 54 api_*.go files (9.7k lines, 21 test files). Every handler repeats nil-check → parse → validate → store call → view shaping, so the Server's method set is approximately as large as its implementation and the same bug pattern recurs in 47 files.
Wanted: one module per dashboard resource (bindings, tasks, audit, …), each declaring the narrow storecontract sub-interface it needs and registering its own routes; Server becomes a registrar.
Done when:
each resource module exposes its handlers through one narrow store seam (staterpc adapter in prod, fake in tests)
per-handler nil-check boilerplate is gone from the handlers
task check green; dashboard e2e checks pass
From the 2026-08 architecture review (recommendation: worth exploring).
**What is wrong:** `internal/webui` puts 189 handler methods on `*Server` (68 fields on `Server`, 12 storecontract-typed) across 54 `api_*.go` files (9.7k lines, 21 test files). Every handler repeats nil-check → parse → validate → store call → view shaping, so the Server's method set is approximately as large as its implementation and the same bug pattern recurs in 47 files.
**Wanted:** one module per dashboard resource (bindings, tasks, audit, …), each declaring the narrow `storecontract` sub-interface it needs and registering its own routes; `Server` becomes a registrar.
**Done when:**
- each resource module exposes its handlers through one narrow store seam (staterpc adapter in prod, fake in tests)
- per-handler nil-check boilerplate is gone from the handlers
- `task check` green; dashboard e2e checks pass
sam
added the discovery label 2026-11-02 14:53:46 +00:00
Pilot done: commit d55d8580 extracts bindingsAPI (internal/webui/bindings.go) owning the /api/bindings* routes and handlers off *Server. The module is constructed only when the binding store is configured; a 503 stub mounts the same routes otherwise, so not-configured answers are unchanged. The shared dispatch-ledger handler stays on Server (captures/tasks routes use it too). task check green. Pattern proven: one module per resource, constructor takes the narrow storecontract surfaces + cross-cutting helpers as func fields, register(mux) owns the routes. Next: mappings, sources, event-types, then the rest area by area.
Pilot done: commit d55d8580 extracts `bindingsAPI` (internal/webui/bindings.go) owning the /api/bindings* routes and handlers off *Server. The module is constructed only when the binding store is configured; a 503 stub mounts the same routes otherwise, so not-configured answers are unchanged. The shared dispatch-ledger handler stays on Server (captures/tasks routes use it too). task check green. Pattern proven: one module per resource, constructor takes the narrow storecontract surfaces + cross-cutting helpers as func fields, register(mux) owns the routes. Next: mappings, sources, event-types, then the rest area by area.
Roll-out wave 1 done: commit 864b87fa extracts eventTypesAPI (internal/webui/eventtypes.go), mappingsAPI (mappings.go) and sourcesAPI (sources.go) off *Server, same pattern as the bindings pilot (d55d8580). event-types registers unconditionally (list answers enabled:false without a store); mappings and sources mount a 503 stub when their store is nil. Shared helpers (unsignedSources, recentRefusals, listedIn) and the dispatch-ledger handler stay on Server. task check green. Remaining areas: tasks, harness, config/logs, chat, and the core routes in registerCoreRoutes.
Roll-out wave 1 done: commit 864b87fa extracts eventTypesAPI (internal/webui/eventtypes.go), mappingsAPI (mappings.go) and sourcesAPI (sources.go) off *Server, same pattern as the bindings pilot (d55d8580). event-types registers unconditionally (list answers enabled:false without a store); mappings and sources mount a 503 stub when their store is nil. Shared helpers (unsignedSources, recentRefusals, listedIn) and the dispatch-ledger handler stay on Server. task check green. Remaining areas: tasks, harness, config/logs, chat, and the core routes in registerCoreRoutes.
Done. Modules extracted: tasks, bindings, event types, mappings, sources, harness, extensions, orgs, identities/tokens, access, control plane, logs, chat, schedules, alerts, audit, workflows. Each owns its routes and narrow dependencies; Server registers them. Remaining Server routes are single-route readers and shared helpers. task check green on every commit; dashboard e2e 25/26 on a fresh stack, the remaining failure is the catalogue signature (#1790), unrelated to this refactor.
Done. Modules extracted: tasks, bindings, event types, mappings, sources, harness, extensions, orgs, identities/tokens, access, control plane, logs, chat, schedules, alerts, audit, workflows. Each owns its routes and narrow dependencies; Server registers them. Remaining Server routes are single-route readers and shared helpers. `task check` green on every commit; dashboard e2e 25/26 on a fresh stack, the remaining failure is the catalogue signature (#1790), unrelated to this refactor.
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.
From the 2026-08 architecture review (recommendation: worth exploring).
What is wrong:
internal/webuiputs 189 handler methods on*Server(68 fields onServer, 12 storecontract-typed) across 54api_*.gofiles (9.7k lines, 21 test files). Every handler repeats nil-check → parse → validate → store call → view shaping, so the Server's method set is approximately as large as its implementation and the same bug pattern recurs in 47 files.Wanted: one module per dashboard resource (bindings, tasks, audit, …), each declaring the narrow
storecontractsub-interface it needs and registering its own routes;Serverbecomes a registrar.Done when:
task checkgreen; dashboard e2e checks passPilot done: commit
d55d8580extractsbindingsAPI(internal/webui/bindings.go) owning the /api/bindings* routes and handlers off *Server. The module is constructed only when the binding store is configured; a 503 stub mounts the same routes otherwise, so not-configured answers are unchanged. The shared dispatch-ledger handler stays on Server (captures/tasks routes use it too). task check green. Pattern proven: one module per resource, constructor takes the narrow storecontract surfaces + cross-cutting helpers as func fields, register(mux) owns the routes. Next: mappings, sources, event-types, then the rest area by area.Roll-out wave 1 done: commit
864b87faextracts eventTypesAPI (internal/webui/eventtypes.go), mappingsAPI (mappings.go) and sourcesAPI (sources.go) off *Server, same pattern as the bindings pilot (d55d8580). event-types registers unconditionally (list answers enabled:false without a store); mappings and sources mount a 503 stub when their store is nil. Shared helpers (unsignedSources, recentRefusals, listedIn) and the dispatch-ledger handler stay on Server. task check green. Remaining areas: tasks, harness, config/logs, chat, and the core routes in registerCoreRoutes.Done. Modules extracted: tasks, bindings, event types, mappings, sources, harness, extensions, orgs, identities/tokens, access, control plane, logs, chat, schedules, alerts, audit, workflows. Each owns its routes and narrow dependencies; Server registers them. Remaining Server routes are single-route readers and shared helpers.
task checkgreen on every commit; dashboard e2e 25/26 on a fresh stack, the remaining failure is the catalogue signature (#1790), unrelated to this refactor.