Repository navigation
refactor(api): cleans up public API, soversion 6 - #545
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Size bounds and runtime version src/lib/zxc_common.c, src/lib/zxc_pstream.c, include/zxc_buffer.h, include/zxc_constants.h, wrappers/rust/*, tests/*, CMakeLists.txt, meson.build, docs/API.md |
Bound and context-size APIs now return size_t. zxc_compress_bound returns 0 when the required size does not fit. The library adds zxc_version_number() and ZXC_VERSION_NUMBER, and the shared-library SOVERSION changes to 6. Tests check near-SIZE_MAX bounds and compare runtime and header version numbers. |
Dictionary API rename and integration include/zxc_dict.h, src/lib/zxc_dict.c, src/lib/zxc_dispatch.c, src/lib/zxc_driver.c, src/lib/zxc_seekable.c, src/cli/main.c, wrappers/*, cmake/zxcWasm.cmake, tests/*, docs/* |
Dictionary ID and training APIs use the names zxc_dict_compute_id, zxc_dict_read_id, zxc_dict_train_content, and zxc_dict_train_huf. The library and its callers, bindings, documentation, and tests use the updated names. Dictionary ID and training behavior remains unchanged in the described changes. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Refactor
Merge Risk: 
Minimal · up to 241b0
-
The reviewed API and ABI changes have no identified merge-blocking issue. Merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 62.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 166 functions across 46 files. (10 skipped: 10 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Align dictionary API naming (`zxc_dict_train_content`, `zxc_dict_train_huf`, `zxc_dict_compute_id`, `zxc_dict_read_id`), switch bound/size functions to `size_t`, and add `zxc_version_number()`. Breaks ABI for the 1.0 surface cleanup. Signed-off-by: Bertrand Lebonnois <[email protected]>
Drop now-redundant (size_t) casts on zxc_compress_bound/zxc_compress_block_bound call sites across docs, tests, fuzzers, and wrappers following their size_t signature change. Tighten zxc_compress_bound's overflow check to report 0 only when the result truly can't fit a size_t, and add regression tests for near-SIZE_MAX inputs. Also export zxc_version_number in the Wasm build and include zxc_constants.h from zxc_buffer.h for ZXC_VERSION_NUMBER. Signed-off-by: Bertrand Lebonnois <[email protected]>
614d47d to
241b0e4
Compare
|
@coderabbitai review |
✅ Action performed
|
* refactor: rename dict API fns, bump SOVERSION to 6 Align dictionary API naming (`zxc_dict_train_content`, `zxc_dict_train_huf`, `zxc_dict_compute_id`, `zxc_dict_read_id`), switch bound/size functions to `size_t`, and add `zxc_version_number()`. Breaks ABI for the 1.0 surface cleanup. Signed-off-by: Bertrand Lebonnois <[email protected]> * refactor: clean up size_t bound usage, fix overflow Drop now-redundant (size_t) casts on zxc_compress_bound/zxc_compress_block_bound call sites across docs, tests, fuzzers, and wrappers following their size_t signature change. Tighten zxc_compress_bound's overflow check to report 0 only when the result truly can't fit a size_t, and add regression tests for near-SIZE_MAX inputs. Also export zxc_version_number in the Wasm build and include zxc_constants.h from zxc_buffer.h for ZXC_VERSION_NUMBER. Signed-off-by: Bertrand Lebonnois <[email protected]> --------- Signed-off-by: Bertrand Lebonnois <[email protected]>
Prepares the library's public surface for a 1.0 release by removing inconsistencies that accumulated as the API grew.
Bound functions return
size_t, notuint64_tzxc_compress_bound,zxc_compress_block_bound,zxc_decompress_block_bound, andzxc_estimate_cctx_sizeto returnsize_tinstead ofuint64_t, removing the awkward(size_t)casts (and the silent truncation risk) scattered across callers, bindings, and examples.zxc_compress_bound: very large inputs now return0(capacity would not fit asize_t) instead of wrapping silently.Renames dictionary API for consistency
zxc_train_dict->zxc_dict_train_contentzxc_train_dict_huf->zxc_dict_train_hufzxc_dict_id->zxc_dict_compute_idzxc_dict_get_id->zxc_dict_read_idzxc_dict_*prefix, making their purpose (train/compute/read) clearer, and updates every caller, wrapper, doc, and golden/fuzz test accordingly.Adds
zxc_version_number()MAJOR*10000 + MINOR*100 + PATCHversion at runtime, mirroring the newZXC_VERSION_NUMBERheader macro, so callers can detect a runtime library older than the one they compiled against.Bumps SOVERSION to 6
Summary by CodeRabbit
size_treturn types for buffer-size estimates.size_t.