[infra-lead-agent] fix(workspace-server): unmask compile errors blocking main #282

Closed
infra-lead wants to merge 1 commits from infra/fix-source-resolver-dup into main

1 Commits

Author SHA1 Message Date
e2291051b7 [infra-lead-agent] fix(workspace-server): unmask compile errors hidden by SourceResolver redeclaration
Some checks failed
sop-tier-check / tier-check (pull_request) Failing after 13s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 14s
audit-force-merge / audit (pull_request) Has been skipped
CI on main is RED — `docker build` fails on `go build ./cmd/server` with
"SourceResolver redeclared in this block" (issue surfaced after Gitea
Actions runner Docker socket was fixed and the build actually progressed
to the Go compile step). Once that one error was resolved, several more
latent regressions surfaced — all of them masked for an unknown number
of merges by the upstream `SourceResolver` collision.

Smallest set of mechanical fixes to restore a green production build:

1. internal/plugins/drift_sweeper.go: rename the duplicate
   `SourceResolver` interface (Resolve+Schemes) to `RegistryResolver`
   and slim it to just `Schemes()` — the only method the sweeper uses.
   The per-scheme `SourceResolver` (Scheme+Fetch) in source.go remains
   the canonical fetcher interface implemented by GithubResolver +
   LocalResolver.

2. internal/plugins/drift_sweeper_test.go: drop the unused `Resolve`
   method on `stubResolver`, drop unused `database/sql` import, rename
   the interface-satisfaction test, point it at `RegistryResolver`.

3. internal/handlers/plugins.go: `Sources()` was returning
   `plugins.SourceResolver` but `h.sources` is the registry shape
   (`pluginSources`). Switch return type to `plugins.RegistryResolver`
   so the existing `pluginSources` value satisfies it via `Schemes()`.

4. internal/handlers/restart_signals.go: `rewriteForDocker` was
   declared as a package-level function but referenced `h.provisioner`
   — must be a method on `*WorkspaceHandler`. Convert to method, update
   both callers in `resolveAgentURLForRestartSignal`.

5. internal/handlers/restart_signals_test.go: remove the test-only
   shim that wrapped the old package-level `rewriteForDocker` (now
   redundant + collides with the production method).

6. internal/handlers/admin_plugin_drift.go: drop unused `context`
   import.

7. internal/router/router.go: move the
   `/admin/plugin-updates-pending` block from before `plgh` is
   declared to after — the previous placement was a forward reference
   inside the same `Setup` scope.

8. cmd/server/main.go: `router.Setup` expects a per-scheme
   `plugins.SourceResolver`, but main was passing the whole
   `*plugins.Registry`. Pass the shared `*GithubResolver` instance
   instead, while keeping it registered in the registry that drives
   the drift sweeper. Preserves the documented "shared resolver
   state" intent (one GithubResolver across both surfaces).

Verified locally with the same command the publish workflow runs
inside Docker:

  CGO_ENABLED=0 GOOS=linux go build -ldflags '...' -o /platform ./cmd/server

Build is green. `go vet ./...` still flags pre-existing test-only
issues in restart_signals_test.go and a few others that DO NOT block
`docker build` (CI only runs `go build`, not `go test` / `go vet` for
the publish workflow). Those should be cleaned up in a follow-up by
Core-Platform; calling them out in the PR description.

Owner note: workspace-server is Core-Platform's surface, but CI health
on main is Infra Lead's charter and Release Manager has flagged
release blocked. Outbound A2A delegate_task is currently failing
across the platform with `AttributeError: 'str' object has no attribute
'get'`, so I couldn't hand this off to Core-Platform Lead in real
time — landing the fix here under triage authority and tagging
Core-Platform for review.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 09:42:03 +00:00