Skip to content

Refuse a name too long for ID's logout Queue before anything is created #19

Backlog

Description

@xgame92

What

gateweave deploy id names three things after --name: the Worker, the D1 database and the logout Queue, <name>-logouts. The name check allows up to 57 characters. That limit was chosen for Track's R2 bucket (<name>-files, 6 more characters). Cloudflare Queue names are at most 63 characters, so with ID a 56- or 57-character name produces a 64- or 65-character Queue name. That only fails inside the product's own deploy, after the person said yes, so whatever the deploy had already created is left in the account. The check should allow only names whose longest derived resource name still fits.

Where to look

  • packages/cli/src/main.ts, lines 130-132:
    // Worker and bucket names allow lowercase letters, digits and dashes; the bucket adds "-files"
    // and must stay within 63 characters.
    const NAME = /^[a-z0-9](?:[a-z0-9-]{0,55}[a-z0-9])?$/;
    and lines 279-286, where it is applied and the message says "at most 57 characters" for every product.
  • packages/cli/src/products.ts, line 48 (bucket: { binding: "FILES", suffix: "-files" }) and line 66 (queue: { binding: "LOGOUTS", suffix: "-logouts" }). The suffixes are data, so the limit can be worked out from the product instead of written by hand.
  • The same check covers update id and doctor id. A shorter limit there is harmless, because no ID deployment can have a longer name.
  • Tests: packages/cli/test/deploy-track.test.ts, lines 1396-1401 ("rejects a name that cannot name a Worker and a bucket") shows the shape, including assert.deepEqual(calls, []) to prove nothing ran. packages/cli/test/deploy-id.test.ts has a deploy(args) helper at line 14.

Done when

  • gateweave deploy id --name <56 lowercase letters> --json exits 2 with code bad-name, and no command was run (calls is empty).
  • A 55-character name for deploy id is accepted as far as the name check goes.
  • Track keeps its limit: a 57-character name still passes the name check for deploy track, and a 58-character name is refused.
  • The message gives the limit for the product in question (57 for Track, 55 for ID) and names what it has to fit (the bucket for Track, the Queue for ID).
  • The new ID test fails without the change.
  • pnpm verify passes.

How to check

pnpm install
pnpm --filter gateweave test
pnpm verify

The tests fake Wrangler, git and pnpm, and never reach Cloudflare.

The draft pull request #18 changes the same files (main.ts, system.ts). If it merges before you open yours, rebase on main first.

Setup is in CONTRIBUTING.md. Say here if you're taking this, so nobody does it twice, and ask here if you get stuck.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions