refactor(rules): change default rule from baseline to fallback behavior

The default rule should runs only when no non-default pre rule matches, instead of running first as a baseline.
This follows the old behavior as before the pr is established.:

- Default rules act as fallback handlers that execute only when no matching non-default rule exists in the pre phase
- IfElseBlockCommand now returns early when a condition matches with a nil Do block, instead of falling through to else blocks
- Add nil check for auth handler to allow requests when no auth is configured
- Fix unterminated environment variable parsing to preserve input

Updates tests to verify the new fallback behavior where special rules suppress default rule execution.
This commit is contained in:
yusing
2026-02-24 00:11:03 +08:00
parent 9bb5c54e7c
commit 1a17f3943a
9 changed files with 124 additions and 32 deletions

View File

@@ -77,6 +77,9 @@ func expandEnvVarsRaw(v string) (string, gperr.Error) {
var err gperr.Error
if inEnvVar {
// Write back the unterminated ${...} so the output matches the input.
buf.WriteString("${")
buf.WriteString(envVar.String())
err = ErrUnterminatedEnvVar
}
if len(missingEnvVars) > 0 {