Skip to content

BUGFIX: preview should display long TXT records as one string#4190

Merged
TomOnTime merged 1 commit intoDNSControl:mainfrom
raman1236:fix/txt-record-display-no-chunking
May 10, 2026
Merged

BUGFIX: preview should display long TXT records as one string#4190
TomOnTime merged 1 commit intoDNSControl:mainfrom
raman1236:fix/txt-record-display-no-chunking

Conversation

@raman1236
Copy link
Copy Markdown
Contributor

Description

Fixes the confusing display of long TXT records in the preview/diff output. Previously, TXT records longer than 255 octets were shown as chunked segments:

"v=DKIM1; k=rsa; p=MIIB...long..." "remaining..."

Now they are displayed as a single string per Opinion #8:

"v=DKIM1; k=rsa; p=MIIB...long...remaining..."

Root Cause

ToComparableNoTTL() (used by the diff engine for both comparison and display) called txtutil.EncodeQuoted(), which splits TXT values into 255-octet chunks before quoting.

Fix

  • Added txtutil.EncodeSingle() that quotes the TXT value as a single string without chunking
  • Changed ToComparableNoTTL() to use EncodeSingle() instead of EncodeQuoted()
  • Zone file output (prettyzone) continues to use EncodeQuoted() with chunking, as that format is required for DNS wire compatibility

Tests

All existing txtutil, diff2, and models tests pass.

Fixes #2834

The preview/diff output previously showed long TXT records as
255-octet chunks (e.g., "255chars" "255chars" "rest"), which
is confusing to users and violates Opinion DNSControl#8 (TXT records are
one long string).

Add EncodeSingle() to txtutil that quotes the TXT value without
splitting into 255-octet chunks, and use it in ToComparableNoTTL()
so that the diff preview shows TXT records as a single string.

The zone file output (prettyzone) continues to use EncodeQuoted()
with chunking, as that format is required for zone file syntax.

Fixes DNSControl#2834
@raman1236
Copy link
Copy Markdown
Contributor Author

Friendly ping — this PR fixes the preview display for long TXT records to show them as a single string rather than split into 255-byte chunks. Would appreciate a review. Thanks!

@KaiSchwarz-cnic
Copy link
Copy Markdown
Contributor

Hey Raman!

We had a public holiday on Friday and today I am on sick leave. Hopefully back tomorrow.

Kai

@TomOnTime
Copy link
Copy Markdown
Collaborator

Hello! Thank you for your patience while we moved DNSControl to our new GitHub org.

Thank you for the PR. The output is definitely more readable this way. Great idea!

@TomOnTime TomOnTime changed the title fix: display long TXT records as one string in preview BUGFIX: preview should display long TXT records as one string May 10, 2026
@TomOnTime TomOnTime merged commit 0682d08 into DNSControl:main May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Display of long TXT record changes is confusing

4 participants