Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Preserve multiline values when exporting and refreshing CI environment files

Open LunaStev opened this issue 1 month ago • 0 comments

Current master follow-up (2026-11-12)

This update records the remaining behavior on the audited master. The historical report and earlier delivered work are retained below; current code paths are Rust rather than the retired Python helpers.

Problem

The shared Rust codec strips only the final LF from multiline payload extraction. For a Windows-style record it leaves the structural CR attached to the value.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

let records = b"A<<END\r\nx\r\nEND\r\n";
println!("{:?}", wave_tools::config::decode_env(records));

Executed result: A maps to "x\r", not "x". An LF record maps to x. Internal CRLF within a multiline value must remain data. The official Actions runner removes its structural newline length in its Windows file-command path; this was a shared-codec fixture, not native Windows execution.

Scope

Remove the entire format-specific structural closing newline while preserving data CR/newlines, empty lines and whitespace. The multiline-support decision is already approved.

Starting points: tools/src/config.rs:158.

Completion criteria

  • [ ] LF and CRLF framed records yield the intended value.
  • [ ] Keep embedded/trailing data newlines distinct from the record terminator.
  • [ ] Retain writer round trips, delimiter collision handling and transactional parse behavior.

This is a bounded newcomer task with the starting point and focused negative/positive checks above.

Original report (historical)

Problem

Exporting AUDIT with value one SECOND=two and refreshing the runner environment yields AUDIT=one plus an unintended SECOND=two. The writer and reader both assume one key=value line per value.

Starting point: tools/ci/common.py:214.

Validation

Audited canonical Wave 540728c2eb6cc12f5c69c3fb3fdb96e07ba059a4 (0.0.1-alpha-dev), whose tree matches the local checkout. Validation: Executed isolated Runner.setenv()/refresh_environment() round-trip. Executed compiler probes use the matching checkout-built compiler and std on Linux amd64 (Rust 1.89.0 / LLVM 21.1.8). Source/header or mocked checks are not native execution on another OS.

Scope

Agree whether the helper supports GitHub multiline environment records or explicitly rejects multiline values before changing state. Apply the chosen contract consistently to writing and refreshing.

Design discussion required

This issue records a proposal or an unresolved contract; it is not approval to choose new semantics. Please mention @LunaStev to discuss the design before starting implementation.

Completion criteria

  • [ ] Embedded newlines/CRLF/equals do not create unintended variable names or silently lose bytes.
  • [ ] Delimiter collisions and existing single-line values have focused coverage.
  • [ ] Rejected inputs leave both in-memory and file state consistent.

LunaStev avatar Oct 24 '26 11:10 LunaStev