You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This update introduces enhanced validation logic for logistics configuration parameters, ensuring that settings adhere to defined constraints and improving the robustness of the configuration handling. This change is crucial for preventing runtime errors that could arise from invalid configuration values.
Changes
Validation and Sanitization Logic:
Added comprehensive validation for various logistics configuration parameters, including limits on speed, energy, and outputs.
Introduced sanitization methods to replace invalid configuration values with sensible defaults, ensuring the application remains stable.
Error Messaging:
Improved error handling with descriptive messages when configuration values do not meet the expected criteria, facilitating easier debugging.
Unit Tests:
Implemented extensive unit tests to verify the correctness of the new validation logic, ensuring resilience against invalid configurations.
Tests cover scenarios such as rejection of invalid values, boundary condition acceptance, and sanitization of configuration fields.
Notes
Ensure that existing configurations are reviewed post-update, as the added validation could lead to previously accepted values being rejected.
This PR extends LogisticsConfig with validation and sanitization capabilities. The ConfigEntry record is enhanced with a validator field. The command registry (ENTRIES) is updated so each quarry, pipe, and engine setting registers both a parser and validator enforcing numeric bounds, finiteness, and cross-field constraints. Configuration loading now sanitizes inputs by validating fields, replacing invalid values with defaults while logging warnings, and normalizing interdependent ranges. A new test suite validates the enforcement of these constraints and the sanitization behavior.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title accurately and concisely describes the main changes: adding validation and sanitization for logistics config fields, which aligns with the core modifications in the changeset.
Description check
✅ Passed
The description is directly related to the changeset, covering validation logic, sanitization methods, error handling, and test coverage—all aspects present in the code changes.
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.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches📝 Generate docstrings
Create stacked PR
Commit on current branch
🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch fix-runtime-config-validation
Comment @coderabbitai help to get the list of available commands and usage tips.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This update introduces enhanced validation logic for logistics configuration parameters, ensuring that settings adhere to defined constraints and improving the robustness of the configuration handling. This change is crucial for preventing runtime errors that could arise from invalid configuration values.
Changes
Validation and Sanitization Logic:
Error Messaging:
Unit Tests:
Notes