Skip to content

refactor: remove unused modes, consolidate ApplyOverrides, add overflow guards#2

Merged
bdchatham merged 1 commit intomainfrom
refactor/cleanup-modes-overrides
Mar 17, 2026
Merged

refactor: remove unused modes, consolidate ApplyOverrides, add overflow guards#2
bdchatham merged 1 commit intomainfrom
refactor/cleanup-modes-overrides

Conversation

@bdchatham
Copy link
Collaborator

Summary

  • Remove ModeRPC and ModeIndexer — they were identical aliases for ModeFull/ModeArchive with zero differentiation
  • Export DefaultSnapshotInterval constant and add SnapshotGenerationOverrides() helper so the controller does not need to duplicate snapshot config knowledge
  • Replace the TOML encode/decode round-trip in ApplyOverrides with direct Registry key lookup + setFieldByPath reflection — the same code path ResolveEnv uses, eliminating ~100 lines (setNestedKey, coerceToType, splitDottedKey)
  • Add overflow guards in setReflectValue for narrower integer types (int32, uint16, uint32) that were previously silently truncated
  • Add 12 new ApplyOverrides tests covering every type path (bool, uint, float, Duration, int64) and error cases (unknown key, invalid values, overflow)

Test plan

  • All existing tests pass
  • New tests cover: string, int, int64, uint64, uint16, uint32, int32, float64, bool, Duration
  • Overflow for uint16 (70000 > 65535), int32 (3B > 2.1B), negative uint all return errors
  • Unknown keys rejected
  • Invalid bool/int/duration values rejected

…ow guards

- Remove ModeRPC and ModeIndexer (identical aliases for ModeFull/ModeArchive)
- Export DefaultSnapshotInterval constant for controller use
- Add SnapshotGenerationOverrides() helper for snapshot-producing nodes
- Replace TOML round-trip in ApplyOverrides with direct Registry+reflection,
  unifying the string-to-typed-value path with ResolveEnv
- Remove setNestedKey, coerceToType, splitDottedKey (no longer needed)
- Add overflow guards in setReflectValue for narrower int/uint types
- Add comprehensive ApplyOverrides tests for every type path and error case
@bdchatham bdchatham force-pushed the refactor/cleanup-modes-overrides branch from 462466d to df21a62 Compare March 17, 2026 00:37
@bdchatham bdchatham marked this pull request as ready for review March 17, 2026 00:38
@bdchatham bdchatham merged commit ed1a95d into main Mar 17, 2026
2 checks passed
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.

1 participant