Skip to content

fix(config): fail startup on malformed numeric env overrides (#277) - #286

Closed
EnRaiha wants to merge 1 commit into
NodeDB-Lab:mainfrom
EnRaiha:fix/c3-env-numeric-strict
Closed

EnRaiha wants to merge 1 commit into
NodeDB-Lab:mainfrom
EnRaiha:fix/c3-env-numeric-strict

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

NODEDB_DATA_PLANE_CORES=abc (or any non-integer) logged a warning and booted with the compiled default core count — issue #277. A typo in an orchestration substitution silently ran the server at the wrong sizing.

Fix

  • apply_numeric_settings / apply_env_overrides now return Result.
  • Non-integer values → Config error naming the variable and value; main.rs propagates it → startup halt, non-zero exit.
  • Zero is rejected for core/connection counts too.
  • NODEDB_LOG_FORMAT keeps its string-typed warning path (non-numeric, out of scope).
  • Env tests serialized behind a shared lock — parallel test threads raced on std::env state once failures could surface as Err.

How to test

cargo test -p nodedb --lib c3_malformed_env_errors_instead_of_silent_default
cargo test -p nodedb --lib c3_valid_env_still_overrides
cargo test -p nodedb --lib c3_zero_value_rejected

Manual: NODEDB_DATA_PLANE_CORES=abc nodedb -c nodedb.toml → startup error invalid value 'abc' for NODEDB_DATA_PLANE_CORES: expected positive integer, exit non-zero (was: boots with default 5 + warning).

Regression

  • cargo test -p nodedb --lib config::server: 59 passed (env suite, host_ports, wal, checkpoint, timeseries, cluster)

Fixes #277.

…Lab#277)

NODEDB_DATA_PLANE_CORES / NODEDB_MAX_CONNECTIONS with non-integer
values logged a warning and booted with the compiled default — a typo
in orchestration silently ran the server at the wrong sizing.
apply_numeric_settings and apply_env_overrides now return Result;
parse failures produce a Config error naming the variable and value,
and main.rs propagates it (startup halt, non-zero exit). Zero is also
rejected for core/connection counts. NODEDB_LOG_FORMAT keeps its
string-typed warning path (non-numeric, out of scope).
Serializes env tests behind a shared lock: parallel threads raced on
std::env state once failures could surface as Err.
Regression: c3_malformed_env_errors_instead_of_silent_default,
c3_valid_env_still_overrides, c3_zero_value_rejected. Config suite:
59 passed.
Copilot AI lite review requested due to automatic review settings September 4, 2026 11:06
@EnRaiha EnRaiha added the run-ci Opt this PR into the full test suite; re-add to force a re-run label Sep 4, 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@farhan-syah farhan-syah closed this Sep 4, 2026
@EnRaiha EnRaiha reopened this Sep 5, 2026
@EnRaiha EnRaiha closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Opt this PR into the full test suite; re-add to force a re-run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Malformed NODEDB_DATA_PLANE_CORES falls back to defaults instead of failing startup

3 participants