Add target_kind to UsageEvent #1224
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 286 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1224"
general
weight: 0.35
ggreer
Summary
UsageEventdoes not say what kind of thing its target is. A consumer that records app-level sign-ins (for example "last login" for the connector's own app) cannot tell a sign-in to the app itself from use of an app reached through it. Today such a consumer has to match connector-specific target IDs, such asapp/dropboxorusage-app/github, keyed by connector type. That does not work for self-hosted connectors, and it cannot separate targets that share one resource type (Google Workspace usesenterprise_applicationfor both its own sign-ins and OAuth clients).This PR adds an optional
target_kindfield (number 5) with a nestedTargetKindenum toUsageEvent.TARGET_KIND_CHILD_APPis the common case, and an unset value means the same, so existing connectors keep their meaning and need no change. Connectors that emit sign-ins to their own app setTARGET_KIND_APP_ACCESSon those events. The field has no validate rule, so a value added later cannot make a consumer reject a whole event.Changes
proto/c1/connector/v2/event_feed.proto:UsageEvent.target_kind = 5andUsageEvent.TargetKind(TARGET_KIND_UNSPECIFIED = 0,TARGET_KIND_CHILD_APP = 1,TARGET_KIND_APP_ACCESS = 2).event_feed.pb.go,event_feed_protoopaque.pb.goandevent_feed.pb.validate.gowithmake protogen.event_feed_validate_test.go:TestUsageEventTargetKindcovers the unset value, both defined values and an unknown value (99): validation passes and the value survives a marshal round-trip.Compatibility
buf breakingagainstmainpasses.TARGET_KIND_UNSPECIFIED, which meansTARGET_KIND_CHILD_APP.Testing
buf lintbuf breaking --against '.git#branch=origin/main'go build ./...go test ./pb/c1/connector/v2/...go vet ./pb/c1/connector/v2/Follow-ups (separate PRs)
TARGET_KIND_APP_ACCESSin baton-aws (SSO sign-ins), baton-github (usage-app/github), baton-dropbox (app/dropbox), baton-google-workspace (the Google sign-in feed) and baton-teleport.🤖 Generated with Claude Code