test: Check an older CLI against a newer agent - #5
Merged
Conversation
Commands that had always printed raw JSON started printing tables, which reads better on screen and breaks anything parsing the output, including every workflow using this CLI today. A table is now for a terminal. A pipe, a redirect or a CI step gets the raw answer, which is what it got before.
Printing the raw answer whenever the output was not a terminal was too broad: it turned a deployment's restart confirmation, and anything else that answers with a sentence, into JSON in a CI log. Only a table is now held back, since something on the other end of a pipe would rather parse the answer than read columns.
Holding a table back from a pipe broke the thing it was meant to protect: `deployment list` has printed a table since it existed, so anything grepping one in a workflow would have got JSON instead. No command that shipped ever printed differently depending on where its output went. A table prints wherever it was asked for, and --json is how the raw answer is asked for, which is what every command already did.
The shared list shape writes the rows under items and under the name the collection used to answer by, so a client built before that shape existed keeps working. This pins it with the bytes the agent actually sends, since a staging agent on an older build cannot show it.
Code Review SummaryThis PR introduces critical test coverage for backward compatibility between the CLI and newer agent responses that use the 🚀 Key Improvements
💡 Minor Suggestions
|
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.
A CLI built before the shared list shape existed still has to read a new agent's answer, and until
now nothing checked it: the staging agent runs an older build, so every comparison ran against a
response that predates the shape.
This pins it with the bytes the agent actually sends, where a collection answers under
itemsandunder the name it used to answer by, plus the field it carried alongside. The released 0.2.0 binary
reads that correctly, and so does the current one.
The doc lines say what the output does when it is piped, which is nothing:
deployment list | grep runningkeeps working, and--jsonis how the raw answer is asked for.