Skip to content

feat(api): expose the running version on /api/info#272

Open
Arvuno wants to merge 1 commit into
enchant97:mainfrom
Arvuno:feat/expose-version-on-info
Open

feat(api): expose the running version on /api/info#272
Arvuno wants to merge 1 commit into
enchant97:mainfrom
Arvuno:feat/expose-version-on-info

Conversation

@Arvuno
Copy link
Copy Markdown

@Arvuno Arvuno commented Jun 3, 2026

What

The /api/info endpoint returns a small ServerInfo document with capability flags and an OIDC pointer, but it never includes the version. The version is injected at build time into main.go's var Version and used by the CLI to print notemark --version, but the API never sees it. Frontends comparing themselves against minSupportedVersion had to fall back to other heuristics.

Plumb the build-time Version through Entrypoint -> commandServe -> SetupHandlers -> SetupMiscHandler and add a Version field to core.ServerInfo. No changes to existing fields; the wire shape only gains one optional string.

Why

Symmetry: the CLI knows its version, the API does not. The version is the most natural value to put in a /api/info response, and now a deployed build can be identified by the same string whether you ask the CLI or the server.

How

  • Add Version string to core.ServerInfo with the json tag version.
  • MiscHandler gains a Version field; SetupMiscHandler now takes an appVersion string and threads it through.
  • SetupHandlers takes the same string and forwards it to SetupMiscHandler.
  • commandServe takes the same string and forwards it to SetupHandlers.
  • Entrypoint was already passing appVersion to cli.App.Version; it now also passes it to commandServe.

Notes

  • The new field is always populated because main.go initialises Version to "unknown" if the build flag is absent; clients can detect that case without a separate null check.
  • I could not run go build here (no Go module cache for this repo in the container), but the change is mechanical and limited to five files; pre-existing TS/JS lint noise in the repo is untouched.

The /api/info endpoint already returns a small ServerInfo document with capability flags and an OIDC pointer, but it never includes the version. The version is injected at build time into main.go's var Version and used by the CLI to print notemark --version, but the API never sees it. The frontend has to fall back to other heuristics when it wants to compare against MinSupportedVersion. Plumb the build-time Version through Entrypoint -> commandServe -> SetupHandlers -> SetupMiscHandler and add a Version field to core.ServerInfo. No changes to existing fields; the wire shape only gains one optional string.
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