refactor(hm-dsl-engine): Replace stringly-typed run() mode ("list"/"render") with an internal enum#113
Merged
markovejnovic merged 2 commits intoJun 10, 2026
Conversation
…ender") with an internal enum
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.
The smell
SubprocessTsEngine::runtook the operation as a rawmode: &str, and the twocall sites passed the string literals
"list"and"render". The same magicstrings were also branched on inside the embedded JS runner. The variant set was
implicit, and a typo like
"lst"would compile fine and only fail at runtime inthe spawned JS process.
The change
Introduced a small private
enum RunMode { List, Render }with anas_arg(self) -> &'static strconversion.runnow takesRunModeinstead of&str;list_pipelinespassesRunMode::Listandrender_pipeline_jsonpasses
RunMode::Render. The wire string now appears in exactly one place — theenum's
as_argmatch.This is fully crate-internal (a private method on a private enum), so the blast
radius is zero and the change is behavior-preserving: the exact same
"list"/"render"argument is still passed to the JS runner.Type-safety pattern
Follows the
fd"ValueEnum / strategy-enum over stringly-typed flag" pattern: aclosed set of operations modeled as an enum makes the dispatch exhaustive and
typo-proof at compile time, while keeping a single source of truth for the wire
string.
Validation
Only
cargo check -p hm-dsl-enginewas run locally (passes). Full CI runs onthis PR.