Skip to content

bugfix(cli): add version to output (#1314)#2807

Merged
bgm-malbeclabs merged 1 commit intomainfrom
bgm/json_version_fix
Feb 5, 2026
Merged

bugfix(cli): add version to output (#1314)#2807
bgm-malbeclabs merged 1 commit intomainfrom
bgm/json_version_fix

Conversation

@bgm-malbeclabs
Copy link
Contributor

@bgm-malbeclabs bgm-malbeclabs commented Feb 4, 2026

Summary of Changes

This PR fixes a json rendering issue when the client is out of date. If the client was out of date and the user tried to return the status as json the json would be malformed as the version warning would be stuffed in.

Now it looks like this:
current:

{
  "version": {
    "status": "current"
  },
  "statuses": [...]
}

compatible:

{
  "version": {
    "status": "outdated",
    "current_version": "0.8.5",
    "latest_version": "0.9.0",
    "message": "A new version of the client is available: 0.8.5 → 0.9.0\nWe recommend updating to the latest version for the best experience."
  },
  "statuses": [...]
}

incompatible:

{
  "version": {
    "status": "incompatible",
    "current_version": "0.7.0",
    "min_required_version": "0.8.0",
    "message": "A new version of the client is available: 0.7.0 → 0.8.0\nYour client version is no longer up to date. Please update it before continuing to use the client."
  },
  "statuses": [...]
}

Closes #1314

Testing Verification

Unit tests have been added that show the output conforms to the expected result.

@bgm-malbeclabs bgm-malbeclabs marked this pull request as draft February 4, 2026 03:11
@bgm-malbeclabs bgm-malbeclabs self-assigned this Feb 4, 2026
@bgm-malbeclabs bgm-malbeclabs marked this pull request as ready for review February 4, 2026 17:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a JSON rendering issue where version warnings were being inserted into JSON output, causing malformed responses. The fix introduces structured version status information that is included in JSON responses and printed to stderr for table output.

Changes:

  • Added VersionStatus enum and get_version_status function to provide structured version checking
  • Modified status, routes, and latency commands to include version information in JSON responses
  • Version warnings now print to stderr for table output to avoid breaking structured output

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
smartcontract/cli/src/checkversion.rs Adds VersionStatus enum and get_version_status function with comprehensive unit tests
client/doublezero/src/command/status.rs Wraps status response with version information for JSON output
client/doublezero/src/command/routes.rs Wraps routes response with version information for JSON output
client/doublezero/src/command/latency.rs Wraps latency response with version information for JSON output
CHANGELOG.md Documents the addition of version field to JSON output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bgm-malbeclabs bgm-malbeclabs enabled auto-merge (squash) February 5, 2026 23:33
@bgm-malbeclabs bgm-malbeclabs merged commit 0a68f68 into main Feb 5, 2026
24 checks passed
@bgm-malbeclabs bgm-malbeclabs deleted the bgm/json_version_fix branch February 5, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version mismatch warning breaks JSON compatibility

2 participants