Skip to content

Commit 03ef1b4

Browse files
claude[bot]claude
andauthored
docs(api): stop pinning a discovery version literal at four sites (#11762)
The discovery `version` field is the serving artifact's version, not a constant. Four hand-written samples asserted a literal for it, and each had a different failure history: - `api/client-sdk.mdx` pinned "1.0.0", a value no producer ever served. - `api/index.mdx` and `protocol/kernel/http-protocol.mdx` pinned "v1", accurate only while the REST server overwrote the producer's value with `config.api.version` — an override since removed. - `http-protocol.mdx`'s `/.well-known/objectstack` sample pinned "1.0.0", the exact literal the runtime dispatcher stopped serving when its version became derived. Each site now says what the field means instead of asserting a value, so none of them goes stale on the next release. Two neighbouring prose claims that explained the old literals were false in the same way and are corrected with them. Claude-Session: https://claude.ai/code/session_015ahemw8RcTgqtxrj15PEZx Co-authored-by: Claude <noreply@anthropic.com>
1 parent 006c181 commit 03ef1b4

3 files changed

Lines changed: 22 additions & 12 deletions

File tree

content/docs/api/client-sdk.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ When you call `client.connect()`, the client:
8787
// connect() resolves with the discovery manifest — capture the return value
8888
const discovery = await client.connect();
8989

90-
console.log(discovery.version); // "1.0.0"
90+
console.log(discovery.version); // the serving artifact's version
9191
console.log(discovery.environment); // "development"
9292

9393
// Check if a service is available before using it

content/docs/api/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Schema reference: [API](/docs/references/api)
100100

101101
## Discovery
102102

103-
The discovery endpoint is the entry point for all clients. It returns the API version, available routes, service capabilities, and per-service status.
103+
The discovery endpoint is the entry point for all clients. It returns the serving artifact's version, available routes, service capabilities, and per-service status.
104104

105105
### `GET /api/v1` (and `GET /api/v1/discovery`)
106106

@@ -114,7 +114,7 @@ the dispatcher cedes the route to it, so a single owner answers it (ADR-0076 D11
114114
**Response**:
115115
```json
116116
{
117-
"version": "v1",
117+
"version": "<the serving artifact's version>",
118118
"apiName": "ObjectStack API",
119119
"routes": {
120120
"data": "/api/v1/data",
@@ -140,6 +140,8 @@ the dispatcher cedes the route to it, so a single owner answers it (ADR-0076 D11
140140
}
141141
```
142142

143+
`version` is the **serving artifact's** version, not the API version: the `OS_RUNTIME_VERSION` stamp when a deployment injects one, otherwise the resolved version of the package that built the response. It carried the configured `api.version` (the `v1` path segment) until #11292 removed that override — the API version is still readable here, as the base path every `routes` entry is prefixed with.
144+
143145
Disabled/uninstalled route keys (e.g. `auth`, `analytics`, `workflow`) are omitted from `routes` entirely rather than set to `null`; check `services` to tell "not installed" apart from "installed but not yet mounted here." The sample above shows a minimal install: `analytics` reports `unavailable` and advertises no route until `@objectstack/service-analytics` registers the engine — the dispatcher then also mounts `/api/v1/analytics/*` (the routes are capability-conditional; an uninstalled capability answers 404 for every method).
144146

145147
`metadata` is reported from whatever implementation fills its slot, so the sample's `available` is the `MetadataPlugin` case (a persisted `sys_metadata` registry). A stack running the kernel's in-memory fallback instead reports `status: "degraded"` with a `message` naming what is missing and what to install. `handlerReady` is `true` either way: `/api/v1/meta` is served by the protocol, so the route is mounted whichever registry sits behind it.

content/docs/protocol/kernel/http-protocol.mdx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Host: api.acme.com
4343
**Response:**
4444
```json
4545
{
46-
"version": "v1",
46+
"version": "<the serving artifact's version>",
4747
"name": "ObjectStack API",
4848
"apiName": "ObjectStack API",
4949
"environment": "development",
@@ -78,9 +78,14 @@ Host: api.acme.com
7878

7979
Three things about this body are worth stating explicitly:
8080

81-
- **`version` is the configured API version, not a product version.** The handler
82-
overwrites the protocol's value with `api.version` — the same string that forms the
83-
path segment (`"v1"`). It is never a semantic version like `2.1.0`.
81+
- **`version` is the serving artifact's version, not the configured API version.** The
82+
handler serves the protocol builder's own value — the `OS_RUNTIME_VERSION` stamp when a
83+
deployment injects one, otherwise the resolved `@objectstack/metadata-protocol` version
84+
— so a semantic version is the normal answer. It used to be overwritten with
85+
`api.version` (the same `"v1"` string that forms the path segment); #11292 removed that
86+
override, because the identity field then answered with the path segment the caller had
87+
just typed to get there. The API version has not left this document: every `routes`
88+
entry below is prefixed with the mounted base path, which is built from `api.version`.
8489
- **`name` is canonical; `apiName` is a deprecated alias with the same value.** Both are
8590
emitted today so clients pinned to the old spelling keep working; `apiName` is removed
8691
in **protocol 18** (#4828). Read `name`.
@@ -126,7 +131,7 @@ Host: api.acme.com
126131
"success": true,
127132
"data": {
128133
"name": "ObjectOS",
129-
"version": "1.0.0",
134+
"version": "<the serving artifact's version>",
130135
"environment": "production",
131136
"routes": {
132137
"data": "/api/v1/data",
@@ -160,10 +165,13 @@ Host: api.acme.com
160165
}
161166
```
162167

163-
`name` and `version` are the dispatcher's own build identity, not your app's name — they
164-
are fixed strings, so do not display them as the deployment's title. `locale` is derived
165-
from the registered i18n service (`getDefaultLocale()` / `getLocales()`); with no i18n
166-
service it degrades to `{ "default": "en", "supported": ["en"], "timezone": "UTC" }`.
168+
`name` and `version` are the dispatcher's own build identity, not your app's name — do
169+
not display them as the deployment's title. `name` is a fixed string; `version` is the
170+
serving artifact's version — the `OS_RUNTIME_VERSION` stamp when a deployment injects one,
171+
otherwise the resolved `@objectstack/runtime` version (#10993), never a hardcoded literal.
172+
`locale` is derived from the registered i18n service (`getDefaultLocale()` /
173+
`getLocales()`); with no i18n service it degrades to
174+
`{ "default": "en", "supported": ["en"], "timezone": "UTC" }`.
167175

168176
`environment` is **derived from** `NODE_ENV`, not the raw value — the field is an enum
169177
(`production` / `sandbox` / `development`), so out-of-enum spellings are mapped rather

0 commit comments

Comments
 (0)