Skip to content

Fix dumpconfig's non-safe YAML and add a --stdout option - #1285

Merged
mkarlesky merged 1 commit into
next_versionfrom
feature/dumpconfig-clean-yaml-stdout
Sep 13, 2026
Merged

mkarlesky merged 1 commit into
next_versionfrom
feature/dumpconfig-clean-yaml-stdout

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Summary

  • Fix: clean, safe YAML from dumpconfig. FilenameExtension (lib/ceedling/filename_extension.rb) had no custom YAML serialization hook, so a default (--app enabled) dumpconfig run emitted !ruby/object:FilenameExtension tags into :extension config entries — unreadable by any safe YAML loader, including Ceedling's own (permitted_classes: [Symbol] only). FilenameExtension#encode_with now dumps it as a plain YAML sequence of its own extensions, matching its internal data exactly. It's the only custom object type Ceedling puts into the config hash, so this is an isolated fix, not a broader pattern.

  • New: dumpconfig --stdout. Writes the resolved YAML directly to standard output instead of a file, for a consuming tool that wants Ceedling's configuration without a temp file. FILEPATH becomes optional; when --stdout is set, every positional argument is treated as a SECTIONS path element instead, and every console banner/notice dumpconfig would otherwise print is suppressed so the stream stays pure YAML.

Tests

  • spec/units/filename_extension_spec.rb — new in-memory case proving YAML.dump produces no !ruby/object tag and round-trips cleanly through YAML.safe_load.
  • New spec/system/dumpconfig_spec.rb — covers a real (--app default) file dump's clean :extension output, --stdout with and without a SECTIONS filter, and the FILEPATH-required error path when --stdout is omitted.

Docs

Updated docs/mkdocs/getting-started/command-line.md (flag table + FILEPATH/SECTIONS explanation). docs/mkdocs/reference/command-line.md's brief link-back summary for dumpconfig already covers this without changes.

Verification

Full unit + integration suites and the new/adjacent system specs (dumpconfig_spec.rb, mixin_ordering_spec.rb, ruby_replacement_spec.rb) green on host (macOS) and the madsciencelab-plugins Docker image (Linux).

🤖 Generated with Claude Code

FilenameExtension had no custom YAML serialization hook, so a default
(--app enabled) `dumpconfig` run emitted `!ruby/object:FilenameExtension`
tags into :extension config entries -- unreadable by any safe YAML loader,
including Ceedling's own (permitted_classes: [Symbol] only). Adds
FilenameExtension#encode_with so it dumps as a plain YAML sequence of its
own extensions instead, matching its internal data. FilenameExtension is
the only custom object type Ceedling puts into the config hash, so this
is an isolated fix.

Also adds `dumpconfig --stdout`: writes the resolved YAML directly to
standard output instead of a file, for a consuming tool that wants
Ceedling's configuration without a temp file. FILEPATH becomes optional;
when --stdout is set, every positional argument is treated as a SECTIONS
path element instead, and every console banner/notice dumpconfig would
otherwise print is suppressed so the stream stays pure YAML.

Docs updated in getting-started/command-line.md (the flag table and
FILEPATH/SECTIONS explanation); the reference page's brief link-back
summary already covers this without changes.

Tests: a new in-memory unit case for FilenameExtension's YAML dump/load
round-trip, and a new spec/system/dumpconfig_spec.rb covering the clean
file dump, --stdout with and without a SECTIONS filter, and the
FILEPATH-required error path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mkarlesky
mkarlesky merged commit af4975c into next_version Sep 13, 2026
20 checks passed
@mkarlesky
mkarlesky deleted the feature/dumpconfig-clean-yaml-stdout branch September 13, 2026 03:46
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.

1 participant