fix(ui): quote YAML scalars containing embedded newlines - #7820
Conversation
yamlScalar decided a value needs quoting from value.trim() !== value plus a special-character regex. trim() only strips edge whitespace, and the regex omitted line breaks, so a value with an embedded newline and no other flagged character (e.g. "claude 3.7\nignore_findings true") was emitted as a raw multi-line scalar -- a stray top-level line that breaks the generated .loopover.yml, violating the file's "a partial form never produces invalid output" invariant. Same incomplete-guard bug class as the csv-export fix. Add \n and \r to the needsQuote regex so any line-break-containing value goes through the existing JSON.stringify quoting path. Adds embedded-newline and carriage-return regression cases to config-generator-yaml.test.ts. Closes JSONbored#7786
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-21 13:59:18 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #7786
yamlScalar(apps/loopover-ui/src/lib/config-generator-yaml.ts) decides a value needs quoting fromvalue.trim() !== valueplus a special-character regex:trim()only strips edge whitespace, and the regex omits line breaks — so a value with an embedded newline and none of the flagged characters (e.g."claude 3.7\nignore_findings true") is returned unquoted.formStateToYamlthen emits it as a raw multi-line scalar: a stray top-level line that breaks the generated.loopover.yml, violating the file's documented invariant that a fresh/partial form never produces invalid output. This is the same incomplete-guard bug class as the already-fixed CSV formula-injection gap incsv-export.ts.Fix: add
\nand\rto theneedsQuoteregex so any line-break-containing value goes through the existingJSON.stringifyquoting path. No call-site or signature change.Tests: adds embedded-newline and carriage-return cases to
config-generator-yaml.test.ts(which previously covered colon and edge-whitespace but not line breaks), including an assertion that the serialized output stays a single line. Verified locally: eslint + prettier clean,tsc --noEmitclean, 11/11 tests pass.Note: currently latent/defense-in-depth — the sole live call site binds
modelto a plain<input type=text>, which strips line breaks beforeonChange. It becomes reachable the moment any field reusingyamlScalaris widened to a<textarea>or populated programmatically. (apps/loopover-uiis outside thesrc/**99% patch gate; the test case is this issue's own deliverable.)