github tis24dev/proxsave v0.13.2

7 hours ago

ProxSave v0.13.2

🧾 Config upgrade fidelity, comment/case preservation, and actionable upgrade warnings

This fix release hardens the backup.env parsing and upgrade pipeline to be much more faithful to real-world configs. It improves handling of comments (inline and block), key casing, legacy export prefixes (with arbitrary whitespace), and multiline values, while adding non-fatal warnings that surface potential issues during plan/upgrade runs. The result is safer upgrades with fewer surprises and clearer operator feedback.

  • More faithful env rewriting (SetEnvValue):
    • Skips commented lines and preserves indentation and inline comments when replacing values.
    • Detects and preserves an optional leading export token, normalizing whitespace (e.g. export FOO=...) instead of dropping it.
  • Stronger parsing for real-world env files:
    • parseEnvFile/parseEnvValues now ignores comment-only lines inside multiline block values, and stores comment text alongside parsed values.
    • splitKeyValueRaw handles legacy export prefixes, extracts quoted/unquoted values more robustly, and returns parsed inline comments.
    • Normalizes env keys to uppercase for consistent lookups while remaining compatible with legacy/lowercase configs (including multiline and multi-value keys).
  • Upgrade logic correctness and no-op detection:
    • computeConfigUpgrade uses case-insensitive lookups, tracks processed user keys, preserves original user casing for extra keys, and counts preserved values correctly.
    • Detects no-op upgrades by comparing rendered content to the original file content.
    • Ensures case-insensitive handling of block-value keys in the upgrade logic.
  • Non-fatal upgrade warnings (surfaced in CLI):
    • Added Warnings []string to the upgrade result and propagated warnings end-to-end so they print during plan/upgrade operations.
    • Warns about duplicate template keys that differ only by case, case-collisions between user keys and template keys, and ignored non-KEY=VALUE lines (multiline behavior preserved).
  • New shared parsing utilities + unified behavior:
    • Introduced string helpers (FindInlineCommentIndex, FindClosingQuoteIndex, SetEnvValue) to centralize handling of inline comments, escaped #, and quoted values.
    • Replaced local setEnvValue implementations to use the unified utility function across the codebase.
  • Legacy export whitespace edge cases fixed:
    • Export detection now uses a Fields-based parse so export\t\tKEY=... works correctly and keys like exporter=... are not misidentified.
    • Added coverage for tabbed whitespace and multiple spacing variants.
  • Preservation tests and regression coverage:
    • Added tests verifying inline comments are preserved through upgrades (including quoted # cases).
    • Added tests verifying block-style comment lines inside multiline variables are preserved.
    • Added tests for lowercase-key normalization across multiline and multi-value accumulation.
  • Minor housekeeping:
    • Updated internal/orchestrator/.backup.lock (pid/time) as part of the changeset.

Overall: config upgrades are now safer and more predictable—comments and formatting are preserved, casing and legacy export syntax are handled correctly, and potential pitfalls are reported as clear, non-fatal warnings.

Changelog

Don't miss a new proxsave release

NewReleases is sending notifications on new releases.