add_domain deduped with a raw substring test, so with sub.example.com
already mapped, adding example.com was a no-op that still reported
success and mail for the new domain never routed. remove_domain
filtered alias lines with a bare `@domain in line` test, which also
deleted example.com.br entries. Appends went through tee -a with no
trailing-newline guard, so a truncated map glued the new entry onto
the last line, corrupting both and making them unremovable.
- add_domain dedupes on the line's domain field
- remove_domain drops only lines whose address tokens are at exactly
that domain (com.br superstrings and sub.example.com both survive)
- map appends heal a missing trailing newline first
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>