Skip to content

fix(kv-ir): Use Result-based error handling for encoded text AST deserialization for accurate error reporting.#2282

Open
LinZhihao-723 wants to merge 1 commit into
y-scope:mainfrom
LinZhihao-723:incomplete-ir-fix
Open

fix(kv-ir): Use Result-based error handling for encoded text AST deserialization for accurate error reporting.#2282
LinZhihao-723 wants to merge 1 commit into
y-scope:mainfrom
LinZhihao-723:incomplete-ir-fix

Conversation

@LinZhihao-723
Copy link
Copy Markdown
Member

@LinZhihao-723 LinZhihao-723 commented May 14, 2026

Description

Before this PR, deserialize_encoded_text_ast was using the legacy version of decoding methods to deserialize logtype and dict variables, which made the error code ambiguous when a truncated stream was encountered. This PR fixes the issue by unifying the implementation with the Result-based error handling to make sure the error codes are reported consistently as expected (no IRErrorCode involved anymore).

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Ensure all workflows pass.
  • Ensure a truncated IR stream can be deserialized and a proper error is reported as:
    error_category=clp::ffi::ir_stream::IrDeserializationError, error=incomplete IR stream
    

Summary by CodeRabbit

  • Refactor

    • Improved internal error handling mechanisms for data deserialization processes.
  • Documentation

    • Updated technical documentation to reflect error propagation details in deserialization functions.

Review Change Stack

@LinZhihao-723 LinZhihao-723 requested a review from a team as a code owner May 14, 2026 20:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Walkthrough

IR stream decoding helper functions migrate from returning IRErrorCode to ystdlib::error_handling::Result<void>, with the main deserialization function updated to use error-propagation macros and header documentation adjusted accordingly.

Changes

IR Stream Decoding Error Handling Refactor

Layer / File(s) Summary
Helper function refactoring to Result-based errors
components/core/src/clp/ffi/ir_stream/decoding_methods.cpp
deserialize_and_append_logtype and deserialize_and_append_dict_var refactored to return Result<void>, producing IrDeserializationError with IncompleteStream or InvalidTag enums instead of IRErrorCode constants.
Main deserialization function error propagation
components/core/src/clp/ffi/ir_stream/decoding_methods.cpp
deserialize_encoded_text_ast implementation switches from manual error-code checks and EncodedTextAstDeserializationFailure wrapping to YSTDLIB_ERROR_HANDLING_TRYX/TRYV macros for propagating errors from helper functions.
Documentation update for error handling
components/core/src/clp/ffi/ir_stream/decoding_methods.hpp
Header documentation for deserialize_encoded_text_ast updated to specify that failures are forwarded from underlying deserialization helpers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • gibber9809
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refactoring error handling in encoded text AST deserialization to use Result-based approach for better error reporting.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant