Skip to content

Add map_feature_names method#202

Merged
juharris merged 8 commits intomainfrom
copilot/add-filter-features-method
Apr 7, 2026
Merged

Add map_feature_names method#202
juharris merged 8 commits intomainfrom
copilot/add-filter-features-method

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Adds a method that filters features by constraints/preferences and returns Vec<Option<String>> preserving input order — None for filtered-out features, Some(canonical_name) for kept ones. Unlike get_filtered_feature_names which collapses the result, this preserves positional correspondence with the input.

Rust Core

  • Trait (provider_trait.rs): Added filter_features to OptionsRegistry
  • OptionsProvider (provider_impl.rs): Implemented with same constraint/alias logic as get_filtered_feature_names, pushing None instead of skipping
  • OptionsWatcher (watcher.rs): Delegation to inner provider
  • Tests (test_provider.rs): Covers no-filter, partial filter, reversed order, and empty input cases
let result = provider.filter_features(&["a", "b"], Some(&preferences))?;
// [None, Some("B")] — "a" filtered out by constraints, "b" kept as canonical "B"

JavaScript (NAPI)

  • filterFeatures(featureNames, preferences?)Array<string | null> on both OptionsProvider and OptionsWatcher

Python (PyO3)

  • filter_features(feature_names, preferences?)List[Optional[str]] on both OptionsProvider and OptionsWatcher
  • Also added the previously missing get_filtered_features method to both providers
  • Updated .pyi type stubs

Ruby (Magnus)

  • filter_features(feature_names, preferences)Array[String?] on both OptionsProvider and OptionsWatcher
  • Registered methods in the init function
  • Updated .rbs and .rbi type signatures

Returns Vec<Option<String>> preserving input order:
- None for filtered-out features
- Some(canonical_name) for kept features

Implemented in OptionsProvider, OptionsWatcher, with tests.

Agent-Logs-Url: https://github.com/juharris/optify/sessions/ec068ee7-5519-499c-959f-e336067d565f

Co-authored-by: nuharris <273340593+nuharris@users.noreply.github.com>
Copilot AI changed the title [WIP] Add method to filter features and provide extra details Add filter_features method to OptionsRegistry trait Apr 7, 2026
Copilot AI requested a review from nuharris April 7, 2026 05:00
@juharris juharris self-assigned this Apr 7, 2026
Comment thread rust/optify/src/provider/provider_trait.rs
- JS: filterFeatures on OptionsProvider and OptionsWatcher (returns Array<string | null>)
- Python: filter_features and get_filtered_features on both provider and watcher, with type stubs
- Ruby: filter_features on both provider and watcher, with method registration and type signatures

Agent-Logs-Url: https://github.com/juharris/optify/sessions/da2ca01f-9506-474e-99f8-f5e7a564fedf

Co-authored-by: nuharris <273340593+nuharris@users.noreply.github.com>
Copilot AI changed the title Add filter_features method to OptionsRegistry trait Add filter_features method to OptionsRegistry trait and all language bindings Apr 7, 2026
Copilot AI requested a review from nuharris April 7, 2026 15:38
@juharris juharris changed the title Add filter_features method to OptionsRegistry trait and all language bindings Add map_feature_names method Apr 7, 2026
@juharris juharris marked this pull request as ready for review April 7, 2026 18:49
@juharris juharris enabled auto-merge (squash) April 7, 2026 21:34
@juharris juharris disabled auto-merge April 7, 2026 21:34
@juharris juharris merged commit b00ecf3 into main Apr 7, 2026
19 checks passed
@juharris juharris deleted the copilot/add-filter-features-method branch April 7, 2026 21:34
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.

Add method to filter features and provide extra details

3 participants