Files
dingtalk-workspace-cli/internal/cli/schema_lazy_metadata.go
玉澜 7afd4139fc refactor(cli): drop dead discovery loader params and retired MCP pin machinery
- NewSchemaCommand / NewMCPCommand / newCatalogCommand no longer accept a
  DiscoveryCatalogLoader they always discarded; schema's no-discovery
  property is now structural, retiring the panic-loader test guard along
  with the trivial root.go wrappers and the unused buildMCPCommandFn seam.
- Delete the lazy sync.Once / atomic counter around the retired MCP pin:
  runtimeMCPMetadata only existed so a diagnostic counter could observe a
  loader that always returns the constant empty pin. Assembly now calls
  emptyPinnedMCPMetadata directly and SchemaMetadataLoadCounts loses the
  dead MCPMetadata field (the policy bans keep the retired names from
  reappearing).
2026-08-03 21:15:20 +08:00

26 lines
945 B
Go

// Copyright 2026 Alibaba Group
// Licensed under the Apache License, Version 2.0 (the "License");
package cli
// SchemaMetadataLoadCounts exposes read-only diagnostics for startup tests and
// profiling. Counts are incremented only when a lazy delivery snapshot is
// assembled / projected for the first time.
type SchemaMetadataLoadCounts struct {
Catalog uint64
MetaIndex uint64
AgentMetadata uint64
ParameterBinding uint64
}
// RuntimeSchemaMetadataLoadCounts reads the concurrency-safe lazy loader
// counters without triggering any loader.
func RuntimeSchemaMetadataLoadCounts() SchemaMetadataLoadCounts {
return SchemaMetadataLoadCounts{
Catalog: runtimeDeliverySchemaCatalogLazyCount.Load(),
MetaIndex: runtimeDeliverySchemaMetaIndexLazyCount.Load(),
AgentMetadata: runtimeAgentMetadataLazyLoadCount.Load(),
ParameterBinding: runtimeSchemaParameterBindingsLazyLoadCount.Load(),
}
}