Repository navigation
fix(input): accept null version, cost, workspace and output_style - #684
Open
eric-engberg wants to merge 1 commit into
Open
eric-engberg wants to merge 1 commit into
eric-engberg wants to merge 1 commit into
Conversation
The status payload schema accepted null for context_window, effort, vim, worktree and rate_limits, but not for version, cost, workspace or output_style. A payload with any of those four set to null failed validation as a whole: the CLI printed "Invalid status JSON format" and exited 1, so no status line rendered, even when no widget on the line reads that field. Mark the four fields nullable like the others. Every reader already goes through optional chaining or a truthiness check (Version, Session Cost, Session Clock, Output Style, and the git and Claude settings lookups that fall back from workspace to cwd), so a null field renders the same as a missing one. Wrong types are still rejected.
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.
What
A status payload with
version,cost,workspaceoroutput_styleset tonullnow renders. Before, it was rejected as a whole: no status line, exit 1.Why
The payload schema already accepts
nullforcontext_window,effort,vim,worktreeandrate_limits, but not for these four. One null in any of them failed validation for the whole payload, even when no widget on the line reads that field:version: null,workspace: nullandoutput_style: nullfail the same way.How
The four fields become
.nullable().optional(), as the other five already are. Nothing else changes:cost?.…, and the git and Claude-settings lookups readworkspace?.…among their candidate directories. A null field renders exactly like a missing one.bun run lintpasses with no other edits.session_id,transcript_path,cwd,model), are unchanged. Making those nullable would need null handling at about a dozen call sites.Demo
A sample payload with the four fields set to
null, piped through the CLI (first output line and exit code), then the same payload with values for comparison. The line has Model, Context Length, Version, Session Cost and Output Style.Powerline: before
Powerline: after
Plain: before
Plain: after
Testing
nullparses and keeps them asnull. It fails onmain.bun test: 2783 pass, 0 fail.bun run lintpasses.StatusJSON.test.tsunder Node (Vitest): 8 pass (7 existing, 1 new).main.nulland a line using Version, Session Cost and Output Style,mainexits 1 under both runtimes. This branch renders the line, and both runtimes agree.