Skip to content

Rename DataStorage.Store/StoreIfAbsent to Upsert/Create#4476

Merged
yrobla merged 1 commit intomainfrom
issue-4220-v3
Apr 1, 2026
Merged

Rename DataStorage.Store/StoreIfAbsent to Upsert/Create#4476
yrobla merged 1 commit intomainfrom
issue-4220-v3

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Apr 1, 2026

Summary

Clarifies the semantic distinction between the two write operations: Upsert (unconditional overwrite) vs Create (atomic set-if-absent), making the difference visible at the call site without reading docs.

Also remove Exists from the interface.

Fixes #4220

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

@yrobla yrobla requested a review from Copilot April 1, 2026 07:12
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Apr 1, 2026
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 renames the DataStorage write operations to better communicate semantics at call sites: Upsert for unconditional overwrite and Create for atomic set-if-absent.

Changes:

  • Renamed DataStorage.StoreUpsert and DataStorage.StoreIfAbsentCreate.
  • Updated LocalSessionDataStorage and RedisSessionDataStorage implementations to match the new interface.
  • Updated DataStorage contract tests to use the new method names.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pkg/transport/session/session_data_storage.go Renames DataStorage interface methods and updates the contract wording.
pkg/transport/session/session_data_storage_local.go Renames Local implementation methods to Upsert/Create.
pkg/transport/session/session_data_storage_redis.go Renames Redis implementation methods to Upsert/Create and updates docs.
pkg/transport/session/session_data_storage_test.go Updates contract tests to use Upsert/Create.
Comments suppressed due to low confidence (1)

pkg/transport/session/session_data_storage.go:29

  • The PR description says “Fixes #4220”, but issue #4220 is about adding operator unit tests for horizontal scaling behaviors; this change is a session DataStorage rename. Please verify the linked issue is correct so the merge doesn’t auto-close an unrelated issue.
//   - Upsert creates or overwrites the metadata for id, refreshing the TTL.
//   - Load retrieves metadata and refreshes the TTL (sliding-window expiry).
//     Returns ErrSessionNotFound if the session does not exist.
//   - Delete removes the session. It is not an error if the session is absent.
//   - Close releases any resources held by the backend (connections, goroutines).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.67%. Comparing base (1bcf16b) to head (43069c0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4476   +/-   ##
=======================================
  Coverage   69.67%   69.67%           
=======================================
  Files         494      494           
  Lines       50434    50422   -12     
=======================================
- Hits        35139    35132    -7     
+ Misses      12600    12598    -2     
+ Partials     2695     2692    -3     

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

@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 1, 2026
@yrobla yrobla requested a review from Copilot April 1, 2026 07:33
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/XS Extra small PR: < 100 lines changed size/S Small PR: 100-299 lines changed labels Apr 1, 2026
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Clarifies the semantic distinction between the two write operations:
Upsert (unconditional overwrite) vs Create (atomic set-if-absent),
making the difference visible at the call site without reading docs.

Also remove Exists from the interface
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 1, 2026
@yrobla yrobla merged commit 8b7c40e into main Apr 1, 2026
42 of 43 checks passed
@yrobla yrobla deleted the issue-4220-v3 branch April 1, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write unit tests for horizontal scaling operator behaviors (THV-0047)

4 participants