feat(M6a): semantic-cluster fixes ($$ root, $keys/$spread, undefined arithmetic, object keys)#18
Merged
Merged
Conversation
…1009 (any value), unary minus D1002
1153 → 1174 (+21) out of 1682 total. Newly-passing groups: conditionals +4 (case000/001/003/004) function-keys +4 (case002/004/005/006) function-spread +2 (case000/003) function-lookup +1 (case003) missing-paths +1 (case004) numeric-operators +3 (case012/013/016) object-constructor +3 (case014/023/024) performance +1 (case000) simple-array-selectors +1 (case014) wildcards +1 (case008) Zero regressions. Guard + 448 unit tests green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
M6a fixes four independent semantic divergences that all teach the same jsonata invariant — an empty sequence IS undefined, and undefined propagates by omission, not by empty-string/empty-array. It's the first of the M6 "structural polish" split (M6b = parser
[]keepArray;#$varlater).$$root context — bind the input under the name"$"at the top frame, so$$resolves through the normal variable chain from any nested scope (it was never bound → all$$forms returned undefined).$(current context) is unaffected.$keys/$spread—$keysof an empty result is now undefined (not[]);$spreadechoes a scalar argument and an empty$spreadis undefined.x + undefined→ undefined (and unary-undefined→ undefined), matching jsonata's exact operand ordering: both defined-non-number type errors (T2001/T2002) fire before the undefined short-circuit; unary-on a non-number raises D1002.Results
conditionals,function-keys,numeric-operators,object-constructor,function-spread, and 5 more groups.Verification
An adversarial fidelity review against a jsonata-js v2.2.1 oracle (~100 probes) found three suite-invisible in-scope divergences —
$spread({}), duplicate-key-with-undefined-value, and unary-minus error code — all fixed in204ab63. (The official suite runner accepts any structured error without comparing codes, so error-code fidelity is checked only by the oracle.)Deferred (out of scope): singleton-unwrap of builtin collection results (
$keys({a:1})→["a"]vs jsonata"a") — an architectural sequence-semantics concern for a dedicated later milestone.Test Plan
bustedfull unit suite — 448/448scripts/run-suite.sh— 1174/1682, zero regressions🤖 Generated with Claude Code