From e206111c1926ba0f93f97aab85edb937abed0465 Mon Sep 17 00:00:00 2001 From: Gavin Ying Date: Wed, 4 Nov 2026 11:46:12 +0800 Subject: [PATCH 1/4] test: validate full and public audit TMs in simulation --- docs/release-process.md | 13 +++++++++++++ tests/test_wot.py | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/docs/release-process.md b/docs/release-process.md index bba0658..f4f7849 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -31,3 +31,16 @@ run the preview workflow manually on v2 with its `tag` input. This skips all publishing jobs, installs the existing PyPI wheel, uses fixtures from that exact tag and runs the current acceptance tooling. It does not replace packages or images. Record the separate validation run and tooling SHA. + +### Audit model compatibility + +Use the approved full TM or its public audit TM as the configuration for a +local TCP simulator. Seed known values for the selected properties with +`--initial PROPERTY=JSON` or `--initial-file`. Public audit TMs expose only the +selected read spans. Use identical initial values for the shared properties +when comparing full and public models. + +Stop a foreground simulator with Ctrl-C. Restart with the same TM and initial +values to restore the original vector. A managed deployment can use +`modsim down -f deployment.yaml` and `modsim up -f deployment.yaml` on POSIX. +These checks verify software interoperability with the selected fixture. diff --git a/tests/test_wot.py b/tests/test_wot.py index cce54b0..96850bf 100644 --- a/tests/test_wot.py +++ b/tests/test_wot.py @@ -196,3 +196,24 @@ def test_defaults_and_constraints_are_respected(tmp_path): args.model_initialization["origins"]["AI0_RAW"] == "synthetic type/constraint fallback" ) + + +@pytest.mark.integration +def test_full_and_public_audit_models_share_selected_vectors(server): + import modpoll_wot + + derive = getattr(modpoll_wot, "derive_audit_tm", None) + if derive is None: + pytest.skip("requires the independently built audit producer candidate") + source = model("HoldingRegister", 10, ["identity", "private_point", "status"]) + source["modpoll:audit"] = {"identity": ["identity"], "status": ["status"]} + artifact = derive(json.dumps(source).encode(), title="Audit vector") + full = server(source, "--initial", "identity=4660", "--initial", "status=43981") + public = server( + json.loads(artifact.payload), "--initial", "identity=4660", "--initial", "status=43981" + ) + for client in (full, public): + assert client.read_holding_registers(10, count=1, device_id=1).registers == [4660] + assert client.read_holding_registers(12, count=1, device_id=1).registers == [43981] + assert public.read_holding_registers(11, count=1, device_id=1).isError() + assert public.write_register(12, 7, device_id=1).isError() From dc3d16080bc5b26bfdcd6ddabd0fd5ce78692abb Mon Sep 17 00:00:00 2001 From: Gavin Ying Date: Wed, 4 Nov 2026 11:50:10 +0800 Subject: [PATCH 2/4] style: format simulator audit vector test --- tests/test_wot.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_wot.py b/tests/test_wot.py index 96850bf..16a70db 100644 --- a/tests/test_wot.py +++ b/tests/test_wot.py @@ -210,10 +210,18 @@ def test_full_and_public_audit_models_share_selected_vectors(server): artifact = derive(json.dumps(source).encode(), title="Audit vector") full = server(source, "--initial", "identity=4660", "--initial", "status=43981") public = server( - json.loads(artifact.payload), "--initial", "identity=4660", "--initial", "status=43981" + json.loads(artifact.payload), + "--initial", + "identity=4660", + "--initial", + "status=43981", ) for client in (full, public): - assert client.read_holding_registers(10, count=1, device_id=1).registers == [4660] - assert client.read_holding_registers(12, count=1, device_id=1).registers == [43981] + assert client.read_holding_registers(10, count=1, device_id=1).registers == [ + 4660 + ] + assert client.read_holding_registers(12, count=1, device_id=1).registers == [ + 43981 + ] assert public.read_holding_registers(11, count=1, device_id=1).isError() assert public.write_register(12, 7, device_id=1).isError() From dbe1886501c62deff1ec78ceaceb5d2e7300b60f Mon Sep 17 00:00:00 2001 From: Gavin Ying Date: Wed, 4 Nov 2026 13:40:06 +0800 Subject: [PATCH 3/4] chore(release): pin the published a4 interpreter for modsim 2.0.0a3 --- docs/preview-notes.md | 11 ++++++++++- modsim/__init__.py | 2 +- pyproject.toml | 4 ++-- uv.lock | 11 ++++++----- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/preview-notes.md b/docs/preview-notes.md index 3e692e8..aaaef8f 100644 --- a/docs/preview-notes.md +++ b/docs/preview-notes.md @@ -1,4 +1,13 @@ -# Modsim 2.0.0a2 preview candidate +# Modsim 2.0.0a3 preview + +This preview pins modpoll-wot 0.2.0a4. A local TCP simulator can load a full +profile 0.2 TM with an audit plan or its independently derived public audit TM. +Tests seed the same known values and verify the public model exposes only the +selected read spans. + +### Previous preview + +#### Modsim 2.0.0a2 This candidate uses published modpoll-wot 0.2.0a2 and immutable modbus-models-v1 inputs. Device mappings and contribution workflows now live in modbus-models; diff --git a/modsim/__init__.py b/modsim/__init__.py index 7e47739..6d39a38 100644 --- a/modsim/__init__.py +++ b/modsim/__init__.py @@ -1 +1 @@ -__version__ = "2.0.0a2" +__version__ = "2.0.0a3" diff --git a/pyproject.toml b/pyproject.toml index 4f6bd16..a0e3373 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,13 @@ [project] name = "modsim" -version = "2.0.0a2" +version = "2.0.0a3" description = "A Simple Modbus TCP Device Simulator used for modpoll tool" authors = [{ name = "Ying Shaodong", email = "helloysd@gmail.com" }] readme = "README.md" requires-python = ">=3.10,<4.0" dependencies = [ "pymodbus~=3.16.1", - "modpoll-wot==0.2.0a2", + "modpoll-wot==0.2.0a4", "jsonschema>=4.21,<5", "PyYAML>=6,<7", ] diff --git a/uv.lock b/uv.lock index a5da255..f2df119 100644 --- a/uv.lock +++ b/uv.lock @@ -829,20 +829,21 @@ wheels = [ [[package]] name = "modpoll-wot" -version = "0.2.0a2" +version = "0.2.0a4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "jsonschema", marker = "python_full_version < '3.15'" }, + { name = "pyyaml", marker = "python_full_version < '3.15'" }, { name = "referencing", marker = "python_full_version < '3.15'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c4/90/a9799454bcf39b73521400db64236e10b04d4b53feef0e39d7eb30b9e7ca/modpoll_wot-0.2.0a2.tar.gz", hash = "sha256:42df645c38638408a9de72b0f80c4186b33872bc1511598239984d88fd07245f", size = 34259, upload-time = "2026-10-30T04:47:03.162Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f0/ca/beb17dcdca9a1112d9d0f533988527bb49d32fb0a6986b2d247d2e90c063/modpoll_wot-0.2.0a4.tar.gz", hash = "sha256:dacf5de45d4dd987650cb085068bc0a3f028896a713946c929cc18f8046921d1", size = 44852, upload-time = "2026-11-04T05:38:14.015Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/f0/a4/992a88d9ab6b83d5efb034820e4ff88cc71c77258e8a6fc89fdac780c0a1/modpoll_wot-0.2.0a2-py3-none-any.whl", hash = "sha256:4d5a4e67b40de9367afa20715b420f3b63ceef45c8b8d0ca05bc6a9ea75e8c29", size = 41328, upload-time = "2026-10-30T04:47:02.286Z" }, + { url = "https://files.pythonhosted.org/packages/1b/2f/d7287c8d4c7604d598139eaf13f6b086e54094fd996135f1fd814c5dbf74/modpoll_wot-0.2.0a4-py3-none-any.whl", hash = "sha256:27b7acc8036e01ab83f8e8ed06236dfd164edbeb96d54f61950adfdc144edac3", size = 40757, upload-time = "2026-11-04T05:38:12.879Z" }, ] [[package]] name = "modsim" -version = "2.0.0a2" +version = "2.0.0a3" source = { editable = "." } dependencies = [ { name = "jsonschema", marker = "python_full_version < '3.15'" }, @@ -872,7 +873,7 @@ docs = [ [package.metadata] requires-dist = [ { name = "jsonschema", specifier = ">=4.21,<5" }, - { name = "modpoll-wot", specifier = "==0.2.0a2" }, + { name = "modpoll-wot", specifier = "==0.2.0a4" }, { name = "pymodbus", specifier = "~=3.16.1" }, { name = "pyyaml", specifier = ">=6,<7" }, ] From 92942b18ff59fa9489ddd5163ef80e2e93f1afe5 Mon Sep 17 00:00:00 2001 From: Gavin Ying Date: Wed, 4 Nov 2026 13:41:40 +0800 Subject: [PATCH 4/4] chore: regenerate fixture provenance with modpoll-wot a4 --- tests/fixtures/io-module/generated.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/io-module/generated.json b/tests/fixtures/io-module/generated.json index 4e55f5b..0d0a3c5 100644 --- a/tests/fixtures/io-module/generated.json +++ b/tests/fixtures/io-module/generated.json @@ -3,7 +3,7 @@ "source_sha256": "4c2aee3334faf6622f4ee34a23108fa0ec100a6b3110a78200eee79da8935596", "generator": { "package": "modpoll-wot", - "version": "0.2.0a2" + "version": "0.2.0a4" }, "instance": { "host": "127.0.0.1",