Skip to content

fix: surface specific PowerDNS 422 detail in DNSRecordSet status#52

Open
ecv wants to merge 1 commit into
mainfrom
feat/surface-pdns-422-detail
Open

fix: surface specific PowerDNS 422 detail in DNSRecordSet status#52
ecv wants to merge 1 commit into
mainfrom
feat/surface-pdns-422-detail

Conversation

@ecv

@ecv ecv commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What

When PowerDNS rejects a PATCH with a 422 whose error field doesn't match one of the curated patterns, FriendlyMessage collapsed it into a generic "The DNS record was rejected as invalid. Check the record type and value." — dropping the specific pdns reason. The detail survived only in the operator pod logs (logger.Error(pdnsErr, "pdns apply failed")), so kubectl get dnsrecordset -o yaml showed nothing actionable.

This appends the specific pdns detail to the generic 422 fallback:

The DNS record was rejected as invalid: <pdns error detail>

Why

Surfaced while diagnosing #51 (fleet-wide prod 422s on PATCH /zones). The whole investigation stalled on "we can't see the rejection reason" — but the reason was being thrown away at the status layer, not unavailable. With this change, future pdns validation regressions are diagnosable from the CR status without pod-log access.

Scope

  • Only the generic 422 fallback changes. Curated actionable messages (Invalid character, Not in zone, Conflicts with pre-existing RRset, CNAME/ALIAS conflicts) are unchanged.
  • The empty-body 422 case still returns the generic message (nothing to append).
  • No behavior change for 404 / 5xx / non-pdns errors.

Test

internal/pdns/errors_test.go — the "unknown 422 body" case now asserts the detail is surfaced. go test ./internal/pdns/ -run TestFriendlyMessage passes. (The package's Docker/testcontainers integration test is unrelated and not run here.)

Refs #51

🤖 Generated with Claude Code

FriendlyMessage collapsed every unrecognized 422 into a generic
"rejected as invalid" message, dropping the pdns `error` field. The
real rejection reason then only existed in operator pod logs, leaving
`kubectl get dnsrecordset -o yaml` with nothing actionable (surfaced
while diagnosing dns-operator#51).

Append the specific pdns detail to the generic 422 fallback so the
reason reaches the CR status. Known actionable patterns and the
empty-body case are unchanged.

Refs: #51

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant