=== BEGIN ARTIFACT FEATURE-Type-and-Numeric-Primitives.md ===
# FEATURE: Type and Numeric Primitives
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq type, length, numeric conversion, predicates, and mathematical primitive filters. |
| Depends On | FEATURE-Value-Model.md, FEATURE-Truthiness-and-Comparison.md |
| Provides | type, length, utf8bytelength, numeric predicates, conversions, and math filters |
| Consumes | jq JSON value model, comparison semantics |
## Questions
- None.
## Intent
Implement `type`, `length`, `utf8bytelength`, `tonumber`, `toboolean`, `tostring`, numeric predicates, and the required standard-library math functions with jq-compatible errors and numeric behavior.
## Programmatic Acceptance
=== AC value-004-conformance ===
Intent: The implementation passes the executed corpus slice covering type and numeric primitives.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"length|type|sqrt|floor|tonumber"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0 and summary["error"] == 0
assert result.returncode == 0
=== END AC value-004-conformance ===
=== AC value-004-numeric-contract ===
Intent: The scoped report contains executed cases and no harness-level failure.
import json
import os
import subprocess
import sys
selector = r"length|type|sqrt|floor|tonumber"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
summary = report["summary"]
assert summary["pass"] + summary["fail"] + summary["error"] + summary["skip"] > 0
assert result.returncode == 0
=== END AC value-004-numeric-contract ===
## User Acceptance
- None.
## Guardrails
- Use only Python standard-library facilities.
- Preserve jq's distinction between numeric values and booleans.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Arithmetic-and-Structural-Operators.md ===
# FEATURE: Arithmetic and Structural Operators
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq arithmetic, string, array, and recursive object operators. |
| Depends On | FEATURE-Type-and-Numeric-Primitives.md, FEATURE-Composition.md |
| Provides | jq +, -, *, /, %, unary negation, recursive merge, repetition, and splitting |
| Consumes | jq value model, numeric primitives, comparison semantics |
## Questions
- None.
## Intent
Implement arithmetic and structural operator behavior across numbers, strings, arrays, objects, and null, including division and modulo errors and recursive object merging.
## Programmatic Acceptance
=== AC flow-001-conformance ===
Intent: The implementation passes the executed corpus slice covering arithmetic and structural operators.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"\+|\-|\*|/|%"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0 and summary["error"] == 0
assert result.returncode == 0
=== END AC flow-001-conformance ===
=== AC flow-001-errors ===
Intent: The executed operator slice includes runtime-error cases while remaining fully conformant.
import json
import os
import subprocess
import sys
selector = r"\+|\-|\*|/|%"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
summary = report["summary"]
assert summary["pass"] > 0
assert summary["fail"] == 0
assert summary["error"] == 0
=== END AC flow-001-errors ===
## User Acceptance
- None.
## Guardrails
- Do not coerce incompatible jq value types implicitly.
- Preserve partial output before runtime failure.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Boolean-and-Alternative-Operators.md ===
# FEATURE: Boolean and Alternative Operators
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq boolean, negation, defined-or, and defined-or assignment semantics. |
| Depends On | FEATURE-Truthiness-and-Comparison.md, FEATURE-Errors-and-Optional.md |
| Provides | and, or, not, //, and //= |
| Consumes | jq truthiness, comparisons, generators, and assignment primitives |
## Questions
- None.
## Intent
Implement boolean operators and defined-or behavior with jq truthiness, generator multiplicity, fallback evaluation, short-circuiting, and assignment semantics.
## Programmatic Acceptance
=== AC flow-002-conformance ===
Intent: The implementation passes the executed corpus slice covering boolean and alternative operators.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"and|or|not|//"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0 and summary["error"] == 0
assert result.returncode == 0
=== END AC flow-002-conformance ===
=== AC flow-002-short-circuit ===
Intent: The executed operator slice passes cases exercising fallback and short-circuit behavior.
import json
import os
import subprocess
import sys
selector = r"and|or|not|//"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
summary = report["summary"]
assert summary["pass"] > 0
assert summary["fail"] == 0 and summary["error"] == 0
=== END AC flow-002-short-circuit ===
## User Acceptance
- None.
## Guardrails
- Only `false` and `null` are falsey.
- Preserve generator ordering and defined-or fallback semantics.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Conditionals-and-Exception-Flow.md ===
# FEATURE: Conditionals and Exception Flow
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide jq conditional branches, try/catch handling, and optional evaluation. |
| Depends On | FEATURE-Errors-and-Optional.md, FEATURE-Boolean-and-Alternative-Operators.md |
| Provides | if, elif, else, try, catch, and optional control flow |
| Consumes | empty, error, try, catch, optional, and boolean semantics |
## Questions
- None.
## Intent
Implement conditional branch streams, omitted else behavior, nested `try`/`catch`, runtime error propagation, and the optional `?` operator.
## Programmatic Acceptance
=== AC flow-003-conformance ===
Intent: The implementation passes the executed corpus slice covering conditionals and exception flow.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"if |try |\?"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0 and summary["error"] == 0
assert result.returncode == 0
=== END AC flow-003-conformance ===
=== AC flow-003-runtime-flow ===
Intent: The executed slice passes cases that exercise both successful branches and caught errors.
import json
import os
import subprocess
import sys
selector = r"if |try |\?"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
summary = report["summary"]
assert summary["pass"] > 0
assert summary["fail"] == 0
assert summary["error"] == 0
=== END AC flow-003-runtime-flow ===
## User Acceptance
- None.
## Guardrails
- Preserve outputs produced before an uncaught runtime error.
- Optional evaluation suppresses only the relevant runtime error.
=== END ARTIFACT ===
=== BEGIN ARTIFACT FEATURE-Labels-and-Breaks.md ===
# FEATURE: Labels and Breaks
| Field | Value |
|-------------|-------|
| Version | 20260822 V1 |
| Description | Provide lexically scoped jq labels and break control. |
| Depends On | FEATURE-Conditionals-and-Exception-Flow.md |
| Provides | label and break control |
| Consumes | conditional evaluation, generators, and runtime error flow |
## Questions
- None.
## Intent
Implement lexical `label` scopes and `break` behavior so the matching generator terminates without leaking outputs, while unbound breaks fail compilation.
## Programmatic Acceptance
=== AC flow-004-conformance ===
Intent: The implementation passes the executed corpus slice covering labels and breaks.
Suite: scoped
Requires: executable=python3; scope=test
import json
import os
import subprocess
import sys
selector = r"label|break"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
summary = report["summary"]
assert sum(summary.values()) > 0
assert summary["fail"] == 0 and summary["error"] == 0
assert result.returncode == 0
=== END AC flow-004-conformance ===
=== AC flow-004-scope ===
Intent: The executed slice passes both scoped-break behavior and invalid-break compilation cases.
import json
import os
import subprocess
import sys
selector = r"label|break"
result = subprocess.run(
[sys.executable, "sources/run_conformance.py", "--select", selector, "--json"],
capture_output=True,
text=True,
env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
report = json.loads(result.stdout)
summary = report["summary"]
assert summary["pass"] > 0
assert summary["fail"] == 0
assert summary["error"] == 0
=== END AC flow-004-scope ===
## User Acceptance
- None.
## Guardrails
- Breaks must target only lexically visible labels.
- Unbound breaks must remain compile failures with exit code 3.
=== END ARTIFACT ===Run artifact