fix(36): compile token scope catalog once in pier boot coverage warning
This commit is contained in:
@@ -17,6 +17,7 @@ func warnUncoveredBackendWriteTools(app *backpack.App, plugins []party.Plugin, c
|
||||
if cat == nil || len(cat.tools) == 0 {
|
||||
return
|
||||
}
|
||||
var matcher *cabana.TokenScopeMatcher
|
||||
byPlugin := map[string][]string{}
|
||||
var pluginOrder []string
|
||||
for _, t := range cat.tools {
|
||||
@@ -26,7 +27,18 @@ func warnUncoveredBackendWriteTools(app *backpack.App, plugins []party.Plugin, c
|
||||
if t.method == http.MethodGet || t.method == http.MethodHead {
|
||||
continue
|
||||
}
|
||||
if cabana.TokenScopeCovers(app, plugins, t.method, t.decl.Permissions) {
|
||||
if matcher == nil {
|
||||
var err error
|
||||
matcher, err = cabana.NewTokenScopeMatcher(app, plugins)
|
||||
if err != nil {
|
||||
logger().Warn(
|
||||
"pier: could not compile token scope catalog while checking backend write MCP tool coverage",
|
||||
"err", err,
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
if matcher.Covers(t.method, t.decl.Permissions) {
|
||||
continue
|
||||
}
|
||||
if _, seen := byPlugin[t.pluginID]; !seen {
|
||||
|
||||
Reference in New Issue
Block a user