add client/server version compatibility check#49
Merged
Conversation
Adds a handshake so the client and server can detect when they're out of sync before failing in confusing ways mid-command. - Server exposes GET /api/v1/version (unauthenticated) and rejects RPCs whose X-Client-Version header is below MIN_CLIENT_VERSION with a typed CLIENT_VERSION_INCOMPATIBLE error and HTTP 426. - Client sends X-Client-Version on every RPC and runs checkServerVersion on me login (and on demand via me version), throwing typed errors when either side is too old. - MIN_CLIENT_VERSION and MIN_SERVER_VERSION live in version.ts. Release scripts prompt for optional bumps when compatibility actually breaks.
The --no-server boolean and the global --server <url> flag share the same opts key under commander, so optsWithGlobals() was returning true (the --no-server default) instead of a URL string. That fed into normalizeOrigin and crashed with 'url2.replace is not a function'. - Rename --no-server to --local to avoid the collision. - Guard with typeof === 'string' before passing to resolveServer. - Add a TypeError at the top of normalizeOrigin so a similar mishap surfaces a clear error instead of a cryptic one.
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.
Adds a handshake so the client and server can detect when they're out of sync before failing in confusing ways mid-command.