Skip to content

feat(plugin): resolve connections by id#3139

Merged
adityathebe merged 1 commit into
mainfrom
feat/plugin-connection-by-id
May 25, 2026
Merged

feat(plugin): resolve connections by id#3139
adityathebe merged 1 commit into
mainfrom
feat/plugin-connection-by-id

Conversation

@adityathebe
Copy link
Copy Markdown
Member

@adityathebe adityathebe commented May 22, 2026

Add a direct connection_id lookup to the plugin HostService API.

This keeps config_item_id scoped to scraper-derived connections, while allowing plugins attached to MissionControl::Connection items to resolve the underlying connection id.

The host implementation uses duty's connection lookup so hydration and RBAC stay centralized.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for resolving connections by ID through the plugin host API. Users can now retrieve connections directly using their connection ID as an alternative to existing lookup methods such as config item ID, type, or label-based resolution, providing a more direct way to access specific connections.

Review Change Stack

Add a direct connection_id lookup to the plugin HostService API and expose it through HostClient.GetConnectionByID. This keeps config_item_id scoped to scraper-derived connections while allowing plugins attached to MissionControl::Connection items to resolve the underlying connection id through duty's hydrated connection lookup and RBAC checks.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c745820b-5e37-4d55-80f6-722bfa9aef72

📥 Commits

Reviewing files that changed from the base of the PR and between a99f388 and 4b6ab5a.

⛔ Files ignored due to path filters (1)
  • plugin/proto/plugin.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (4)
  • plugin/host/connection.go
  • plugin/host/service.go
  • plugin/proto/plugin.proto
  • plugin/sdk/host_client.go

Walkthrough

This PR adds ID-based connection resolution to the Mission Control plugin system. The proto schema extends GetConnectionRequest with a new connection_id lookup option, the host service implements the getConnectionByID helper and wires it into the GetConnection handler, and the SDK client exposes GetConnectionByID as a public interface method.

Changes

Connection ID-based lookup support

Layer / File(s) Summary
Proto message contract for ID-based lookup
plugin/proto/plugin.proto
GetConnectionRequest.lookup oneof is extended with connection_id (field 4) to enable direct Mission Control connection ID resolution, with updated documentation for all four lookup modes.
Host-side connection ID resolution
plugin/host/connection.go, plugin/host/service.go
Service.getConnectionByID validates the connection ID, fetches via dutyConn.Get, wraps errors, and converts to ResolvedConnection. GetConnection handler adds a switch case for GetConnectionRequest_ConnectionId that invokes this helper using the already-built pluginCtx.
SDK client interface and implementation
plugin/sdk/host_client.go
HostClient interface adds GetConnectionByID(ctx context.Context, connectionID string) method. hostClient implementation forwards to the GetConnection RPC with ConnectionId lookup and applies the invocation token via authContext.

Sequence Diagram

sequenceDiagram
  participant Plugin
  participant hostClient
  participant GetConnection
  participant getConnectionByID
  participant dutyConn
  Plugin->>hostClient: GetConnectionByID(ctx, connectionID)
  hostClient->>GetConnection: GetConnection(ctx, ConnectionId lookup)
  GetConnection->>getConnectionByID: getConnectionByID(ctx, connectionID)
  getConnectionByID->>dutyConn: Get(connectionID)
  dutyConn-->>getConnectionByID: connection
  getConnectionByID-->>GetConnection: ResolvedConnection
  GetConnection-->>hostClient: ResolvedConnection
  hostClient-->>Plugin: ResolvedConnection
Loading

Possibly related PRs

  • flanksource/mission-control#3085: Overlaps in connection-by-ID resolution logic; PR #3085 scopes the resolution to the plugin's registry namespace while this PR adds the core ID-based lookup path.

Suggested reviewers

  • moshloop
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding direct connection ID lookup to the plugin API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plugin-connection-by-id
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/plugin-connection-by-id

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@adityathebe adityathebe linked an issue May 22, 2026 that may be closed by this pull request
@adityathebe adityathebe requested a review from moshloop May 22, 2026 12:50
@adityathebe adityathebe merged commit 2c1c5f9 into main May 25, 2026
12 checks passed
@adityathebe adityathebe deleted the feat/plugin-connection-by-id branch May 25, 2026 06:33
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.

Plugin: Get connection by string

1 participant