Skip to content

fix: return 400 when label is missing in POST /versionsource - #273

Merged
kptdobe merged 1 commit into
mainfrom
worktree-agent-a981e16ccba179c7f
May 5, 2026
Merged

kptdobe merged 1 commit into
mainfrom
worktree-agent-a981e16ccba179c7f

Conversation

@kptdobe

@kptdobe kptdobe commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • POST /versionsource was returning 500 "Version was not created" when the request body was missing or had no label field, because label = undefined caused shouldCreateVersionObject to be false
  • Added an early return of { status: 400, error: 'label is required' } in postObjectVersion when label is falsy

Test plan

  • Updated the existing test that previously expected a 500 to now assert a 400 response with 'label is required'
  • Added a test for label: null in the request body also returning 400
  • Added a test confirming a valid label still results in a 201 response
  • All 371 tests pass; lint is clean

🤖 Generated with Claude Code

Return a 400 'label is required' early in postObjectVersion when no body
is sent or the label field is absent, preventing a misleading 500 error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented May 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kptdobe
kptdobe requested a review from bosschaert May 4, 2026 09:28
@kptdobe
kptdobe merged commit 36acb2b into main May 5, 2026
6 checks passed
@kptdobe
kptdobe deleted the worktree-agent-a981e16ccba179c7f branch May 5, 2026 09:50
adobe-bot pushed a commit that referenced this pull request May 5, 2026
## [1.7.2](v1.7.1...v1.7.2) (2026-05-05)

### Bug Fixes

* handle NoSuchKey error name in copyFile catch block ([#272](#272)) ([939b491](939b491))
* increase writeAuditEntry 412 retries to 5 and remove dead retry loop in put.js ([#274](#274)) ([2aca684](2aca684))
* return 400 when label is missing in POST /versionsource ([#273](#273)) ([36acb2b](36acb2b))
@adobe-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants