Follow-up from #1598, which unfroze swag init and regenerated the docs. The root cause of the freeze was that nothing validated the generation step, so it silently aborted and the served docs went stale for a long time (missing the rejoin routes, etc.). Two things to harden it and one fidelity item.
1. Prevent silent refreeze (the real root cause)
2. Keep the two copies in sync
share/dashboard/swagger.json is committed and served directly; it drifted from docs/swagger.json before. The make swagger target above keeps them in lockstep; the CI check enforces it.
3. Type the 5 dynamic endpoints (fidelity, lower priority)
#1598 documented these as map[string]interface{} because the concrete types are live runtime structs (mutexes, os.Process, sql.Null*) that can't be represented in OpenAPI:
ReplicationManager (/api/monitor), cluster.Cluster (list/get), cluster.ServerMonitor (server views), config.Config (cluster settings), cluster.Proxy.
Context: #1598.
4. WireVersion doc-drift (LOG_PLUGINS.md) — same class of bug
doc/implementation/cluster/LOG_PLUGINS.md restates the plugin wire version in
three hand-maintained spots (prose "current version is N", the WireVersion = N
code snippet, and the wire-vN/ signer-layout tree). Nothing checks them against
the source of truth (WireVersion in cluster/logplugin/plugins/wire/wire.go), and
they had already drifted — the doc said 2 while the code was 3 (fixed on the
plugins/schema-advisor branch).
Generalize this issue from "swagger hygiene" to derived-value doc-drift checks:
Same principle as §1–§2: a derived fact restated in docs must be validated, not trusted.
Follow-up from #1598, which unfroze
swag initand regenerated the docs. The root cause of the freeze was that nothing validated the generation step, so it silently aborted and the served docs went stale for a long time (missing the rejoin routes, etc.). Two things to harden it and one fidelity item.1. Prevent silent refreeze (the real root cause)
make swaggertarget that runs the exact working command and syncs the dashboard copy:make swaggerand fails ifgit diff --exit-code docs/ share/dashboard/swagger.jsonis dirty — so a change that breaks generation (or forgets to regenerate) is caught, not silently frozen.2. Keep the two copies in sync
share/dashboard/swagger.jsonis committed and served directly; it drifted fromdocs/swagger.jsonbefore. Themake swaggertarget above keeps them in lockstep; the CI check enforces it.3. Type the 5 dynamic endpoints (fidelity, lower priority)
#1598 documented these as
map[string]interface{}because the concrete types are live runtime structs (mutexes,os.Process,sql.Null*) that can't be represented in OpenAPI:ReplicationManager(/api/monitor),cluster.Cluster(list/get),cluster.ServerMonitor(server views),config.Config(cluster settings),cluster.Proxy.Context: #1598.
4.
WireVersiondoc-drift (LOG_PLUGINS.md) — same class of bugdoc/implementation/cluster/LOG_PLUGINS.mdrestates the plugin wire version inthree hand-maintained spots (prose "current version is N", the
WireVersion = Ncode snippet, and the
wire-vN/signer-layout tree). Nothing checks them againstthe source of truth (
WireVersionincluster/logplugin/plugins/wire/wire.go), andthey had already drifted — the doc said
2while the code was3(fixed on theplugins/schema-advisorbranch).Generalize this issue from "swagger hygiene" to derived-value doc-drift checks:
makecheck: readWireVersion = Nfromwire.go; fail ifLOG_PLUGINS.mdstates a different number or references any
wire-v<other>directory.WireVersionpointer) and refer to it abstractly elsewhere (wire-v<WireVersion>/),shrinking the manual surface from 3 to 1.
Same principle as §1–§2: a derived fact restated in docs must be validated, not trusted.