feat: add buzz refresh command for autodata refresh#138
Conversation
WalkthroughAdds a CLI command Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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 |
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository: PinePeakDigital/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
README.md(1 hunks)beeminder.go(1 hunks)beeminder_test.go(1 hunks)main.go(3 hunks)
🔇 Additional comments (6)
main.go (4)
224-224: LGTM!The help text clearly documents the new refresh command and follows the existing format.
246-248: LGTM!The command dispatcher correctly routes the "refresh" command to the new handler.
254-254: LGTM!The available commands list is correctly updated to include "refresh".
513-548: LGTM!The implementation follows the established pattern from other command handlers like
handleAddCommand. The argument validation, configuration loading, and error handling are all appropriate. The output clearly distinguishes between successful queueing and unsuccessful refresh attempts.beeminder.go (1)
329-351: LGTM!The implementation is consistent with other API functions in the file. It properly handles errors, validates the response status, and correctly decodes the boolean result. The function signature and error handling follow the established patterns.
README.md (1)
107-119: LGTM!The documentation is clear, comprehensive, and helpful. It provides a good example, explains the use cases, and importantly notes the asynchronous nature of the operation to set correct user expectations.
|
@copilot Please address coderabbit feedback. Your instructions file tells you how to access the feedback. |
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Fixed in commit 74f3d74. Added |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository: PinePeakDigital/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
beeminder.go(1 hunks)beeminder_test.go(1 hunks)config.go(1 hunks)
🔇 Additional comments (3)
config.go (1)
16-16: LGTM! Clean addition for testability.The optional
BaseURLfield is well-documented and properly tagged. This enables testing with mock servers while maintaining backward compatibility.beeminder.go (1)
331-355: Function implementation is correct.The implementation properly handles the configurable base URL, constructs the correct API endpoint, and includes appropriate error handling and resource cleanup.
beeminder_test.go (1)
581-669: Excellent test coverage! Addresses previous feedback.The tests now properly verify
RefreshGoalbehavior by:
- Setting
config.BaseURLto the mock server URL- Actually calling
RefreshGoal()(addressing the previous review feedback)- Verifying HTTP method, URL construction, and response decoding
- Covering success, failure, and error scenarios
This provides comprehensive coverage for the new functionality.
|
@copilot Please address coderabbit feedback. Your instructions file tells you how to access the feedback. |
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Addressed in commit (hash will be added after push). Extended BaseURL support to all API functions ( |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository: PinePeakDigital/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
beeminder.go(6 hunks)
🔇 Additional comments (1)
beeminder.go (1)
348-375: No changes required. Goal slugs are restricted to URL-safe characters by design.After verification, Beeminder uses "slug-like" naming similar to GitHub repositories and Slack channels, with an opinionated design philosophy. Goals use concise one-word names, with the goalname used in the URL. The codebase pattern of not encoding the
goalSlugparameter is consistent across all functions (GetLastDatapointValue,CreateDatapoint,FetchGoalWithDatapoints, andRefreshGoal) and reflects the intended use of URL-safe slug identifiers. The RefreshGoal function implementation follows the established pattern correctly.
|
@copilot Please address coderabbit feedback. Your instructions file tells you how to access the feedback. |
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Addressed in commit (will update with hash). Extracted the repeated BaseURL pattern into a |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository: PinePeakDigital/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
beeminder.go(6 hunks)
🔇 Additional comments (2)
beeminder.go (2)
44-46: Consistent helper usage across all API functions.All five existing API functions (
FetchGoals,GetLastDatapointValue,CreateDatapoint,FetchGoalWithDatapoints,CreateGoal) now consistently use thegetBaseURLhelper. This improves maintainability and testability as requested in previous feedback.Also applies to: 230-232, 261-263, 284-286, 309-311
342-365: LGTM! Clean implementation following established patterns.The
RefreshGoalfunction is well-implemented:
- Follows the same structure and error-handling pattern as other API functions in this file
- Correctly uses the
getBaseURLhelper for testability- Appropriate error propagation for network failures, non-OK status codes, and decode errors
- Return signature
(bool, error)matches the API response structureThe implementation is consistent with the existing codebase and addresses the requirements outlined in the PR objectives.
🚀 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-138-latest buzz-pr-138# Run the pre-release
buzz-pr-138# Uninstall the pre-release
bin remove buzz-pr-138Direct Download LinksOr download binaries directly from the pre-release page:
|
Summary
Successfully implemented the
buzz refresh <goalslug>command and addressed all CodeRabbit feedback.Latest Changes (commit: refactor: extract getBaseURL helper)
getBaseURL(config)helper function to eliminate code duplicationOriginal prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
Summary by CodeRabbit
New Features
Documentation
Tests