Task Registry
Every generated route — including the Admin API and tenant Admin API — is wired via middleware.RegisterTask(action, requireAuth, reqType, respType, pathParams...) instead of a bare handler or a direct RequireAuth wrap. This is baseline infrastructure generated for every app (task/task.go, middleware/task.go), ported from a proven pattern in one of nexler's own downstream apps.
task/task.go is an in-process registry describing every route's contract (name, whether it requires auth, path parameters, request/response shapes) — not a job queue; a route's Task never sets an Executor, since it's normally invoked through the API itself, not dispatched in-process. middleware.RegisterTask registers the route, then — when requireAuth is true — runs RequireAuth, then (once set) PermissionCheck, then best-effort audit-logs the call via core.LogAudit (on a core-database app only): actor, correlation ID, session ID, and path parameters.
middleware.PermissionCheck (func(ctx, subject, action) (bool, error), nil by default) is the shared guard every protected route now has: RegisterTask calls it, once set, denying with 403 on a false/error result. nexler init kpass wires it automatically to services/kpass.CheckAccess — until then, any authenticated caller may hit any RegisterTask-guarded route.
On a core-database app, core.SyncTasks mirrors the registry into core_tasks at startup (best-effort, never fatal) — its request/response JSON schemas reuse the same reflection /openapi.json already does (openapi.JSONSchema) — so provisioning/workflow tooling can read every route's shape straight from the database without the binary running.
Each core_tasks entry also says how to reach the task over HTTP: service (the app's name), method, path, base_path ({APPNAME}_API_BASE_PATH) and callable. Generated openapi.Register calls carry Task: "<action>" (and Callable: true with -callable); core.SyncTasks joins each task to its operation by that name, falling back to the only operation with the same request and response types for a hand-written route without Task. openapi.Operations() returns every registered operation. Mongo core only: a SQL core's core_task_upsert procedure still takes the original columns.