Skip to content

fix(api): count exact frontend string budgets as code points#3316

Merged
nighca merged 1 commit into
goplus:devfrom
aofei:api-string-length-codepoints
Jul 2, 2026
Merged

fix(api): count exact frontend string budgets as code points#3316
nighca merged 1 commit into
goplus:devfrom
aofei:api-string-length-codepoints

Conversation

@aofei

@aofei aofei commented Jun 26, 2026

Copy link
Copy Markdown
Member

Use getStringLengthInCodePoints for frontend logic that must preserve exact Unicode code point budgets, such as Copilot inputs, AI description payload construction, and spx model string validation.

Keep ordinary form validation on native JavaScript and browser string length behavior, while keeping shared API limits in API modules.

Document when frontend code should use native string length and when it should count Unicode code points.

gemini-code-assist[bot]

This comment was marked as resolved.

fennoai[bot]

This comment was marked as resolved.

Comment thread spx-gui/src/apps/xbuilder/pages/admin/grant.vue Outdated
Comment thread spx-gui/src/apps/xbuilder/pages/admin/grant.vue Outdated
Comment thread spx-gui/src/utils/utils.ts Outdated
Comment thread spx-gui/AGENTS.md Outdated
@aofei aofei force-pushed the api-string-length-codepoints branch from 3b8e168 to 1f650c4 Compare July 2, 2026 02:36
@aofei aofei changed the title fix(api): count frontend string limits as code points fix(api): count exact frontend string budgets as code points Jul 2, 2026
@aofei aofei force-pushed the api-string-length-codepoints branch from 1f650c4 to f17fe6f Compare July 2, 2026 03:03
@aofei

aofei commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

刚才给批量创建用户的逻辑里也加上了必要的校验逻辑 https://github.com/goplus/builder/compare/1f650c48104ed3627f4e4faf52fe5ef1b3a97971..f17fe6fe32bb2e01a54cca789c13c0d236bebc6f

Comment thread spx-gui/src/components/community/user/EditProfileModal.vue Outdated
Use `getStringLengthInCodePoints` for frontend logic that must preserve
exact Unicode code point budgets, such as Copilot inputs, AI description
payload construction, and spx model string validation.

Keep ordinary form validation on native JavaScript and browser string
length behavior, while keeping shared API limits in API modules.

Document when frontend code should use native string length and when it
should count Unicode code points.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
@nighca nighca merged commit 908e84d into goplus:dev Jul 2, 2026
5 checks passed
@aofei aofei deleted the api-string-length-codepoints branch July 2, 2026 05:13
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