fix(api): count exact frontend string budgets as code points#3316
Merged
Conversation
0a16dac to
b2125fc
Compare
b2125fc to
2851b1b
Compare
2851b1b to
d96fe3b
Compare
d96fe3b to
052bb64
Compare
052bb64 to
3b8e168
Compare
nighca
reviewed
Jul 1, 2026
3b8e168 to
1f650c4
Compare
1f650c4 to
f17fe6f
Compare
Member
Author
nighca
reviewed
Jul 2, 2026
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>
f17fe6f to
644ace3
Compare
nighca
approved these changes
Jul 2, 2026
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.
Use
getStringLengthInCodePointsfor 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.