Skip to content

Conversation

@joe-bowman
Copy link
Contributor

@joe-bowman joe-bowman commented Jul 22, 2025

1. Summary

Fixes #1935

2.Type of change

  • Bug fix (non-breaking change which fixes an issue)

3. Implementation details

  • Move mutex from function to response object.
  • Make it a RWMutex to avoid concurrent reads and writes which could introduce race conditions.
  • Add getter to gate fetch on mutex.
  • Add test.

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced thread safety for concurrent access and JSON serialization of response data to prevent race conditions.
  • Tests

    • Added unit tests validating thread-safe access to response data under concurrent conditions.
  • Chores

    • Updated and pruned dependencies to improve module compatibility and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

## Walkthrough

The changes update the Quicksilver dependency version in `icq-relayer`, remove it from `xcclookup`, and reorganize dependencies there. In `xcclookup`, a read-write mutex was added to the `Response` struct to ensure thread-safe access, with new getter methods returning deep copies. Unit tests were added to verify mutex presence and thread safety during concurrent access. A test was also refined to assert non-nil key fields.

## Changes

| File(s)                                      | Change Summary                                                                                                      |
|----------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| icq-relayer/go.mod                           | Updated `github.com/quicksilver-zone/quicksilver` dependency from `v1.8.0-beta.11` to `v1.9.0`.                     |
| xcclookup/go.mod                             | Removed `github.com/quicksilver-zone/quicksilver` and several cloud, telemetry, and other dependencies; added new testing and utility libs. |
| xcclookup/pkgs/types/rpc.go                  | Added `sync.RWMutex` to `Response` struct; modified `Update` method to use mutex; added thread-safe getters returning deep copies. |
| xcclookup/pkgs/types/rpc_test.go             | Added tests verifying mutex presence and thread-safe concurrent access to `Response` assets.                        |
| xcclookup/pkgs/types/output_test.go          | Modified test to assert non-nil `Messages` and `Assets` fields individually instead of whole struct.                |
| xcclookup/pkgs/services/assets_service_test.go | Changed message access in test from direct field to getter method `GetMessages()`.                                  |
| xcclookup/pkgs/types/output.go               | Updated `outputResponse` to handle nil responses safely and marshal a thread-safe JSON copy of `Response`.          |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant Test as Test (rpc_test.go)
    participant Resp as Response (with RWMutex)
    loop Concurrent Goroutines
        Test->>+Resp: GetAssets()
        Resp-->>-Test: Deep copy of Assets (thread-safe)
    end

Estimated code review effort

2 (~20 minutes)

Possibly related PRs

  • Release v1.9.0 #1931: Broader dependency version bumps and upgrade handler additions related to Quicksilver version updates.

Suggested labels

dependencies, dead-code

Suggested reviewers

  • faddat
  • ajansari95

Poem

In the warren of code, where the quicksilver flows,
A mutex now guards where the shared data grows.
With tests hopping in, no more race to the end—
Each thread gets its carrot, no need to contend!
🥕
—Rabbit, delighted by the peace


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 4b6bd023df768d149b8c14bfa659341a0581d28d and 0dfd54a614791a2356c34756f426a36856f4c0c1.

</details>

<details>
<summary>📒 Files selected for processing (5)</summary>

* `xcclookup/pkgs/services/assets_service_test.go` (1 hunks)
* `xcclookup/pkgs/types/output.go` (3 hunks)
* `xcclookup/pkgs/types/output_test.go` (2 hunks)
* `xcclookup/pkgs/types/rpc.go` (2 hunks)
* `xcclookup/pkgs/types/rpc_test.go` (1 hunks)

</details>

<details>
<summary>🧠 Learnings (3)</summary>

<details>
<summary>📓 Common learnings</summary>

Learnt from: joe-bowman
PR: #1821
File: icq-relayer/go.mod:214-214
Timestamp: 2025-02-16T19:50:23.555Z
Learning: The icq-relayer daemon in the Quicksilver project requires using the local version of the quicksilver module (../) via the replace directive in its go.mod, as it needs to always use the current version from the same repository.


Learnt from: joe-bowman
PR: #1833
File: proto/osmosis/gamm/poolmodels/balancer/v1beta1/tx.proto:4-6
Timestamp: 2025-04-04T13:21:50.558Z
Learning: In the Quicksilver project, some proto files like "amino/amino.proto" are not directly included in the repository but are imported during compilation through buf's dependency resolution mechanism, which pulls them from external dependencies specified in the buf.yaml configuration.


Learnt from: joe-bowman
PR: #1747
File: app/upgrades/v1_7.go:44-49
Timestamp: 2024-11-19T14:54:21.046Z
Learning: In the Quicksilver codebase, panicking in an upgrade handler (e.g., using panic(err) within V010702UpgradeHandler in app/upgrades/v1_7.go) is acceptable to prevent the state from being committed when an error occurs during an upgrade.


