PR #555 (fixing #291) added ifNonempty:path,prefix,suffix support to cli/planner.py::resolve_expr and cli/renderer.py::_resolve_expr:
if expr.startswith("ifNonempty:"):
path, prefix, suffix = expr[len("ifNonempty:"):].split(",", 2)
...
A malformed expression missing the two required commas, e.g. ${ifNonempty:config.password}, raises an uncaught ValueError: not enough values to unpack from the .split(",", 2) call. This propagates out of resolve_expr/_resolve_expr and crashes cds validate/cds test/cds render instead of producing a clean diagnostic.
Every other expression-parsing path in planner.py/renderer.py fails soft (returns None, leaving the placeholder unresolved and later caught by the existing E071 unresolved-expression check).
Task
Validate the ifNonempty: argument count before unpacking, in both planner.py and renderer.py. Either:
- fail closed by returning
None/leaving the expression unresolved (so E071 catches it), or
- raise a proper
Diagnostic with a dedicated error code describing the malformed syntax.
Add a regression test covering a malformed ifNonempty: expression (wrong number of commas) for both resolvers.
Follow-up from PR #555 review.
PR #555 (fixing #291) added
ifNonempty:path,prefix,suffixsupport tocli/planner.py::resolve_exprandcli/renderer.py::_resolve_expr:A malformed expression missing the two required commas, e.g.
${ifNonempty:config.password}, raises an uncaughtValueError: not enough values to unpackfrom the.split(",", 2)call. This propagates out ofresolve_expr/_resolve_exprand crashescds validate/cds test/cds renderinstead of producing a clean diagnostic.Every other expression-parsing path in
planner.py/renderer.pyfails soft (returnsNone, leaving the placeholder unresolved and later caught by the existingE071unresolved-expression check).Task
Validate the
ifNonempty:argument count before unpacking, in bothplanner.pyandrenderer.py. Either:None/leaving the expression unresolved (soE071catches it), orDiagnosticwith a dedicated error code describing the malformed syntax.Add a regression test covering a malformed
ifNonempty:expression (wrong number of commas) for both resolvers.Follow-up from PR #555 review.