feat: core improvements #32
Merged
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 PR introduces several core improvements to the requestmigrations library focused on performance, API clarity, and robustness.
1. Eager Graph Building (LR-2)
sync.Mapfor thread-safe cache access with minimal lock contentionFinalize()step required—just register and use2. API Surface Reduction (LR-3)
TypeGraphBuilderunexported (typeGraphBuilder) - internal implementation detailrm.For(req)/rm.Bind(req)returns aMigratorrm.For(req).Marshal(&data)/rm.For(req).Unmarshal(body, &data)3. Native Type Migration Validation (ME-3)
ErrNativeTypeMigrationerror for invalid registration attemptsstring,int,bool,float64, etc.[]string,map[string]int,interface{},errortype MyString string,type User struct{},type Tags []string4. Concurrency Improvements
sync.Mutextosync.RWMutexfor better read concurrencysync.Mapfor graph cache (lock-free reads)5. Test Coverage Expansion (LR-5)
Test_MigrationTypeValidationwith 18 test cases covering type validation6. CI Improvements
-raceflag to CI workflow for race condition detectionFiles Changed
requestmigrations.gorequestmigrations_test.gocommon.go.github/workflows/go.ymlutil.goTest Plan