Skip to content

feat(aisle): case-insensitive matching and preserve config order#88

Open
dubadub wants to merge 5 commits intomainfrom
feat/aisle-case-insensitive-and-order
Open

feat(aisle): case-insensitive matching and preserve config order#88
dubadub wants to merge 5 commits intomainfrom
feat/aisle-case-insensitive-and-order

Conversation

@dubadub
Copy link
Member

@dubadub dubadub commented Feb 5, 2026

Summary

  • Make ingredient matching case-insensitive so "Chili flakes" matches "chili flakes" in aisle.conf
  • Preserve aisle.conf category order in shopping lists instead of sorting alphabetically
  • Preserve ingredient order within each category to match aisle.conf order

Details

Case-insensitive matching

Previously, aisle ingredient matching was case-sensitive, which caused issues when recipes used different casing than the aisle.conf file (e.g., "Chili flakes" vs "chili flakes"). This is now fixed by storing lowercase keys in the ingredients_info() HashMap and using lowercase lookups.

This brings aisle matching in line with pantry matching, which was already case-insensitive.

Preserve config order

Previously, CategorizedIngredientList used BTreeMap which sorted categories alphabetically. Users expected categories to appear in the same order as their aisle.conf file.

This is fixed by:

  • Adding indexmap dependency for insertion-order preservation
  • Pre-creating category buckets in aisle.conf order in categorize()
  • Changing CategorizedIngredientList.categories from BTreeMap to IndexMap

Preserve ingredient order within categories

Previously, ingredients within each category were sorted alphabetically. Now ingredients appear in the order they are listed in the aisle.conf file.

This is fixed by:

  • Changing IngredientList from BTreeMap to IndexMap
  • Rewriting categorize() to iterate through aisle.conf ingredients in order

Test plan

  • Added case_insensitive_lookup test in aisle.rs
  • Added test_categorize_preserves_aisle_order test
  • Added test_categorize_case_insensitive test
  • Added test_use_common_names_case_insensitive test
  • Added test_ingredients_preserve_aisle_order_within_category test
  • All existing tests pass

- Make ingredient matching case-insensitive so "Chili flakes" matches
  "chili flakes" in aisle.conf (consistent with pantry behavior)
- Preserve aisle.conf category order in shopping lists instead of
  sorting alphabetically
- Add indexmap dependency for insertion-order preservation
- Add tests for both behaviors
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 5, 2026

commit: 3ece701

Use --install-strategy=nested to avoid npm hoisting issues with
platform-specific optional dependencies (rollup required by vitest).

See: npm/cli#4828
Ingredients within each category now appear in the same order as they
are listed in the aisle.conf file, not alphabetically.

Changed IngredientList from BTreeMap to IndexMap and rewrote
categorize() to iterate through aisle.conf ingredients in order.
@dubadub dubadub force-pushed the feat/aisle-case-insensitive-and-order branch from 2c2b5a3 to 95dcf15 Compare February 5, 2026 17:27
Fixes mismatched_lifetime_syntaxes warnings by adding '_ to Cow return types.
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.

1 participant