Skip to content

feat: Carry SuperTrend hub state through a hub snapshot - #2393

Merged
DaveSkender merged 3 commits into
psar-hub-snapshotfrom
supertrend-hub-snapshot
Oct 17, 2026
Merged

DaveSkender merged 3 commits into
psar-hub-snapshotfrom
supertrend-hub-snapshot

Conversation

@DaveSkender

@DaveSkender DaveSkender commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

SuperTrendHub now supports the internal hub snapshot contract from #2387. A snapshot carries the direction, both bands, the previous ATR, and the rollback ring, so a restored chain resumes bit-exact, and a correction to the newest bar right after a restore takes the same O(1) path as an uninterrupted chain.

The rollback path and the snapshot restore share a new RestoreState helper.

Part of the v3.1 follow-up to #2076, stacked on the Parabolic SAR layer. With this layer, every hub that keeps a rollback ring supports snapshots.

Review notes

SuperTrendWarmStart restores at each warmup boundary and at the first bearish trend, so a lost direction flag is caught. Mutants killed: ring not written, ring not loaded, scalars not restored, IsBullish, LowerBand and PrevAtr dropped.

@DaveSkender
DaveSkender added this pull request to stack #2383 October 16, 2026 06:56
@DaveSkender DaveSkender changed the title feat: Carry SuperTrend hub state and its rollback ring through a hub snapshot feat: Carry SuperTrend hub state through a hub snapshot Oct 16, 2026
@codacy-production

codacy-production Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 37 complexity · 7 duplication

Metric Results
Complexity 37
Duplication 7

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4c4330c) 19623 19137 97.52%
Head commit (6fd7170) 19647 (+24) 19161 (+24) 97.53% (+0.00%)

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 (#2393) 28 28 100.00%

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.

@DaveSkender

Copy link
Copy Markdown
Member Author

Local review: READY at 7ae4837. Reviewer pane READY at 55e1662 (0 critical). N1 and N2 are fixed: SuperTrend restores at the last bullish bar before the first flip as well as at the first bearish bar, and drops split 0, which held the same default state as split Lookback. N3 (a ring miss on a pruned provider replays from relative index 0) is already tracked in #2154. Test-only delta; full suite passes.

@DaveSkender
DaveSkender marked this pull request as ready for review October 16, 2026 07:33
@facioquoqa

This comment has been minimized.

@DaveSkender

This comment has been minimized.

@facioquoqa

facioquoqa Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

:neckbeard: FaciōQuōqa Mage code review was completed with comments.
Reviewed the branch head: GitHub had no current merge result for this pull request, so findings describe it as written rather than as merged.

  • Trigger re-review
    Last reviewed at 7ae4837; head is now 6fd7170. Request review to cover.

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

Reviewed the full diff (2 files, quick single-context pass; all CI checks green). No findings.

  • CaptureSnapshotState/RestoreSnapshotState write and read the same four scalars and the rollback ring in matching order, and decode fully before mutating hub state (RestoreState then LoadRing), so a malformed snapshot can't leave a half-restored hub. This matches the SnapshotCodec ring contract (capacity-bounded count, timestamp range checks).
  • Extracting RestoreState leaves the RollbackState fast path unchanged.
  • SuperTrendWarmStart splits cover the warmup boundary, the ATR seed, the first smoothed ATR, and the first bearish bar (FirstBearishSplit() returns the count that includes the first bar with a non-null UpperBand, so -1 is the last bullish bar).

Not checked: the new test was not executed in this session (the CI results above are the evidence).

Reviewed by the FaciōQuō swarm

@DaveSkender
DaveSkender force-pushed the supertrend-hub-snapshot branch from 7ae4837 to 5d70d2b Compare October 16, 2026 08:03
@DaveSkender
DaveSkender force-pushed the supertrend-hub-snapshot branch from 5d70d2b to 9060cf6 Compare October 16, 2026 08:09
@DaveSkender

Copy link
Copy Markdown
Member Author

Local review: READY at 9060cf6. Reviewer pane re-review READY (0 critical, 0 non-critical). Test-only delta. SuperTrend state-layout overrides.

@DaveSkender
DaveSkender force-pushed the supertrend-hub-snapshot branch from 9060cf6 to 6fd7170 Compare October 16, 2026 08:24
@DaveSkender

Copy link
Copy Markdown
Member Author

Local review: READY at 6fd7170. Delta since the reviewer's READY at 9060cf6: one test local inlined (RCS1124 in CI's full-solution Roslynator step). Rebase only, no behaviour change; full suite and full-solution Roslynator pass.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant