feat(pluginmgr): add GRPCBroker reverse channel and streaming delivery#335
Merged
Merged
Conversation
afb2df2 to
22e5333
Compare
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
HostClient, not just as return values fromHandleEventStreamEventsRPC) for host-to-plugin event delivery, replacing per-event unary RPCs with a single long-lived connection and automatic fallback to unary when streaming is unavailablehostEventServiceIDto an exported constant (HostEventServiceID) shared between host and SDK, eliminating duplicate declarations and the risk of service ID driftChanges
Plugin SDK
pkg/plugin/sdk/host_client.go: ExportHostEventServiceIDconstant (was unexported duplicate); switch toerrors.Newfor static error strings; use exported constant inbroker.Dialcallpkg/plugin/sdk/host_client_test.go: Update assertions to reference exportedHostEventServiceIDconstantPlugin Manager — Core
internal/infrastructure/pluginmgr/grpc_event.go: MovedomainEventToStreamMessageconversion helper here fromstream_manager.goso proto↔domain conversions are co-located in the gRPC adapter fileinternal/infrastructure/pluginmgr/stream_manager.go: RemovedomainEventToStreamMessage(relocated togrpc_event.go)internal/infrastructure/pluginmgr/rpc_manager.go: Replace localhostEventServiceIDconstant withsdk.HostEventServiceIDto use the single exported source of truthPlugin Manager — Tests
internal/infrastructure/pluginmgr/broker_integration_test.go: New file — integration tests covering emit-and-receive, emit denied by manifest, 100-event streaming with sequence numbers, transparent fallback to unary, goroutine leak verification across 50 cycles, F090 backward compatibility, and unary/stream delivery benchmarksinternal/infrastructure/pluginmgr/grpc_event_test.go: Add unit tests fordomainEventToStreamMessage(all fields, zero sequence number)internal/infrastructure/pluginmgr/rpc_manager_test.go: Add tests forstartBrokerHostServicenil-broker/nil-bus no-ops,manifestLookupthread-safety, and stream-manager fallback path; fixwireEventSubscriptionstest to useNewStreamManagerinstead of zero-value struct literalinternal/infrastructure/pluginmgr/stream_manager_test.go: Replace singlelastMessagefield withmessagesslice in mock to support multi-event tests without message clobbering; add dequeue semantics togetLastMessageInfrastructure — Notify
internal/infrastructure/notify/webhook_test.go: Replace externalhttpbin.orgURL in concurrent webhook test with localhttptest.Serverto eliminate network dependency in unit testsDocumentation
docs/development/plugin-event-architecture.md: Add F092 architecture sections covering GRPCBroker,HostEventService,StreamManager,EventDelivererseam, fallback handling, and updated ASCII architecture diagramdocs/user-guide/plugin-events.md: DocumentHostClient.Emit()as second emission method, addSetHostClientwiring guide, streaming delivery section with automatic fallback descriptionREADME.md: Update Plugin System feature bullet with GRPCBroker reverse channel and persistent streaming delivery descriptionsCLAUDE.md: Replace two outdated pitfalls/conventions with new rules for gRPC/concurrency coverage requirements and staged-file verificationTest plan
make test-race— verify no data races in stream managers,EventBusdelivery goroutines, and broker integration pathsmake test-unit— confirm allpluginmgrandsdkunit tests pass including newdomainEventToStreamMessageandHostEventServiceIDtestsgo test ./internal/infrastructure/pluginmgr/ -run TestBrokerIntegration -v— verify emit/deny/stream/fallback/goroutine-leak integration scenarios all passgo test ./internal/infrastructure/pluginmgr/ -bench BenchmarkEventDelivery -benchmem— confirm stream delivery throughput exceeds unary baselineCloses #334
Generated with awf commit workflow