Repository navigation
refactor: Name IndyMath stream hubs after their Series operators - #2448
Conversation
IndyMath stream hubs drop the To...Hub form and take the Series name, so `barHub.ToEmaHub(12).Minus(barHub.ToEmaHub(26))` reads like its Series twin `bars.ToEma(12).Minus(bars.ToEma(26))`. The receiver picks the style: a hub gets a hub, a series gets a series. Buffer lists keep To...List, since a list receiver would bind to the Series method. One method name now serves two catalog styles, so IndicatorListing.GetMethodOverloads() keeps the overloads that return the listing's style. Closes #2439
|
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
| Duplication | 0 |
🟢 Coverage 98.55% diff coverage · -0.01% coverage variation
Metric Results Coverage variation ✅ -0.01% coverage variation Diff coverage ✅ 98.55% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (9fd8a98) 20766 20294 97.73% Head commit (6ec4ca1) 20811 (+45) 20335 (+41) 97.71% (-0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#2448) 69 68 98.55% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Six non-blocking findings, none critical. The rename itself is complete and consistent: no old To…Hub IndyMath name remains anywhere in the repository, and the hub and Series overloads cannot collide at a call site (no type implements both IReadOnlyList<T> and IChainProvider<T>). CI had no failures when this review ran; the unit, regression, and NativeAOT jobs were still pending.
Notes
- The no-shim decision holds. The IndyMath hub files were first committed on 2026-11-05, after the 3.0.4 release on 2026-10-22, so none of the old names shipped.
- The docs parity test only reads
*.Series.csand Series listings, so it is unaffected by the new shared names. ListingExecutorstill reads every overload and separates Series from hub overloads by argument type (Accepts), so execution does not depend on the new filter.- I could not build or run the tests in this review; the pending CI jobs are the check.
🤖 Prompt for AI Agents (all)
Validate findings against the current codebase and fix confirmed issues.
Use live analysis to confirm or refute each; do not rely on prior memory.
Reply succinctly to each review comment with disposition and rationale.
In `tools/baselining/IndicatorExecutor.cs`:
- Around line 72–87: The method lookup matches by name, parameter count and
InputShapeMatches only. Confirm that IndyMath scalar Series listings (for
example PLUS) also match the same-named IChainProvider hub overloads. If so,
select the method from listing.GetMethodOverloads() or require an
IReadOnlyList<> return type so a hub overload is never invoked.
In `src/Common/Catalog/CatalogMethodResolver.cs`:
- Around line 95–112: Confirm that Stoch.ToStoch has a Series overload set and
a StochHub-returning overload, and that GetOverloads(name, Style.Series) now
excludes the hub one. If so, add a test in
tests/PublicApi/Catalog.MethodOverloads.Tests.cs asserting the STOCH Series
overloads all return IReadOnlyList<StochResult>.
- Around line 120–151: GetStyle duplicates the return-shape walk in
GetResultType. Confirm both match the same three shapes, then extract one
private helper returning the matched generic type and have both methods
use it without changing behavior or trim/AOT safety.
In `src/Common/Catalog/Schema/IndicatorListing.cs`:
- Around line 110–111: Make the <returns> text say the overloads of the
listing's own style are returned, or every overload when none matches.
In `docs/utilities/catalog.md`:
- Around line 75: Update the GetMethodOverloads() sentence to describe the
style filter and the fallback to all overloads.
In `.agents/skills/indicator-catalog/SKILL.md`:
- Around line 37: Keep the IndyMath exception note here, then mirror it in
the files named below.
In `src/AGENTS.md`, `.agents/skills/indicator-stream/SKILL.md` and
`.coderabbit.yaml`:
- File-level: Find the statements that every stream hub entry point is named
To{Name}Hub. Confirm they still hold for IndyMath operators; if not, add a
short exception saying IndyMath hubs reuse the Series operator name.
In `tests/PublicApi/Catalog.MethodOverloads.Tests.cs`:
- Around line 40–51: Confirm no test exercises the Buffer arm of GetStyle or
the all-overloads fallback in CatalogMethodResolver.GetOverloads(name, style).
If so, add tests: a Buffer listing returns only BufferList<> overloads, and a
listing with a style no overload returns gets every overload.
Reviewed by the FaciōQuō swarm
Findings outside the diff
These lines are not in the diff, so they could not take an inline comment.
tools/baselining/IndicatorExecutor.cs line 72-87 (NON-CRITICAL)
The baselining tool picks the Series method by name, parameter count, and whether the second parameter is an IReadOnlyList<>. Before this PR the scalar IndyMath stream hubs had distinct names (ToPlusHub, ToRollingMaxHub), so nothing else matched. Now Plus(IChainProvider<IReusable>, double) and RollingMax(IChainProvider<IReusable>, int) pass the same filter as the Series overloads for every scalar listing (PLUS, MINUS, TIMES, DIVIDED-BY, PLUS-PERCENT, ROLLING-MAX, ROLLING-MIN, ROLLING-MEDIAN). FirstOrDefault then returns whichever overload reflection lists first, which the runtime does not guarantee. If that is a hub overload, Invoke fails with an argument-type error when the workflow regenerates baselines.
Resolve the method through listing.GetMethodOverloads() (now style-filtered) or add a return-type check to the lookup.
Action: Fix before the next baseline regeneration. The lookup now has same-name hub overloads to choose from.
🤖 Prompt for AI Agents
Validate findings against the current codebase and fix confirmed issues.
Use live analysis to confirm or refute each; do not rely on prior memory.
In `tools/baselining/IndicatorExecutor.cs`:
- Around line 72–87: The method lookup matches by name, parameter count and
InputShapeMatches only. Confirm that IndyMath scalar Series listings (for
example PLUS) also match the same-named IChainProvider hub overloads. If so,
select the method from listing.GetMethodOverloads() or require an
IReadOnlyList<> return type so a hub overload is never invoked.
impact: medium / confidence: low
- Baseline generator picks only Series-returning overloads, so a same-named IndyMath hub is never invoked. - One return-shape classifier serves GetResultType and GetStyle. - GetMethodOverloads docs state the style filter and its fallback. - Contributor guidance records the IndyMath naming exception. - Tests pin the Buffer filter, the fallback, both hub arities, and the Stoch Series listing leaving out its hub factory.
Two-series IndyMath methods (Series, buffer list, and stream hub) took `source` and `other`, which read poorly next to `amount` and the other fixed operands in the docs. They now take `basisSource` and `otherSource`. Fixed-amount and rolling-window methods keep `source`.
The six-parameter StochHub factory was named ToStoch, the Series name, unlike every other hub factory. It is now a ToStochHub overload beside the three-parameter one. Callers of barHub.ToStoch(...) with the extended parameters switch to barHub.ToStochHub(...).
Formatted C# usage syntax for clarity. Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Requested by Dave · project thread
Closes #2439.
Problem
IndyMath stream hubs used the usual
To{Name}Hubform, which reads badly for arithmetic:Change
Every IndyMath stream hub method now takes its Series name. The receiver picks the style: called on a hub, it returns a hub.
ToPlusHub,ToMinusHub,ToTimesHub,ToDividedByHubPlus,Minus,Times,DividedByToPlusPercentHubPlusPercentToMaxWithHub,ToMinWithHubMaxWith,MinWithToRollingMaxHub,ToRollingMinHub,ToRollingMedianHubRollingMax,RollingMin,RollingMedianPairMathHub,ScalarMathHub,RollingMaxHub, and the rest) keep their names.To{Method}List. A list is anIReadOnlyList, solist.Minus(other)already binds to the Series method.IReadOnlyList<T>, and no series implementsIChainProvider<T>.[Obsolete]shims. IndyMath was added after 3.0.4, so these names were never released.Two-series parameter names
The two-series methods in every style take
basisSourceandotherSourceinstead ofsourceandother, so they don't read like the fixed operands (amount,factor,divisor) in the docs. The catalog listings for the two-series methods use the same names. Fixed-amount and rolling-window methods keepsource.The shared
PairBufferListbase keepsAddSourceandAddOtherand still reports a null element in a starting series assourceorother. It also serves Beta, Correlation, and PRS, which are released.Stochastic hub factory (breaking)
The six-parameter
StochHubfactory was namedToStoch, the Series name, unlike every other hub factory. It is now aToStochHuboverload beside the three-parameter one:It first shipped in 3.0.3, and it is removed without an
[Obsolete]shim because the name was a mistake. Only this repository's own tests called it.Catalog
A Series listing and a Stream listing can now share a method name, such as
Minus.IndicatorListing.GetMethodOverloads()now returns only the overloads that return the listing's own style. When none do, as with a listing built outside the catalog, it returns every overload like before. No other name spans two styles, so every other listing resolves exactly as it did.The baseline generator (
tools/baselining/IndicatorExecutor.cs) now picks only Series-returning overloads, so a same-named hub is never invoked.Decision
To…Hubform, such asToDifferenceHuborToSpreadHub. They keep the catalog's one-name-per-style rule but split the vocabulary between Series (Minus) and hubs (Difference), and still read as a conversion rather than arithmetic.ema12 - ema26). They need .NET 10 and leave the net8.0 and net9.0 targets out.Tests
CatalogMethodOverloadsTests:MINUS-SERIESSeries resolves only Series overloads, and Stream keeps both hub arities; anEMABuffer listing resolves onlyEmaList; a listing with no overload of its style gets every overload.Toprefix rule, as it already did for Series. The class-binding test compares every style's overloads.Validation
Tests.Indicatorsunit tests: 3,306 passed, 6 skipped. IndyMath regression: 42 passed.Tests.PublicApi: 96 passeddotnet format --verify-no-changes: clean.audit-streamhub.sh: clean. markdownlint: 0 issues.Generated by Claude Code