ABI Stability Assessment Report
Generated: 2026-05-28 | Assessment of
csilk_ctx_sopaque type conversion (PLAN.md P2-1)
Summary
Verdict: LOW PRIORITY — Current design is adequate for the project stage.
Making csilk_ctx_s fully opaque would require significant refactoring of
internal code, tests, and examples for marginal benefit at this point. It
should be deferred until a v1.0 stable release is planned.
Current State
Public API (include/csilk.h:83)
typedef struct csilk_ctx_s csilk_ctx_t;
Only a forward declaration — user code cannot directly instantiate or
dereference the struct without including context_internal.h.
Full Definition (include/csilk/core/context_internal.h:107-218)
The struct has 30+ fields across 9 functional groups:
- Handler chain state (handler_index, handlers, aborted)
- Error recovery (jump_buffer, has_jump_buffer)
- Memory management (arena)
- Request data (request — method, path, headers, body, query, form)
- Response data (response — status, headers, body, sent)
- URL path parameters (params[CSILK_MAX_PARAMS], params_count)
- Protocol mode flags (is_websocket, is_sse)
- Callbacks (on_ws_message, on_close)
- Driver pointers, sendfile state, tracing UUID
Who includes context_internal.h?
| Consumer | Count | Notes |
|---|---|---|
Framework source (src/) |
~10 files | Expected — internal implementation |
Tests (tests/) |
30+ files | Direct field access for testing |
Examples (examples/) |
3 files | c->request.method/path/status, c->is_websocket |
Direct Struct Field Access (Non-Framework Code)
Tests accessing c->response.* directly:
test_redirect.c—c->response.headers.bucketstest_gzip.c—c->response.body,.body_len,.body_is_managed,.statustest_logger.c—c->response.statustest_session_ext.c—c->request.headers.buckets,c->arena
Examples accessing struct fields directly:
advanced_server.c:91—c->is_websocketcheck in handlerexample_app.c:381—c->request.method,c->request.path,c->response.status
Impact Analysis
If csilk_ctx_s were made fully opaque:
Breakages:
| File | Field accessed |
|---|---|
test_redirect.c |
c->response.headers.buckets |
test_gzip.c |
c->response.body, .body_len, .status |
test_logger.c |
c->response.status |
test_session_ext.c |
c->request.headers, c->arena |
examples/advanced_server.c |
c->is_websocket |
examples/example_app.c |
c->request.method/path, c->response.status |
New accessor APIs needed:
csilk_ctx_get_method(c)→ returns method stringcsilk_ctx_get_path(c)→ returns path stringcsilk_ctx_get_status(c)→ returns status codecsilk_ctx_set_status(c, status)→ sets status codecsilk_ctx_set_body(c, data, len)→ sets response bodycsilk_ctx_is_websocket(c)→ returns intcsilk_ctx_get_arena(c)→ returns arena pointercsilk_request_get_header(c, key)→ returns header valuecsilk_response_set_header(c, key, value)→ sets response header
Other considerations:
csilk_client_t(defined incontext_internal.h) is also exposedcsilk_request_t,csilk_response_t,csilk_param_ttypes are part of the internal layout and would need separate public headers or opaque accessor APIs- SSE/WebSocket callback function pointers stored directly in struct
Recommendation
Defer opaque conversion until v1.0 preparation
Rationale:
- Project maturity: csilk is pre-1.0 (current: v0.2.3). ABI stability is not a contractual promise at this stage.
- Test dependency: 30+ test files include
context_internal.h. Moving them to pure API-based testing is a separate project. - Low user impact: External users receive
csilk_ctx_t*and interact through the well-documented public API incsilk.h. Includingcontext_internal.his an explicit opt-in. - No installation exposure:
context_internal.his installed alongside the public headers but is clearly documented as "Internal — do not include." Users who include it anyway assume the risk.
Mitigation steps (when v1.0 is planned)
- Move
context_internal.htosrc/core/(out ofinclude/). - Add accessor macros/inline functions in
csilk.hfor commonly-needed fields (method, path, status, is_websocket). - Update tests to use accessors instead of direct field access.
- Update examples to remove
context_internal.hinclude. - Release with a deprecation notice in minor version before the breaking change.