You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/09/10 00:30:11 UTC
(texera) branch gh-readonly-queue/main/pr-8240-644c19fee7e0556ed0325eb26c7bd2fac6bc9acc created (now 4874e61cf3)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-8240-644c19fee7e0556ed0325eb26c7bd2fac6bc9acc
in repository https://gitbox.apache.org/repos/asf/texera.git
at 4874e61cf3 feat(pyamber): reject invalid port booleans (#8240)
This branch includes the following new commits:
new 4874e61cf3 feat(pyamber): reject invalid port booleans (#8240)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(texera) 01/01: feat(pyamber): reject invalid port booleans (#8240)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-8240-644c19fee7e0556ed0325eb26c7bd2fac6bc9acc
in repository https://gitbox.apache.org/repos/asf/texera.git
commit 4874e61cf3fd34c146253c9b63dc5d436604ca4d
Author: carloea2 <ca...@uci.edu>
AuthorDate: Thu Sep 10 00:29:48 2026 +0000
feat(pyamber): reject invalid port booleans (#8240)
### What changes were proposed in this PR?
The Python GlobalPortIdentity decoder now rejects invalid boolean tokens
instead of silently treating them as false. Valid mixed-case true and
false values remain supported.
### Any related issues, documentation, discussions?
Closes #8239
### How was this PR tested?
```text
python -c "import sys,pytest; sys.path[:0]=[r'C:\Users\carlo\texera\texera-worktrees\investigate-bug56\amber\src\main\python',r'C:\Users\carlo\texera\texera\amber\src\main\python']; raise SystemExit(pytest.main(['amber/src/test/python/core/util/test_virtual_identity.py','amber/src/test/python/core/storage/test_vfs_uri_factory.py','-q','-p','no:cacheprovider']))"
48 passed
ruff check amber/src/main/python amber/src/test/python
All checks passed
ruff format --check amber/src/main/python amber/src/test/python
213 files already formatted
```
Direct reproduction after the fix:
```text
ValueError: Invalid isInternal: maybe
```
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Codex
---------
Signed-off-by: Meng Wang <me...@uci.edu>
Co-authored-by: Meng Wang <me...@uci.edu>
Co-authored-by: Copilot Autofix powered by AI <17...@users.noreply.github.com>
---
amber/src/main/python/core/util/virtual_identity.py | 6 ++++++
amber/src/test/python/core/util/test_virtual_identity.py | 10 ++++++++++
2 files changed, 16 insertions(+)
diff --git a/amber/src/main/python/core/util/virtual_identity.py b/amber/src/main/python/core/util/virtual_identity.py
index 0a9de0ccc4..804d9d918c 100644
--- a/amber/src/main/python/core/util/virtual_identity.py
+++ b/amber/src/main/python/core/util/virtual_identity.py
@@ -111,6 +111,12 @@ def deserialize_global_port_identity(encoded_str: str) -> GlobalPortIdentity:
port_id = int(port_id_str)
if port_id < 0:
raise ValueError(f"portId must be non-negative: {port_id}")
+ for field, value in (("isInternal", is_internal_str), ("isInput", is_input_str)):
+ if value.lower() not in ("true", "false"):
+ raise ValueError(
+ f"Invalid {field}: {value}. Expected true/false in GlobalPortIdentity "
+ f"encoding: {encoded_str}"
+ )
is_internal = is_internal_str.lower() == "true"
is_input_port = is_input_str.lower() == "true"
op_id = PhysicalOpIdentity(
diff --git a/amber/src/test/python/core/util/test_virtual_identity.py b/amber/src/test/python/core/util/test_virtual_identity.py
index ad60391c28..fae65b4e6d 100644
--- a/amber/src/test/python/core/util/test_virtual_identity.py
+++ b/amber/src/test/python/core/util/test_virtual_identity.py
@@ -195,6 +195,16 @@ class TestDeserializeGlobalPortIdentity:
assert result.port_id.internal is True
assert result.input is False
+ @pytest.mark.parametrize(
+ ("field", "valid"), [("isInternal", "false"), ("isInput", "true")]
+ )
+ def test_rejects_invalid_boolean_value(self, field, valid):
+ encoded = (
+ "(logicalOpId=op,layerName=l,portId=0,isInternal=false,isInput=true)"
+ ).replace(f"{field}={valid}", f"{field}=maybe")
+ with pytest.raises(ValueError, match=f"Invalid {field}"):
+ deserialize_global_port_identity(encoded)
+
def test_raises_value_error_on_malformed_input(self):
with pytest.raises(ValueError, match="Invalid GlobalPortIdentity format"):
deserialize_global_port_identity("not-a-port-id")