← Back to issue list

Properly represent multi-line yaml strings

View original Github issue

Metadata

Project
craft-application
Number
#255
Type
issue
State
open
Author
cmatsuoka
Labels
Created
Updated
Closed

Current evaluation

Multi-line YAML strings (description, scriptlets) not using the block-style representer when marshaled. Maintainer confirmed dump_yaml already handles it correctly; the _repr_str representer is present and wired into dump_yaml in current code.

Suggested action: close not a bug

Reason: Maintainer lengau demonstrated with a reproducer that util.dump_yaml already produces correct block-style output (|- and |) for multi-line strings, and the current code confirms _repr_str is defined and registered via yaml.add_representer in dump_yaml. The behavior is working as intended, so this is resolved rather than an open bug.

Impact: 40 Quick Win: 34.0 Staleness: 70 Complexity: 15 Confidence: 75 Support Request: 10

Issue body

### What needs to get done Add multi-line string representer to be used when marshaling yaml fields such as description and scriptlets. The representer is currently [defined in Snapcraft](https://github.com/canonical/snapcraft/blob/8a9a5c21229f68a5e0daa7c89d609d7d29006477/snapcraft/meta/snap_yaml.py#L487) but it's not being invoked since https://github.com/canonical/snapcraft/commit/e75d0e93bcbf019a8dbd17caf4842e23788ab53a. ### Why it needs to get done Multi-line fields formatting is not correct in generated yaml data if the representer is not used.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 34.0
Staleness: 70
Complexity: 15
Confidence: 75
Support Request: 10
close not a bug Multi-line YAML strings (description, scriptlets) not using the block-style representer when marshaled. Maintainer confirmed dump_yaml already handles it correctly; the _repr_str representer is present and wired into dump_yaml in current code.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 75
close not a bug Requests a multi-line YAML string representer for marshaling. A maintainer tested the current util.dump_yaml implementation and confirmed it already formats multi-line strings correctly, indicating the reported behavior is working as intended.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 35
Confidence: 65
Support Request: 10
needs triage Unlabelled feature request for a YAML multi-line string representer. Inactive for over a year; a maintainer recently noted the functionality appears to work, requiring verification.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 20
Confidence: 85
Support Request: 10
close not a bug Addresses multi-line YAML string formatting during marshaling. A maintainer flagged a missing representer, but a contributor showed util.dump_yaml already handles it correctly. Awaiting confirmation to proceed or close.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: craft-application@51346d9b (confidence 80%)

    Commit 'fix: correctly represent yaml dumped multiline strings' introduced the _repr_str representer now present in craft_application/util/yaml.py and wired into dump_yaml.

Related issues

No related issues found above the similarity threshold.