fix(chart): align road risers with same-day datapoint risers - #347
Merged
Conversation
Day-snap bright-red-line knots onto the local-midnight day grid the datapoints are bucketed on (mirroring beebrain's stampIn/daysnap), and sample each chart column at its right edge so a knot's value change lands in the same column as a same-day datapoint node. Without this a derailment's road jump — stored at a mid-day knot time — drew several columns away from its #DERAIL datapoint instead of overlapping as on Beeminder's own graph. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Clamp roadValuesForTimeframe's last-column sample to endTime so the rightmost column never shows a road value extrapolated past the window (auto-applied low-risk: overshoot clamp + regression test, daysnapRoad unit test, slices.IndexFunc in new test). Recompute slopePerDay from snapped boundaries in daysnapRoad so valueAt's before-start extrapolation can't use a stale pre-snap slope. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…stDaysnapRoad (auto-applied low-risk: parsed segments share exact boundary floats, so the check only re-verified pure-function determinism) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: PinePeakDigital/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesGoal chart alignment
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Pre-release Build ReadyTest builds are ready! Install directly using the # Install the pre-release
bin install https://github.com/PinePeakDigital/buzz/releases/tag/pr-347-latest buzz-pr-347# Run the pre-release
buzz-pr-347# Uninstall the pre-release
bin remove buzz-pr-347Direct Download LinksOr download binaries directly from the pre-release page:
|
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.

What
Make
buzz view's goal-progress chart match Beeminder's own graph at a derailment: the bright red line's vertical jump and the same-day datapoint's vertical riser now draw in the same column (overlapping), instead of several columns apart.Why it looked wrong
Beeminder day-snaps both the road (roadall) knots and the datapoints onto one shared local-midnight grid before plotting, so a derail's road step and its
#DERAILdatapoint line up. Buzz did neither:inttruncation), adding a further one-column offset.Result: on
narthur/abed(a real derailment — road jumps 30 → 10091 on Jul 20,#DERAILdatapoint on the same day) the red riser sat 4 columns right of the blue one.The fix
daysnapRoad— floor every parsed road segment boundary to local midnight (beebrain'sdaysnapequivalent), and recomputeslopePerDayfrom the snapped boundaries.roadValuesForTimeframe— sample each column at its right edge so a day-snapped knot's value change lands in the same column as a same-day datapoint node. The last column is clamped toendTimeso the rightmost ("today") column never shows a value extrapolated past the window.Before → after (real
narthur/abedchart)Before — stray red riser offset right of the blue one:
After — the red road riser is hidden directly behind the blue datapoint riser (same column; blue drawn on top), exactly as on Beeminder's graph:
(No stray red segment: the road step now coincides with the datapoint riser and is overdrawn by blue.)
Notes
Test plan
go test ./...— green.TestRoadStepAlignsWithSameDayDatapoint(road step and same-day datapoint node share a column, at two widths),TestDaysnapRoad(flooring, vertical-step equality, sub-day collapse,slopePerDayrecompute),TestRoadValuesForTimeframe(right-edge sampling + last-column clamp regression case).narthur/abedgoal before/after.🤖 Generated with Claude Code
Summary by CodeRabbit