feat(kg): add thresholds read commands over v1 threshold config - #1316
Open
kblaschke512 wants to merge 2 commits into
Open
kblaschke512 wants to merge 2 commits into
kblaschke512 wants to merge 2 commits into
Conversation
Add `gcx kg thresholds get` (whole config as YAML) and `list --category request|resource` (custom/global split) over the Asserts v1 threshold API. Targets v1 — the version the Asserts UI and all user thresholds run on. Tables are declared as one column list per ADR-002; goldens captured from a hand-rolled codec pair still pass unchanged. Machine formats keep the custom/global wire split via a local format switch. Verified against a dev stack, which caught two things unit tests missed: real threshold exprs are multi-line PromQL that broke the table apart, now collapsed and clipped; and `get` must encode a *pointer* to the unstructured envelope, since MarshalJSON is on the pointer receiver and a value leaks an "Object" key. Read-only first; writes land in a follow-up. Refs #1078. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kblaschke512
force-pushed
the
feat/kg-thresholds
branch
from
September 14, 2026 21:01
3317d1f to
95543ff
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
Adds read-only
gcx kg thresholdsover the Asserts v1 threshold config API. Refs #1078 — writes (set -f,upsert,delete) follow in a second PR, so this one carries no destructive paths.Why v1, not v2
The Asserts app UI and every threshold users have actually configured run on v1 —
ManageAssertions.service.tscalls only/v1/config/threshold-rule(s), across six call sites.ThresholdsV2ConfigControllerhas zero call sites in the plugin UI; it appears only in the proxy authz allow-list (pkg/plugin/authz/authz.go) and its own tests. So a v2 client would diverge from what the product actually uses.Re-checked at
asserts-app-plugin@dc0b960bandasserts-adi@4f4d8a8880(2026-09-11): both controllers still exist, neither is@Deprecated, and the v1 endpoint map is unchanged.The two read endpoints in this PR were verified live against a dev stack — response shapes match the DTOs exactly (
{active, expr, labels, record}). The write endpoints are from source reading only; they land with the follow-up PR.Notes for review
getsupports human and machine output. Table is the default and reuses the existing prom-rules table codecs. JSON/YAML preserve thePrometheusRulesDtoresource envelope through the existingRuleToResourcepath.listtables follow ADR-002. One column list defines narrow and wide output;LABELSis the onlyWideOnlycolumn.internal/outputcontract. ADR-002 and those packages are unchanged.[], nevernull.--categoryis validated before any request and path-escaped before being added to the URL.Testing
GCX_AGENT_MODE=false mise run all— lint 0 issues, full suite green, docs/reference generation and build greenOut of scope
set -fwhole-config replace,upsert,delete) — follow-up PR;setreplaces everything, so it gets a confirmation prompt plus--yes🤖 Generated with Claude Code