From 05b3cd7689a9d5284067542079eb06f9c63d3aed Mon Sep 17 00:00:00 2001 From: Sven Boeckelmann Date: Sat, 12 Sep 2026 00:48:41 +0200 Subject: [PATCH 1/2] epcis: use the unversioned EPCIS context URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EPCIS_CONTEXT pinned https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld. GS1 publishes the context unversioned at .../standards/epcis/epcis-context.jsonld; the versioned form pins a snapshot we do not mean. Every document this library builds carried it, so it shows up in every capture and in the EPCIS tab of the Odoo connector, which vendors this package. `schemaVersion` stays "2.0" — that is the property's value, not the context version, and GS1's own published examples carry it that way too. The eventID does not move. As the constant's own docstring says, the context belongs on the document, not on the event, and the hash is taken over the event. The two tests that pin literal ni:///sha-256; values stay green: 169 passed, 27 subtests, with the `hash` extra installed. --- src/benelog_client/events/document.py | 8 +++++++- tests/test_events.py | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/benelog_client/events/document.py b/src/benelog_client/events/document.py index 9df586f..2ea4581 100644 --- a/src/benelog_client/events/document.py +++ b/src/benelog_client/events/document.py @@ -56,7 +56,13 @@ ID_GS1_ORG = "https://id.gs1.org" #: JSON-LD context of EPCIS 2.0. Belongs on the document, not on the event. -EPCIS_CONTEXT = "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld" +#: +#: The UNVERSIONED URL. GS1 publishes the context at +#: .../standards/epcis/epcis-context.jsonld; .../epcis/2.0.0/... pins a +#: snapshot we do not mean. ``schemaVersion`` next to it stays "2.0" -- that +#: is the property's value, not the context version, and GS1's own published +#: examples carry it that way too. +EPCIS_CONTEXT = "https://ref.gs1.org/standards/epcis/epcis-context.jsonld" #: UUIDv5 namespace for the sender-side idempotency keys this library derives #: (see :func:`idempotency_key`). Private and arbitrary, as RFC 4122 intends: diff --git a/tests/test_events.py b/tests/test_events.py index 92b66d2..66d1ae6 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -141,7 +141,7 @@ class TestDocument: def test_the_context_sits_on_the_document_not_the_event(self) -> None: wrapped = document([object_event(action=cbv.OBSERVE, event_time=NOON)]) assert wrapped["@context"] == [ - "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld" + "https://ref.gs1.org/standards/epcis/epcis-context.jsonld" ] assert "@context" not in wrapped["epcisBody"]["eventList"][0] @@ -411,7 +411,7 @@ def test_a_prefix_from_an_earlier_document_does_not_leak_into_the_next(self) -> # canonicalises — weeks later, in production only. with_prefix = { "@context": [ - "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld", + "https://ref.gs1.org/standards/epcis/epcis-context.jsonld", {"ex": "https://one.example.test/ns/"}, ], "type": "EPCISDocument", From 9aeb0b812412758f631b4b88285f2e3d0a583c24 Mon Sep 17 00:00:00 2001 From: Sven Boeckelmann Date: Sat, 12 Sep 2026 19:23:40 +0200 Subject: [PATCH 2/2] style: ruff format nach der Kuerzung der Kontext-URL Die unversionierte URL ist kuerzer, damit passt der Ausdruck in test_events.py wieder auf eine Zeile. Reine Formatierung, kein Verhalten -- ruff 0.16.2, wie in pyproject gepinnt. --- tests/test_events.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_events.py b/tests/test_events.py index 66d1ae6..ec69a59 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -140,9 +140,7 @@ def test_a_pallet_holds_its_children(self) -> None: class TestDocument: def test_the_context_sits_on_the_document_not_the_event(self) -> None: wrapped = document([object_event(action=cbv.OBSERVE, event_time=NOON)]) - assert wrapped["@context"] == [ - "https://ref.gs1.org/standards/epcis/epcis-context.jsonld" - ] + assert wrapped["@context"] == ["https://ref.gs1.org/standards/epcis/epcis-context.jsonld"] assert "@context" not in wrapped["epcisBody"]["eventList"][0]