Skip to content

feat(node): admin_v1_reload alongside SIGHUP hot-reload (#373) - #381

Merged
alpergundogdu merged 1 commit into
mainfrom
feat/admin-reload
May 1, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
feat/admin-reload

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Summary

  • New jsonrpsee method admin_v1_reload on the existing admin_v1 namespace; calls the same RuntimeReloadState::reload SIGHUP uses, so both paths share the internal mutex (a SIGHUP racing the RPC waits behind it).
  • Two distinct error codes: -32_003 CONFIG_PATH_UNSET (node was started without --config, nothing on disk to re-read) and -32_004 RELOAD_ERROR (parse/resolve/setter failure; previous values retained per the SIGHUP contract).
  • On success returns {rate_per_mb, log_level} so operator scripts confirm the post-reload state without scraping logs.
  • CLI ride-along: decdn node reload prints two grep-friendly lines (or --json), matching the decdn node health shape.

Closes #373.

Test plan

  • cargo nextest run -p decdn-node — 199/199 passing, including:
    • admin_reload_without_hook_returns_config_path_unset
    • admin_reload_applies_and_returns_post_reload_values
    • admin_reload_with_missing_config_returns_reload_error
    • cli_reload_surfaces_connection_refused
    • cli_reload_rejects_zero_timeout
  • cargo clippy -p decdn-node --all-targets -- -D warnings clean.
  • cargo fmt --check clean.
  • decdn node reload --help renders.

🤖 Generated with Claude Code

Expose the same hot-reload path #367 wired to SIGHUP as a JSON-RPC
method on the existing local-admin-http surface. Both call
RuntimeReloadState::reload(); its internal mutex serialises a SIGHUP
racing the RPC, so the two paths queue rather than corrupt state.

The RPC takes no params: the node always reloads the file path it was
started with (admin_v1_reload would otherwise let an operator script
swap in a different config without a restart, which is out of scope
for the SIGHUP-equivalent semantics this method advertises).
- `CONFIG_PATH_UNSET_CODE` (-32_003) when the node was started without
  --config; nothing on disk to re-read.
- `RELOAD_ERROR_CODE` (-32_004) when the underlying reload fails;
  previous values retained, mirroring the SIGHUP "best-effort" contract.
- On success: `{rate_per_mb, log_level}` so operator scripts can
  confirm the post-reload state without scraping logs.

CLI ride-along: `decdn node reload` calls the RPC and prints two
grep-friendly lines (or --json), matching the `decdn node health`
shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces the admin_v1_reload RPC method and a matching decdn node reload CLI command, allowing operators to hot-reload configuration fields such as payment.rate_per_mb and observability.log_level via JSON-RPC. The implementation integrates a ReloadHook into the admin state and ensures consistency between RPC-triggered reloads and SIGHUP signals. I have no feedback to provide.

@alpergundogdu
alpergundogdu merged commit 5f8f703 into main May 1, 2026
10 checks passed
@alpergundogdu
alpergundogdu deleted the feat/admin-reload branch May 1, 2026 11:44
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.

feat(node): expose admin_v1_reload to trigger hot-reload over loopback HTTP

1 participant