Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1377 +/- ##
==========================================
+ Coverage 91.89% 91.96% +0.07%
==========================================
Files 97 97
Lines 5516 5566 +50
Branches 704 709 +5
==========================================
+ Hits 5069 5119 +50
Misses 325 325
Partials 122 122
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 19.0% fully typed (4 / 21)
Patch symbol details
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit acb4cbb. Configure here.
| if self.axis in ["origin", 2, -2]: | ||
| starts = factors.origin.to_timestamp(how="s") | ||
| matches = np.where((starts >= lo) & (starts <= hi))[0] | ||
| position = (int(matches[0]), 0) if len(matches) else None |
There was a problem hiding this comment.
Rebasing drops origin frequency
Medium Severity
_get_rebasing_factor builds the match window with pd.Period(str(base_period)), which discards the triangle's origin frequency. Fiscal-year origins such as Y-JUN become calendar Y-DEC, so the default latest-origin anchor from _latest_period matches nothing or the wrong year. Trend.fit can raise or emit factors relative to the wrong period on valid fiscal-year triangles, including when base_period is omitted.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit acb4cbb. Configure here.


Summary of Changes
Adds two arguments to
cl.Trend():Related GitHub Issue(s)
closes #1375
closes #1376
#1370
AI/LLM Usage
Claude
Additional Context for Reviewers
Submitter's Checklist
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist
Note
Medium Risk
Changes core reserve-adjustment factor math and default vs full-triangle behavior; extensive tests reduce regression risk but downstream CapeCod/pipeline users should verify factor surfaces match expectations.
Overview
cl.Trendgainsbase_period(re-anchor so that period’s factor is 1.0) andfull_triangle(emit factors for the full origin×development rectangle, including cells past the valuation date that default masking leaves NaN).fitis reworked: trend factors are built by compounding segment trends on a dense grid of 1s (_grid/_accumulate), then divided by the factor at the anchor period (_latest_periodorbase_periodvia_get_rebasing_factor). Invalidbase_periodvalues raiseValueError. Default output still matches the input triangle’s NaN pattern;full_triangle=Trueskips that mask and restores the caller’s array backend when needed.Docs add examples for rebasing and full triangles.
test_trend.pyexpands with parametrized coverage of axes, piecewise segments, gaps, rebasing rules (including quarterly grain), backend preservation, and sklearnclone/get_paramsfor the new arguments.Reviewed by Cursor Bugbot for commit 24f60c2. Bugbot is set up for automated code reviews on this repo. Configure here.