The partial inlining optimization for short strings could allocate strings at min_cap size. Code in grow_by assumed cap != __min_cap - 1 as proof that the input is an allocated long string leading to bad deallocation.
- add the invariant that no long string should have <= min_cap capacity
- use actual is_long() for 'was_long' observation in __grow_by logic for robustness / readability
Combined these defend against both the (previously not expressed) invariant and its consequences.