Conversation
…am (#148) Introduce src/queue_name.ts owning MAX_QUEUE_NAME_LENGTH, InvalidQueueNameError, QueueNameTooLongError, validateQueueName and parseQueueName. QueueManager validates through the same rules (and now rejects empty names); the HTTP handler parses names once in a queueRoute wrapper with a single error mapper, removing extractQueueName's Response-returning union and per-route try/catch. Status codes and response bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#148) Enqueue decodes the queue name up front but leaves the length rule to QueueManager, so payload errors (413, Invalid JSON) still win over an over-length name as on main. Pin that ordering with HTTP tests, cover parseQueueName with astral code points, restore the enqueueErrorResponse name to limit conflict with #136, and drop an unused re-export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All Queue Name rules now live in one module,
src/queue_name.ts. The HTTP handler maps the domain errors to responses in one place.Design notes:
decodeQueueNameis exported so that enqueue keeps today's error order: 413 or "Invalid JSON" still beats "Queue name too long". Without it, the brief's "byte-identical" rule would break.QueueManagernow also rejects an empty name (InvalidQueueNameError) for direct callers. HTTP can't reach that case, because the route pattern needs at least one character.load()still does not validate persisted names, which is unchanged from before.CONTEXT.mdglossary entry and registered the new module in the quality gate.openapi.yamlnow documents the existing 400 "Invalid queue name" response.Closes #148
Evidence
QueueManager.tests/queue_name_test.tsdidn't exist, and running it failed type-checking (module not found).After:
tests/queue_name_test.tshas 19 HTTP-free unit tests. They coverundefined,"",%E0%A4%A,a%20b → a b, decoding exactly once (%2541 → %41), and 128/129 code points, both ASCII and astral.main's handler and this branch's handler. They covered every queue route, HEAD dequeue, malformed and over-length names, and payload errors. Two of the payload errors were checked combined with over-length names: 413 and Invalid JSON. They also covered 507 capacity errors and thrown 500s. Result: 0 differences in status and body.deno test(full suite): 387 passed, 0 failed.npm run quality:productionpasses.Merge Danger
Door: two-way
A refactor with no change to the wire contract. Reverting it is a plain
git revert.Blast Radius: small
Direct
QueueManagercallers that pass""now get an exception. Before,""was accepted as a queue name. Expect a rebase conflict with #136 inenqueueHandler.🤖 Generated with Claude Code