</details>
<details>
<summary>xcclookup/pkgs/services/assets_service_test.go (1)</summary>

Learnt from: arhamchordia
PR: quicksilver-zone/quicksilver#1803
File: x/supply/keeper/keeper_test.go:31-66
Timestamp: 2025-01-28T19:03:57.668Z
Learning: Avoid suggesting test cases that duplicate functionality already tested in msg_server_test.go, particularly for module account operations and balance transfers. Focus on unique keeper functionality instead.

</details>
<details>
<summary>xcclookup/pkgs/types/rpc.go (2)</summary>

Learnt from: arhamchordia
PR: quicksilver-zone/quicksilver#1803
File: x/supply/keeper/keeper_test.go:31-66
Timestamp: 2025-01-28T19:03:57.668Z
Learning: Avoid suggesting test cases that duplicate functionality already tested in msg_server_test.go, particularly for module account operations and balance transfers. Focus on unique keeper functionality instead.

Learnt from: joe-bowman
PR: quicksilver-zone/quicksilver#1813
File: icq-relayer/pkg/types/config.go:176-183
Timestamp: 2025-02-03T13:53:37.573Z
Learning: In Go, maps.Values() returns an iterator, not a slice. When using range with maps.Values(), it directly yields the values on each iteration, not indexes.

</details>

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>

* xcclookup/pkgs/types/output_test.go
* xcclookup/pkgs/types/rpc_test.go

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (3)</summary>

<details>
<summary>📓 Common learnings</summary>

Learnt from: joe-bowman
PR: #1821
File: icq-relayer/go.mod:214-214
Timestamp: 2025-02-16T19:50:23.555Z
Learning: The icq-relayer daemon in the Quicksilver project requires using the local version of the quicksilver module (../) via the replace directive in its go.mod, as it needs to always use the current version from the same repository.


Learnt from: joe-bowman
PR: #1833
File: proto/osmosis/gamm/poolmodels/balancer/v1beta1/tx.proto:4-6
Timestamp: 2025-04-04T13:21:50.558Z
Learning: In the Quicksilver project, some proto files like "amino/amino.proto" are not directly included in the repository but are imported during compilation through buf's dependency resolution mechanism, which pulls them from external dependencies specified in the buf.yaml configuration.


Learnt from: joe-bowman
PR: #1747
File: app/upgrades/v1_7.go:44-49
Timestamp: 2024-11-19T14:54:21.046Z
Learning: In the Quicksilver codebase, panicking in an upgrade handler (e.g., using panic(err) within V010702UpgradeHandler in app/upgrades/v1_7.go) is acceptable to prevent the state from being committed when an error occurs during an upgrade.


</details>
<details>
<summary>xcclookup/pkgs/services/assets_service_test.go (1)</summary>

Learnt from: arhamchordia
PR: quicksilver-zone/quicksilver#1803
File: x/supply/keeper/keeper_test.go:31-66
Timestamp: 2025-01-28T19:03:57.668Z
Learning: Avoid suggesting test cases that duplicate functionality already tested in msg_server_test.go, particularly for module account operations and balance transfers. Focus on unique keeper functionality instead.

</details>
<details>
<summary>xcclookup/pkgs/types/rpc.go (2)</summary>

Learnt from: arhamchordia
PR: quicksilver-zone/quicksilver#1803
File: x/supply/keeper/keeper_test.go:31-66
Timestamp: 2025-01-28T19:03:57.668Z
Learning: Avoid suggesting test cases that duplicate functionality already tested in msg_server_test.go, particularly for module account operations and balance transfers. Focus on unique keeper functionality instead.

Learnt from: joe-bowman
PR: quicksilver-zone/quicksilver#1813
File: icq-relayer/pkg/types/config.go:176-183
Timestamp: 2025-02-03T13:53:37.573Z
Learning: In Go, maps.Values() returns an iterator, not a slice. When using range with maps.Values(), it directly yields the values on each iteration, not indexes.

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)</summary>

* GitHub Check: test quicksilver (amd64, windows)
* GitHub Check: test quicksilver (darwin, arm64)
* GitHub Check: test quicksilver (amd64, linux)
* GitHub Check: Analyze
* GitHub Check: lint

</details>

<details>
<summary>🔇 Additional comments (10)</summary><blockquote>

<details>
<summary>xcclookup/pkgs/services/assets_service_test.go (1)</summary>

`358-359`: **LGTM! Proper usage of thread-safe getter method.**

The change from direct field access (`response.Messages`) to the thread-safe getter method (`response.GetMessages()`) aligns with the concurrency improvements in the Response struct and prevents potential race conditions during test execution.

