Skip to content

Fix YAML sequence indentation in manifest and mock data files#286

Open
nicomiguelino wants to merge 7 commits intomasterfrom
fix/yaml-sequence-indentation
Open

Fix YAML sequence indentation in manifest and mock data files#286
nicomiguelino wants to merge 7 commits intomasterfrom
fix/yaml-sequence-indentation

Conversation

@nicomiguelino
Copy link
Copy Markdown
Contributor

@nicomiguelino nicomiguelino commented May 7, 2026

Summary

  • serde_yaml emits block sequences flush with the parent key (e.g. - item at the same indent level as key:), which does not conform to standard YAML style.
  • Adds pretty_yaml as a dependency and introduces a shared format_yaml helper in serde_utils.rs that post-processes serde_yaml::to_string output with Quotes::PreferSingle and indent_block_sequence_in_map: true (the pretty_yaml default).
  • Applied at all three YAML write sites: EdgeAppManifest::save_to_file, InstanceManifest::save_to_file, and EdgeAppCommand::generate_mock_data.
  • Updates four test assertions in manifest.rs to reflect the corrected indentation.

Before:

---
syntax: manifest_v1
id: test_app
categories:
- Utilities
- Dashboards
entrypoint:
  type: file

After:

---
syntax: manifest_v1
id: test_app
categories:
  - Utilities
  - Dashboards
entrypoint:
  type: file

Test plan

  • cargo test — 185 tests pass; one pre-existing failure (test_read_token_correct_token_is_returned) is unrelated to this change and fails on master as well.
  • Verified structured help_text (nested mappings with sequences) round-trips correctly through the formatter.
  • Manually tested screenly edge-app create and confirmed the generated screenly.yml has properly indented sequence items.
  • cargo audit — all findings are pre-existing; pretty_yaml introduces no new vulnerabilities.

Copy link
Copy Markdown

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

This PR aims to ensure YAML written by the CLI follows a more conventional indentation style for sequences (e.g., list items indented under their parent key) by formatting serde_yaml::to_string output before writing manifests and mock data.

Changes:

  • Added a shared YAML formatter helper (format_yaml) and applied it to all YAML write paths for edge-app manifests and mock data generation.
  • Updated manifest serialization tests to match the new sequence indentation.
  • Introduced the pretty_yaml dependency (and corresponding lockfile updates) to perform the formatting.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/commands/serde_utils.rs Adds format_yaml helper based on pretty_yaml for post-processing YAML text.
src/commands/edge_app/server.rs Formats generated mock-data.yml output before writing to disk.
src/commands/edge_app/manifest.rs Formats serialized screenly.yml and updates YAML string assertions for indented sequences.
src/commands/edge_app/instance_manifest.rs Formats serialized instance.yml before writing to disk.
Cargo.toml Adds pretty_yaml dependency.
Cargo.lock Locks transitive dependencies introduced by pretty_yaml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/serde_utils.rs
Comment thread src/commands/serde_utils.rs
Comment thread src/commands/edge_app/server.rs
Copy link
Copy Markdown
Member

@salmanfarisvp salmanfarisvp left a comment

Choose a reason for hiding this comment

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

@nicomiguelino
Copy link
Copy Markdown
Contributor Author

@salmanfarisvp, please see #287 for the fix on Nix builds.

Comment thread src/commands/edge_app/server.rs Outdated
Copy link
Copy Markdown

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 5 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/commands/edge_app/server.rs Outdated
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.

4 participants