Skip to content

Migration: Props interface prune + props.New

Part of the GTB framework core follow-ups. Pre-1.0, so this ships as a minor bump.

Removed: eight unused provider interfaces

These narrow provider interfaces had zero production consumers — pure API ornament — and were removed from pkg/props:

ConfigReader, ConfigFSProvider, FileSystemProvider, VersionProvider, ErrorHandlerProvider, TelemetryProvider, LoggingConfigProvider, CoreProvider.

The four interfaces with real consumers are kept: LoggerProvider, ConfigProvider, AssetProvider, ToolMetadataProvider.

Every getter method on *Props is unchangedGetFS, GetVersion, GetErrorHandler, GetCollector, GetConfigView, GetConfigFS and the rest all remain. Only the interface types were removed.

Migration:

  • If you declared a parameter as one of the removed interfaces, take *props.Props directly (that is how the whole codebase already works), or reintroduce a one-method interface local to your package over the getter you need.
// before
func f(p props.FileSystemProvider) { fs := p.GetFS() }

// after — take the concrete container, or a local narrow interface
func f(p *props.Props) { fs := p.GetFS() }

Added: props.New(...) and Props.Validate()

A blessed construction path now checks the nil-field contract at one place:

p, err := props.New(tool, logger, fs,
    props.WithAssets(assets),
    props.WithVersion(ver),
)

New requires a named Tool, a Logger, and a filesystem; it defaults the optional invariants (Collector → noop, ErrorHandler, Version) and leaves Config nil (the pre-run assigns it; the init path runs with it nil by design). Props.Validate() and Props.ApplyDefaults() are exposed for callers that still build a struct literal. Building a Props struct literal continues to work unchanged — New is additive.

Behaviour changes (not API)

  • doctor no longer ships a built-in Git check, and its AI-key check now runs only when the AI feature is enabled. A tool with a git-consuming feature should register its own git check via setup.RegisterChecks.
  • Assets fs.FileInfo.Name() on merged structured reads now returns the base name (per the fs.FileInfo contract), not the full path passed to Open. Code that relied on the old full-path return should join the path itself.