Skip to content

Conversation

@ivanauth
Copy link
Contributor

Summary

Fixes #554

When running zed version with an unavailable SpiceDB instance, the command would retry multiple times and log noisy error messages that cluttered the output.

Changes

  • Disables retries by default for the version command (sets max-retries=0)
  • Respects user-specified --max-retries if explicitly set
  • Restores both flag value and Changed state to preserve flag semantics
  • Logs connection failures at debug level instead of error
  • Always prints service: (unknown) for consistent output format
  • Adds test coverage for unavailable server scenario

Before

$ zed version --endpoint=localhost:12345 --insecure
client: zed v0.33.0
{"level":"error","error":"rpc error: code = Unavailable...","attempt":1,...}
{"level":"error","error":"rpc error: code = Unavailable...","attempt":2,...}
{"level":"error","error":"rpc error: code = Unavailable...","attempt":3,...}
... (9+ retry logs)
service: (unknown)

After

$ zed version --endpoint=localhost:12345 --insecure
client: zed v0.33.0
service: (unknown)

Test Plan

  • All existing tests pass
  • Added TestVersionCommandWithUnavailableServer to verify silent fallback
  • Manually tested with unavailable endpoint (no retry logs)
  • Verified user-specified --max-retries is still respected

When running 'zed version' with an unavailable SpiceDB instance,
the command would retry multiple times and log noisy error messages.

This fix:
- Disables retries by default for the version command
- Respects user-specified --max-retries if explicitly set
- Restores both flag value and Changed state to preserve semantics
- Logs connection failures at debug level instead of error
- Always prints 'service: (unknown)' for consistent output
- Adds test coverage for unavailable server scenario

Fixes authzed#554
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 67.85714% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.64%. Comparing base (7ed5ab0) to head (72b70ad).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
internal/cmd/version.go 67.85% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #564      +/-   ##
==========================================
+ Coverage   39.28%   40.64%   +1.36%     
==========================================
  Files          37       37              
  Lines        5448     5494      +46     
==========================================
+ Hits         2140     2233      +93     
+ Misses       3063     3009      -54     
- Partials      245      252       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

zed version produces error output when spicedb is unavailable

2 participants