key-cape/src/internal/server/telemetry/events.go
tegwick 7c9ed852ff
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 39s
Close the KEY-WP-0009 handoff gap and deliver the two blocked admissions
KEY-WP-0009-T04 is done. Re-ran verification on main with an explicit Go 1.23.0
toolchain and a writable build cache: contract validator PASS, build, vet and the
full test suite pass, git diff --check clean. gofmt had drifted on
internal/server/telemetry/events.go and tests/migration/scenario_c_test.go
(comment alignment only, no semantic change); both reformatted so the task's
formatting claim holds. The four handoffs to netkingdom, secrets-engine,
ops-warden and railiance-platform were then actually sent -- the 2026-09-05 audit
had shown the earlier claimed delivery had no receipts -- and each receipt id is
recorded in the workplan and readable back from the hub.

KEY-WP-0013-T02 and KEY-WP-0014-T04 stay in wait. Their remaining work is not
ours to do, so what was owed was the request, and it is now delivered: custody
admission for the two approval clients to railiance-platform, the exact human
client id and callback URI to approval-engine, and the OpenBao-token vs
issuer-JWT split plus Qonto rotation execution authority to ops-warden. Each
message quotes the existing non-secret packet or reviewed sequence and states
what is explicitly not being treated as authorization.

No secret was read, no production resource changed, no route retired.
SCOPE.md updated to match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uV8zoCKpA1WRAxsKRYbdH

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 1182213@bnt-lap001
Assistant-Session: 966597b9-ae61-46a4-8b9e-1594ab3ec4ad
2026-09-08 10:22:52 +02:00

35 lines
1.4 KiB
Go

// Package telemetry implements the KeyCape telemetry pipeline (spec §6).
// Every auth and error code path MUST call Emit — there are no silent paths.
package telemetry
import "time"
// EventType identifies the category of a telemetry event.
type EventType string
const (
EventAuthStart EventType = "auth_start"
EventAuthSuccess EventType = "auth_success"
EventAuthFailure EventType = "auth_failure"
EventTokenIssued EventType = "token_issued"
EventUnsupportedFeature EventType = "unsupported_feature"
EventInvalidRequest EventType = "invalid_request"
EventMigration EventType = "migration_event"
)
// Event carries all required telemetry fields from spec §6.2.
// Timestamp, Environment, TraceID, ClientID, Endpoint, Result, and EventType
// are mandatory for every event; other fields are conditional on context.
type Event struct {
Timestamp time.Time `json:"timestamp"`
ClientID string `json:"client_id"`
Endpoint string `json:"endpoint"`
Feature string `json:"feature,omitempty"`
Result string `json:"result"` // "success" | "failure"
ErrorType string `json:"error_type,omitempty"`
Scopes []string `json:"scopes,omitempty"`
GrantType string `json:"grant_type,omitempty"`
Environment string `json:"environment"`
TraceID string `json:"trace_id"`
EventType EventType `json:"event_type"`
}