feat(insights): wrap the guardrail recommendations API in GraphQL - #5837
Open
alonkeyval wants to merge 1 commit into
Open
alonkeyval wants to merge 1 commit into
alonkeyval wants to merge 1 commit into
Conversation
The insights engine mines promoted transactions' relation samples for attribute pairs that always agree and offers each as a ready-made attribute_correlation rule. This exposes those eight REST endpoints to the UI, so an operator can review a mined rule and apply it without writing the correlation spec by hand. Queries: insights.recommendations(...) and insights.recommendation(id). Mutations: apply / dismiss / restore / revert / preview / recompute. Two wire quirks are handled here rather than pushed to the UI: - A partially failed bulk action answers 422 carrying both the items that succeeded and a reason per item that did not. Treating that as a request error would hide both halves, so the client decodes the body instead; every other non-2xx status is still an error. - live_since / live_last are time.Time with omitempty, which does nothing for a struct, so a recommendation that live traffic has not reached yet carries Go's zero time. That maps to null rather than rendering as year 1. why_it_matters is exposed but the engine never populates it - the security narrative is generated into spec.why instead; noted in the schema description. Also adds the webapp GraphQL documents and registers the operations in the ui-kit adapter. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What this PR does / why we need it:
Wraps the insights service's guardrail-recommendations API in GraphQL, so the UI
can list the
attribute_correlationrules the engine mined from a transaction'slearning samples and apply one without the operator writing the spec by hand.
Queries
insights.recommendations(...)/insights.recommendation(id), andmutations
apply/dismiss/restore/revert/preview/recompute.Also adds the webapp GraphQL documents and registers the operations in the
ui-kit adapter.
Two wire quirks are absorbed here rather than pushed to the UI:
succeeded and a reason per item that did not. Treating that as a request
error would hide both halves, so the client decodes that body; every other
non-2xx status is still an error.
live_since/live_lastaretime.Timewithomitempty, which doesnothing for a struct, so a recommendation live traffic has not reached yet
carries Go's zero time. That maps to
nullinstead of rendering as year 1.why_it_mattersis exposed but the engine never populates it — the securitynarrative is generated into
spec.why— noted in the schema description.Needs an insights build with the recommendations API (
v1.38.0-pre1+);resolvers behave like every other insights field when it is unavailable.
UI side: odigos-io/ui-kit#1320.
Changelog entry: Does this PR introduce a user-facing bug fix, feature, dependency update, or breaking change??
🤖 Generated with Claude Code