[codex] Introduce config generation storage#39
Merged
Conversation
Add source, overlay, candidate, active, last-good, and compatibility config paths for Mihomo config rendering. Wire init, update, and apply flows through candidate rendering while preserving config.yaml as the runtime entrypoint. Co-Authored-By: Codex GPT-5 <noreply@openai.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a config “generation store” to persist multiple Mihomo config generations (source/overlay/candidate/active/last-good/compat), and routes existing flows (init/update/apply) through candidate rendering + activation so overrides can be applied without mutating the raw subscription config.
Changes:
- Add
ConfigGenerationStorewith well-defined generation paths and seed/activate behaviors. - Switch
ensure_remote_config,update_config, andapplyto rendercandidate.yaml(plusoverlay.yaml) and then activate toactive.yamland runtimeconfig.yaml. - Update tests and README to reflect the new on-disk config state and behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mihoro.rs | Routes config flows through generation seeding, candidate rendering, and activation. |
| src/main.rs | Registers the new config_store module. |
| src/config.rs | Splits override logic into overlay rendering and source→output override rendering. |
| src/config_store.rs | New generation store managing paths, seeding from legacy config.yaml, and candidate activation with last-good backups. |
| README.md | Documents generated config files and runtime config.yaml compatibility. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+318
to
+324
| if let Ok(existing) = fs::read_to_string(path) { | ||
| let existing_value: serde_yaml::Value = serde_yaml::from_str(&existing)?; | ||
| let overlay_value: serde_yaml::Value = serde_yaml::from_str(&serialized_overlay)?; | ||
| if existing_value == overlay_value { | ||
| return Ok(false); | ||
| } | ||
| } |
Comment on lines
+359
to
365
| if let Ok(current_output) = fs::read_to_string(output_path) { | ||
| let raw_value: serde_yaml::Value = serde_yaml::from_str(¤t_output)?; | ||
| let serialized_value: serde_yaml::Value = serde_yaml::from_str(&serialized_mihomo_yaml)?; | ||
| if raw_value == serialized_value { | ||
| return Ok(false); | ||
| } | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Closes #3
Verification