fix: enforce utf8 resolution limits

This commit is contained in:
gti
2026-09-22 19:20:45 -03:00
parent 516c71b932
commit 06f6d0f940
3 changed files with 53 additions and 4 deletions
@@ -129,3 +129,44 @@ Result:
```
The existing `pytest_asyncio` configuration and `openpyxl` print-area warnings remain unchanged.
## UTF-8 Byte-Length Re-Review Fix
### RED
Added `test_resolution_input_rejects_multibyte_utf8_at_ascii_character_limits` before changing production code. It submits `é` repeated 512 times as `value` and 2000 times as `reason`; both are within the existing character counts but exceed the corresponding UTF-8 byte budgets.
Focused command:
```text
python -m pytest central/tests/test_blocker_resolution_panel.py -q
```
RED result:
```text
1 failed, 9 passed
```
The failure confirmed character-count validation accepted the multibyte inputs.
### GREEN
- `value` and `reason` limits now use `len(value.encode("utf-8"))` and `len(reason.encode("utf-8"))`.
- Existing ASCII boundary inputs remain accepted.
- Multibyte inputs fail closed with explicit UTF-8 byte-limit validation errors, before persistence or audit sanitization.
- Redaction and remote-write boundaries were not changed.
Focused result:
```text
10 passed, 1 warning
```
Full central result:
```text
266 passed, 1 warning
```
The existing `pytest_asyncio` configuration and `openpyxl` print-area warnings remain unchanged.