Skip to content

fix: prevent delete-generation failures on 204 responses#32

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/critical-bug-inspection-e179
Draft

fix: prevent delete-generation failures on 204 responses#32
cursor[bot] wants to merge 1 commit intomainfrom
cursor/critical-bug-inspection-e179

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Apr 6, 2026

Summary

  • Fix a critical API-client correctness bug where successful 204 No Content responses were treated as JSON and threw parse errors.
  • This bug broke deletion flows (deleteGeneration) despite backend success, causing major user-facing breakage in gallery delete actions.
  • Add a focused regression test to ensure 204 delete responses resolve successfully.

Root cause

PixelmuseClient.request() unconditionally called res.json() for all successful responses. The API documents DELETE /api/v1/images/{id} returning 204, which has no body.

Fix

  • In src/core/client.ts, return undefined for 204/205 before JSON parsing.
  • Add src/core/client.test.ts validating that deleteGeneration() succeeds when fetch returns 204.

Validation

  • pnpm build
  • pnpm test (all tests passing, including new regression test)
Open in Web View Automation 

Co-authored-by: Dylan Boudro <starmorph@users.noreply.github.com>
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.

1 participant