fix(web/loader): use job not found for missing external job ID batch slots#21712
Open
cuiweixie wants to merge 1 commit intosmartcontractkit:developfrom
Open
Conversation
…slots Replace the misleading "feeds manager not found" message with "job not found", matching loadByPipelineSpecIDs and the job dataloader context.
Contributor
There was a problem hiding this comment.
Pull request overview
Risk Rating: LOW
Aligns GraphQL dataloader behavior for missing jobs when batch-loading by external job ID with the existing pipeline-spec ID path by returning "job not found" instead of an unrelated "feeds manager not found" error.
Changes:
- Update the default “missing slot” error in
loadByExternalJobIDsto"job not found". - Update the related in-code comment to refer to missing jobs (not feeds managers).
Comment on lines
+58
to
61
| // fill array positions without any jobs | ||
| for _, ix := range keyOrder { | ||
| results[ix] = &dataloader.Result{Data: nil, Error: errors.New("feeds manager not found")} | ||
| results[ix] = &dataloader.Result{Data: nil, Error: errors.New("job not found")} | ||
| } |
There was a problem hiding this comment.
This change alters the observable error for missing external job IDs, but there is no unit test covering the "missing slot" behavior for JobsByExternalJobIDs (loader_test.go only covers the success case). Add a test that requests multiple external IDs with at least one not returned by the ORM and assert the missing position returns "job not found" (matching the pipeline-spec path).
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
When batch-loading jobs by external job ID, unfilled slots now return the same
"job not found"error as the pipeline-spec ID path, instead of the incorrect"feeds manager not found". Updated the stale comment to match.Testing
go test ./core/web/loader/...(local env had toolchain/GOSUMDB issue)