Skip to content

feat: Add Goals (goalsV2) support to Budget service#12

Merged
eshaffer321 merged 1 commit intomainfrom
feature/goals-support
Oct 8, 2025
Merged

feat: Add Goals (goalsV2) support to Budget service#12
eshaffer321 merged 1 commit intomainfrom
feature/goals-support

Conversation

@eshaffer321
Copy link
Copy Markdown
Owner

Summary

  • Add Goal and BudgetWithGoals types to support financial goals tracking
  • Add ListWithGoals() method to BudgetService interface
  • Create GraphQL query combining budget and goals data
  • Implement comprehensive test coverage with 4 new test cases

Implementation Details

New Types (pkg/monarch/types.go)

  • Goal struct with fields: id, name, type, amounts, target dates, account info, progress tracking
  • BudgetWithGoals struct that embeds Budget and includes Goals array

New Interface Method (pkg/monarch/interfaces.go)

  • ListWithGoals(ctx, startDate, endDate) - retrieves budgets with associated goals

GraphQL Query (internal/graphql/queries/budgets/list_with_goals.graphql)

  • Combines budgetData and goalsV2 queries in a single request
  • Includes all necessary fields for both budgets and goals

Implementation (pkg/monarch/budgets.go)

  • Follows existing codebase patterns
  • Properly handles nil cases for missing data
  • Converts nested GraphQL response to flat budget list with goals attached

Test Coverage (pkg/monarch/budgets_test.go)

  • TestBudgetService_ListWithGoals: Full test with budgets and goals
  • TestBudgetService_ListWithGoals_NoGoals: Budget data without goals
  • TestBudgetService_ListWithGoals_EmptyResponse: Empty response handling
  • TestBudgetService_ListWithGoals_MultipleGoals: Multiple goals test

Test Results

✅ All 4 new ListWithGoals tests pass
✅ All existing budget tests still pass (6 total)
✅ All 58 tests in pkg/monarch package pass
go vet ./... passes with no issues
✅ Coverage increased from 37% to 39.3%

Test plan

  • Run go test ./pkg/monarch/... -v - all tests pass
  • Run go vet ./... - no issues found
  • Run tests with coverage - 39.3% coverage (improved from 37%)
  • Verify GraphQL query syntax is valid
  • Test handles nil/empty responses correctly
  • CI pipeline passes

🤖 Generated with Claude Code

Implements Goals support following Option A approach from analysis:
- Add Goal and BudgetWithGoals types
- Add ListWithGoals() method to BudgetService interface
- Create list_with_goals.graphql query combining budgets and goals
- Implement ListWithGoals() in budgetService
- Add comprehensive test coverage (4 test cases)

Test coverage increased from 37% to 39.3%
All 58 tests pass including 4 new Goals tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 8, 2025

Codecov Report

❌ Patch coverage is 90.19608% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.80%. Comparing base (a543a3e) to head (fd5ffc5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/monarch/budgets.go 90.19% 3 Missing and 2 partials ⚠️

❌ Your project status has failed because the head coverage (41.80%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
+ Coverage   40.67%   41.80%   +1.12%     
==========================================
  Files          15       15              
  Lines        2188     2239      +51     
==========================================
+ Hits          890      936      +46     
- Misses       1233     1236       +3     
- Partials       65       67       +2     
Flag Coverage Δ
unittests 41.80% <90.19%> (+1.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/monarch/budgets.go 61.41% <90.19%> (+19.31%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a543a3e...fd5ffc5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eshaffer321 eshaffer321 merged commit 70bf1a1 into main Oct 8, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant