feat(devops): add instevent verb for reporting CD deployment failures#33
Merged
Conversation
Companion to rearm-saas#337. ReARM CD currently logs deploy failures to its pod stdout and nowhere else; this is the transport that puts them in front of an operator in the ReARM Instance view. Batched by design (one call per reconcile, not per failure) via --events/--eventsfile, with single-event flags for ad-hoc use. Both paths go through the same sanitizer so the batch form cannot bypass it. Two safety properties carry the weight: - Redaction before transmit. Captured helm stderr can echo rendered values, and this runs inside a customer cluster while the backend may be hosted, so raw stderr must never leave. Assignments to credential-named keys, Authorization headers, PEM private-key blocks, JWTs, and URL-embedded credentials are replaced, then the payload is truncated with a visible marker. Deliberately aggressive: a lost diagnostic line is cheaper than a leaked credential. - Stable fingerprints. The server dedupes on (namespace, deploymentName, fingerprint), so a fingerprint that drifts between reconciles would insert a row every 15s instead of bumping a counter. Volatile tokens (uuids, digests, timestamps, bare numbers) are normalized out before hashing. Tests caught two real bugs in the first cut, both now pinned: - an anchored \bpassword\b missed camelCase keys entirely, so 'adminPassword: secret' shipped in the clear - the dominant convention in helm values, i.e. the exact leak this feature would have opened; - lowercasing the message before applying the timestamp pattern defeated it, so timestamps survived normalization and broke dedup. Coverage also pins that ordinary Kubernetes RBAC diagnostics (which contain 'rbac.authorization.k8s.io') survive redaction unmangled. Incidental: README's devops table of contents was missing entries 9-11; added alongside the new 12 so the list is coherent. ReARM-Agentic-Session: cli-instevent-1784937359 ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b Co-Authored-By: Claude Fable 5 <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.
Transport half of CD-failure visibility. Companion to relizaio/rearm-saas#337 (backend ingest). This must be released before rearm-cd can consume it — that's why the agent side is deliberately not in flight yet.
What it does
rearm devops insteventreports deployment failures for an instance, surfaced in the ReARM Instance view instead of dying in the CD pod's stdout.--events/--eventsfile) — one call per reconcile, not per failure — plus single-event flags for ad-hoc use. Both paths run through the same sanitizer, so the batch form cannot bypass it.sendRequestplumbing and the same auth asinstdata.The two properties that carry the weight
1. Redaction before transmit. Captured helm stderr routinely echoes rendered values, and this runs inside a customer cluster while the backend may be hosted — raw stderr must never leave. Credential-named assignments (incl. camelCase),
Authorizationheaders, PEM private-key blocks, JWTs and URL-embedded credentials are replaced; payload then truncated with a visible marker. Aggressive on purpose: a lost diagnostic line is cheaper than a leaked credential.2. Stable fingerprints. The server dedupes on
(namespace, deploymentName, fingerprint). A fingerprint that drifts between reconciles would insert a row every 15s instead of bumping a counter, so volatile tokens (uuids, digests, timestamps, bare numbers) are normalized out before hashing.Tests found two real bugs in the first cut
Both now pinned by regression tests:
\bpassword\bmissed camelCase keys entirely —adminPassword: "s3cr3t"shipped in the clear. camelCase is the dominant convention in helm values, so this was precisely the leak path the feature would have opened.Coverage also pins the inverse: ordinary Kubernetes diagnostics containing
rbac.authorization.k8s.io(i.e. the traefik RBAC error that motivated this work) survive redaction unmangled, so the feature stays useful.Validation
go build ./...,go vet ./...clean; 20 new tests green; fullgo test ./...green.Docs: new
docs/devops.md§15.12 covering flags, dedup semantics, redaction guarantees, and the inferred-resolution contract (report a live failure every reconcile; silence means fixed). Incidentally filled README TOC entries 9–11, which were already missing.🤖 Generated with Claude Code