Skip to content

Commit b4b9b64

Browse files
hbarthelsclaude
andcommitted
Make int32 config parsing strict and loud
Previously `_extract_value_int32` silently returned the field default when a config value was present but not an `int32_value` (e.g. a bare `2` instead of `2i32`). That silent fallback masked malformed input. Now the helper errors loudly (`ParseError`) when a config value is present with the wrong type, while still keeping the `i32` suffix requirement and returning the default only when the field is genuinely absent. Edited `meta/src/meta/grammar.y` and regenerated the Python, Julia, and Go parsers. Added regression tests in the Julia and Python SDKs covering: a properly-typed `2i32` parses, a bare `2` raises `ParseError`, and omitting the field yields the default (1). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 671608d commit b4b9b64

6 files changed

Lines changed: 343 additions & 273 deletions

File tree

meta/src/meta/grammar.y

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,11 @@ export_iceberg_config
14561456

14571457

14581458
def _extract_value_int32(value: Optional[logic.Value], default: int) -> Int32:
1459-
if value is not None and builtin.has_proto_field(builtin.unwrap_option(value), 'int32_value'):
1459+
if value is None:
1460+
return builtin.int64_to_int32(default)
1461+
if builtin.has_proto_field(builtin.unwrap_option(value), 'int32_value'):
14601462
return builtin.unwrap_option(value).int32_value
1463+
builtin.error("expected an int32 value (e.g. `1i32`) for this config field")
14611464
return builtin.int64_to_int32(default)
14621465

14631466

0 commit comments

Comments
 (0)