Skip to content

add client/server version compatibility check#49

Merged
jgpruitt merged 2 commits intomainfrom
me0/versioning
Apr 27, 2026
Merged

add client/server version compatibility check#49
jgpruitt merged 2 commits intomainfrom
me0/versioning

Conversation

@jgpruitt
Copy link
Copy Markdown
Collaborator

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.

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.
@jgpruitt jgpruitt merged commit ccb19fc into main Apr 27, 2026
3 checks passed
@jgpruitt jgpruitt deleted the me0/versioning branch April 27, 2026 14:49
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.

1 participant