Align CLI behavior with go-jsonnet#1068
Open
He-Pin wants to merge 4 commits into
Open
Conversation
4664627 to
e335c1e
Compare
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
c2ac117 to
d82f180
Compare
Motivation: The assembly smoke test expected tail-recursive CLI evaluation to hit the stack limit, but sjsonnet preserves TCO for tail calls and MainTests already assert that behavior. Modification: Use a non-tail recursive expression for the max-stack failure smoke check, and add an explicit tail-recursive success smoke check. Result: The smoke test now verifies both the stack-limit error path and the existing tail-call optimization path without contradicting runtime behavior.
Motivation: Short option normalization expanded every character in a cluster before checking whether any option consumed a value. Attached values such as -Jdir or -n4 were therefore split into unrelated flags. Modification: Stop cluster expansion when a value-taking short option is encountered, treating the rest of the token as that option value. Add CLI tests for attached -J and -n values while preserving flag-only clusters such as -eS. Result: The CLI handles attached short option values predictably and the JVM test suite, formatting check, and assembly smoke pass.
Motivation: The stack trace cropping split could produce only an ellipsis for --max-trace 1 and no tail frame for --max-trace 2. Modification: Keep at least one visible head frame for limit 1 and at least one tail frame for larger cropped traces. Add CLI regression coverage for --max-trace 1 and 2. Result: Small max-trace limits keep useful stack evidence, and checkFormat, JVM tests, and assembly smoke pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
sjsonnet CLI should be a go-jsonnet-compatible superset for applicable CLI behavior, while making remaining intentional differences explicit.
Modification
--help/--versionwithout an input file and keep control flags inactive when they are option values or after--.-Jpriority with go-jsonnet right-most-wins behavior while keepingJSONNET_PATHlower priority.--terminator behavior with go-jsonnet where applicable.-Jdirand-n4.Result
--versionwithout inputSjsonnet 0.7.1-SNAPSHOT--helpwithout input-- --versionwith file named--version-J a -J bduplicate import pathbbab--yaml-stream -e '[{a:1},{b:2}]'--------max-stack 2non-tail recursion--max-stack 2tail recursion0via TCO0via TCO-Jdir/-n4attached values-JdirReferences