Repository navigation
Commit f8d5393
fix(text): bound compactText for tiny caps (#576)
* fix(text): harden string helpers against small/degenerate inputs
Four internal string helpers violated their invariants on inputs outside their
current call sites (all callers pass safe values, so these are latent, surfaced
by property-testing with einsiedlerkrebs):
- trimMiddle: maxLength < 120 made `edge` negative — slices read the wrong ends
(`slice(-0)` returns the whole string) and the "truncated N" count exceeded the
input length. Fall back to a simple head truncation.
- compactText: maxLength <= 2 returned the bare "..." (length 3), overflowing the
cap. Drop the ellipsis when there is no room for it.
- slug: the length slice ran after the trailing-dash trim, so slicing on a "-"
boundary re-introduced a trailing dash — not idempotent. Re-trim post-slice.
- normalizeGitHubActor: stripped only one trailing [bot], leaving a residual on a
doubled suffix — not idempotent. Strip all trailing [bot].
Adds regression + unregression tests for each.
Closes #571
Closes #572
Closes #573
Closes #574
* test(repair): keep mutation actor matching fail-closed
* test(text): pin helper boundary semantics
* fix(text): narrow hardening to compact text bounds
Co-authored-by: Cameron Beeley <[email protected]>
---------
Co-authored-by: Peter Steinberger <[email protected]>1 parent 0bb5964 commit f8d5393
2 files changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments