Skip to content

Commit e43b18f

Browse files
claude[bot]claude
andauthored
docs(protocol): show a real PluginHealthReport under Custom Health Checks (#11812)
The JSON block under `### Custom Health Checks` matched neither an HTTP body nor the internal type its lead-in named. `PluginHealthReport` (`packages/spec/src/kernel/plugin-lifecycle-advanced.zod.ts:90-136`, built at `packages/core/src/health-monitor.ts:185-193`) is per-plugin, and the sketch diverged on every structural axis: - `checks` is an array of `{ name, status: 'passed' | 'failed' | 'warning' }` (schema:121-126), not a keyed map of subsystems whose entries read `"healthy"` - `uptime` lives under `metrics` in milliseconds (schema:109-116, `Date.now() - startTime`), not at top level in seconds - no `version` field exists (0 occurrences in schema:90-136, against a control of 5 for `status` in the same region) The example is now a report the monitor actually builds: `status` from `PluginHealthStatusSchema`, `metrics.uptime` in ms, and a `checks` array whose entry is named after the configured `checkMethod` (health-monitor.ts:119-125). `"2.0.0"` is absent because the schema has no `version` field — not because the literal was edited to something else. Two fields that were already correct are unchanged: `status: "healthy"` (a real `PluginHealthStatusSchema` member) and the `timestamp` literal. The `### Health Status Response` sample above is untouched. That one is the `GET /health` wire body and a different thing entirely; conflating the two is the defect this change closes. The callout's "richer per-subsystem report" became "per-plugin health report", since the per-subsystem block it pointed at no longer exists. Not audited, filed separately: the TypeScript example above the block declares `healthChecks` as a map of async functions, while the real config is `PluginHealthCheckSchema.checkMethod` (a method name on the plugin). Claude-Session: https://claude.ai/code/session_015ahemw8RcTgqtxrj15PEZx Co-authored-by: Claude <noreply@anthropic.com>
1 parent dce6a01 commit e43b18f

1 file changed

Lines changed: 25 additions & 37 deletions

File tree

content/docs/protocol/kernel/lifecycle.mdx

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ rather than black-holing a working deployment.
633633

634634
<Callout type="info">
635635
`GET /health` returns a compact liveness body (`status`, `timestamp`, `version`,
636-
`uptime`) and `GET /ready` returns readiness. The richer per-subsystem report
636+
`uptime`) and `GET /ready` returns readiness. The per-plugin health report
637637
and the plugin-declared custom checks below describe the internal health-monitor model
638638
(`PluginHealthMonitor`), which covers **plugins, not driver connections** — they
639639
are **not yet** exposed as a dedicated HTTP endpoint or as a declarative plugin
@@ -694,50 +694,38 @@ export default {
694694
};
695695
```
696696

697-
The richer per-subsystem view the callout above refers to is sketched below. It
698-
is **illustrative only**: no endpoint serves this shape, and it is not the
699-
monitor's own serialized type either — `PluginHealthReport`
700-
(`@objectstack/spec/kernel`) is per-plugin, carries `checks` as an array of
701-
`{ name, status: "passed" | "failed" | "warning" }`, and reports `uptime` under
702-
`metrics`. Read the sketch as a picture of what per-subsystem health reporting
703-
would carry, not as a contract.
697+
The monitor keeps one report per plugin rather than one aggregate document. Each
698+
round of checks builds a `PluginHealthReport` (`@objectstack/spec/kernel`,
699+
constructed in `packages/core/src/health-monitor.ts`) and stores it under the
700+
plugin's name, where `getHealthReport(pluginName)` reads it back. Nothing serves
701+
this shape over HTTP — it is an in-process model, not a wire body.
704702

705703
```json
706704
{
707705
"status": "healthy",
708-
"uptime": 3600,
709-
"version": "2.0.0",
710706
"timestamp": "2024-01-15T11:00:00.000Z",
711-
"checks": {
712-
"database": {
713-
"status": "healthy",
714-
"latency_ms": 5,
715-
"connections": {
716-
"active": 8,
717-
"idle": 2,
718-
"max": 10
719-
}
720-
},
721-
"redis": {
722-
"status": "healthy",
723-
"latency_ms": 2
724-
},
725-
"plugins": {
726-
"status": "healthy",
727-
"loaded": 3,
728-
"enabled": 3,
729-
"failed": 0
730-
},
731-
"jobs": {
732-
"status": "healthy",
733-
"pending": 5,
734-
"running": 2,
735-
"failed": 0
736-
}
737-
}
707+
"metrics": {
708+
"uptime": 3600000
709+
},
710+
"checks": [
711+
{ "name": "healthCheck", "status": "passed" }
712+
]
738713
}
739714
```
740715

716+
`checks` is an **array**, and a check's `status` is `"passed" | "failed" |
717+
"warning"` — the six-value `"healthy" | "degraded" | "unhealthy" | "failed" |
718+
"recovering" | "unknown"` vocabulary belongs to the report's own top-level
719+
`status`, never to an entry inside `checks`. Each entry is named after the
720+
plugin's configured `checkMethod`, or `"plugin-loaded"` when a plugin configures
721+
none. `metrics.uptime` is in **milliseconds** (`Date.now() - startTime`), unlike
722+
the seconds-valued `uptime` of `GET /health` above, and the report carries no
723+
`version` field — it identifies its plugin by the key it is stored under. The
724+
optional `message` is set only when a check fails; the schema's remaining
725+
`metrics` fields (`memoryUsage`, `cpuUsage`, `activeConnections`, `errorRate`,
726+
`responseTime`) and its `dependencies` array are declared but left unset by the
727+
monitor today.
728+
741729
## Shutdown Sequence
742730

743731
Graceful shutdown ensures in-flight requests complete before process exits.

0 commit comments

Comments
 (0)