Skip to content

Fix response correctness: empty dequeue returns 204, peek() returns value (qu-g2j)#10

Merged
jonbaldie merged 2 commits into
mainfrom
polecat/thunder-mofs8eao
Apr 26, 2026
Merged

Fix response correctness: empty dequeue returns 204, peek() returns value (qu-g2j)#10
jonbaldie merged 2 commits into
mainfrom
polecat/thunder-mofs8eao

Conversation

@jonbaldie

Copy link
Copy Markdown
Owner

Automated PR from refinery for qu-g2j. Replaces response indices with values and fixes empty dequeue status code.

jonbaldie and others added 2 commits April 26, 2026 21:28
…alue not index (qu-g2j)

Two bugs fixed:
1. peek() was returning array indices as strings (e.g., '0') instead of values
2. Dequeue from empty queue returned HTTP 200 with 'undefined' string instead of HTTP 204

Changes:
- queue.ts: Fixed peek() to return this.messages[0] instead of for...in loop
- handler.ts: Return HTTP 204 when dequeue gets undefined; added /peek endpoint
- manager.ts: Added peek() method to support the new /peek endpoint
- tests/test.ts: Added TDD tests for both bugs (RED tests that now pass)

Manual E2E verification confirmed:
- peek() returns actual message values, not indices
- Empty dequeue returns HTTP 204 No Content

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@jonbaldie
jonbaldie force-pushed the polecat/thunder-mofs8eao branch from c63df07 to 7f5b3c2 Compare April 26, 2026 20:29
@jonbaldie
jonbaldie merged commit 5fc3345 into main Apr 26, 2026
1 check passed
@jonbaldie
jonbaldie deleted the polecat/thunder-mofs8eao branch April 26, 2026 20:33
jonbaldie added a commit that referenced this pull request Apr 26, 2026
…alue (qu-g2j) (#10)

* fix: response correctness - empty dequeue returns 204, peek returns value not index (qu-g2j)

Two bugs fixed:
1. peek() was returning array indices as strings (e.g., '0') instead of values
2. Dequeue from empty queue returned HTTP 200 with 'undefined' string instead of HTTP 204

Changes:
- queue.ts: Fixed peek() to return this.messages[0] instead of for...in loop
- handler.ts: Return HTTP 204 when dequeue gets undefined; added /peek endpoint
- manager.ts: Added peek() method to support the new /peek endpoint
- tests/test.ts: Added TDD tests for both bugs (RED tests that now pass)

Manual E2E verification confirmed:
- peek() returns actual message values, not indices
- Empty dequeue returns HTTP 204 No Content

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Fix tests to match new API behavior (204 status on empty dequeue, peek returns value)

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.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