refactor: extract duplicated utilities into shared modules#4
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
refactor: extract duplicated utilities into shared modules#4devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Extract duplicated code patterns into three new shared modules in codex-plus-core: - toml_helpers: parse_toml_document, table_mut_or_insert, ensure_trailing_newline, normalize_trimmed_text, unquote_toml_string, unquote_toml_string_simple - json_value: json_string_value, required_json_string, optional_json_string - timestamp: timestamp_millis, timestamp_secs_string Deduplicated across 11 source files: - relay_config.rs, computer_use_guard.rs, settings.rs (TOML helpers) - zed_remote.rs, zed_remote/fallback.rs, zed_remote/registry.rs (JSON) - model_catalog.rs, script_market.rs (mixed) - env_conflicts.rs, user_scripts.rs (timestamp) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Extracts duplicated utility functions scattered across 11 source files into three new shared modules in
codex-plus-core:toml_helpers— TOML document parsing and manipulation:parse_toml_document(contents) -> Result<DocumentMut>(was inrelay_config,settings,computer_use_guard)table_mut_or_insert(doc, key) -> Result<&mut Table>(was inrelay_config,computer_use_guard)ensure_trailing_newline(contents) -> String(was inrelay_config,computer_use_guard)normalize_trimmed_text(contents) -> String(wasnormalize_text_tomlinrelay_config,normalize_text_configinsettings)unquote_toml_string/unquote_toml_string_simple(was inmodel_catalog,relay_configwith different implementations)json_value— JSONValuefield extraction:json_string_value(Option<&Value>) -> String(wasstring_valueinzed_remote,zed_remote/fallback,zed_remote/registry)required_json_string(&Value, key) -> Option<String>(wasrequired_stringinscript_market)optional_json_string(&Value, key) -> String(wasoptional_stringinscript_market)timestamp— Timestamp utilities:timestamp_millis() -> u128(was inrelay_config,env_conflicts)timestamp_secs_string() -> String(wascurrent_unix_timestamp_stringinuser_scripts)Net result: -40 lines (149 added, 189 removed). All existing tests pass; the one pre-existing failure (
settings_store_save_load_roundtrip_preserves_aggregate_relay_settings) also fails onmain.Link to Devin session: https://app.devin.ai/sessions/88fdd12ce3cc41179b2d34e6e5d1fef6
Requested by: @ManhND226677