Skip to content

Feature/sets and dicts#88

Merged
adolgert merged 8 commits intodev/sample-contextfrom
feature/sets-and-dicts
Oct 10, 2025
Merged

Feature/sets and dicts#88
adolgert merged 8 commits intodev/sample-contextfrom
feature/sets-and-dicts

Conversation

@adolgert
Copy link
Owner

Add SetOfSets utility and fix hierarchical sampler enabled() methods

Summary

Introduces SetOfSets utility type and fixes enabled() interface across samplers to support hierarchical MultiSampler structures.

Key Changes

New: SetOfSets type

  • Provides read-only unified view over multiple sets implementing AbstractSet interface
  • Avoids memory allocation with lazy iteration
  • Handles empty collections correctly (init=0 in length())

Refactored: enabled() for KeyedPrefixSearch

  • Moved PrefixEnabled from direct.jl to keyedprefixsearch.jl
  • Simplified KeyedRemovalPrefixSearch.enabled() to return keys(kp.index) directly
  • Fixed isenabled() - removed keys aren't in index, no need to check values

Fixed: MultiSampler.enabled()

  • Changed to collect() generator before passing to SetOfSets
  • Fixes type inference when propagators return different enabled set types
  • Matches working pattern from MultipleDirect.enabled()

Tests

Added 46 test assertions for SetOfSets covering iteration, set operations, edge cases, and different types. All tests pass including hierarchical MultiSampler scenarios.

@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 77.60000% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.58%. Comparing base (63345e8) to head (c215f5c).

Files with missing lines Patch % Lines
src/prefixsearch/keyedprefixsearch.jl 55.55% 12 Missing ⚠️
src/sample/multiple_direct.jl 72.41% 8 Missing ⚠️
src/sample/combinednr.jl 80.76% 5 Missing ⚠️
src/trace/track.jl 0.00% 2 Missing ⚠️
src/sample/firstreaction.jl 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@                  Coverage Diff                   @@
##           dev/sample-context      #88      +/-   ##
======================================================
+ Coverage               67.37%   68.58%   +1.20%     
======================================================
  Files                      20       21       +1     
  Lines                     843      955     +112     
======================================================
+ Hits                      568      655      +87     
- Misses                    275      300      +25     

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

@adolgert adolgert merged commit 6686b36 into dev/sample-context Oct 10, 2025
10 checks passed
@adolgert adolgert deleted the feature/sets-and-dicts branch October 10, 2025 12:50
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