Skip to content

CSV formula guard is not undone when a CSV baseline is read back #479

Backlog

Description

@TMHSDigital

Summary

The CSV writer prefixes ' to record values that start with = + - @ \t \r (formula guard), but diff.Parse reads CSV baselines back as written. A TXT record starting with one of those characters is reported "changed" on every -diff-records run against a CSV baseline.

Where

  • internal/output/writer.go:377-381, :425 (csvSafe)
  • internal/diff/parse.go:119 (add(row[0], dns.Record{Type: row[1], Value: row[2]}))
  • internal/diff/diff.go:40 (TXT compared byte-exact)

Impact

With a CSV -diff baseline and -diff-records (or subenum diff -records, or the MCP diff tool on a CSV file), every such name is reported changed and the run exits 4. Monitoring with -format csv gets a permanent false change, and previous_records show the stray quote.

Steps to reproduce

  1. Zone with t TXT "=abc".
  2. subenum -format csv -type TXT -o base.csv ...
  3. subenum -diff base.csv -diff-records -type TXT ... on the unchanged zone reports t as changed.

Suggested fix

In Parse's CSV branch, strip one leading ' from row[2] when the next character is one of =+-@\t\r (exactly what csvSafe added). Add a write-then-Parse round-trip test.

Acceptance criteria

  • A CSV written by subenum and read back by diff.Parse gives the original values.
  • The repro above reports no change.

Getting started

  • Relevant files: internal/diff/parse.go, internal/output/writer.go
  • How to run tests: go test ./internal/diff ./internal/output

Filed by repo-audit/full-audit at a45b999. Severity: low. Effort: S. audit-key: bug|internal/diff/parse.go|csvBaseline

Activity

  1. added
    bug
    good first issue
    area: output
    severity: low
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: outputbuggood first issueseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions