Skip to content

refactor: Name IndyMath stream hubs after their Series operators - #2448

Merged
DaveSkender merged 7 commits into
mainfrom
claude/project-thread-d8r60i
Nov 6, 2026
Merged

DaveSkender merged 7 commits into
mainfrom
claude/project-thread-d8r60i

Conversation

@DaveSkender

@DaveSkender DaveSkender commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Requested by Dave · project thread

Closes #2439.

Problem

IndyMath stream hubs used the usual To{Name}Hub form, which reads badly for arithmetic:

PairMathHub spread = barHub
    .ToEmaHub(12)
    .ToMinusHub(barHub.ToEmaHub(26));

Change

Every IndyMath stream hub method now takes its Series name. The receiver picks the style: called on a hub, it returns a hub.

// Series
IReadOnlyList<MathResult> spread = bars.ToEma(12).Minus(bars.ToEma(26));

// stream hub
PairMathHub spread = barHub.ToEmaHub(12).Minus(barHub.ToEmaHub(26));
was now
ToPlusHub, ToMinusHub, ToTimesHub, ToDividedByHub Plus, Minus, Times, DividedBy
ToPlusPercentHub PlusPercent
ToMaxWithHub, ToMinWithHub MaxWith, MinWith
ToRollingMaxHub, ToRollingMinHub, ToRollingMedianHub RollingMax, RollingMin, RollingMedian
  • The hub types (PairMathHub, ScalarMathHub, RollingMaxHub, and the rest) keep their names.
  • Buffer lists keep To{Method}List. A list is an IReadOnlyList, so list.Minus(other) already binds to the Series method.
  • Overloads can't collide: no hub implements IReadOnlyList<T>, and no series implements IChainProvider<T>.
  • No [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 basisSource and otherSource instead of source and other, 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 keep source.

IReadOnlyList<MathResult> spread = basisSource.Minus(otherSource);

The shared PairBufferList base keeps AddSource and AddOther and still reports a null element in a starting series as source or other. It also serves Beta, Correlation, and PRS, which are released.

Stochastic hub factory (breaking)

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:

// before
StochHub hub = barHub.ToStoch(14, 3, 3, 5, 4, MaType.SMMA);

// after
StochHub hub = barHub.ToStochHub(14, 3, 3, 5, 4, MaType.SMMA);

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

  • Chosen: hubs reuse the Series operator name. A Series chain then streams by turning each indicator call into its hub form, with the math in between left alone.
  • Discarded: noun names inside the To…Hub form, such as ToDifferenceHub or ToSpreadHub. 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.
  • Discarded: C# 14 extension operators (ema12 - ema26). They need .NET 10 and leave the net8.0 and net9.0 targets out.
  • Would reverse if: a catalog-driven consumer turns out to need one method name per style. Then the noun option is the fallback.

Tests

  • CatalogMethodOverloadsTests: MINUS-SERIES Series resolves only Series overloads, and Stream keeps both hub arities; an EMA Buffer listing resolves only EmaList; a listing with no overload of its style gets every overload.
  • Catalog metadata exempts IndyMath stream listings from the To prefix rule, as it already did for Series. The class-binding test compares every style's overloads.

Validation

  • Solution build: 0 warnings
  • Tests.Indicators unit tests: 3,306 passed, 6 skipped. IndyMath regression: 42 passed.
  • Tests.PublicApi: 96 passed
  • dotnet format --verify-no-changes: clean. audit-streamhub.sh: clean. markdownlint: 0 issues.
  • AOT publish not run locally; CI covers it.

Generated by Claude Code

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
@facioquoqa

facioquoqa Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

:neckbeard: FaciōQuōqa Mage code review was completed with comments.

  • Trigger re-review
    Last reviewed at 13dba93; head is now 6ec4ca1. Request review to cover.

@codacy-production

codacy-production Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity · 0 duplication

Metric Results
Complexity 6
Duplication 0

View in Codacy

🟢 Coverage 98.55% diff coverage · -0.01% coverage variation

Metric Results
Coverage variation ✅ -0.01% coverage variation
Diff coverage ✅ 98.55% diff coverage

View coverage diff in Codacy

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.

@facioquoqa facioquoqa Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cs and Series listings, so it is unaffected by the new shared names.
  • ListingExecutor still 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>
@DaveSkender
DaveSkender enabled auto-merge (squash) November 6, 2026 04:32
@DaveSkender
DaveSkender merged commit 44703eb into main Nov 6, 2026
@DaveSkender
DaveSkender deleted the claude/project-thread-d8r60i branch November 6, 2026 04:42

This branch was previously deployed

1 inactive deployment
preview — 6ec4ca1f Deployed Nov 6, 2026 by DaveSkender
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.

reconsider IndyMath stream hub API shapes

1 participant