chore: trim internal-wiring from the public API surface#97
Merged
Conversation
Four changes, each removing or clarifying surface that was only there for internal wiring or was speculative: - Export Upcaster: RegisterEvent's param was an unexported alias (upcastFn), so godoc rendered an un-nameable type. Now `type Upcaster = func(...)`. - Delete StateAppCounter: documented as a shipped specialization but had zero consumers (only its own unit test). Speculative surface; dropped until a real need appears. docs/distributed-state.md now shows the inline StateAppEvents[tick,int64] pattern instead. - Move WithTestServer out of production into vt.Serve(t, app): the option pulled net/http/httptest into production config.go/app.go to serve a test-only need. App is its own http.Handler and ServeHTTP dispatches dynamically, so httptest.NewServer(app) is equivalent and order-independent. Added vt.Serve (auto-closes via t.Cleanup) and migrated all call sites; internal `package via` tests use httptest.NewServer(app) directly (vt->via import cycle bars vt there). - Document the sealed readCtx param: StateTab.Text and StateAppEvents.Text now state they accept *Ctx or *CtxR, matching the other Read/Text methods, so the opaque (intentionally unexported) readCtx in the signature is explained. Build, vet, gofmt, and `go test -race ./...` all green.
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes/clarifies public surface that existed only for internal wiring or was speculative. Pure API hygiene — no runtime behavior change.
Changes
UpcasterRegisterEvent's param was an unexported alias (upcastFn) → godoc showed an un-nameable type. Nowtype Upcaster = func(old json.RawMessage) (json.RawMessage, error).StateAppCounterStateAppEvents[tick,int64]pattern.WithTestServer→vt.Serve(t, app)net/http/httptestinto productionconfig.go/app.gofor a test-only need.Appis its ownhttp.HandlerandServeHTTPdispatches dynamically, sohttptest.NewServer(app)is equivalent + order-independent. Newvt.Serveauto-closes viat.Cleanup. All call sites migrated; internalpackage viatests usehttptest.NewServer(app)directly (vt→via import cycle barsvtthere).readCtxparamStateTab.Text/StateAppEvents.Textnow state they accept*Ctxor*CtxR, matching the otherRead/Textmethods.readCtxstays unexported by design (sealing — only*Ctx/*CtxRcan satisfy it).Verification
go build ./...,go vet ./...,gofmt -l(clean), andgo test -race ./...— all green.