Skip to content

fix: preserve Unicode whitespace in variable edit documents - #1310

Draft
Kayvan-Zahiri wants to merge 1 commit into
railwayapp:masterfrom
Kayvan-Zahiri:codex/preserve-variable-editor-whitespace
Draft

Kayvan-Zahiri wants to merge 1 commit into
railwayapp:masterfrom
Kayvan-Zahiri:codex/preserve-variable-editor-whitespace

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

railway variable edit quotes ASCII spaces/tabs but leaves other whitespace unquoted. The reader uses Rust's Unicode-aware trim, so saving an unchanged document drops leading/trailing non-breaking, em, thin, narrow non-breaking and ideographic spaces, NEL, vertical tab and form feed. Whitespace-only values become empty. This produces unwanted pending variable updates; the CLI still requires confirmation before applying them.

Quote any value containing char::is_whitespace, matching the reader. Existing special-character escaping remains intact. Add a regression that writes and reads an edit document and checks the resulting variable diff across 32 cases: eight whitespace characters in leading, trailing, whitespace-only and embedded positions. Before, 24 boundary cases lose data; eight embedded controls are preserved. After, all round-trip and unchanged-diff assertions pass. All 16 variable-editor tests pass.

Validation on Rust/Cargo 1.98.0 with unchanged Cargo.lock:

  • cargo test --locked: 1,890 passed, six ignored, across unit and CLI integration suites.
  • cargo fmt --check, git diff --check and built CLI --version (5.71.0) pass.
  • Required cargo lint-fix completes. Its unrelated rewrites were excluded from this change; final cargo clippy --locked --all-targets --all-features completes with existing warnings outside the changed lines. The only warning in this file concerns the unchanged render_variable_plan_plain at line 197.

The regression uses local temporary files and synthetic values. Broader integration tests use local fixtures; no Railway project variables or live credentials were used. No release build or hosted account behavior is claimed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant