CLOUDFLAREAPI: Fix comment and tag removal not taking effect#4045
Merged
tlimoncelli merged 1 commit intoStackExchange:mainfrom Feb 2, 2026
Merged
Conversation
When removing CF_COMMENT or CF_TAGS from a record, dnscontrol detected the change but the API call didn't actually clear the values. This caused preview/push to show the same correction on every run. Root cause: modifyRecord checked for metadata key existence (comments) or non-empty value (tags) before setting the API fields. When a record had no comment/tags in the desired config, the metadata key was absent entirely, so the API fields were omitted — which Cloudflare interprets as "keep the existing value." Fix: preprocessConfig now ensures the metadata key exists (set to "") on every record when management is enabled. modifyRecord's existing ok-check then correctly sends an empty string to clear comments, and the tags path now sends an empty slice to clear tags. Fixes StackExchange#4039
tlimoncelli
approved these changes
Feb 2, 2026
Contributor
|
Thanks for the fast fix! |
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.
Summary
preview/pushto show the same correction on every run without convergingpreprocessConfignow ensures metadata keys exist (set to"") on every desired record whenCF_MANAGE_COMMENTSorCF_MANAGE_TAGSis enabled, somodifyRecordcorrectly sends empty values to the APImodifyRecordtags path now sends an empty slice ([]string{}) to clear tags, matching the comment pattern which already sent&""to clear commentsFixes #4039
Test plan
preprocessConfigmetadata key initialization (4 tests)genComparableWithMgmtedge cases (6 subtests)commands,models,pkg)CF_COMMENTfrom a record clears the comment in CloudflareCF_TAGSfrom a record clears all tags in Cloudflarepreview/pushshows 0 corrections (convergence verified)