Skip to content

Config Module - #172

Merged
mstdokumaci merged 2 commits into
mainfrom
config-module
Aug 1, 2026
Merged

mstdokumaci merged 2 commits into
mainfrom
config-module

Conversation

@mstdokumaci

@mstdokumaci mstdokumaci commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added centralized configuration state covering server, authentication, security, logging, and performance settings.
    • Added default values and cleanup support for configuration data.
  • Documentation

    • Updated configuration and security documentation to reflect reorganized configuration sources and test locations.
  • Refactor

    • Separated configuration state from loading and validation while preserving existing behavior.
    • Updated application components and tests to use the reorganized configuration structure.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 919cff4c-35ce-47e3-aa7c-0e3196beb87e

📥 Commits

Reviewing files that changed from the base of the PR and between 96d3249 and b66e7bc.

📒 Files selected for processing (3)
  • src/schema/test_helpers.zig
  • src/storage_engine/write_worker_perf_test.zig
  • src/storage_engine_test_helpers.zig
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/storage_engine_test_helpers.zig
  • src/storage_engine/write_worker_perf_test.zig

📝 Walkthrough

Walkthrough

The configuration model moves to src/config/state.zig. Loading remains in src/config/loader.zig. Consumers, tests, and specifications now use the split module paths.

Changes

Configuration module split

Layer / File(s) Summary
Configuration state model
src/config/state.zig
Adds public configuration types, defaults, and Config.deinit resource cleanup.
Loader state ownership
src/config/loader.zig
Imports Config from state.zig and preserves loading, substitution, construction, and validation behavior.
Consumers, tests, and documentation
src/server.zig, src/message_handler.zig, src/storage_engine.zig, src/storage_engine/*, src/schema/test_helpers.zig, src/config/*_test.zig, src/test_all.zig, specs/implementation/*
Updates imports, test paths, and documentation references for the split configuration modules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the main change: restructuring the configuration code into a dedicated module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
src/schema/test_helpers.zig (1)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the state-module name for all three aliases.

config_loader points to config/state.zig at all three sites. Rename each alias to config_state and update the corresponding Config.PerformanceConfig reference.

  • src/schema/test_helpers.zig#L3-L3: rename the alias and update its use at Line 311.
  • src/storage_engine_test_helpers.zig#L3-L3: rename the alias and update its use at Line 369.
  • src/storage_engine/write_worker_perf_test.zig#L4-L4: rename the alias and update its use at Line 137.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/schema/test_helpers.zig` at line 3, Rename the config/state.zig import
alias from config_loader to config_state in src/schema/test_helpers.zig (lines
3-3), src/storage_engine_test_helpers.zig (lines 3-3), and
src/storage_engine/write_worker_perf_test.zig (lines 4-4); update each
corresponding Config.PerformanceConfig reference at lines 311, 369, and 137 to
use config_state.
src/config/state.zig (1)

75-115: 🩺 Stability & Availability | 🔵 Trivial

Confirm memory-safety coverage for the new deinit.

deinit now owns cleanup of every allocated field previously handled inline in loader.zig. As per coding guidelines, run bun run test:safe periodically after Zig changes to detect memory-safety regressions, since this method is the sole place that must stay in sync with every allocation site in loader.zig.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/config/state.zig` around lines 75 - 115, Run bun run test:safe after the
deinit changes and use any reported failures to verify that Config.deinit
releases every allocation formerly cleaned up inline in loader.zig. Keep
Config.deinit as the single cleanup path and update it only if the safety checks
identify missing or invalid deallocation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/config/state.zig`:
- Around line 75-115: Run bun run test:safe after the deinit changes and use any
reported failures to verify that Config.deinit releases every allocation
formerly cleaned up inline in loader.zig. Keep Config.deinit as the single
cleanup path and update it only if the safety checks identify missing or invalid
deallocation.

In `@src/schema/test_helpers.zig`:
- Line 3: Rename the config/state.zig import alias from config_loader to
config_state in src/schema/test_helpers.zig (lines 3-3),
src/storage_engine_test_helpers.zig (lines 3-3), and
src/storage_engine/write_worker_perf_test.zig (lines 4-4); update each
corresponding Config.PerformanceConfig reference at lines 311, 369, and 137 to
use config_state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 450489f1-ff9b-4a1b-a491-2356e29eea00

📥 Commits

Reviewing files that changed from the base of the PR and between b0ee3aa and 96d3249.

📒 Files selected for processing (14)
  • specs/implementation/config-grammar.md
  • specs/implementation/security.md
  • src/config/loader.zig
  • src/config/loader_property_test.zig
  • src/config/loader_test.zig
  • src/config/state.zig
  • src/message_handler.zig
  • src/schema/test_helpers.zig
  • src/server.zig
  • src/storage_engine.zig
  • src/storage_engine/write_worker.zig
  • src/storage_engine/write_worker_perf_test.zig
  • src/storage_engine_test_helpers.zig
  • src/test_all.zig

@mstdokumaci
mstdokumaci merged commit 9d7f99e into main Aug 1, 2026
8 checks passed
@mstdokumaci
mstdokumaci deleted the config-module branch August 1, 2026 07:18
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