Skip to content

fix(cli): validate channel name and clarify invalid-name error#3095

Open
jorgemoya wants to merge 2 commits into
canaryfrom
jorgemoya/ltrac-1088-unclear-error-when-creating-a-channel-with-an-invalid-name
Open

fix(cli): validate channel name and clarify invalid-name error#3095
jorgemoya wants to merge 2 commits into
canaryfrom
jorgemoya/ltrac-1088-unclear-error-when-creating-a-channel-with-an-invalid-name

Conversation

@jorgemoya

Copy link
Copy Markdown
Contributor

Linear: LTRAC-1088

What/Why?

Creating a channel with an unsupported name (e.g. an apostrophe in "Bob's Store") failed with an opaque API error, forcing users to guess. This validates the channel name in the shared runCreateChannelFlow, so both catalyst create and catalyst channel create benefit. The interactive prompt validates as you type, and an invalid --name flag fails fast with a UserActionableError before hitting the API. Both paths name the offending input and list the allowed characters.

Note/tradeoff: this is a client-side allowlist (Unicode letters/numbers, spaces, hyphens, underscores). Names the API might currently accept with other punctuation (&, #, (, .) are now rejected client-side. There's no documented character constraint for the channels API, so this follows a conservative set — easy to widen the regex + message if the API is more permissive.

Testing

  • New create-channel-flow.spec.ts (13 tests): validator matrix (accepts plain/hyphen/underscore/accented/padded; rejects apostrophe/ampersand/hash/parens/empty/whitespace) and flow wiring (invalid --name throws before the API call, prompt validate wired, valid --name passes through).
  • typecheck and lint pass.

Migration

None.

The Catalyst channels API rejects channel names containing unsupported
characters (e.g. an apostrophe in "Bob's Store") with an opaque server
error, leaving users to guess what went wrong. Validate the name in the
shared channel-creation flow used by both `catalyst create` and
`catalyst channel create`: the interactive prompt validates as you type,
and an invalid `--name` flag throws a UserActionableError before the API
call. Either way the message names the offending input and lists the
allowed characters (letters, numbers, spaces, hyphens, underscores).

Refs LTRAC-1088
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 99f16ad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Jul 10, 2026 3:54pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from 8d9f9a9 (2026-07-10).

No bundle size changes detected.

Apply eslint --fix (prettier) to create-channel-flow.ts and its spec to
satisfy the CI lint step (--max-warnings 0).

Refs LTRAC-1088
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 90 92 91 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 74 81 77 80
Accessibility 95 98 95 92
Best Practices 100 100 100 95
SEO 88 88 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.8 s 5.1 s 3.6 s 5.3 s
CLS 0.05 0 0.001 0
FCP 1.2 s 1.2 s 1.1 s 1.2 s
TBT 10 ms 0 ms 0 ms 10 ms
Max Potential FID 60 ms 40 ms 50 ms 60 ms
Time to Interactive 3.8 s 5.1 s 3.6 s 5.3 s

Full Unlighthouse report →

@jorgemoya jorgemoya marked this pull request as ready for review July 10, 2026 17:12
@jorgemoya jorgemoya requested a review from a team as a code owner July 10, 2026 17:12
@jorgemoya

Copy link
Copy Markdown
Contributor Author

Testing

~/dev/catalyst/core on  jorgemoya/ltrac-1088-unclear-error-when-creating-a-channel-with-an-invalid-name [?] took 13s
❯ node ../packages/catalyst/dist/cli.js channel create
◢ @bigcommerce/catalyst v1.0.0

? What would you like to name your new channel? test' wrong channel 2 #@$#
> "test' wrong channel 2 #@$#" is not a valid channel name. Channel names may contain only letters, numbers, spaces, hyphens (-), and underscores (_).

Comment thread packages/catalyst/src/cli/lib/create-channel-flow.ts
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.

2 participants