refactor: consolidate duplicated helpers into internal/util#92
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
refactor: consolidate duplicated helpers into internal/util#92devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
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
Several tiny helper functions were copy-pasted verbatim across packages. This adds a single generic
internal/utilpackage and replaces all the duplicates with it, removing the local copies.New package
internal/util:Call sites updated:
boolPtr→util.Ptrinconfig/convert.go,service/store/sqlite_store.govalueOrDefault/intOrDefault→util.OrDefault,boolOrDefault→util.Derefinconfig/config.go+config/config_loader.go, andvalueOrDefaultinextension/codex/catalog.gofirstNonEmpty/firstNonEmptyString→util.FirstNonEmptyinprotocol/openai/adapter.go,extension/deepseek_v4/{deepseek_v4,state}.go,service/server/adapter_dispatch.govalueOrDefault(no callers) inservice/provider/manager.goutilhas no imports, so no import cycles are introduced. Behavior is identical —OrDefaultuses the zero value (""/0) as the "empty" sentinel, matching the previous per-type helpers.Testing
go build ./...,go vet ./...cleango test ./...passes (all packages), including newinternal/utilunit testsLink to Devin session: https://app.devin.ai/sessions/2d5f007ca93b447f9171f0bb1fbf757a
Requested by: @ZhiYi-R