- Added explicit status validation across error handling tests. - Added lifecycle and slot-leak checks to older tests. - Improved unhandled-error propagation coverage. - Added repository guidance and a test runner script. - Verified all 23 CTest tests pass. Co-Authored by Codex GPT 5.4
2.6 KiB
Repository Guidelines
Project Structure & Module Organization
This is a small C library built with CMake. Core implementation lives in
src/error.c. The public header is generated at build time from
include/akerror.tmpl.h by scripts/generrno.sh, which also generates
src/errno.c under the build directory. CMake package and pkg-config templates
are in cmake/ and akerror.pc.in. Tests are one-file C programs in tests/;
shared test helpers live beside them, such as tests/err_capture.h.
Build, Test, and Development Commands
Use an out-of-tree build:
cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure
cmake -S . -B build configures the build and generates akerror.h.
cmake --build build compiles libakerror and test executables. ctest
runs the registered unit tests. To emit CI-style results, use:
ctest --test-dir build --output-on-failure --output-junit "$(pwd)/ctest-junit.xml"
Mutation testing is available through:
cmake --build build --target mutation
scripts/mutation_test.py --target src/error.c --threshold 65
Coding Style & Naming Conventions
Use C99-compatible C and follow the surrounding style. Functions and types use
the akerr_ prefix; macros and constants use AKERR_ or all-caps macro names
such as PREPARE_ERROR. Keep generated-code changes in templates or generator
scripts, not in build outputs. Preserve concise comments for invariants,
macro constraints, and non-obvious error lifecycle behavior.
Testing Guidelines
Add tests as tests/err_<behavior>.c. Register each new test in the
AKERR_TESTS list in CMakeLists.txt; tests that intentionally abort must
also be listed in AKERR_WILL_FAIL_TESTS. Prefer focused executable tests that
return zero on success and use existing helpers such as AKERR_CHECK. Run the
CTest suite before submitting changes, and run mutation testing when changing
core control-flow, reference counting, stack-trace, or handler behavior.
Commit & Pull Request Guidelines
Recent commits use short, imperative, sentence-case subjects, for example
Fix refcount leak and stack-trace buffer overflow. Keep commits focused and
describe the observable behavior changed. Pull requests should include a brief
summary, tests run, and any compatibility impact for public macros, generated
headers, installation paths, or CMake/pkg-config consumers.
Agent-Specific Instructions
Do not overwrite uncommitted user changes. Avoid editing generated files in
build/; update include/akerror.tmpl.h, src/error.c, CMake files, tests,
or scripts instead.