akerr_init()'s own reservation failure is untested, and needs a second library target #9

Open
opened 2026-08-02 18:59:10 -04:00 by tachikoma · 0 comments
Collaborator

Source: TODO.md §7 (at 5695061)

tests/err_library_status_fatal.c covers the terminal path in
__akerr_name_library_status() by naming a status the library does not own. The
band reservation in akerr_init() has no such handle:
it can only fail in a
build whose tables are too small for the library's own entries, and both sizes
are PRIVATE to the library target, so a test executable cannot set them.

Closing it means a second library target built with tiny tables plus a WILL_FAIL
test linked against it. Nothing in the CMake does that yet: the sanitizer and
coverage options vary the flags of the one library target, not its compile
definitions.

Related, and worth reading before adding defensive checks. Branch coverage on
src/error.c sits just above its 50% gate. Every FAIL_* site carries about six
branch outcomes of error-construction machinery (ENSURE_ERROR_READY,
AKERR_STACKTRACE_APPEND) that only run when that specific failure fires, and
every PASS site around a call that cannot fail carries about twenty-five.
Validating more inputs therefore lowers the ratio by construction. Expect to
add a test that drives them, as tests/err_copy_string.c does.

Files: CMakeLists.txt, tests/


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.md §7 (at 5695061) `tests/err_library_status_fatal.c` covers the terminal path in `__akerr_name_library_status()` by naming a status the library does not own. **The band reservation in `akerr_init()` has no such handle:** it can only fail in a build whose tables are too small for the library's own entries, and **both sizes are `PRIVATE` to the library target, so a test executable cannot set them.** Closing it means a second library target built with tiny tables plus a `WILL_FAIL` test linked against it. **Nothing in the CMake does that yet:** the sanitizer and coverage options vary the *flags* of the one library target, not its compile definitions. **Related, and worth reading before adding defensive checks.** Branch coverage on `src/error.c` sits just above its 50% gate. Every `FAIL_*` site carries about six branch outcomes of error-construction machinery (`ENSURE_ERROR_READY`, `AKERR_STACKTRACE_APPEND`) that only run when that specific failure fires, and **every `PASS` site around a call that cannot fail carries about twenty-five.** Validating more inputs therefore **lowers the ratio by construction.** Expect to add a test that drives them, as `tests/err_copy_string.c` does. **Files:** `CMakeLists.txt`, `tests/` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 2.0.x milestone 2026-08-02 18:59:10 -04:00
tachikoma added the test-coverageblast-radius:mediumstatus::grooming labels 2026-08-02 18:59:10 -04:00
Sign in to join this conversation.