</details>
<details>
<summary>xcclookup/pkgs/types/output.go (3)</summary>

`23-29`: **LGTM! Improved robustness with nil response handling.**

Adding nil response handling prevents potential panics and provides a sensible default with empty messages and assets. This improves the function's defensive programming.

---

`40-40`: **LGTM! Thread-safe message clearing.**

Replacing direct field assignment (`response.Messages = nil`) with the thread-safe `ClearMessages()` method maintains consistency with the new encapsulated access pattern and prevents race conditions.

---

`43-45`: **LGTM! Thread-safe JSON serialization.**

Using `GetJSONSafeCopy()` instead of marshaling the original response directly ensures thread-safe access to the data while excluding the mutex field from JSON output. This is the correct approach for concurrent-safe serialization.

</details>
<details>
<summary>xcclookup/pkgs/types/rpc.go (6)</summary>

`63-63`: **LGTM! Appropriate mutex choice for concurrent access.**

Adding `sync.RWMutex` to the Response struct is the correct solution for the concurrent writes issue. Using RWMutex allows multiple concurrent readers while ensuring exclusive access for writers, which is optimal for this use case.

---

`75-85`: **LGTM! Thread-safe mutation methods integrated properly.**

The Update method correctly uses the new thread-safe `AddMessage` and `AddAsset` methods instead of direct field manipulation, ensuring all modifications are properly synchronized.

---

`88-99`: **LGTM! Proper read-locking with deep copy for thread safety.**

The GetAssets method correctly:
- Uses read lock for concurrent-safe access
- Creates a deep copy to prevent race conditions on the returned data
- Properly releases the lock with defer

This ensures callers receive a snapshot that won't be affected by concurrent modifications.

---

`101-110`: **LGTM! Thread-safe message access with proper copying.**

The GetMessages method correctly uses read locks and creates a copy of the messages slice, preventing race conditions while allowing concurrent read access.

---

`112-145`: **LGTM! Complete set of thread-safe mutation methods.**

All setter and mutator methods properly use write locks to ensure exclusive access during modifications. The API provides comprehensive thread-safe operations for:
- Setting/clearing messages
- Adding individual messages
- Adding assets to specific chains  
- Setting the entire assets map

This gives consumers fine-grained control while maintaining thread safety.

---

`147-169`: **LGTM! Clean JSON serialization without mutex field.**

The GetJSONSafeCopy method and ResponseJSON struct provide a clean solution for JSON marshaling:
- Uses read lock to safely access data
- Returns a struct without the mutex field to avoid serialization issues
- Maintains thread safety during JSON preparation

This is the correct approach for concurrent-safe serialization.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIARgBOAGYAVkgAM3gADwUMBmwKfwxQgHcKdWkAGmj7bAFmdRp6OUhsREpIIXwSMAF8YuZMdGRbSAxHAXaExIA2CvRaWn9ENuQkBw8zKeSNGARhu1Q0SAFsInSssNhqdHhmZAI/aXwvKRy8grIGeV5BSLvHrzUKIPJi5fKFEplGiIDRuWAeW7cP7sajwfBYeAYCTPKTIZj4CSYs64eGQZh4EjZNIUFjodLYXLidH2JjcDwPEkeJbcdFtfjCUShdRtLxpHYAQQW6jRGDQPlkc05ZIp2VQDCuGFI9AeR38aFoYFK5WVNGyAAobAB1ACyKoAlGF8Dx/FIin40AwPKDaNLeYw0K0os1Qe8IY99chMPQjdCJZBSLgaHw2CTFChIwtgU7Qbgab4PZ7lo7Lh4iECWogiSWTZSdu5rHY5YgnZiGF5sEpI2EQsWpGU0vIlRlMrCDPX1ZhSJH/CgimQlNqW8wfq8SXr6Ig0GkSLh5M0fmyKF55IhZLlYDSMPAAF5VgvSe5OxBXfz0Jb4fKFyDFdQILBK7leQ8QQRDEUd9GMcAoHnfg0hwAhiDIZRGgUVh2C4Xh+VA8RcWOeQmCUKhVHULQdAgkwoDgVBDiwAMENIcgqBQpg0KKLgqGKGonBcPCFEIlQ1E0bRdDAQxINMAx4AYAIwH8QFZEoAB6Ih8A0fFaA4Axom0gwLEgcUAElEMYoEN0cAYePwOCJ01aQ4Q8AADFS1MUBzzkidJ8D4JUHKkmS5LQBSKDc9T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XmWSBoW6BriYJyJeXmAGBuBricxKRxKuSuWIIDAHJe2DAABvAwSAGIMuogWAbLaILgRfCoIdmIcgq8TURASdl/OfAwAAXx7b7dLagCbZbbbcyHEvrdEiAA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=quicksilver-zone/quicksilver&utm_content=1936):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
xcclookup/pkgs/types/rpc_test.go (2)

