[stage2] fix: serialize multiline descriptions in legacy TOML renderer#2097
[stage2] fix: serialize multiline descriptions in legacy TOML renderer#2097RbBtSn0w wants to merge 2 commits intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the legacy TOML rendering used during preset/extension command registration so multiline description values produce valid TOML and round-trip correctly through tomllib.
Changes:
- Escape TOML
descriptionvalues using a basic-string renderer (no raw newlines in one-line TOML strings). - Add a regression test ensuring multiline descriptions parse and preserve semantics when loaded.
- Introduce a small helper for rendering TOML basic strings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/specify_cli/agents.py |
Updates legacy TOML command rendering to safely serialize multiline description values via escaped basic strings. |
tests/test_extensions.py |
Adds regression coverage to ensure multiline description values round-trip through tomllib. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fix the legacy TOML rendering path still used by preset and extension command registration.
This PR corrects the
CommandRegistrar.render_toml_command()behavior for multilinedescriptionvalues so the generated TOML remains parseable and preserves the description text when loaded back throughtomllib.What changed
descriptionvalues through safe basic-string escaping instead of embedding raw newlines in a one-line TOML stringtests/test_extensions.pyValidation
uv run --with pytest python -m pytest tests/test_extensions.py -q -k "multiline_description or embedded_triple_double_quotes or escapes_when_both_triple_quote_styles_exist"uv run --with pytest python -m pytest tests/test_extensions.py -qIssue
Part of #2095.