Fix[Experiments]: Adopt character based count to gate features#802
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #802 +/- ##
=============================================
+ Coverage 76.48% 76.51% +0.03%
Complexity 1869 1869
=============================================
Files 89 89
Lines 7990 7996 +6
=============================================
+ Hits 6111 6118 +7
+ Misses 1879 1878 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @hasanmehmood. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
- Each word is assumed to have 5 characters on average. For example, 15 words becomes 75 characters.
- Adopts character based counting mechanism.
- Also unifies JS and PHP constants for `minContentLength`
- Also fixes wording in e2e tests.
- Updates docs. - Updates tests. - Updates comments.
ad4c1bc to
cc285a8
Compare
|
@hasanmehmood if you can connect your GitHub and WordPress.org accounts, then I can more formally credit you in the release post there and grant you the AI Contributor badge. |
What, Why, and How?
Closes #767
This PR standardizes AI feature content-length checks on character counts excluding spaces, instead of switching between words and characters based on locale.
This fixes cases where AI feature buttons stay disabled for sufficient CJK or similar non-space-delimited content when the site or user locale uses word-based counting. It also keeps
minContentLengthconsistent by making the unit deterministic across users and languages.The character thresholds are based on the previous word thresholds, using 5 characters as an approximate average word length. So a previous limit of 15 words now becomes 75 (15*5) characters. This keeps the limits calculated and proportional, rather than choosing new values arbitrarily.
Use of AI Tools
AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5.5
Used for: Code reviews
Testing Instructions
Screenshots
Changelog Entry