11-23: Basic functionality test is good but could be more specific.

The test verifies that GetAssets works, but the test name suggests it should verify mutex existence. Consider renaming or adding an explicit mutex field check.


30-32: Consider using thread-safe initialization in tests.

The test directly assigns to response.Assets["chain1"] which bypasses the thread-safe Update method. Consider using the Update method or adding a comment explaining why direct assignment is used in tests.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0758178 and 47a2fca.

⛔ Files ignored due to path filters (1)
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • icq-relayer/go.mod (1 hunks)
  • xcclookup/go.mod (0 hunks)
  • xcclookup/pkgs/types/rpc.go (2 hunks)
  • xcclookup/pkgs/types/rpc_test.go (1 hunks)
🧠 Learnings (3)
📓 Common learnings
Learnt from: joe-bowman
PR: quicksilver-zone/quicksilver#1821
File: icq-relayer/go.mod:214-214
Timestamp: 2025-02-16T19:50:23.555Z
Learning: The icq-relayer daemon in the Quicksilver project requires using the local version of the quicksilver module (`../`) via the `replace` directive in its go.mod, as it needs to always use the current version from the same repository.
icq-relayer/go.mod (1)

Learnt from: joe-bowman
PR: #1821
File: icq-relayer/go.mod:214-214
Timestamp: 2025-02-16T19:50:23.555Z
Learning: The icq-relayer daemon in the Quicksilver project requires using the local version of the quicksilver module (../) via the replace directive in its go.mod, as it needs to always use the current version from the same repository.

xcclookup/pkgs/types/rpc_test.go (1)

Learnt from: arhamchordia
PR: #1803
File: x/supply/keeper/keeper_test.go:31-66
Timestamp: 2025-01-28T19:03:57.668Z
Learning: Avoid suggesting test cases that duplicate functionality already tested in msg_server_test.go, particularly for module account operations and balance transfers. Focus on unique keeper functionality instead.

💤 Files with no reviewable changes (1)
  • xcclookup/go.mod
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: joe-bowman
PR: quicksilver-zone/quicksilver#1821
File: icq-relayer/go.mod:214-214
Timestamp: 2025-02-16T19:50:23.555Z
Learning: The icq-relayer daemon in the Quicksilver project requires using the local version of the quicksilver module (`../`) via the `replace` directive in its go.mod, as it needs to always use the current version from the same repository.
icq-relayer/go.mod (1)

Learnt from: joe-bowman
PR: #1821
File: icq-relayer/go.mod:214-214
Timestamp: 2025-02-16T19:50:23.555Z
Learning: The icq-relayer daemon in the Quicksilver project requires using the local version of the quicksilver module (../) via the replace directive in its go.mod, as it needs to always use the current version from the same repository.

xcclookup/pkgs/types/rpc_test.go (1)

Learnt from: arhamchordia
PR: #1803
File: x/supply/keeper/keeper_test.go:31-66
Timestamp: 2025-01-28T19:03:57.668Z
Learning: Avoid suggesting test cases that duplicate functionality already tested in msg_server_test.go, particularly for module account operations and balance transfers. Focus on unique keeper functionality instead.

🔇 Additional comments (3)
xcclookup/pkgs/types/rpc.go (3)

63-63: Excellent addition of thread-safe mutex.

The RWMutex is properly added with JSON exclusion tag, enabling safe concurrent access to the Response struct.


68-69: Proper implementation of write lock in Update method.

The mutex locking is correctly implemented using write locks for exclusive access during updates to Messages and Assets fields.


91-102: Well-implemented thread-safe getter for Assets.

The GetAssets method correctly uses read locks and creates a deep copy to prevent race conditions. The deep copy implementation properly handles the slice of Asset structs.

…ex guarded getters and setters, to ensure thread-safety. Add new struct for JSON marshalling that doesn't include the mutex. Update instance where test was comparing response objects, which is now not possible because of copying locks, so we compare individual values
@codecov
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.63%. Comparing base (e1b5e68) to head (0dfd54a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1936   +/-   ##
=======================================
  Coverage   57.63%   57.63%           
=======================================
  Files         172      172           
  Lines       15268    15268           
=======================================
  Hits         8800     8800           
  Misses       5702     5702           
  Partials      766      766           
Flag Coverage Δ
unittests 57.63% <ø> (ø)

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

🚀 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.

@ajansari95 ajansari95 merged commit ea9bbe9 into main Aug 13, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Xcclookup tests failing on 'concurrent map writes'

3 participants