Skip to content

Offer to refresh a page when its server's rebuilt, and take the config a page has read - #203

Merged
djthorpe merged 2 commits into
mainfrom
djt/1112/config-seed
Nov 12, 2026
Merged

djthorpe merged 2 commits into
mainfrom
djt/1112/config-seed

Conversation

@djthorpe

@djthorpe djthorpe commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Two changes to config, and to the TypeScript package's ConfigController.

Rebuilt servers offer Refresh. The controller only offered Refresh when the version changed. A server rebuilt with the same version, such as while it's developed (git describe doesn't change until a commit), just said "The server is back".

  • /config.json now has build: when the server was built, from pkg/version.BuildTime() (the BuildDate ldflag, which go-server's Makefile already sets).
  • A server back with another build is upgraded. The notification and gs-server-status's tooltip then say it's been rebuilt, with Refresh.
  • Servers whose Makefile doesn't set BuildDate behave as before. The README says how to set it.

A page reads /config.json once. A page reads its config to find the API, then made the controller read it again. ConfigController now takes config, the config the page has read, and starts up with it.

const page = await getConfig();
const changes = new ChangesController(configClient(page));
const config = new ConfigController(changes, { config: page, notifications });
changes.start();

…g a page has read

- /config.json has build, when the server was built, from pkg/version's
  BuildDate, so a frontend knows a server was rebuilt with the same
  version, such as while it's developed
- ConfigController treats a server back with another build as upgraded,
  and says it's been rebuilt
- ConfigController takes the config, as config, which the page has read,
  so it doesn't read /config.json again

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 18:10
@djthorpe djthorpe self-assigned this Nov 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression test can pass despite redundant configuration fetches, and the documented Makefile substitution can leave BuildDate empty.

2 open issues
What changed in this PR

This PR lets frontends detect same-version server rebuilds and offer a page refresh. It also lets ConfigController reuse configuration already loaded by the page, avoiding a duplicate initial request.

Changes:

  • Expose the server’s build timestamp through /config.json.
  • Detect rebuilds and show refresh notifications and status tooltips.
  • Accept preloaded configuration, with updated tests and usage documentation.
File Description
frontend/​test/​config-controller.test.ts Add preloaded-configuration and rebuild tests.
frontend/​src/​config/​view.ts Show rebuild-specific refresh tooltips.
frontend/​src/​config/​schema.ts Add the optional build timestamp.
frontend/​src/​config/​controller.ts Reuse preloaded configuration and detect changed builds.
frontend/​README.md Document build timestamps and configuration reuse.
config/​config.go Include the server build time in configuration responses.
config/​config_test.go Cover the build field in handler responses.

Review effort: Balanced

Comment thread frontend/test/config-controller.test.ts Resolved
Comment thread frontend/README.md Resolved
…DME's build date

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@djthorpe
djthorpe merged commit 1821364 into main Nov 12, 2026
2 checks passed
@djthorpe
djthorpe deleted the djt/1112/config-seed branch November 12, 2026 18:15
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.

2 participants