Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
==========================================
+ Coverage 97.17% 97.25% +0.08%
==========================================
Files 18 18
Lines 2369 2369
==========================================
+ Hits 2302 2304 +2
+ Misses 55 53 -2
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds utilities to deep-copy SRouterContext between Go contexts, along with comprehensive tests, and updates indirect dependencies.
- Introduce
cloneSRouterContext,CopySRouterContext, andCopySRouterContextOverlayfunctions incontext.go, using the newmapsimport for flag copying. - Add
pkg/scontext/copy_test.gowith extensive tests covering context copying, overlay behavior, independence, and nil-handling cases. - Bump versions for indirect dependencies in
go.mod(golang.org/x/text, github.com/prometheus/procfs, golang.org/x/sys).
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/scontext/context.go | Added context copy helpers and imported maps to deep-copy flag maps |
| pkg/scontext/copy_test.go | Added tests for CopySRouterContext, CopySRouterContextOverlay, and cloneSRouterContext behaviors |
| go.mod | Updated indirect dependency versions |
Comments suppressed due to low confidence (2)
pkg/scontext/context.go:500
- [nitpick] Clarify in the doc comment that only flags and path params are deep-copied, while other fields like
UserandTransactionare copied by reference.
// cloneSRouterContext creates a deep copy of an existing SRouterContext.
pkg/scontext/copy_test.go:311
- Add a test case to verify that modifying
srcRC.PathParamsafter cloning does not affectclonedRC.PathParams, ensuring slice independence.
func TestCloneSRouterContext(t *testing.T) {
|
|
||
| import ( | ||
| "context" | ||
| "maps" |
There was a problem hiding this comment.
[nitpick] Reorder imports to group standard library packages (context, maps, net/http) together and separate third-party imports for consistency.
No description provided.