Versioning
Versioning
Section titled “Versioning”Protocol versioning and per-function versioning
Overview
Section titled “Overview”Mesh has two independent versioning systems:
| Type | Scope | Changes |
|---|---|---|
| Protocol version | Envelope structure, error format, core semantics | Rare, coordinated |
| Function version | Business logic, arguments, return shape | Per-team, independent |
Protocol Versioning
Section titled “Protocol Versioning”Format
Section titled “Format”The protocol field specifies the Mesh protocol version using Semantic Versioning:
<major>.<minor>.<patch>Examples:
0.1.0— Draft/experimental1.0.0— First stable release1.2.0— Minor additions2.0.0— Breaking changes
Semantics
Section titled “Semantics”Major version — Breaking changes:
- Removing or renaming required fields
- Changing field types
- Altering error semantics
- Modifying core behavior
Minor version — Backwards-compatible additions:
- New optional fields
- New error codes
- New optional features
Patch version — Backwards-compatible fixes:
- Clarifications to specification text
- Documentation corrections
- No behavioral changes
Compatibility Rules
Section titled “Compatibility Rules”Servers MUST:
- Reject requests with unsupported major versions
- Accept requests with supported major version, any minor version
- Return
INVALID_PROTOCOL_VERSIONfor unsupported versions
Clients SHOULD:
- Send the protocol version they were built for
- Handle responses from any minor version of the same major
Example
Section titled “Example”// Request with unsupported version{ "protocol": { "name": "mesh", "version": "99.0.0" }, "id": "req_123", "call": { ... }}
// Response{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_123", "result": null, "errors": [{ "code": "INVALID_PROTOCOL_VERSION", "message": "Unsupported protocol version: 99.0.0", "retryable": false, "details": { "requested": "99.0.0", "supported": ["0.1.0"] } }]}Function Versioning
Section titled “Function Versioning”Philosophy
Section titled “Philosophy”Each function is versioned independently. This differs from REST’s monolithic API versioning:
REST (monolithic):
/api/v1/orders ← Forced to v1 because users changed/api/v1/users ← The actual change/api/v1/products ← Unchanged, but still "v1"Mesh (per-function):
orders.create@1 ← Untouchedusers.get@2 ← Evolved independentlyproducts.list@1 ← UntouchedBenefits
Section titled “Benefits”- Teams evolve functions without coordinating releases
- Consumers upgrade function-by-function
- No version sprawl where everything is “v7” but 90% is unchanged
- Deprecation is surgical: sunset
orders.create@1, not “all of v1”
Format
Section titled “Format”The version field in the call object specifies function version:
{ "call": { "function": "orders.create", "version": "2", "arguments": { ... } }}Type: String. MUST use integer strings: "1", "2", "3"
Default Version Behavior
Section titled “Default Version Behavior”When a request omits the version field, servers SHOULD route to the latest stable version:
{ "call": { "function": "orders.create", "arguments": { ... } }}Resolution rules:
- Find all versions with
status: "stable"(excludebeta,removed) - Select the highest version number
- If no stable versions exist, return
VERSION_NOT_FOUND
Example: If a function has versions 1 (stable, deprecated), 2 (stable), and 3 (beta):
- Omitting version routes to
2(latest stable) - Explicitly requesting
3routes to beta
Recommendations:
- Clients SHOULD specify explicit versions in production code for predictability
- Servers SHOULD support version omission for exploration and development
- Version discovery: Use
mesh.describeto find available versions and their status
// Discover versions before calling{ "call": { "function": "mesh.describe", "version": "1", "arguments": { "function": "orders.create" } }}When to Increment
Section titled “When to Increment”Implementations MUST increment function version for:
- Removing or renaming arguments
- Changing argument types
- Changing return value structure
- Altering function behavior
Implementations SHOULD NOT increment for:
- Adding optional arguments with defaults
- Adding fields to return value
- Bug fixes that don’t change the contract
Maintaining Multiple Versions
Section titled “Maintaining Multiple Versions”Servers MAY support multiple versions simultaneously:
orders.create@1 ← Legacy, deprecatedorders.create@2 ← Current, recommendedorders.create@3 ← Beta, testingDeprecation
Section titled “Deprecation”To deprecate a function version:
- Document deprecation with timeline
- MAY return warning in
meta:{"meta": {"deprecated": {"reason": "Use version 2","sunset": "2025-06-01"}}} - Eventually return
VERSION_NOT_FOUND
Unknown Version
Section titled “Unknown Version”When a client requests an unknown version:
{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_123", "result": null, "errors": [{ "code": "VERSION_NOT_FOUND", "message": "Version 5 not found for function orders.create", "retryable": false, "details": { "function": "orders.create", "requested_version": "5", "available_versions": ["1", "2", "3"] } }]}Version Discovery
Section titled “Version Discovery”Clients MAY discover available versions using system functions:
// Request{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_discover", "call": { "function": "mesh.describe", "version": "1", "arguments": { "function": "orders.create" } }}
// Response{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_discover", "result": { "function": "orders.create", "versions": [ { "version": "1", "status": "stable", "deprecated": { "reason": "Use version 2", "sunset": "2025-06-01" } }, { "version": "2", "status": "stable" }, { "version": "3", "status": "beta" } ] }}See System Functions for details.
Examples
Section titled “Examples”Version 1 Request
Section titled “Version 1 Request”{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_v1", "call": { "function": "users.get", "version": "1", "arguments": { "user_id": 42 } }}Version 1 Response
Section titled “Version 1 Response”{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_v1", "result": { "id": 42, "name": "Alice", "email": "alice@example.com" }}Version 2 Request (Different Arguments)
Section titled “Version 2 Request (Different Arguments)”{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_v2", "call": { "function": "users.get", "version": "2", "arguments": { "identifier": { "type": "id", "value": 42 } } }}Version 2 Response (Different Structure)
Section titled “Version 2 Response (Different Structure)”{ "protocol": { "name": "mesh", "version": "0.1.0" }, "id": "req_v2", "result": { "user": { "id": 42, "profile": { "name": "Alice", "email": "alice@example.com" }, "metadata": { "created_at": "2024-01-01T00:00:00Z" } } }}