Skip to content

Comments

Add validation and test coverage for tensorstore_cache_bytes edge cases#60

Merged
rhoadesScholar merged 4 commits intocache_boundfrom
copilot/sub-pr-59
Feb 24, 2026
Merged

Add validation and test coverage for tensorstore_cache_bytes edge cases#60
rhoadesScholar merged 4 commits intocache_boundfrom
copilot/sub-pr-59

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

Addresses unresolved review comments from PR #59 regarding validation and test coverage for tensorstore_cache_bytes parameter edge cases.

Changes

  • Added negative value validation: Raises ValueError when tensorstore_cache_bytes < 0, either from direct parameter or CELLMAP_TENSORSTORE_CACHE_BYTES environment variable

  • Added test coverage for tensorstore_cache_bytes=0: Verifies that zero correctly disables TensorStore's in-memory cache (per TensorStore documentation, total_bytes_limit=0 disables the LRU cache)

  • Added validation tests:

    • Negative parameter values rejected
    • Negative environment variable values rejected
    • Non-integer environment variable values rejected (already implemented, now tested)

Example Usage

# Disable caching entirely
loader = CellMapDataLoader(dataset, tensorstore_cache_bytes=0)

# Negative values now raise clear errors
loader = CellMapDataLoader(dataset, tensorstore_cache_bytes=-100)
# ValueError: tensorstore_cache_bytes must be >= 0 when set; got -100

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…alues

Co-authored-by: rhoadesScholar <37990507+rhoadesScholar@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tensorstore cache bounding in CellMapDataLoader Add validation and test coverage for tensorstore_cache_bytes edge cases Feb 23, 2026
@rhoadesScholar rhoadesScholar marked this pull request as ready for review February 23, 2026 19:56
Copy link
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 addresses unresolved review comments from PR #59 by adding validation and test coverage for tensorstore_cache_bytes parameter edge cases in the CellMapDataLoader. The changes ensure that invalid values (negative numbers, non-integers from environment variables) are properly rejected with clear error messages, and that the special case of zero (which disables caching) is explicitly tested and documented.

Changes:

  • Added validation to reject negative tensorstore_cache_bytes values from both direct parameters and the CELLMAP_TENSORSTORE_CACHE_BYTES environment variable
  • Added test coverage for tensorstore_cache_bytes=0 to verify it correctly disables TensorStore's in-memory cache
  • Added comprehensive validation tests for negative values and invalid environment variable inputs

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/cellmap_data/dataloader.py Added negative value validation check (lines 173-176) and formatting improvements (blank lines)
tests/test_dataloader.py Added 4 new test methods covering zero-byte cache behavior and validation of negative/invalid inputs

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.38%. Comparing base (ea597bf) to head (eeeceb8).
⚠️ Report is 5 commits behind head on cache_bound.

Additional details and impacted files
@@               Coverage Diff               @@
##           cache_bound      #60      +/-   ##
===============================================
+ Coverage        70.28%   70.38%   +0.09%     
===============================================
  Files               28       28              
  Lines             2628     2630       +2     
===============================================
+ Hits              1847     1851       +4     
+ Misses             781      779       -2     

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

@rhoadesScholar rhoadesScholar merged commit 99b745b into cache_bound Feb 24, 2026
12 checks passed
@rhoadesScholar rhoadesScholar deleted the copilot/sub-pr-59 branch February 24, 2026 00:06
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