Conversation
88ce52a to
53d7ef8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes growth estimation behavior early in the year so projected totals and deltas stay consistent, and updates integration testing to be year-independent/deterministic across calendar years.
Changes:
- Update
CalculateNewEstimateearly-year logic to project using the prior year’s growth delta (when available). - Add unit tests covering early-year, later-year, and fallback estimation scenarios.
- Make integration outputs deterministic by normalizing/removing year-dependent rows and updating fixtures accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| script/remove-non-deterministic-rows | Filters additional non-deterministic rows and normalizes leading year values to YYYY for stable fixture comparisons. |
| script/build-test-repository | Uses the current year when creating test-repo commits so integration tests don’t go stale year-to-year. |
| pkg/display/sections/growth_tables_test.go | Adds unit tests for CalculateNewEstimate across early/mid-year and fallback cases. |
| pkg/display/sections/growth_estimates.go | Adjusts early-year estimation to apply last year’s delta (using two-years-ago data when present). |
| fixtures/git-metrics.txt | Updates fixture output to match normalized year placeholders and removed commit-date rows. |
Comments suppressed due to low confidence (1)
script/remove-non-deterministic-rows:50
- The success check at the end now keys off the exit status of the last
rm -f(orsed/rm), not thegrep/filtering step (and even previously it didn’t validategrep). This means the script will report success and overwrite the input even ifgrep/sedfails. Capture and validategrep/sedexit codes explicitly (treatinggrepexit 1 as acceptable when it matches all lines), or enableset -eand restructure with a trap for temp-file cleanup.
grep -Ev -f "$pattern_file" "$input_file" > "$temp_file"
rm -f "$pattern_file"
# Normalize year references to YYYY for deterministic comparison
sed -i.bak -E 's/^([0-9]{4})([\^~\* ]+)/YYYY\2/g' "$temp_file"
rm -f "$temp_file.bak"
# Check if the temporary file was created successfully
if [ $? -eq 0 ]; then
mv "$temp_file" "$input_file"
echo "Non-deterministic rows removed successfully. Output written to '$input_file'."
53d7ef8 to
3b635ff
Compare
Apply previous years growth rate when < 60 days into current year Projected totals now include expected growth instead of copying previous year Add unit tests for CalculateNewEstimate edge cases Make integration tests year-independent to prevent CI failures
3b635ff to
29b74b8
Compare
The else branch handling missing yearlyStats[currentYear-2] was unreachable. CalculateNewEstimate is only called from DisplayUnifiedGrowth when estimationYears > 0, which guarantees at least 2 full years of commit history exist. Removed the dead code and corresponding test case.
steffen
approved these changes
Feb 23, 2026
steffen
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes growth estimation logic when running early in the year (< 60 days) and resolves CI failures caused by year-dependent fixture comparisons.
Changes
Growth estimation fix
CalculateNewEstimatenow projects current year totals using last year's growth delta instead of copying previous year's values unchangedTest improvements
CalculateNewEstimatecovering early-year, mid-year, and fallback scenariosBefore
Early-year estimate showed previous year's totals with a delta suggesting growth (inconsistent).
After
Early-year estimate shows projected totals that match the applied delta (consistent).