Relationships
#4604 serve: swamp serve reload changes grant mode, grant sources and explicit-grant rules, and removes admins, without a restart
Opened by stack72 · 11/10/2026· Shipped 11/11/2026
Split out of #4602, part of #4439: everything in serve.yaml except the listener, the auth mode and the datastore should change with swamp serve reload, not a restart.
grant-reload, the grants file and directory and the explicit-grant rules are still marked "not applied by reload yet; restart serve to change it" in the setting catalogue (src/serve/serve_settings_reload.ts), and every auth.admins change needs a restart. This issue makes them reloadable, except adding an admin, through the validated reload path #4588 built (a refused serve.yaml changes nothing).
Scheduling on or off, max-concurrent-scheduled-runs and the timed services moved to #4633.
Grant reload mode
PolicySnapshotLoadertakes the mode in its constructor and subscribes to access-model events only in auto. It needs asetModethat adds or removes those subscriptions while rebuilds may be scheduled.- The grants directory poller is built only when the mode is auto, or on a v3 datastore. Switching from manual to auto on a non-v3 serve has to build and start it, and auto to manual stops it. v3 serves keep theirs for the commits made by the lease holder.
- The poller's handling of empty-source deletes depends on whether it has started.
Grant sources and explicit-grant rules
Also reload grants-file, grants-dir, auth.approve-requires-explicit-grant, auth.signal-requires-explicit-grant and auth.tag-requires-explicit-grant. They belong with grant reload mode: a changed grants source re-points the loader and poller, and the explicit-grant rules change what the policy snapshot authorizes.
Removing an admin
Adding an admin stays a deliberate restart. Removing one should apply on reload: auth.admins losing a name revokes that admin's grant-config-* grant through materializeAdmins and reloads the policy snapshot. It belongs here because admin authority comes only from grants:
- the revocation is a grant write under
commitGrantWritesthat must run on the instance leading grant writes (applyGrantConfigAtLead), and the report must not say applied until it has landed; - in team mode an instance that has not reloaded and then takes the lead re-materialises from its own file and would reactivate the grant, so the removal has to persist past a change of leader;
- swapping one admin for another must apply the removal even though the addition waits for a restart, without tripping the at-least-one-admin startup check.
Tests
- Grant mode manual to auto picks up a grant file without a restart; auto to manual stops the poller.
- A changed grants file or directory is loaded on reload; a refused source keeps its stored grants, as at startup.
- Turning an explicit-grant rule on or off changes what the next request is allowed.
- Removing an admin by reload revokes their grant before the report says applied; their next admin request is refused.
- Team mode: a removed admin's grant stays revoked after a change of leader, including when the new leader has not reloaded.
- Swapping one admin for another applies the removal and reports the addition as needing a restart.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.