feat: add pkg/plugin-sdk as the stable plugin API surface#14
Merged
Conversation
dbus_test.go guarded parsed events with 'if event == nil { t.Fatal(...) }'
then dereferenced them. staticcheck (SA5011) does not model t.Fatal as
terminating, so it flagged the subsequent field access as a possible nil
dereference — failing 'golangci-lint run' on main (6 findings across three
test cases). Add an explicit return after each t.Fatal so the non-nil
guarantee is visible to flow analysis.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Plugins previously imported core internals under src/infra/grpc/... directly (the generated contract and client scaffolding). Introduce pkg/plugin-sdk as the stable, supported API surface for building trigger plugins: a thin re-export of Connect/ConnectOrNil, the Client and RecurClient types, and the ReportTriggerEvent request/response messages. Out-of-tree plugin repos depend on this path so the contract can evolve behind a curated boundary. - Migrate all 7 in-repo plugins to import pkg/plugin-sdk instead of src/infra. - Build, test, and lint ./pkg/... in CI (neither pkg/config nor the SDK was covered before); drop a dead strPtr test helper that lint then flagged. Prepares plugins for extraction into their own repositories. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Binary Size Report
|
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.
Summary
First step toward extracting first-party plugins into their own repositories: give plugins a stable, supported API to build against instead of reaching into core internals under
src/infra/grpc/....Today every plugin imports the generated gRPC contract and client scaffolding directly. Once plugins live in separate repos, those
src/infra/...paths become a de-facto public API pinned from outside — brittle and unversioned. This PR introducespkg/plugin-sdkas the curated boundary, migrates the in-repo plugins onto it, and brings./pkg/...under CI.Also un-breaks the
Lintcheck:golangci-lintwas already red onmaindue to a pre-existing nil-deref pattern indevicemonitortests (fixed as its own commit).Changes
fix(devicemonitor)—dbus_test.goguarded parsed events withif event == nil { t.Fatal(...) }then dereferenced them. staticcheck (SA5011) doesn't modelt.Fatalas terminating, so it flagged the field access as a possible nil dereference (6 findings, 3 test cases), failing lint onmain. Add an explicitreturnafter eacht.Fatal.feat: pkg/plugin-sdkpkg/plugin-sdkpackage: a thin re-export ofConnect/ConnectOrNil, theClientandRecurClienttypes, and theReportTriggerEventrequest/response messages — the entire surface plugins consume from core (verified: justclientgrpc.Connect+recurv1.ReportTriggerEventRequest).pkg/plugin-sdkinstead ofsrc/infra/...../pkg/...in CI and lint it in theTaskfile(neitherpkg/confignor the SDK was covered before); drop a deadstrPtrhelper that lint then surfaced.Test plan
go buildcore + SDK + all 7 plugins (workspace)GOWORK=off go test ./pkg/plugin-sdk/(consumer path, no workspace)go test ./src/... ./pkg/...and all plugin tests passgolangci-lint runover full CI scope +./pkg/...→ 0 issuesChecklist
Breaking changes
None.
pkg/plugin-sdkis additive and the plugin runtime contract is unchanged.