Skip to content

Fix: read the YAML layouts real dashboard configs use - #33

Merged
SandObserver merged 1 commit into
mainfrom
fix/yaml-real-world-layouts
Aug 11, 2026
Merged

SandObserver merged 1 commit into
mainfrom
fix/yaml-real-world-layouts

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Read a sequence written level with the key it belongs to as that key's value, which is how most YAML is written and what Dashy's own default config does with navLinks; a mapping at the same column stays the parent's next key. This also covers a Homepage group nested by two spaces rather than four.
  • Read block scalars, folded and literal, with chomping indicators and an explicit indentation digit. The body is consumed during the scan, so a list dash, a comment marker or a tab inside it is text and never structure.
  • Read [] and {} as an empty list and mapping. A flow collection with contents still refuses, since parsing that is where guessing would start.
  • Add a fixture in the flush layout and cover each construct, including that the two layouts of the same document parse to the same thing.

Testing
All green: 1092 backend, 618 frontend, 94.8% line coverage, lint, format, both typechecks, paths:check and cache-busting. Checked against js-yaml on fourteen real files, ten community and official Dashy configs plus a real four-file gethomepage setup: every file both parsers accept parses identically, and the one refusal left is an Ansible template that js-yaml rejects too. Before this, eight of eleven Dashy configs and the gethomepage services file were refused outright.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

Three constructs refused a whole file, and between them they blocked most
real configs, including the default one Dashy ships.

A sequence written level with the key it belongs to is now read as that
key's value. Only a sequence may do this; a mapping at the same column is
the next key of the same parent. This is the common way of writing YAML
and it also covers a Homepage group nested by two spaces.

A block scalar is folded or kept literally, with chomping. Its body is
consumed while scanning, so a list dash, a comment marker or a tab inside
it is text rather than structure. Long API keys and icon URLs are wrapped
this way.

An empty flow collection reads as an empty list or mapping. One with
contents still refuses, which is where parsing it would start to guess.

Checked against js-yaml on fourteen real files: every one that both accept
parses identically.
@SandObserver SandObserver added the bug Something isn't working label Aug 11, 2026
@SandObserver
SandObserver merged commit 32d6ddd into main Aug 11, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/yaml-real-world-layouts branch August 11, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant