Skip to content

Comments

fix(milestones): align API response parsing with contract#261

Merged
steilerDev merged 3 commits intobetafrom
fix/milestones-api-format
Feb 24, 2026
Merged

fix(milestones): align API response parsing with contract#261
steilerDev merged 3 commits intobetafrom
fix/milestones-api-format

Conversation

@steilerDev
Copy link
Owner

Summary

  • Fix production bug in milestonesApi.ts where createMilestone, updateMilestone, and getMilestone incorrectly expected wrapped { milestone: ... } responses, causing all three to return undefined
  • Update unit test mocks to match actual API contract (unwrapped responses)
  • Fix E2E milestone CRUD test response parsing (body.milestone.idbody.id)
  • Fix switchToGantt() POM method to handle empty/no-dates state on mobile (prevents timeout)

Root Cause

The API contract specifies that single-resource milestone endpoints return the milestone object directly. The server implementation is correct, but milestonesApi.ts was incorrectly doing .then(r => r.milestone) which returned undefined. This caused:

  • Milestone create form to show "Failed to create" error (even though the milestone was created)
  • E2E tests to fail with TypeError: Cannot read properties of undefined (reading 'id')
  • Mobile calendar view toggle tests to time out (separate issue: empty state handling)

Test plan

  • Unit tests pass locally (npx jest milestonesApi.test.ts)
  • CI Quality Gates pass
  • E2E shards 5, 11, 15 now pass (previously failing)

🤖 Generated with Claude Code

GET /api/milestones/:id, POST /api/milestones, and PATCH /api/milestones/:id
return the milestone object directly (not wrapped in { milestone: ... }).
The client was incorrectly unwrapping a non-existent wrapper property, causing
getMilestone, createMilestone, and updateMilestone to always return undefined.

listMilestones is unchanged — GET /api/milestones correctly returns { milestones: [...] }.

Fixes #23

Co-Authored-By: Claude frontend-developer (Sonnet 4.5) <noreply@anthropic.com>
…e format

Update milestonesApi unit test mocks to return milestone objects directly
instead of wrapped in { milestone: ... }. Fix E2E milestone CRUD tests to
parse page.request.post responses correctly. Fix switchToGantt() POM method
to handle empty state on mobile (prevents timeout when no work items exist).

Co-Authored-By: Claude qa-integration-tester (Sonnet 4.5) <noreply@anthropic.com>
… responses

Update createMilestone and updateMilestone mutation response mocks to return
the milestone object directly instead of wrapped in { milestone: ... }.

Co-Authored-By: Claude qa-integration-tester (Opus 4.6) <noreply@anthropic.com>
@steilerDev steilerDev merged commit 96b1b8e into beta Feb 24, 2026
9 checks passed
@github-actions
Copy link

🎉 This PR is included in version 1.10.0-beta.13 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants