{"modulePath":"github.com/txn2/mcp-data-platform","version":"v1.170.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package changesethttp\n\nPackage changesethttp serves the knowledge changesets to the portal (#2337): the list, one changeset, and its rollback under /api/v1/portal/knowledge/changesets, for a caller who holds apply\\_knowledge.\n\nThe portal's Changesets tab is offered on that capability, not on the admin role, and the apply\\_knowledge tool already lists and rolls back changesets for whoever holds it. These routes give the tab the same audience: they run the admin API's own changeset handlers, so the two surfaces answer alike, with the portal caller named as the one who rolled a changeset back.\n\nIt lives beside pkg/portal, like the other portal route packages here, so the portal package stays within its size budget.\n\n## Functions\n\n```go\nfunc KnowledgeHandler(p *platform.Platform) *admin.KnowledgeHandler\n```\nKnowledgeHandler is the knowledge review and changeset handler, nil without an insight store: the admin API serves it, and Mount serves its changesets to the portal.\n\n```go\nfunc Mount(mux *http.ServeMux, wrap func(http.Handler) http.Handler, kh *admin.KnowledgeHandler, resolver portal.PersonaResolver, isAdmin func([]string) bool)\n```\nMount serves kh's changesets to the portal's callers, each behind wrap, admitting whoever holds apply\\_knowledge: the tool resolver names, or an administrator. A nil kh mounts nothing.\n\n```go\nfunc Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler, d Deps)\n```\nRegister mounts the routes on mux, each behind wrap (the portal's authentication and access gate). Nothing is mounted without a handler.\n\n## Types\n\n```go\ntype Caller struct {\n\tUserID string\n\tEmail  string\n\tRoles  []string\n}\n```\nCaller is the authenticated portal user.\n\n```go\ntype Changesets interface {\n\tListChangesets(w http.ResponseWriter, r *http.Request)\n\tGetChangeset(w http.ResponseWriter, r *http.Request)\n\tRollbackChangeset(w http.ResponseWriter, r *http.Request)\n}\n```\nChangesets is the admin API's changeset handler (admin.KnowledgeHandler).\n\n```go\ntype Deps struct {\n\tChangesets Changesets\n\t// Caller resolves the request's portal user, nil when it carries none.\n\tCaller func(*http.Request) *Caller\n\t// CanApply reports whether the caller holds apply_knowledge\n\t// (access.Checker.HasApplyKnowledge: the persona's tool, or admin).\n\tCanApply func(*Caller) bool\n}\n```\nDeps carries what the routes need.\n\n","path":"github.com/txn2/mcp-data-platform/internal/httpserver/changesethttp","name":"changesethttp","synopsis":"Package changesethttp serves the knowledge changesets to the portal (#2337): the list, one changeset, and its rollback under /api/v1/portal/knowledge/changesets, for a caller who holds apply_knowledge.","isRedistributable":true}
