Guard config wiring and function-call parameters - #80
Merged
Merged
Conversation
Extends the static checks over the loaded scripts to two more classes of error that only surface at run time, in the config-to-GUI wiring that has little other coverage. Both pass on the current code; these keep it that way. - A named argument passed to a Winnow function must match one of its parameters, by unambiguous prefix as PowerShell allows, or a common parameter. A mismatch fails with "A parameter cannot be found that matches parameter name". Functions taking $args are skipped. - Every feature's category must be one the config defines, and every UiGroup must name a real category and map its options to features that exist and have a CLI parameter. A combobox option pointing at a missing feature applies nothing when selected. Both were confirmed to fail against a deliberately broken config and a call with a bogus parameter.
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.
Two more static checks over every script Winnow loads, in the config-to-GUI area that has little runtime coverage. Both pass on the current code - this is prevention, not a live fix, following the two guards that did catch bugs (#74 unloaded files, #78 keyword-as-command).
Test-SafetyGuards): a named argument to a Winnow function must match a declared parameter (by unambiguous prefix, as PowerShell allows) or a common parameter; functions taking$argsare skipped. A mismatch would fail at run time with "A parameter cannot be found that matches parameter name". Scan of the current tree: 0 mismatches across 308 functions.Test-FeaturesJson): every feature's category must be defined; every UiGroup must name a real category and map each combobox option to a feature that exists and has a CLI parameter. A dangling UiGroup FeatureId would make a GUI option silently apply nothing. Scan of the current config: 0 problems.Confirmed both catch breakage: a UiGroup FeatureId typo and a call with a bogus parameter each fail the relevant test.
Test-only, no product change; no release needed. Local: static validation clean (134 files),
Tests\Unit212 passed / 0 failed.