Skip to content

refactor(dataset): replace available_segment_count property with get_available_segment_count(session) - #42523

Merged
asukaminato0721 merged 4 commits into
langgenius:mainfrom
Ultroncn:refactor/dataset-available-segment-count
Sep 21, 2026
Merged

asukaminato0721 merged 4 commits into
langgenius:mainfrom
Ultroncn:refactor/dataset-available-segment-count

Conversation

@Ultroncn

Copy link
Copy Markdown

Related issue

Part of #40372

Summary

Dataset.available_segment_count is the last @property in api/models/dataset.py that reads from the global db.session. This PR replaces it with an explicit-session method, matching the get_* convention already used by all its neighbors.

  • Removes the @property decorator and renames to get_available_segment_count(self, *, session: Session) -> int.
  • Passes the caller-provided session to session.scalar(...) instead of db.session.scalar(...).
  • Updates the existing container integration test to call the method with session=db_session_with_containers.

This is a narrowly scoped, non-overlapping slice. available_segment_count has exactly two references in the repository: its definition and the integration test. No other open PR touches this symbol. The neighboring refactor PR #41647 explicitly leaves this symbol out of scope.

Scope and compatibility

  • No production callers exist outside the test file.
  • The query, filter conditions, and return type are unchanged.

Verification

  • Updated test passes with the new method signature.
  • No other test references available_segment_count.
  • Ruff lint and format check pass on the two changed files.

From Claude Code

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 65.12% 65.12% +0.00%
Strict coverage 64.73% 64.73% +0.00%
Typed symbols 47,503 47,505 +2
Untyped symbols 25,596 25,595 -1
Modules 3430 3430 0

@codecov

codecov Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.58%. Comparing base (9a0961a) to head (bbad351).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #42523   +/-   ##
=======================================
  Coverage   87.58%   87.58%           
=======================================
  Files        5471     5471           
  Lines      318391   318384    -7     
  Branches    63816    63813    -3     
=======================================
- Hits       278871   278866    -5     
+ Misses      34129    34127    -2     
  Partials     5391     5391           
Flag Coverage Δ
api 87.27% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asukaminato0721
asukaminato0721 added this pull request to the merge queue Sep 21, 2026
Merged via the queue into langgenius:main with commit 9089ed4 Sep 21, 2026
48 checks passed
@Ultroncn
Ultroncn deleted the refactor/dataset-available-segment-count branch October 28, 2026 16:20
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