Skip to content

feat(devops): add instevent verb for reporting CD deployment failures#33

Merged
taleodor merged 1 commit into
mainfrom
2026-07-instevent-verb
Jul 25, 2026
Merged

feat(devops): add instevent verb for reporting CD deployment failures#33
taleodor merged 1 commit into
mainfrom
2026-07-instevent-verb

Conversation

@taleodor-claude

Copy link
Copy Markdown
Contributor

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 instevent reports deployment failures for an instance, surfaced in the ReARM Instance view instead of dying in the CD pod's stdout.

  • Batched (--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.
  • Uses the existing sendRequest plumbing and the same auth as instdata.

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), Authorization headers, 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\b missed camelCase keys entirelyadminPassword: "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.
  • Lowercasing before applying the timestamp pattern defeated it — timestamps survived normalization, breaking dedup exactly as described above.

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; full go 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

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>
@taleodor
taleodor merged commit 70b7499 into main Jul 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants