fix(work): return 400 when jobName is missing instead of defaulting#74
Open
Chzhqv wants to merge 1 commit into
Open
fix(work): return 400 when jobName is missing instead of defaulting#74Chzhqv wants to merge 1 commit into
Chzhqv wants to merge 1 commit into
Conversation
When the jobName query param was missing, the code searched user.workConfig.jobs for a job with name === null, which always returned undefined, then silently proceeded with hourlyRate=0 and the default weeklyTarget=20 instead of erroring — masking the missing parameter as if the user simply had no hours logged. Verified live: before the fix, GET /api/work/summary (no jobName) returned 200 with hourlyRate:0; after the fix it returns 400 with a clear error, while a valid jobName still resolves the real job config correctly. Fixes TemaDeveloper#26
|
Someone is attempting to deploy a commit to the Artemii's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
jobNamequery param was missing, the code searcheduser.workConfig.jobsfor a job withname === null, which always returnedundefined, then silently proceeded withhourlyRate=0and the defaultweeklyTarget=20instead of erroring — masking a missing parameter as if the user simply had no hours logged.400with a clear error whenjobNameis missing.Test plan
GET /api/work/summarywith nojobNamereturned200withhourlyRate:0; after the fix it returns400 {"error":"jobName is required"}jobNamestill resolves the real job config correctly (hourlyRate/weeklyTargetfrom the user's configured job)jobNamekeeps its existing fallback behavior (out of scope for this fix, not changed)pnpm lint,tsc --noEmit, fullvitest run(556/556) all passFixes #26