Repository navigation
Add UTF-8 unit tests for apteryx_set, apteryx_get, apteryx_set_tree, apteryx_get_tree - #456
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/alliedtelesis/apteryx/sessions/98c81a54-d2a5-4b4e-ac9b-5927c7649e72 Co-authored-by: atlnz-scottp <239511521+atlnz-scottp@users.noreply.github.com>
…viour) Agent-Logs-Url: https://github.com/alliedtelesis/apteryx/sessions/93120a49-5d6c-4313-a30d-a2946969ee76 Co-authored-by: atlnz-scottp <239511521+atlnz-scottp@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
atlnz-scottp
April 16, 2026 21:24
View session
atlnz-scottp
marked this pull request as ready for review
April 17, 2026 02:26
sparlane
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a dedicated
"UTF-8"CUnit suite (19 tests, 132 assertions) covering both valid multi-byte Unicode and known edge-case / invalid-input behaviour across all four core data APIs.Happy-path tests (10)
Verify correct round-trip storage and retrieval — including byte-length assertions to catch silent character-to-byte collapsing:
é,ö)set/get日本語)set/get😀)set/getset/getcafé 日本 😀, 17 bytes / 9 chars)set/getset/getset_tree/getset_string/get_treeset_tree/getandset/get_treeEdge-case / invalid-input tests (9)
Document two known limitations of the current implementation:
Class A – Silent NUL-byte truncation.
rpc_msg_encode_string()usesstrlen(), so any embedded0x00terminates the data at that point; bytes after it are silently dropped.Covers: value truncation (
set/get), path truncation (write redirected to wrong key), and tree-leaf value truncation (set_tree/get).Class B – No UTF-8 validation.
validate_path()and the RPC layer perform no byte-content inspection. Invalid sequences are accepted and returned unchanged:\x80\xC1\x81\xE2\x80\xFF\xED\xA0\x80\xC3\xA9\x80set_tree/get_tree)