Repository navigation
feat: Carry SuperTrend hub state through a hub snapshot - #2393
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 37 |
| Duplication | 7 |
🟢 Coverage 100.00% diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation Diff coverage ✅ 100.00% diff coverage 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.
52bb9c4 to
55e1662
Compare
55e1662 to
7ae4837
Compare
|
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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
There was a problem hiding this comment.
Reviewed the full diff (2 files, quick single-context pass; all CI checks green). No findings.
CaptureSnapshotState/RestoreSnapshotStatewrite and read the same four scalars and the rollback ring in matching order, and decode fully before mutating hub state (RestoreStatethenLoadRing), so a malformed snapshot can't leave a half-restored hub. This matches theSnapshotCodecring contract (capacity-bounded count, timestamp range checks).- Extracting
RestoreStateleaves theRollbackStatefast path unchanged. SuperTrendWarmStartsplits 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-nullUpperBand, so-1is 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
7ae4837 to
5d70d2b
Compare
5d70d2b to
9060cf6
Compare
|
Local review: READY at 9060cf6. Reviewer pane re-review READY (0 critical, 0 non-critical). Test-only delta. SuperTrend state-layout overrides. |
9060cf6 to
6fd7170
Compare
SuperTrendHubnow 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
RestoreStatehelper.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
SuperTrendWarmStartrestores 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,LowerBandandPrevAtrdropped.