Add collision-safe status code registry

Replace the consumer-sized status-name array with private sparse storage and accept arbitrary integer status values. Add explicit range reservations with overlap diagnostics, reserve the library's 0-255 compatibility band, and harden pointer and string boundary handling.

Update regression coverage and document the required migration for custom status-code consumers.
This commit is contained in:
2026-07-30 13:53:39 -04:00
parent 0bb3a4d52c
commit 11d21068df
9 changed files with 250 additions and 260 deletions

View File

@@ -109,9 +109,4 @@ remaining survivors are dominated by:
Findings surfaced by mutation testing:
* **Fixed:** `AKERR_MAX_ERR_VALUE` was `AKERR_LAST_ERRNO_VALUE + 15`, below
`AKERR_NOT_IMPLEMENTED` (+16) and `AKERR_BADEXC` (+17). `akerr_name_for_status`
rejects any status `> AKERR_MAX_ERR_VALUE`, so those codes could never store or
return a name and the `akerr_name_for_status(AKERR_BADEXC, ...)` call in
`akerr_init` was dead code (which is why deleting it survived). The max is now
`+ 17`, and `tests/err_maxval.c` guards the invariant so it can't regress.
* **Superseded:** status names now use a private sparse registry, so the old public `AKERR_MAX_ERR_VALUE` ceiling and its consumer ABI mismatch no longer exist. `tests/err_maxval.c` covers arbitrary `int` values and registry exhaustion.