Skip to content

fix(work): return 400 when jobName is missing instead of defaulting#74

Open
Chzhqv wants to merge 1 commit into
TemaDeveloper:mainfrom
Chzhqv:fix/work-summary-missing-jobname
Open

fix(work): return 400 when jobName is missing instead of defaulting#74
Chzhqv wants to merge 1 commit into
TemaDeveloper:mainfrom
Chzhqv:fix/work-summary-missing-jobname

Conversation

@Chzhqv

@Chzhqv Chzhqv commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • 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 a missing parameter as if the user simply had no hours logged.
  • Now returns 400 with a clear error when jobName is missing.

Test plan

  • Verified live against the real dev server: before the fix, GET /api/work/summary with no jobName returned 200 with hourlyRate:0; after the fix it returns 400 {"error":"jobName is required"}
  • Confirmed a valid jobName still resolves the real job config correctly (hourlyRate/weeklyTarget from the user's configured job)
  • Confirmed a provided-but-nonexistent jobName keeps its existing fallback behavior (out of scope for this fix, not changed)
  • pnpm lint, tsc --noEmit, full vitest run (556/556) all pass

Fixes #26

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
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

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.

bug: Work summary API returns wrong data when jobName is null

1 participant