Skip to content

Scontext copy#91

Merged
Suhaibinator merged 3 commits intomainfrom
scontextCopy
Jul 12, 2025
Merged

Scontext copy#91
Suhaibinator merged 3 commits intomainfrom
scontextCopy

Conversation

@Suhaibinator
Copy link
Copy Markdown
Owner

No description provided.

@Suhaibinator Suhaibinator requested a review from Copilot July 12, 2025 05:52

This comment was marked as outdated.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.25%. Comparing base (6b6fc6c) to head (697eaad).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Suhaibinator Suhaibinator requested a review from Copilot July 12, 2025 06:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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, and CopySRouterContextOverlay functions in context.go, using the new maps import for flag copying.
  • Add pkg/scontext/copy_test.go with 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 User and Transaction are 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.PathParams after cloning does not affect clonedRC.PathParams, ensuring slice independence.
func TestCloneSRouterContext(t *testing.T) {

Comment thread pkg/scontext/context.go

import (
"context"
"maps"
Copy link

Copilot AI Jul 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Reorder imports to group standard library packages (context, maps, net/http) together and separate third-party imports for consistency.

Copilot uses AI. Check for mistakes.
@Suhaibinator Suhaibinator merged commit 261621e into main Jul 12, 2025
11 checks passed
@Suhaibinator Suhaibinator deleted the scontextCopy branch July 12, 2025 06:03
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.

2 participants