From 38b06204b4b3f569dd007c0a8a2174440ad6b70a Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Sat, 5 Dec 2026 13:21:21 +0530 Subject: [PATCH 1/2] fix(admin): report dvm settings changes as restart-required Signed-off-by: Priyanshubhartistm --- .changeset/dvm-settings-restart-required.md | 5 ++++ resources/admin/assets/dashboard.js | 6 +++- resources/default-settings.yaml | 2 ++ .../admin/patch-settings-controller.ts | 10 ++++++- test/unit/routes/admin-settings.spec.ts | 30 +++++++++++++++++++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .changeset/dvm-settings-restart-required.md diff --git a/.changeset/dvm-settings-restart-required.md b/.changeset/dvm-settings-restart-required.md new file mode 100644 index 000000000..05d7321b1 --- /dev/null +++ b/.changeset/dvm-settings-restart-required.md @@ -0,0 +1,5 @@ +--- +"nostream": patch +--- + +The admin settings API and dashboard now report a change to `dvm` settings as restart-required instead of hot-reload. Each DVM orchestrator is started for one entry of `dvm.workers` and keeps the configuration it started with, so a narrowed `kinds` list, a removed worker or a new command was reported as applied while the running orchestrator went on dispatching jobs under the old policy. The default settings file now says the same. diff --git a/resources/admin/assets/dashboard.js b/resources/admin/assets/dashboard.js index ace91f4a2..2a8b26c1b 100644 --- a/resources/admin/assets/dashboard.js +++ b/resources/admin/assets/dashboard.js @@ -901,7 +901,11 @@ } const getReloadBehavior = (path) => { - return path.startsWith('workers.') || path.startsWith('payments') || path.startsWith('network.') + return path.startsWith('workers.') || + path.startsWith('payments') || + path.startsWith('network.') || + path === 'dvm' || + path.startsWith('dvm.') ? 'restart required' : 'hot reload' } diff --git a/resources/default-settings.yaml b/resources/default-settings.yaml index a54965632..20484cf51 100755 --- a/resources/default-settings.yaml +++ b/resources/default-settings.yaml @@ -273,6 +273,8 @@ eventStore: # Only postgres for now. Changing it needs a restart. backend: postgres dvm: + # One orchestrator starts for each worker and keeps the configuration it started with, so a change here needs a + # restart. workers: [] limits: # Every `period` below is a count of milliseconds, and `rate` is how many hits diff --git a/src/controllers/admin/patch-settings-controller.ts b/src/controllers/admin/patch-settings-controller.ts index d01dc9c99..275598d13 100644 --- a/src/controllers/admin/patch-settings-controller.ts +++ b/src/controllers/admin/patch-settings-controller.ts @@ -171,7 +171,15 @@ export class PatchAdminSettingsController implements IController { } const getSettingsReloadBehavior = (path: string): 'hot-reload' | 'restart-required' => { - if (path.startsWith('workers.') || path.startsWith('payments') || path.startsWith('network.')) { + // A DVM orchestrator is started for each of dvm.workers and keeps the configuration it started with, so a change to + // its kinds, command or timeout, or to the list of workers, takes effect at the next start only. + if ( + path.startsWith('workers.') || + path.startsWith('payments') || + path.startsWith('network.') || + path === 'dvm' || + path.startsWith('dvm.') + ) { return 'restart-required' } diff --git a/test/unit/routes/admin-settings.spec.ts b/test/unit/routes/admin-settings.spec.ts index c2e61d7e0..ab843413a 100644 --- a/test/unit/routes/admin-settings.spec.ts +++ b/test/unit/routes/admin-settings.spec.ts @@ -258,6 +258,36 @@ describe('admin settings API', () => { expect(settingsRaw).to.include('enabled: true') }) + describe('which settings need a restart', () => { + const patchSetting = async (path: string, value: unknown) => { + const passwordHash = hashAdminPassword('settings-password') + const baseUrl = await startServer({ + admin: { enabled: true, passwordHash, sessionTtlSeconds: 3600 }, + }) + const cookie = await login(baseUrl) + + return axios.patch( + `${baseUrl}/settings`, + { path, value }, + { headers: { cookie, 'content-type': 'application/json' }, validateStatus: () => true }, + ) + } + + it('reports a change to the DVM workers as restart-required, since each keeps the configuration it started with', async () => { + const response = await patchSetting('dvm.workers', [{ command: 'node', kinds: [5300] }]) + + expect(response.status).to.equal(200) + expect(response.data.reload).to.equal('restart-required') + }) + + it('still reports a setting read on every use as hot-reload', async () => { + const response = await patchSetting('info.name', 'Another relay') + + expect(response.status).to.equal(200) + expect(response.data.reload).to.equal('hot-reload') + }) + }) + describe('the admin password hash', () => { const otherHash = () => hashAdminPassword('another-password') From cd53c11e7f96b47912b76974728eafea9d2ba2c2 Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Sat, 5 Dec 2026 18:12:52 +0530 Subject: [PATCH 2/2] fix(admin): classify a settings path with spaces as it is written Signed-off-by: Priyanshubhartistm --- .changeset/dvm-settings-restart-required.md | 2 +- resources/admin/assets/dashboard.js | 6 +----- src/controllers/admin/patch-settings-controller.ts | 10 +++++++++- test/unit/routes/admin-settings.spec.ts | 7 +++++++ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.changeset/dvm-settings-restart-required.md b/.changeset/dvm-settings-restart-required.md index 05d7321b1..703303223 100644 --- a/.changeset/dvm-settings-restart-required.md +++ b/.changeset/dvm-settings-restart-required.md @@ -2,4 +2,4 @@ "nostream": patch --- -The admin settings API and dashboard now report a change to `dvm` settings as restart-required instead of hot-reload. Each DVM orchestrator is started for one entry of `dvm.workers` and keeps the configuration it started with, so a narrowed `kinds` list, a removed worker or a new command was reported as applied while the running orchestrator went on dispatching jobs under the old policy. The default settings file now says the same. +The admin settings API now reports a change to `dvm` settings as restart-required instead of hot-reload. Each DVM orchestrator is started for one entry of `dvm.workers` and keeps the configuration it started with, so a narrowed `kinds` list, a removed worker or a new command was reported as applied while the running orchestrator went on dispatching jobs under the old policy. The default settings file now says the same. diff --git a/resources/admin/assets/dashboard.js b/resources/admin/assets/dashboard.js index 2a8b26c1b..ace91f4a2 100644 --- a/resources/admin/assets/dashboard.js +++ b/resources/admin/assets/dashboard.js @@ -901,11 +901,7 @@ } const getReloadBehavior = (path) => { - return path.startsWith('workers.') || - path.startsWith('payments') || - path.startsWith('network.') || - path === 'dvm' || - path.startsWith('dvm.') + return path.startsWith('workers.') || path.startsWith('payments') || path.startsWith('network.') ? 'restart required' : 'hot reload' } diff --git a/src/controllers/admin/patch-settings-controller.ts b/src/controllers/admin/patch-settings-controller.ts index 275598d13..6b7a9a87b 100644 --- a/src/controllers/admin/patch-settings-controller.ts +++ b/src/controllers/admin/patch-settings-controller.ts @@ -170,7 +170,15 @@ export class PatchAdminSettingsController implements IController { } } -const getSettingsReloadBehavior = (path: string): 'hot-reload' | 'restart-required' => { +const getSettingsReloadBehavior = (rawPath: string): 'hot-reload' | 'restart-required' => { + // The settings writer trims the path and each of its segments (`' dvm '` names `dvm`), so the path is classified in + // that form. + const path = rawPath + .trim() + .split('.') + .map((segment) => segment.trim()) + .join('.') + // A DVM orchestrator is started for each of dvm.workers and keeps the configuration it started with, so a change to // its kinds, command or timeout, or to the list of workers, takes effect at the next start only. if ( diff --git a/test/unit/routes/admin-settings.spec.ts b/test/unit/routes/admin-settings.spec.ts index ab843413a..3e26088a5 100644 --- a/test/unit/routes/admin-settings.spec.ts +++ b/test/unit/routes/admin-settings.spec.ts @@ -280,6 +280,13 @@ describe('admin settings API', () => { expect(response.data.reload).to.equal('restart-required') }) + it('classifies a path written with spaces the way the settings writer reads it', async () => { + const response = await patchSetting(' dvm . workers ', [{ command: 'node', kinds: [5300] }]) + + expect(response.status).to.equal(200) + expect(response.data.reload).to.equal('restart-required') + }) + it('still reports a setting read on every use as hot-reload', async () => { const response = await patchSetting('info.name', 'Another relay')