Skip to content

[stage2] fix: serialize multiline descriptions in legacy TOML renderer#2097

Open
RbBtSn0w wants to merge 2 commits intogithub:mainfrom
RbBtSn0w:fix-legacy-toml-rendering
Open

[stage2] fix: serialize multiline descriptions in legacy TOML renderer#2097
RbBtSn0w wants to merge 2 commits intogithub:mainfrom
RbBtSn0w:fix-legacy-toml-rendering

Conversation

@RbBtSn0w
Copy link
Copy Markdown
Contributor

@RbBtSn0w RbBtSn0w commented Apr 5, 2026

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 multiline description values so the generated TOML remains parseable and preserves the description text when loaded back through tomllib.

What changed

  • render TOML description values through safe basic-string escaping instead of embedding raw newlines in a one-line TOML string
  • add regression coverage for multiline description round-tripping in tests/test_extensions.py
  • leave prompt fallback behavior unchanged

Validation

  • 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 -q

Issue

Part of #2095.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 description values 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.

@RbBtSn0w RbBtSn0w changed the title fix: serialize multiline descriptions in legacy TOML renderer [stage1] fix: serialize multiline descriptions in legacy TOML renderer Apr 5, 2026
@RbBtSn0w RbBtSn0w marked this pull request as ready for review April 5, 2026 01:36
@RbBtSn0w RbBtSn0w requested a review from mnriem as a code owner April 5, 2026 01:36
@RbBtSn0w RbBtSn0w changed the title [stage1] fix: serialize multiline descriptions in legacy TOML renderer [stage2] fix: serialize multiline descriptions in legacy TOML renderer Apr 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RbBtSn0w
Copy link
Copy Markdown
Contributor Author

RbBtSn0w commented Apr 5, 2026

#2096

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants