Conversation
WalkthroughMoves many resolver implementations from service.go into a new resolver file, adds a recursive Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
…solvers-causes-issues
❌ Internal Query Planner CI checks failedThe Internal Query Planner CI checks failed in the celestial repository, and this is going to stop the merge of this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2464 +/- ##
==========================================
- Coverage 61.43% 61.41% -0.03%
==========================================
Files 229 229
Lines 23855 23855
==========================================
- Hits 14656 14650 -6
- Misses 7967 7971 +4
- Partials 1232 1234 +2 🚀 New features to boost your workflow:
|
…solvers-causes-issues
…789-recursive-call-with-field-resolvers-causes-issues
…solvers-causes-issues
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@demo/pkg/subgraphs/projects/src/service/service_resolve.go`:
- Around line 47-75: The code currently uses
math.Abs(endDate.Sub(now).Hours()/24) which treats past deadlines as upcoming;
change both milestone and project checks to compute the raw duration
(endDate.Sub(now)) and only consider non-negative durations (i.e., duration >=
0) before converting to days and comparing to withinDays/nearestDays; update the
milestone loop (where nearestMilestone, nearestDays are set) and the project
fallback (where project.EndDate is parsed and daysUntil computed via duration)
so overdue dates are excluded while keeping the existing comparisons and the use
of data.PopulateMilestoneRelationships and data.GetProjectByID intact.
In `@router-tests/grpc_subgraph_test.go`:
- Around line 256-260: This test case duplicates the one in
router_plugin_test.go and its query doesn't match the test name (no multiple
recursion levels); either remove this duplicate test entry named "query project
with normal and recursive field resolver and aliases and multiple levels of
recursion and aliases" or update its query to actually exercise multiple levels
of recursion and aliases (e.g., expand the project selection to include nested
subProjects within subProjects and use distinct aliases like
urgent/nextDeadline/subsub/subsubsub) and then update the expected JSON to match
the deeper nested response; ensure you modify the test entry's query string and
expected string together (the test name, query field 'subProjects', and the
expected JSON are the unique symbols to change) and avoid keeping an identical
test already present in router_plugin_test.go.
In `@router-tests/router_plugin_test.go`:
- Around line 453-457: The test case in router_tests (the struct with name
"query project with normal and recursive field resolver and aliases and multiple
levels of recursion and aliases") is a duplicate of the previous case; either
remove this duplicated test entry or change its query to actually exercise
multi-level recursion and aliases (e.g., in the query string for that test add a
nested alias like `subsub: subProjects { id name status nested: subProjects { id
} }`) and update the corresponding expected JSON to include the
nested.subProjects results (IDs) so the expected output matches the new nested
alias shape; locate this test by the name field in the test table in
router_plugin_test.go and edit the query and expected fields (or delete the
entire test struct) accordingly.
🧹 Nitpick comments (2)
demo/pkg/subgraphs/projects/src/service/util.go (1)
39-54: Consider pre-allocating slice capacity for minor efficiency gain.The loops use
appendwithout pre-allocation. For demo/test code this is acceptable, but pre-allocating would avoid repeated reallocations.♻️ Optional: Pre-allocate slice capacity
func (p *ProjectsService) populateMilestonesList(milestones []*service.Milestone) []*service.Milestone { - var populatedMilestones []*service.Milestone + populatedMilestones := make([]*service.Milestone, 0, len(milestones)) for _, milestone := range milestones { populatedMilestones = append(populatedMilestones, data.PopulateMilestoneRelationships(milestone)) } return populatedMilestones } func (p *ProjectsService) populateTasksList(tasks []*service.Task) []*service.Task { - var populatedTasks []*service.Task + populatedTasks := make([]*service.Task, 0, len(tasks)) for _, task := range tasks { populatedTasks = append(populatedTasks, data.PopulateTaskRelationships(task)) } return populatedTasks }demo/pkg/subgraphs/projects/src/schema.graphql (1)
108-109: Trim resolver context to only required fields.
ResolveProjectSubProjectsuses only the project ID; includingnameandstatusincreases payload without benefit. If you don’t plan to use them, trim the context.♻️ Proposed update
- subProjects(includeArchived: Boolean): [Project!]! `@connect__fieldResolver`(context: "id name status") + subProjects(includeArchived: Boolean): [Project!]! `@connect__fieldResolver`(context: "id")
Nested field resolvers are not behaving properly. This PR updates the dependencies for the related engine improvements for field resolvers and adds some more test cases
Summary by CodeRabbit
New Features
Tests
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist