From 16884200a5066fc7d1ddc270cc38a010ef267ca2 Mon Sep 17 00:00:00 2001 From: mrgh97 <44031031+mrgh97@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:39:10 +0800 Subject: [PATCH] fix(msgs): prepare 2.1.0 and validate release tags before publishing --- .github/workflows/ci.yml | 2 +- .github/workflows/publish-pypi.yml | 14 ++++++- CHANGELOG.md | 6 ++- Cargo.lock | 2 +- README.md | 9 ++++- README_zh.md | 8 +++- RELEASING.md | 12 ++++-- cpp/forge_msgs/CMakeLists.txt | 2 +- crates/forge_msgs/Cargo.toml | 2 +- packages/msgs/pyproject.toml | 2 +- scripts/tests/test_publish_workflow.py | 55 ++++++++++++++++++++++++++ uv.lock | 2 +- versions.toml | 2 +- 13 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 scripts/tests/test_publish_workflow.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2379746..aa4b30e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: run: uv run python scripts/check_forge_msgs_schema.py - name: Run Python tests - run: uv run pytest packages/common/tests packages/msgs/tests packages/policy/tests packages/robot/tests packages/kinematics/tests packages/tool/tests + run: uv run pytest packages/common/tests packages/msgs/tests packages/policy/tests packages/robot/tests packages/kinematics/tests packages/tool/tests scripts/tests - name: Build and validate all Python distributions run: uv run python scripts/build_python_distributions.py diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index eff3600..b4f8bdc 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: tag: - description: "Immutable family tag to publish (for example, forge-common-v2.0.0)" + description: "Existing annotated family tag (for example, forge-msgs-v2.1.0); this input does not create a tag" required: true type: string @@ -19,6 +19,8 @@ concurrency: jobs: resolve: runs-on: ubuntu-latest + permissions: + contents: read outputs: tag: ${{ steps.release.outputs.tag }} @@ -32,6 +34,7 @@ jobs: shell: bash env: REQUESTED_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} + GH_TOKEN: ${{ github.token }} run: | set -euo pipefail @@ -43,6 +46,15 @@ jobs: family="${BASH_REMATCH[1]}" version="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.${BASH_REMATCH[4]}" + if ! tag_type=$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/tags/${REQUESTED_TAG}" --jq '.object.type'); then + echo "::error::Release tag '${REQUESTED_TAG}' does not exist or cannot be read. Run workflow does not create tags. Create the annotated family tag on the reviewed release commit before retrying." >&2 + exit 1 + fi + if [[ "$tag_type" != "tag" ]]; then + echo "::error::Release '${REQUESTED_TAG}' must be an annotated tag; a lightweight tag is not supported." >&2 + exit 1 + fi + echo "tag=$REQUESTED_TAG" >> "$GITHUB_OUTPUT" echo "family=$family" >> "$GITHUB_OUTPUT" echo "version=$version" >> "$GITHUB_OUTPUT" diff --git a/CHANGELOG.md b/CHANGELOG.md index 40940fd..0c252dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,15 @@ Forge package families are versioned independently. Python, Rust, and C++ implem ## Unreleased -### forge-msgs 2.0.1 +## forge-msgs 2.1.0 - 2026-11-12 + +Family tag: `forge-msgs-v2.1.0` - 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. +- Publish as the independently versioned `forge-msgs-v2.1.0` family tag. The earlier 2.0.1 candidate was not released to PyPI. +- Reject nonexistent and lightweight release tags before checkout, with an actionable error for manual workflow runs. ## forge-common 2.1.0 - 2026-09-08 diff --git a/Cargo.lock b/Cargo.lock index 1074b3f..39e8967 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -220,7 +220,7 @@ dependencies = [ [[package]] name = "forge_msgs" -version = "2.0.1" +version = "2.1.0" dependencies = [ "arrow-array", "arrow-schema", diff --git a/README.md b/README.md index 5f8a288..7d6104c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ 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`; Msgs is `2.0.1`; Robot, Policy, Kinematics and Tool remain +Common is `2.1.0`; Msgs is `2.1.0`; 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 @@ -321,6 +321,13 @@ Local release-family mode rejects dirty trees and requires the expected protecte tag not to exist. A family tag CI run selects that family automatically and requires its tag to exist and point to the checked-out `HEAD`. +For the Python Msgs release, use the annotated tag `forge-msgs-v2.1.0` on the +reviewed, merged release commit. Creating that tag in `PhyAgentOS/forge` triggers +`publish-pypi.yml`. Manually entering a tag in **Run workflow** does not create it; +the workflow rejects missing or lightweight tags before checking out the release. +PyPI Trusted Publishing must authorize `PhyAgentOS/forge`, workflow +`publish-pypi.yml`, environment `pypi-msgs`. See [RELEASING.md](RELEASING.md). + Run the C++ tests: ```bash diff --git a/README_zh.md b/README_zh.md index 2157131..ba21f39 100644 --- a/README_zh.md +++ b/README_zh.md @@ -25,7 +25,7 @@ Forge 是面向 Dora 数据流的机器人基础框架,提供公共消息 sche ## 版本状态 Forge 按 Common、Msgs、Robot、Policy、Kinematics、Tool 六个包家族维护。 -Common 为 `2.1.0`,Msgs 为 `2.0.1`;Robot、Policy、Kinematics、Tool 保持 Dora 1.x 对齐的 `2.0.0` 基线。 +Common 为 `2.1.0`,Msgs 为 `2.1.0`;Robot、Policy、Kinematics、Tool 保持 Dora 1.x 对齐的 `2.0.0` 基线。 各家族可独立发布次版本和修订版本;同一家族跨语言包版本保持一致, 实际能力允许不同,语言无关接口版本另行跟踪。 @@ -283,6 +283,12 @@ uv run python scripts/build_python_distributions.py --release-family msgs 本地家族发布模式拒绝脏工作区,并要求预期受保护标签尚不存在。 家族标签 CI 自动选择该家族,并要求标签已存在且指向当前 `HEAD`。 +Python Msgs 本次发布使用附注标签 `forge-msgs-v2.1.0`,指向已审核并合并的发布提交。 +在 `PhyAgentOS/forge` 创建该标签会自动触发 `publish-pypi.yml`。 +在 **Run workflow** 填写标签名称不会创建标签;流水线会在检出前拒绝不存在或轻量标签。 +PyPI Trusted Publishing 应绑定 `PhyAgentOS/forge`、工作流 `publish-pypi.yml`、 +环境 `pypi-msgs`。详细流程见 [RELEASING.md](RELEASING.md)。 + 运行 C++ 测试: ```bash diff --git a/RELEASING.md b/RELEASING.md index 1112569..84e3988 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -9,7 +9,7 @@ Forge is a Monorepo with independently versioned logical package families. Imple ```toml [packages] common = "2.1.0" -msgs = "2.0.0" +msgs = "2.1.0" robot = "2.0.0" policy = "2.0.0" kinematics = "2.0.0" @@ -245,14 +245,20 @@ Environment per package family and add the matching trusted publisher to each PyPI project (or as a pending publisher before the first upload). For Msgs: ```text -Owner: Forgelab-Robotics +Owner: PhyAgentOS Repository: forge Workflow: publish-pypi.yml Environment: pypi-msgs ``` Existing release tags can be published with `workflow_dispatch` by entering the -full immutable family tag. Future `forge-*-v*` tag pushes trigger the same +full immutable family tag. Entering a name does not create its tag. Create an +annotated tag on the reviewed, merged release commit first; for the current Msgs +candidate the package version is `2.1.0` and its tag is `forge-msgs-v2.1.0`. +The resolver rejects absent and lightweight tags before checkout. A tag whose +version differs from `versions.toml` is also rejected. Do not move an existing tag. + +Future `forge-*-v*` tag pushes trigger the same workflow automatically. In both cases the workflow checks out and verifies the annotated tag, builds only that family, stores the artifacts for audit, and publishes only its wheel and source archive. diff --git a/cpp/forge_msgs/CMakeLists.txt b/cpp/forge_msgs/CMakeLists.txt index 3d17a36..604736c 100644 --- a/cpp/forge_msgs/CMakeLists.txt +++ b/cpp/forge_msgs/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) -project(forge_msgs_cpp VERSION 2.0.1 LANGUAGES CXX) +project(forge_msgs_cpp VERSION 2.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/crates/forge_msgs/Cargo.toml b/crates/forge_msgs/Cargo.toml index 481d416..9f67365 100644 --- a/crates/forge_msgs/Cargo.toml +++ b/crates/forge_msgs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forge_msgs" -version = "2.0.1" +version = "2.1.0" edition.workspace = true license.workspace = true authors.workspace = true diff --git a/packages/msgs/pyproject.toml b/packages/msgs/pyproject.toml index 0ed0f36..9fc5a61 100644 --- a/packages/msgs/pyproject.toml +++ b/packages/msgs/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "forge-msgs" -version = "2.0.1" +version = "2.1.0" description = "Python message models and Arrow serialization for Forge robotics dataflows." readme = "README.md" authors = [ diff --git a/scripts/tests/test_publish_workflow.py b/scripts/tests/test_publish_workflow.py new file mode 100644 index 0000000..5418d99 --- /dev/null +++ b/scripts/tests/test_publish_workflow.py @@ -0,0 +1,55 @@ +"""Exercise the actual release resolver against remote tag API outcomes.""" +import os +from pathlib import Path +import subprocess + +import pytest +import yaml + +ROOT = Path(__file__).resolve().parents[2] + + +@pytest.mark.parametrize( + "tag_type,api_status,expected_status", + [("tag", 0, 0), ("commit", 0, 1), ("", 1, 1)], + ids=["annotated-tag", "lightweight-tag", "missing-tag"], +) +def test_release_resolver_rejects_missing_or_lightweight_tags( + tmp_path, tag_type, api_status, expected_status +): + workflow = yaml.safe_load((ROOT / ".github/workflows/publish-pypi.yml").read_text()) + script = workflow["jobs"]["resolve"]["steps"][0]["run"] + fake_gh = tmp_path / "gh" + fake_gh.write_text( + '#!/bin/sh\nprintf "%s\\n" "$FAKE_TAG_TYPE"\nexit "$FAKE_API_STATUS"\n' + ) + fake_gh.chmod(0o755) + output = tmp_path / "output" + result = subprocess.run( + ["bash", "-c", script], + env={ + **os.environ, + "PATH": str(tmp_path) + os.pathsep + os.environ["PATH"], + "GITHUB_REPOSITORY": "PhyAgentOS/forge", + "REQUESTED_TAG": "forge-msgs-v2.1.0", + "GITHUB_OUTPUT": str(output), + "GH_TOKEN": "unused-test-token", + "FAKE_TAG_TYPE": tag_type, + "FAKE_API_STATUS": str(api_status), + }, + capture_output=True, + text=True, + check=False, + ) + assert result.returncode == expected_status, result.stderr + if expected_status == 0: + values = dict(line.split("=", 1) for line in output.read_text().splitlines()) + assert values == { + "tag": "forge-msgs-v2.1.0", + "family": "msgs", + "version": "2.1.0", + "distribution": "forge-msgs", + } + else: + assert "annotated" in result.stderr + assert not output.exists() diff --git a/uv.lock b/uv.lock index 21a2b47..c4d3737 100644 --- a/uv.lock +++ b/uv.lock @@ -334,7 +334,7 @@ provides-extras = ["least-squares"] [[package]] name = "forge-msgs" -version = "2.0.1" +version = "2.1.0" source = { editable = "packages/msgs" } dependencies = [ { name = "numpy" }, diff --git a/versions.toml b/versions.toml index 0642271..76e8feb 100644 --- a/versions.toml +++ b/versions.toml @@ -2,7 +2,7 @@ schema_version = 1 [packages] common = "2.1.0" -msgs = "2.0.1" +msgs = "2.1.0" robot = "2.0.0" policy = "2.0.0" kinematics = "2.0.0"