FEATURE: Traversal and Streaming
| Field | Value |
|---|---|
| Version | 20261028 V1 |
| Description | Traverse jq values recursively and convert them to and from stream events. |
| Depends On | FEATURE-Dates.md, FEATURE-Assignment.md |
| Provides | jq traversal and streaming builtins |
| Consumes | jq date builtins, jq path mutation |
Purpose
Provide recursive traversal and stream conversion filters using the generator and path contracts.
Behavior
recurseemits the input and recursively emits successive results in jq order, applying the optional condition to descendants. Preserve lazy backtracking.walkprocesses children before their containing array or object and then applies its filter, preserving jq's handling of empty and multiple results.tostreamemits path and leaf events and closing events in the order described by the manual.fromstreamreconstructs values from events, andtruncate_streamremoves the requested leading path elements.- Handle empty structures and the corpus's deep-value boundaries without losing output or changing errors.
Programmatic Acceptance
=== AC traversal-corpus ===
Intent: Recursive walking and stream conversion execute their corpus cases with their required ordering.
Suite: scoped
Requires: executable=python3; scope=test
Probe: --list
Probe Count: summary
import json import os import subprocess import sys
SELECT = r"\b(?:walk|tostream|fromstream|truncate_stream|recurse)\b" 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"] assert sum(tally.values()) > 0, f"selector matched no case: {SELECT}" assert tally["fail"] == 0 and tally["error"] == 0, tally assert result.returncode == 0, result.returncode === END AC traversal-corpus ===
User Acceptance
- None.
Guardrails
- Preserve immutable value semantics and ordered generator behavior.
- Do not alter staged source assets or use external jq implementations.