Add telemetry ingest, feedback collector, pressure API and insight CLI
Some checks failed
ci / build (push) Failing after 3h11m37s
Some checks failed
ci / build (push) Failing after 3h11m37s
Completes FLUID-WP-0005. Normalization and redaction live on one path, shared by the in-process emitter and the ingest endpoint: two paths with two normalizations would eventually disagree, and the disagreement would surface as a pressure finding that is really a pipeline bug. Telemetry kind is inferred from event shape rather than defaulting to "request", since an error filed as a request understates the interface's failure rate. A malformed event in a batch does not discard the rest. Feedback is stored as evidence and creates no pressure and no hypothesis on its own, per API Standards 15, with the consumer recorded as the actor so their untrusted status stays visible in the audit trail. The feedback endpoint is the only consumer-reachable part of the control plane. The observation endpoints are not served at all when no pseudonymization salt is configured, rather than served with a generated one: a salt that changed per run would make the same consumer look new every time and every cohort count wrong. Adds an end-to-end test driving real traffic through the gateway and confirming it becomes a classified pressure record, with no raw consumer identity reaching the store. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014KmVxhJ35tCo7rE7UnLwWu Assistant: claude-code Assistant-Model: opus Assistant-Process: 1116572@bnt-lap001 Assistant-Session: 8ba9bb93-a72a-4883-b189-2499cce5c400
This commit is contained in:
parent
6e705aa0af
commit
7e0de9e5b7
13 changed files with 1307 additions and 29 deletions
|
|
@ -30,6 +30,7 @@ import (
|
|||
"github.com/tegwick/fluid-core/internal/control"
|
||||
"github.com/tegwick/fluid-core/internal/evidence"
|
||||
"github.com/tegwick/fluid-core/internal/intent"
|
||||
"github.com/tegwick/fluid-core/internal/observation"
|
||||
"github.com/tegwick/fluid-core/internal/policy"
|
||||
"github.com/tegwick/fluid-core/internal/publish"
|
||||
"github.com/tegwick/fluid-core/internal/signing"
|
||||
|
|
@ -49,6 +50,8 @@ func run() error {
|
|||
keyID = flag.String("key-id", envOr("FLUID_SIGNING_KEY_ID", "dev"), "signing key identifier")
|
||||
keyFile = flag.String("key-file", os.Getenv("FLUID_SIGNING_KEY"), "base64 ed25519 private key file")
|
||||
ephemeral = flag.Bool("ephemeral-key", false, "generate a throwaway signing key (development only)")
|
||||
saltFile = flag.String("redaction-salt-file", os.Getenv("FLUID_REDACTION_SALT"),
|
||||
"file holding the pseudonymization salt; required for the observation plane")
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
|
|
@ -83,9 +86,33 @@ func run() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// The observation plane is optional. Without a salt there is no safe way to
|
||||
// pseudonymize consumer identities, so the endpoints that would record them
|
||||
// are simply not served rather than served unsafely.
|
||||
var pressureAPI *control.PressureAPI
|
||||
if *saltFile != "" {
|
||||
salt, err := os.ReadFile(*saltFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read redaction salt: %w", err)
|
||||
}
|
||||
policy := observation.DefaultRedactionPolicy([]byte(trimSpace(string(salt))))
|
||||
ingest, err := observation.NewIngest(ev, contract.InterfaceID(*iface), policy)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pressureAPI = control.NewPressureAPI(
|
||||
observation.NewPressureRegistry(ev, contract.InterfaceID(*iface)), ingest)
|
||||
} else {
|
||||
log.Print("no redaction salt configured: telemetry, feedback and pressure endpoints are disabled")
|
||||
}
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: *addr,
|
||||
Handler: control.NewServer(control.NewRevisionAPI(ev, pipeline), control.NewIntentAPI(intents, gate)).Routes(),
|
||||
Addr: *addr,
|
||||
Handler: control.NewServer(
|
||||
control.NewRevisionAPI(ev, pipeline),
|
||||
control.NewIntentAPI(intents, gate),
|
||||
pressureAPI,
|
||||
).Routes(),
|
||||
ReadHeaderTimeout: 10 * time.Second,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue