feat(api): expose the running version on /api/info#272
Open
Arvuno wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 Versionand used by the CLI to printnotemark --version, but the API never sees it. Frontends comparing themselves againstminSupportedVersionhad to fall back to other heuristics.Plumb the build-time
Versionthrough Entrypoint -> commandServe -> SetupHandlers -> SetupMiscHandler and add aVersionfield tocore.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
Version stringtocore.ServerInfowith the json tagversion.MiscHandlergains aVersionfield;SetupMiscHandlernow takes anappVersion stringand threads it through.SetupHandlerstakes the same string and forwards it toSetupMiscHandler.commandServetakes the same string and forwards it toSetupHandlers.Entrypointwas already passingappVersiontocli.App.Version; it now also passes it tocommandServe.Notes
main.goinitialisesVersionto"unknown"if the build flag is absent; clients can detect that case without a separate null check.go buildhere (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.