Fix dumpconfig's non-safe YAML and add a --stdout option - #1285
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix: clean, safe YAML from
dumpconfig.FilenameExtension(lib/ceedling/filename_extension.rb) had no custom YAML serialization hook, so a default (--appenabled)dumpconfigrun emitted!ruby/object:FilenameExtensiontags into:extensionconfig entries — unreadable by any safe YAML loader, including Ceedling's own (permitted_classes: [Symbol]only).FilenameExtension#encode_withnow 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.FILEPATHbecomes optional; when--stdoutis set, every positional argument is treated as aSECTIONSpath element instead, and every console banner/noticedumpconfigwould otherwise print is suppressed so the stream stays pure YAML.Tests
spec/units/filename_extension_spec.rb— new in-memory case provingYAML.dumpproduces no!ruby/objecttag and round-trips cleanly throughYAML.safe_load.spec/system/dumpconfig_spec.rb— covers a real (--appdefault) file dump's clean:extensionoutput,--stdoutwith and without aSECTIONSfilter, and theFILEPATH-required error path when--stdoutis omitted.Docs
Updated
docs/mkdocs/getting-started/command-line.md(flag table +FILEPATH/SECTIONSexplanation).docs/mkdocs/reference/command-line.md's brief link-back summary fordumpconfigalready 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 themadsciencelab-pluginsDocker image (Linux).🤖 Generated with Claude Code