Skip to content

feat(family-api): add FAMILIES const and family-taxonomy tests#60

Open
kingchenc wants to merge 2 commits into
mainfrom
feat/family-api
Open

feat(family-api): add FAMILIES const and family-taxonomy tests#60
kingchenc wants to merge 2 commits into
mainfrom
feat/family-api

Conversation

@kingchenc
Copy link
Copy Markdown
Owner

Summary

  • Introduces wickra_core::FAMILIES: &[(&str, &[&str])] mapping every built-in indicator to one of 16 families (the same taxonomy already used in README's Indicators table).
  • Adds a family_tests module with two guards:
    • no_duplicates_across_families — every indicator lives in exactly one family.
    • total_count_matches_expected — hard-coded total (214 today) drifts in lockstep with the indicator catalogue. Adding a new indicator without filing it under a family trips this test, surfacing the omission early.
  • Corrects a stale doc comment in crates/wickra-core/src/indicators/mod.rs that claimed modules were grouped by category — they are alphabetical, the canonical taxonomy now lives in FAMILIES.

Why

Today, family membership is duplicated across the README table, the Wiki overview, and per-binding section comments — each maintained by hand. FAMILIES becomes the machine-readable single source of truth that downstream surfaces can be generated from in follow-up work (Python __init__.py, Node index.d.ts, Wiki sidebar, etc.). This PR ships the Rust surface only; binding surfaces are deliberately out of scope.

Scope

  • 2 files touched: crates/wickra-core/src/indicators/mod.rs, crates/wickra-core/src/lib.rs (re-export).
  • No behavioural changes — additive only.
  • 1750 + 2 new tests pass; clippy clean on the four-crate matrix.

kingchenc and others added 2 commits May 27, 2026 13:25
Introduce `wickra_core::FAMILIES`, a `&'static [(&str, &[&str])]` mapping
every built-in indicator to one of 16 families (Moving Averages, Momentum
Oscillators, Trend & Directional, Price Oscillators, Volatility & Bands,
Bands & Channels, Trailing Stops, Volume, Price Statistics, Ehlers /
Cycle (DSP), Pivots & S/R, DeMark, Ichimoku & Charts, Candlestick
Patterns, Market Profile, Risk / Performance).

Two compile-time-anchored guards make sure the const stays trustworthy:
- `no_duplicates_across_families`: no indicator is listed in two families
- `total_count_matches_expected`: hard-coded total bumps in lockstep with
  the indicator catalogue (214 today), so any new indicator added without
  being filed under a family trips the test.

Also corrects the module doc comment which falsely claimed
indicators were grouped by category internally; the `mod` block is
alphabetical, and the canonical taxonomy now lives in `FAMILIES`.
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