fix(feishu): feishu connector name validate#797
Conversation
Co-authored-by: Haze <[email protected]>
Co-authored-by: Haze <[email protected]>
Co-authored-by: Haze <[email protected]>
|
Cursor Agent can help with this pull request. Just |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a52178375d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
electron/api/routes/channels.ts
Outdated
| const accountIdError = validateCanonicalAccountId(body.accountId); | ||
| if (accountIdError) { | ||
| sendJson(res, 400, { success: false, error: accountIdError }); |
There was a problem hiding this comment.
Preserve updates for legacy non-canonical account IDs
This new canonical-ID gate now rejects any persisted account ID that was created before this change (the previous UI allowed any non-empty value), so users with legacy IDs like uppercase/non-ASCII can no longer edit that account’s config and will also hit the same block on default-account/binding mutations. In upgrade scenarios, this effectively strands existing channel accounts unless users manually edit config files, so the validation should be scoped to new IDs or paired with a migration/normalization path.
Useful? React with 👍 / 👎.
…ector Co-authored-by: Haze <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d942d12f3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const trimmed = accountId.trim(); | ||
| if (!trimmed) return 'accountId cannot be empty'; | ||
| if (isCanonicalOpenClawAccountId(trimmed)) { | ||
| return null; |
There was a problem hiding this comment.
Normalize account IDs before applying route mutations
The new validator checks accountId.trim() for canonical format, but downstream routes still use the original raw body.accountId. This means a request like "feishu-main " passes validation (because trimmed value is canonical) yet /api/channels/config can still persist a non-canonical key with trailing whitespace, undermining the routing-safety guarantee this change introduces and causing hard-to-target account IDs later. Return/use the normalized trimmed ID from validation for all subsequent mutations.
Useful? React with 👍 / 👎.
| const configuredAccounts = listConfiguredChannelAccountsFromConfig(config) ?? {}; | ||
| const storedChannelType = resolveStoredChannelType(channelType); | ||
| const knownAccountIds = configuredAccounts[storedChannelType]?.accountIds ?? []; |
There was a problem hiding this comment.
Allow legacy-ID checks to include disabled channel sections
Legacy ID compatibility is now decided via listConfiguredChannelAccountsFromConfig(config), but that helper skips channels where enabled === false. In that state, previously persisted non-canonical account IDs are treated as unknown and get rejected by the new 400 validation path on config/default-account/binding routes, so users with disabled channels can be blocked from managing those legacy accounts until they edit config manually. Backward-compat lookup should read account IDs from config regardless of enabled flag.
Useful? React with 👍 / 👎.
This pull request contains changes generated by a Cursor Cloud Agent