Skip to content

Align CLI behavior with go-jsonnet - #1068

Merged
stephenamar-db merged 1 commit into
databricks:masterfrom
He-Pin:codex/go-jsonnet-cli-compat
Jul 2, 2026
Merged

Align CLI behavior with go-jsonnet#1068
stephenamar-db merged 1 commit into
databricks:masterfrom
He-Pin:codex/go-jsonnet-cli-compat

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

sjsonnet CLI should be a go-jsonnet-compatible superset for applicable CLI behavior, while making remaining intentional differences explicit.

Modification

  • Allow --help / --version without an input file and keep control flags inactive when they are option values or after --.
  • Align -J priority with go-jsonnet right-most-wins behavior while keeping JSONNET_PATH lower priority.
  • Align YAML stream, output-file newline, create-output-dirs, max-trace, and -- terminator behavior with go-jsonnet where applicable.
  • Harden short-option normalization for attached values such as -Jdir and -n4.
  • Keep sjsonnet's existing CLI tail-call optimization behavior and test it explicitly.

Result

Case go-jsonnet v0.22.0 jrsonnet 0.5.0-pre99 sjsonnet before sjsonnet after
--version without input prints version prints version parser error prints Sjsonnet 0.7.1-SNAPSHOT
--help without input prints help prints help parser error prints help without parser noise
-- --version with file named --version evaluates file evaluates file parser error evaluates file
-J a -J b duplicate import path imports from b imports from b imports from a imports from b
--yaml-stream -e '[{a:1},{b:2}]' JSON document stream with --- YAML document stream old stream formatting JSON document stream with ---
--max-stack 2 non-tail recursion stack error stack error stack error stack error
--max-stack 2 tail recursion stack error stack error returns 0 via TCO returns 0 via TCO
-Jdir / -n4 attached values not supported for -Jdir supported broken short cluster parsing supported as sjsonnet robustness

References

  • Local behavior checks against go-jsonnet v0.22.0 and jrsonnet 0.5.0-pre99.

@He-Pin
He-Pin marked this pull request as draft June 29, 2026 03:17
@He-Pin
He-Pin force-pushed the codex/go-jsonnet-cli-compat branch from 4664627 to e335c1e Compare June 29, 2026 03:39
He-Pin added a commit to He-Pin/sjsonnet that referenced this pull request Jun 29, 2026
Motivation:
Close CLI compatibility gaps with go-jsonnet, including option parsing, output behavior, environment/JPATH handling, and stack accounting semantics.

Modification:
Update CLI config and main flow, add JVM CLI compatibility tests, and keep tail-call trampolines from consuming the user-facing maxStack budget while preserving maxStack failures for non-tail recursion.

Result:
The PR branch is represented as one cohesive commit and the JVM CI failure is fixed by aligning tests with the intended tail-recursive stack behavior.

References:
databricks#1068
@He-Pin
He-Pin force-pushed the codex/go-jsonnet-cli-compat branch from c2ac117 to d82f180 Compare June 29, 2026 05:45
@He-Pin
He-Pin marked this pull request as ready for review June 29, 2026 17:57
Motivation:
Close CLI compatibility gaps with go-jsonnet, including option parsing, output behavior, environment/JPATH handling, and stack accounting semantics.

Modification:
Update CLI config and main flow, add JVM CLI compatibility tests, and keep tail-call trampolines from consuming the user-facing maxStack budget while preserving maxStack failures for non-tail recursion.

Result:
The PR branch is represented as one cohesive commit and the JVM CI failure is fixed by aligning tests with the intended tail-recursive stack behavior.

References:
databricks#1068
@He-Pin
He-Pin force-pushed the codex/go-jsonnet-cli-compat branch from ba7f67a to 3547b3f Compare June 30, 2026 19:36
@He-Pin
He-Pin marked this pull request as draft July 2, 2026 04:36
@He-Pin
He-Pin marked this pull request as ready for review July 2, 2026 09:58
@stephenamar-db
stephenamar-db merged commit 87d30a5 into databricks:master Jul 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants