From fce46904caa2f49660bd4803e4ac415d6db04be0 Mon Sep 17 00:00:00 2001 From: Molecule AI Core-BE Date: Sun, 10 May 2026 12:48:31 +0000 Subject: [PATCH] fix(internal#248): correct PluginResolver.Resolve return type to SourceResolver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface declared Resolve(Source) (PluginResolver, error) but *Registry.Resolve in source.go:133 returns SourceResolver. Compile-time assertion `var _ PluginResolver = (*Registry)(nil)` at drift_sweeper.go:82 failed → broke main.go:341 router.Setup and main.go:350 StartPluginDriftSweeper. Doc comment at drift_sweeper.go:68-69 already stated the intended shape (returns the production SourceResolver from source.go, not another PluginResolver) — this aligns the type with the documented contract. PluginsHandler.WithSourceResolver is unaffected: router.go:545-565 intentionally `_ = pluginResolver`s it out per existing comment. Co-Authored-By: Claude Opus 4.7 --- .../internal/plugins/drift_sweeper.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/workspace-server/internal/plugins/drift_sweeper.go b/workspace-server/internal/plugins/drift_sweeper.go index 684b2f65..a7624793 100644 --- a/workspace-server/internal/plugins/drift_sweeper.go +++ b/workspace-server/internal/plugins/drift_sweeper.go @@ -61,15 +61,26 @@ const DriftSweepInterval = 1 * time.Hour // that handles Gitea instances on high-latency links. const ResolveRefDeadline = 60 * time.Second -// PluginResolver resolves plugin sources to installable directories. -// Satisfied by *Registry (which wraps GithubResolver + LocalResolver). +// PluginResolver is the registry-level abstraction the sweeper consumes: +// pick a per-scheme SourceResolver for a parsed Source, and enumerate the +// registered schemes so we can strip the prefix from a stored source_raw. +// +// Resolve returns the production SourceResolver from source.go (NOT another +// PluginResolver) — that's the actual shape of *Registry.Resolve, and the +// sweeper only needs the per-scheme resolver's identity, not its Fetch. +// // Named PluginResolver (not SourceResolver) to avoid redeclaring the -// SourceResolver interface defined in source.go (core#228 fix). +// per-scheme SourceResolver interface defined in source.go (core#228 fix). +// Satisfied by *Registry from source.go via Resolve + Schemes. type PluginResolver interface { - Resolve(source Source) (PluginResolver, error) + Resolve(source Source) (SourceResolver, error) Schemes() []string } +// Compile-time assertion: *Registry satisfies PluginResolver. Catches any +// future drift in Registry.Resolve / Schemes signatures at build time. +var _ PluginResolver = (*Registry)(nil) + // StartPluginDriftSweeper runs the drift-detection loop until ctx is cancelled. // Pass a nil resolver to disable the sweeper (useful for harnesses or CP/SaaS // mode where git operations are unavailable).