Skip to content

implement thread safe router#3358

Merged
cody-littley merged 3 commits into
mainfrom
cjl/thread-safe-router
May 4, 2026
Merged

implement thread safe router#3358
cody-littley merged 3 commits into
mainfrom
cjl/thread-safe-router

Conversation

@cody-littley

Copy link
Copy Markdown
Contributor

Describe your changes and provide context

A wrapper implementation of migration.Router that provides necessary thread safety for migration utilities. This was split out from a larger PR.

Testing performed to validate your change

unit tests

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 4, 2026, 2:30 PM

@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.19%. Comparing base (08f440a) to head (e827171).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3358      +/-   ##
==========================================
+ Coverage   59.06%   59.19%   +0.12%     
==========================================
  Files        2098     2098              
  Lines      172968   172474     -494     
==========================================
- Hits       102168   102092      -76     
+ Misses      61933    61533     -400     
+ Partials     8867     8849      -18     
Flag Coverage Δ
sei-chain-pr 81.95% <100.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/state_db/sc/migration/thread_safe_router.go 100.00% <100.00%> (ø)

... and 42 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

// TestInMemoryRouter is a [Router] backed by an in-memory map. The outer map keys
// are store (module) names and the inner map keys are store keys. It does not
// support iteration or proofs.
type TestInMemoryRouter struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks TestInMemoryRouter is named and documented as test infrastructure, but the file is not suffixed _test.go ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed to migration_test_framework_test.go. Name is ugly, but I guess that's go convention. 🤷

// may run concurrently with one another. See [threadSafeRouter] for the
// full concurrency contract, including the iterator caveat.
func NewThreadSafeRouter(router Router) Router {
return &threadSafeRouter{inner: router}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggest add this to match NewModuleRouter and NewRoute

if router == nil {
        return nil, fmt.Errorf("router must not be nil")
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

@cody-littley cody-littley enabled auto-merge May 4, 2026 14:31
@cody-littley cody-littley added this pull request to the merge queue May 4, 2026
Merged via the queue into main with commit 92a4674 May 4, 2026
45 of 54 checks passed
@cody-littley cody-littley deleted the cjl/thread-safe-router branch May 4, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants