Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Forge package families are versioned independently. Python, Rust, and C++ implem

## Unreleased

### forge-msgs 2.0.1

- Require Pillow 13 (`>=13.0.0,<14`) for the Python compressed-image codec to consume its security fixes. Python 3.11 remains supported.
- Cover RGB/grayscale JPEG, PNG and WebP codecs, strided arrays, malformed input, and exact raw-depth round trips without changing the Arrow wire schema.
- Keep Msgs package-family versions synchronized across Python, Rust and C++; Rust/C++ codec behavior and the `forge_msgs.v1` interface are unchanged.

## forge-common 2.1.0 - 2026-09-08

Protected tag: `forge-common-v2.1.0`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ packages, for example a separate `forge_robots` repository.
## Status

Forge tracks six package families: Common, Msgs, Robot, Policy, Kinematics, and Tool.
Common is `2.1.0`; the other five families remain at the coordinated Dora 1.x
`2.0.0` baseline. Families can receive independent minor and patch releases.
Common is `2.1.0`; Msgs is `2.0.1`; Robot, Policy, Kinematics and Tool remain
at the coordinated Dora 1.x `2.0.0` baseline. Families can receive independent minor and patch releases.
Package versions within one family remain synchronized across languages;
capabilities may differ, and language-neutral interface versions are tracked
separately.

The Python Msgs compressed-image codec requires Pillow `>=13.0.0,<14`.
Msgs still supports Python 3.11; the complete workspace requires Python 3.12.
Consumers pinning Pillow below 13 must update their dependency constraints.
Raw RGB/depth payloads and the Arrow wire schema are unchanged.

`master` carries the latest Forge 2.x development line. `stable/1.x` preserves the
Dora 0.4-compatible Forge 1.x line for critical fixes during downstream migration.

Expand Down
7 changes: 6 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ Forge 是面向 Dora 数据流的机器人基础框架,提供公共消息 sche
## 版本状态

Forge 按 Common、Msgs、Robot、Policy、Kinematics、Tool 六个包家族维护。
Common 为 `2.1.0`,其余五家族保持 Dora 1.x 对齐的 `2.0.0` 基线。
Common 为 `2.1.0`,Msgs 为 `2.0.1`;Robot、Policy、Kinematics、Tool 保持 Dora 1.x 对齐的 `2.0.0` 基线。
各家族可独立发布次版本和修订版本;同一家族跨语言包版本保持一致,
实际能力允许不同,语言无关接口版本另行跟踪。

Python Msgs 的压缩图像编解码要求 Pillow `>=13.0.0,<14`。
Msgs 继续支持 Python 3.11;完整工作区要求 Python 3.12。
固定使用 Pillow 13 以下版本的使用方需要更新依赖约束。
原始 RGB/深度数据及 Arrow 线协议保持不变。

`master` 维护 Forge 2.x 开发线;`stable/1.x` 保留兼容 Dora 0.4 的 Forge 1.x,
用于下游迁移期间的关键修复。

Expand Down
2 changes: 1 addition & 1 deletion cpp/forge_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)

project(forge_msgs_cpp VERSION 2.0.0 LANGUAGES CXX)
project(forge_msgs_cpp VERSION 2.0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion crates/forge_msgs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "forge_msgs"
version = "2.0.0"
version = "2.0.1"
edition.workspace = true
license.workspace = true
authors.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions packages/msgs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "forge-msgs"
version = "2.0.0"
version = "2.0.1"
description = "Python message models and Arrow serialization for Forge robotics dataflows."
readme = "README.md"
authors = [
Expand All @@ -11,7 +11,7 @@ license = "Apache-2.0"
license-files = ["LICENSE"]
dependencies = [
"numpy>=1.26,<3",
"pillow>=10,<13",
"pillow>=13.0.0,<14",
"pyarrow>=14,<24",
"pydantic>=2.0,<3",
]
Expand Down
63 changes: 63 additions & 0 deletions packages/msgs/tests/test_image_codec_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""Regression matrix for Pillow 13 using Forge's public image API."""

import io

import numpy as np
import pyarrow as pa
import pytest
from forge_msgs import CompressedImage, Image
from PIL import Image as PILImage


@pytest.mark.parametrize("fmt", ["jpeg", "png", "webp"])
@pytest.mark.parametrize("shape", ["rgb", "gray", "gray_channel"])
@pytest.mark.parametrize("strided", [False, True])
def test_codec_shape_dtype_channel_order(fmt, shape, strided):
rgb = np.empty((48, 64, 3), dtype=np.uint8)
rgb[:] = [220, 90, 30]
frame = rgb if shape == "rgb" else np.full((48, 64), 123, dtype=np.uint8)
if shape == "gray_channel":
frame = frame[..., None]
if strided:
frame = frame[::2, ::2]
compressed = CompressedImage.from_numpy(frame, format=fmt, quality=95)
batch = compressed.to_arrow()
buf = io.BytesIO()
with pa.ipc.new_stream(buf, batch.schema) as writer:
writer.write_batch(batch)
decoded = CompressedImage.from_arrow(buf.getvalue()).to_numpy()
expected = frame if frame.ndim == 3 else frame[..., None]
if fmt == "webp" and expected.shape[-1] == 1:
expected = np.repeat(expected, 3, axis=-1)
assert decoded.shape == expected.shape
assert decoded.dtype == np.uint8
tolerance = 0 if fmt == "png" else 5
assert np.abs(decoded.astype(int) - expected.astype(int)).max() <= tolerance
external = np.array(PILImage.open(io.BytesIO(compressed.data)))
if external.ndim == 2:
external = external[..., None]
# WebP decodes gray input as RGB; Forge's stable output contract follows mode.
np.testing.assert_array_equal(decoded, external)


@pytest.mark.parametrize(
"encoding,dtype", [("16UC1", "uint16"), ("32SC1", "int32"), ("32FC1", "float32")]
)
def test_depth_remains_exact_and_independent_of_pillow(encoding, dtype):
frame = np.array([[0, 123, 65535], [1, 1000, 5000]], dtype=dtype)
msg = Image.from_numpy(frame, encoding=encoding)
np.testing.assert_array_equal(Image.from_arrow(msg.to_arrow()).to_numpy(), frame)
with pytest.raises(ValueError, match="uint8"):
CompressedImage.from_numpy(frame, format="png")


def test_bgr_input_is_not_a_pillow_mode_conversion():
bgr = np.array([[[30, 90, 220]]], dtype=np.uint8)
msg = Image.from_numpy(bgr, encoding="bgr8")
np.testing.assert_array_equal(Image.from_arrow(msg.to_arrow()).to_numpy(), bgr)


@pytest.mark.parametrize("fmt", ["jpeg", "png", "webp"])
def test_invalid_bitstream_fails_explicitly(fmt):
with pytest.raises(OSError):
CompressedImage(format=fmt, data=b"invalid-image-data").to_numpy()
Loading
Loading