Skip to content

refactor(sdk): reframe sei SDK as a wire-client product (Phase A)#443

Merged
bdchatham merged 1 commit into
mainfrom
refactor/sdk-wire-provider-reframe
Jun 24, 2026
Merged

refactor(sdk): reframe sei SDK as a wire-client product (Phase A)#443
bdchatham merged 1 commit into
mainfrom
refactor/sdk-wire-provider-reframe

Conversation

@bdchatham

Copy link
Copy Markdown
Collaborator

What

Make the sdk/sei pieces idiomatically express a settled design decision: the SDK is a wire-client product + contract owner. Its providers (k8s, docker) are WIRE clients — they speak RPC/CRDs to an already-running chain, so version-pinning them is fine. An in-process ("local") provider is a category error for the SDK: it would link sei-chain's Go source (the controller can't transitively build it; and it co-versions the harness with the chain). The in-process harness lives in sei-chain, satisfies these handle interfaces by shape, and is registered/constructed consumer-side. The SDK stops pretending to host "local".

Changes

  • Delete the sdk/sei/provider/local ErrNotImplemented stub package.
  • Drop the built-in local mode + SEI_LOCAL from resolveMode (and the resolve/ambiguity error text). The registry stays generic — a consumer may still provider.Register("local", …) its own in-process adapter and Open(ctx, "local") explicitly.
  • Keep docker untouched (legitimate wire stub).
  • Name the contract seam: Provider/*Handle + *Spec + the registry are the stable, dependency-light contract — the seam a future leaf module would extract — and must stay free of controller-runtime/apimachinery/CRD imports. Documented in provider.go and CLAUDE.md. Not extracted now (deferred).
  • Add a go list -deps import-discipline test that mechanically enforces that seam on the core sei package.
  • Fix the drift test to pin built-in modes to exactly {k8s, docker}; refresh package/Provider/Object() docs and sdk/CLAUDE.md.

No Provider/handle interface signatures change. No contract sub-package/module extraction, no harness changes, no sei-chain changes (Phases B/C).

Verification

go build ./..., go test ./sdk/... -race, go vet ./sdk/..., gofmt -s -l sdk/, golangci-lint run ./sdk/... (0 issues) — all green.

For reviewers

  • The drift test moved from "contains" to "exactly equals {docker, k8s}" — stricter, so an extra built-in mode also fails. Intentional: the SDK's built-in surface is now closed.
  • TestResolveMode_ExplicitBeatsEnv now resolves a "consumer-mode" name, doubling as coverage that a consumer passes its own mode explicitly (the only path left for a non-wire provider).
  • The new imports_test.go shells out to go list; it confirmed core has zero hits while the k8s provider pulls apimachinery, so it discriminates correctly.

Out of scope (Phase A)

Interface-signature changes; contract sub-package/module extraction; integration harness (Phase B); sei-chain (Phase C).

🤖 Generated with Claude Code

The SDK ships WIRE providers (k8s, docker) that speak RPC/CRDs to an
already-running chain. An in-process ("local") provider is a category
error: it would link sei-chain's Go source (uninstallable in the
controller; co-versioned with the chain). The in-process harness lives
in sei-chain and conforms to these handle interfaces by shape,
registered/constructed consumer-side.

- delete the local ErrNotImplemented stub package
- drop the built-in "local" mode + SEI_LOCAL from env resolution
  (registry stays generic — a consumer may still Register("local", …))
- name the contract seam: Provider/*Handle + *Spec + registry stay free
  of controller-runtime/apimachinery/CRD imports
- add a go-list import-discipline test enforcing that seam
- pin built-in modes to exactly {k8s, docker}; refresh docs

docker is untouched. No interface signatures change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor

cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Breaking for callers that relied on SEI_LOCAL or blank-importing the local stub; mode resolution and registered built-in providers change, though explicit Open and RegisterProvider remain for custom modes.

Overview
Repositions the SDK as a wire-client product (k8s/docker only) and drops the shipped local stub and SEI_LOCAL env wiring. In-process harnesses are expected to live in sei-chain and register via RegisterProvider with an explicit Open(ctx, "…") mode name.

Removals: entire sdk/sei/provider/local package (stub + tests); modeLocal and SEI_LOCAL from resolveMode and related error strings.

Documentation: sdk/CLAUDE.md, sei.go, provider.go, and readiness.go now describe the contract seam, consumer-side registration, and that Object() may be nil for non-k8s providers.

Tests: new TestCoreContractStaysDependencyLight (go list -deps) bans k8s/controller-runtime/api imports from core sdk/sei; TestProviderKeysMatchOpenModes requires built-in providers to be exactly {docker, k8s}; registry/Open tests updated for two env modes and explicit consumer mode names.

Public **Provider/handle signatures are unchanged.

Reviewed by Cursor Bugbot for commit ba8ccf7. Bugbot is set up for automated code reviews on this repo. Configure here.

@bdchatham

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit ba8ccf7. Configure here.

@bdchatham

Copy link
Copy Markdown
Collaborator Author

Review-gate: PASS — merging

Coral slate (blinded, 4 lenses): unanimous RATIFY.

  • kubernetes-specialist (assigned dissenter): RATIFY — repo-wide hunt found zero live consumers of the removed SEI_LOCAL/local surface; sole SDK consumer (integration harness) is k8s-only; imports_test seam guard discriminates correctly; SEI_LOCAL not on the frozen one-way-door list; provider.Register + explicit Open reintroduction path open.
  • systems-engineer: RATIFY — import-guard fails-closed and can fire (verified via go list -deps); resolveMode correct across all cases; registry concurrency untouched; drift exact-equals sound.
  • idiomatic-reviewer: RATIFY — reads native. Advisory: fold the duplicated seam comment into the Provider doc.
  • prose-steward: RATIFY (w/ reservations) — docs unambiguous. Advisory: standardize on the provider.Register façade (vs RegisterProvider) in consumer-facing instructions.

Bugbot: clean. CI: lint / test / test-integration / verify-generated all green.

The two advisory doc nits are non-blocking and will be folded into a later SDK-docs touch.

@bdchatham bdchatham merged commit 12d0b38 into main Jun 24, 2026
5 checks passed
@bdchatham bdchatham deleted the refactor/sdk-wire-provider-reframe branch June 24, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant