Skip to content

Commit b38e5ad

Browse files
Fix misleading persisted_length comments in SDK
The comments implied persisted_length was an exact fixed storage size. Based on experimentation with Claude, it is actually a maximum buffer ceiling — the server persists only as many bytes as the encode function writes via its length output parameter (already documented correctly on vef_encode_func_t). Updated both sdk/ and stable_sdk/v1/. AI=CLAUDE Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f930393 commit b38e5ad

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

villagesql/sdk/include/villagesql/abi/types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ typedef struct {
538538
// Encoded using UTF-8
539539
const char *name;
540540

541-
// Size of the binary representation when stored
541+
// Maximum buffer size for binary storage; actual bytes persisted are
542+
// determined by the encode function via its length output parameter.
542543
int64_t persisted_length;
543544

544545
// Maximum size of the string representation (for decode output buffer)

villagesql/sdk/include/villagesql/extension.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
// ending with .build():
113113
//
114114
// make_type("mytype")
115-
// .persisted_length(8) // Bytes when stored
115+
// .persisted_length(8) // Max storage buffer (encode sets actual length)
116116
// .max_decode_buffer_length(64) // Max bytes for string representation
117117
// .encode(&mytype_encode) // String -> binary
118118
// .decode(&mytype_decode) // Binary -> string

villagesql/stable_sdk/v1/include/villagesql/abi/types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ typedef struct {
504504
// Encoded using UTF-8
505505
const char *name;
506506

507-
// Size of the binary representation when stored
507+
// Maximum buffer size for binary storage; actual bytes persisted are
508+
// determined by the encode function via its length output parameter.
508509
int64_t persisted_length;
509510

510511
// Maximum size of the string representation (for decode output buffer)

villagesql/stable_sdk/v1/include/villagesql/extension.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
// ending with .build():
113113
//
114114
// make_type("mytype")
115-
// .persisted_length(8) // Bytes when stored
115+
// .persisted_length(8) // Max storage buffer (encode sets actual length)
116116
// .max_decode_buffer_length(64) // Max bytes for string representation
117117
// .encode(&mytype_encode) // String -> binary
118118
// .decode(&mytype_decode) // Binary -> string

0 commit comments

Comments
 (0)