Skip to content

test(node): cover SIGHUP rejection of restart-required config fields (#499) - #572

Merged
thiras merged 2 commits into
mainfrom
test/sighup-restart-required-fields-499
May 15, 2026
Merged

thiras merged 2 commits into
mainfrom
test/sighup-restart-required-fields-499

Conversation

@thiras

@thiras thiras commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #499. Adds an integration test verifying the SIGHUP config
hot-reload path applies mutable fields (payment.rate_per_mb,
observability.log_level) while rejecting restart-required fields
(network, blockchain, cache, identity, gossip) with an
info-level ignoring change to X (requires restart) notice — never a
silent apply or silent drop.

Before this, the reload unit tests only exercised the diff helpers
directly and the other sighup_signal.rs tests only fed reloadable
sections, so nothing drove a real SIGHUP carrying both a mutable and a
restart-required change in one file — exactly the regression class #499
describes.

What the test covers

All three branches of log_ignored_other_sections::changed, via two
real SIGHUP→reload cycles on a current_thread runtime:

Assertions match the stable section prefix + (requires restart)
suffix, so cosmetic edits to warn_ignored's field lists won't break
the test while misclassification/suppression regressions still will.

Notes

  • The rejection is only observable as a tracing event (restart-required
    fields are never applied to live runtime state), so the test installs
    a buffer-capturing tracing-subscriber. (tracing-subscriber is
    already a normal decdn-node dependency and integration tests can
    use it directly — an earlier revision added a redundant dev-dependency
    that was removed after review.)
  • Module doc now states these tests require cargo nextest's
    per-process isolation — tokio::signal::unix registration is
    process-global.
  • This PR incorporated a multi-agent review pass (code/tests/comments/
    type design); the Critical finding (a previously-vacuous reload-Add devcontainer for secure Claude Code sessions #1
    assertion) drove the three-branch restructure above.

Deferred follow-up

The pinned_hashes-only cache.* suppression negative case
(cache_changed_only_reloadable_fields) guards a logically distinct
property — spurious cache warnings on pin/unpin, not restart-required
rejection — and is better as its own focused test than overloading this
one.

Verification

  • cargo nextest run -p decdn-node --test sighup_signal → 3/3 pass
  • cargo clippy -p decdn-node --tests → clean
  • cargo fmt -- --check → clean

🤖 Generated with Claude Code

…499)

Add an integration test that drives a real SIGHUP carrying both mutable
(payment.rate_per_mb, observability.log_level) and restart-required
(network/blockchain/cache/identity/gossip) changes, asserting the mutable
ones apply while the restart-required ones are rejected with an
info-level "ignoring change to X (requires restart)" notice.

The existing reload unit tests poke the diff helpers directly and the
other tests in this file only feed reloadable sections, so no test
previously exercised the restart-required rejection arm against an OS
signal -- the silent apply/drop regression #499 calls out.

The test exercises all three branches of log_ignored_other_sections'
section diff: reload #1 hits the absent->present no-baseline
conservative-warn path ([network] vs empty baseline) and asserts absent
sections stay silent; reload #2 keeps [network] byte-identical (the
suppression branch must not re-warn) while newly-changed sections each
emit exactly one notice, alongside mutable changes that must still
apply. Assertions match the stable section prefix + "(requires restart)"
suffix so cosmetic warn_ignored field-list edits don't break the test.

Runs on a current_thread runtime with an inline-awaited reload and a
thread-local buffer-capturing subscriber; tracing-subscriber is repeated
as a dev-dependency since integration tests link only the public API +
dev-deps. Module doc notes these tests require nextest's per-process
isolation (tokio signal registration is process-global).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 15, 2026 15:47

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.

Pull request overview

Adds an end-to-end integration test for the node’s SIGHUP hot-reload behavior to prevent regressions where restart-required config changes are silently applied or silently ignored, while ensuring mutable fields continue to hot-apply as expected.

Changes:

  • Added a new sighup_signal integration test that performs two real SIGHUP→reload cycles and asserts (a) mutable fields apply and (b) restart-required section changes emit exactly-once “requires restart” info logs with correct suppression behavior.
  • Added log-capture infrastructure in the test (buffer writer + tracing_subscriber default subscriber) to assert on reload-path tracing output.
  • Added tracing-subscriber to decdn-node dev-dependencies to support the new integration test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/node/tests/sighup_signal.rs Adds an integration test that validates mutable hot-reload + restart-required rejection (via captured tracing logs) across two reload cycles.
crates/node/Cargo.toml Adds a dev-dependency needed by the new integration test to install a buffer-capturing tracing subscriber.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/node/Cargo.toml Resolved
@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 88.93% (was 88.90%, ▲ +0.03%) — 14596/16412 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
5b0de7e 88.93% ▲ +0.03%
526d378 (HEAD) 88.93% ▲ +0.03%

@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 enhances the SIGHUP signal integration tests by adding a new test case that verifies the correct handling of mutable versus restart-required configuration fields. It introduces a BufferWriter to capture tracing events and asserts that changes to restart-required sections are rejected with an informative log message while mutable fields are updated. Additionally, tracing-subscriber was added to the dev-dependencies to support log capturing in tests. I have no feedback to provide.

tracing-subscriber is already a normal [dependencies] entry of
decdn-node. Integration tests have access to the package's normal
dependencies (not only dev-dependencies, as the removed comment
incorrectly claimed), so the duplicate dev-dependency was unnecessary
and risked feature/version drift between the two entries. Verified by
forced recompile of tests/sighup_signal.rs with the dev-dep removed:
3/3 tests still build and pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@thiras
thiras merged commit 63fe8bd into main May 15, 2026
11 checks passed
@thiras
thiras deleted the test/sighup-restart-required-fields-499 branch May 15, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants