Skip to content

fix: remove double usage_count increment in Session.retire()#1816

Open
vdusek wants to merge 1 commit intomasterfrom
fix/session-retire-double-increment
Open

fix: remove double usage_count increment in Session.retire()#1816
vdusek wants to merge 1 commit intomasterfrom
fix/session-retire-double-increment

Conversation

@vdusek
Copy link
Copy Markdown
Collaborator

@vdusek vdusek commented Mar 28, 2026

Summary

  • Session.retire() incremented _usage_count, but callers (mark_good(), mark_bad()) already increment it before calling retire(), causing a double-increment when a session is retired at the usage limit.
  • Removed the redundant _usage_count += 1 from retire().
  • Added tests covering the no-double-increment invariant for mark_good(), mark_bad(), and direct retire() calls.

Test plan

  • Existing session tests pass
  • New tests verify usage_count is incremented exactly once per mark_good()/mark_bad() call, even when retirement is triggered

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Mar 28, 2026
@vdusek vdusek self-assigned this Mar 28, 2026
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Mar 28, 2026
@github-actions github-actions bot added this to the 137th sprint - Tooling team milestone Mar 28, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Mar 28, 2026
@vdusek vdusek requested review from Mantisus and Pijukatel March 28, 2026 09:37
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.24%. Comparing base (02a18ea) to head (3d72b64).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1816   +/-   ##
=======================================
  Coverage   92.23%   92.24%           
=======================================
  Files         157      157           
  Lines       10863    10881   +18     
=======================================
+ Hits        10020    10037   +17     
- Misses        843      844    +1     
Flag Coverage Δ
unit 92.24% <ø> (+<0.01%) ⬆️

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

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@Mantisus Mantisus left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants