Skip to content

Provider registration should be automatic on StarlarkRuntime use #257

Closed

Description

@David-Noble-at-work

Problem

Every consumer of op.StarlarkRuntime must manually blank-import pkg/op/provider to trigger provider self-registration. Today this is done in 5+ places across devlore-cli (internal/writ/commands.go, internal/lore/builder.go, internal/writ/migrate/session.go, internal/writ/migrate/plan.go, internal/e2e/testrunner/runner.go) and will need to be done in every external consumer (e.g., noblefactor-ops).

The root cause is that pkg/op cannot import pkg/op/provider (circular dependency), so register.go's blank imports are never triggered by using the op package alone.

Expected behavior

Using op.StarlarkRuntime (or op.NewStarlarkRuntime) should ensure all announced providers are available without the caller needing to know about pkg/op/provider or manually import it.

Current workaround

Every binary entry point adds:

_ "github.com/NobleFactor/devlore-cli/pkg/op/provider"

This is fragile — forgetting the import means providers silently don't register, and op.Providers() returns an incomplete list.

Possible approaches

  • Move register.go or its equivalent into a package that op can import without circularity
  • Have NewStarlarkRuntime or NewBindingConfig call a registration function that doesn't require an import
  • Use a Go init() in op that references a registration hook set by the provider package
  • Accept the manual import but document it as a required step and add a runtime check that errors if no providers are registered when BuildReceivers is called

Context

Discovered during noblefactor-ops integration work (star-provider-migration). The generate-register Makefile target produces register.go correctly, but nothing ensures it gets imported.

Activity

  1. David-Noble-at-work commented on Aug 7, 2026

    @David-Noble-at-work
    ContributorAuthor

    Closing as addressed: pkg/op/inventory is the single-import registration manifest (generated blank imports), replacing the scattered per-binary provider imports this issue describes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions