Run artifact

workspace/targets/jq/blueprint/FEATURE-Control.md

FEATURE: Conditional and Error Control

FieldValue
Version20261028 V1
DescriptionEvaluate jq conditionals, alternatives, and error handlers.
Depends OnFEATURE-Operators.md
Providesjq conditional and error control
Consumesjq operators

Behavior

For each condition output, evaluate the corresponding branch against the condition's input; only false and null select the false branch. An omitted else branch is identity. Support elif and conditions that yield zero or multiple values.

The alternative operator emits all non-false, non-null outputs of its left side, or evaluates its right side when none exist. Try and catch handle errors raised within their expression boundaries, passing the error value to the handler. The optional suffix suppresses errors as an empty handler. Preserve outputs already emitted before an error and do not catch errors raised outside the handler's scope.

Programmatic Acceptance

=== AC control-corpus ===
Intent: Conditional and alternative expressions execute the selected corpus cases with jq truth and stream semantics.
Suite: scoped
Requires: executable=python3; scope=test
Probe: --list
Probe Count: summary

import json import os import subprocess import sys

SELECT = r"^\[if (1,null,2|empty|1|null) then|^\[if (true|false) then|^if false then 3" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", SELECT, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": os.path.abspath("jq")}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) tally = report["summary"] print(f"{tally['pass']} passed, {tally['fail']} failed, {tally['error']} errored") assert sum(tally.values()) > 0 assert tally["fail"] == 0 and tally["error"] == 0, tally assert result.returncode == 0, result.returncode === END AC control-corpus ===

User Acceptance

Guardrails