Skip to content

Conversation

@neilhuang007
Copy link

  • Use default values when config options are missing instead of throwing
  • Regenerate config automatically when options are missing or malformed
  • Add TRUNCATE_EXISTING to prevent leftover data from corrupting config
  • Remove System.exit(1) on config parse errors to allow recovery

Fixes #115

- Use default values when config options are missing instead of throwing
- Regenerate config automatically when options are missing or malformed
- Add TRUNCATE_EXISTING to prevent leftover data from corrupting config
- Remove System.exit(1) on config parse errors to allow recovery

Fixes imthosea#115
Copilot AI review requested due to automatic review settings December 25, 2025 00:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the robustness of config file loading by implementing graceful degradation when config files are missing or partially corrupted. Instead of crashing the application with System.exit(1), the system now logs errors, uses default values, and automatically regenerates the config file.

Key changes:

  • Removed System.exit(1) call when config file loading fails completely
  • Added tracking for missing config options via hasMissingOptions flag
  • Config regeneration now triggers for missing options in addition to version mismatches
  • Added TRUNCATE_EXISTING flag to prevent partial writes from corrupting config files

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ConfigLoadContext.java Added hasMissingOptions flag, replaced crash on parse failure with null return and warning logs for missing options
Config.java Updated config regeneration condition to include missing options and added TRUNCATE_EXISTING to prevent partial file corruption

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

@imthosea imthosea closed this Dec 28, 2025
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.

2 participants