Repository navigation
fix(star): every empty list in a command's result is [], not null (#1215) - #1216
Merged
Merged
Conversation
…sult as null Step 14 of NobleFactor/noblefactor-engprod#346, ahead of #379 and #436, which it blocks. A list is always a list, [] when it is empty, ruled 2026-11-08; goSlice starts from an empty slice, and a test pins it.
goSlice declared its slice nil, so a list with no elements stayed nil and JSON wrote it as null, at every depth of a command's result: anything that looped over it failed. It starts from an empty slice now. result_test.go is the first test of goValue: an empty list, an empty tuple, one in a dict and one in a list encode as [], and None as null.
3 tasks done
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
goSlice(cmd/star/extension/result.go) declared its slice nil, so a list with no elements stayednil and JSON wrote it as
null, at every depth of a star command's result. Anything that looped over it failed:jq exits 5, "Cannot iterate over null". star keeps every Triage project up to date, one for each team or user account noblefactor-engprod#436's
tests/Test-StarGitHubfound it.goSlicestarts from an empty slice. A list is always a list,[]when it is empty, and a key thatholds one value and has none stays
null, as the owner ruled on 2026-11-08. Every star command's output changeswith it: where an empty list printed
null, it prints[].cmd/star/extension/result_test.go, the first test ofgoValue: an empty list, an empty tuple, onein a dict and one in a list encode as
[], a list with an element as itself, andNoneasnull.docs/plans/fix/1215-empty-list-not-null.md. Step 14 of Schedule: issue tracking, iteration 1 noblefactor-engprod#346, aheadof devlore-test run fails on Windows: output streams default to /dev/stdout #379 and devlore must not know its callers: shed writ's accessors from cmd/internal/devlore #436 there, which it blocks.
Closes #1215.
Test plan
result_test.gofailed before the fix, on the empty list, the empty tuple and both nested cases, and passes aftermake checkpasses: the quality gate, vet on every platform, both linters, complexity, the release check andevery test
tests/Test-StarGitHub, run with a star built from this branch: all 32cases pass, the six that failed on null lists among them
Written with AI assistance.
Signed-off-by: David Noble [email protected]
Assisted-by: Claude Code
Time
Computed by the algorithm of noblefactor-ops#188 at merge.