From f6999604f8e2137bc29f2d5562ac372d934e3067 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" <> Date: Wed, 18 Nov 2026 18:18:22 -0800 Subject: [PATCH 1/4] fix(add_tags)!: AddTags is the same operator for every order of its tags (ITL-1269) Developer, 2026-11-18: "I absolutely agree to make it entry order independent". The new tags are a set: AddTags holds them in name order, so its identity, its saved config, its predicted schema and the placement of the new tags after the input's tags no longer follow the keyword order. Tests: five tags of every accepted type in all 120 keyword orders (identity, config), streams on plain, data-tag and mixed inputs, sync and async, jobs on both orchestrators. Co-Authored-By: Claude Opus 5.5 --- .zed/rules | 11 +- CLAUDE.md | 11 +- changelog.d/ITL-1269.md | 10 ++ docs/concepts/operators.md | 18 +- docs/reference/hashing.md | 1 + src/orcapod/core/operators/add_tags.py | 15 +- tests/test_core/operators/test_add_tags.py | 28 ++- .../operators/test_add_tags_order.py | 159 ++++++++++++++++++ .../test_core/operators/test_several_items.py | 10 +- 9 files changed, 232 insertions(+), 31 deletions(-) create mode 100644 changelog.d/ITL-1269.md create mode 100644 tests/test_core/operators/test_add_tags_order.py diff --git a/.zed/rules b/.zed/rules index 08e410ac6..03a48ed3d 100644 --- a/.zed/rules +++ b/.zed/rules @@ -758,10 +758,13 @@ no input tag name may appear among the data columns. An operator may add a tag, never data (developer, November 16, 2026, ITL-1196): "synthesizing a tag is fine — that's not a value. Operator may never add data." AddTags (stream.add_tags(cohort="A", run=3)) adds tags holding one constant value on every row, after -the input's tags; data columns, source info and system tags pass through unchanged. A value is -exactly a bool, int, float, str or bytes (Arrow bool, int64, double, -large_string, large_binary, non-nullable); anything else (None, Decimal, datetime, -date, a subclass) is refused. Its identity is the names and values in order. A function form +the input's tags, in name order; data columns, source info and system tags pass through +unchanged. A value is exactly a bool, int, float, str or bytes (Arrow bool, int64, +double, large_string, large_binary, non-nullable); anything else (None, Decimal, +datetime, date, a subclass) is refused. The new tags are a set (developer, November 18, +2026, ITL-1269: "I absolutely agree to make it entry order independent"): the operator holds +them in name order, and its identity is the names and values in name order, so the order of the +keywords never changes a hash, a stored path or a column name. A function form (new tags computed from a row's tags and data) is future work, not designed yet. Two operators reduce row count many→one. Batch groups consecutive rows by count; GroupBy diff --git a/CLAUDE.md b/CLAUDE.md index 8812d3704..1f95f2a51 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -777,10 +777,13 @@ no input tag name may appear among the data columns. **An operator may add a tag, never data** (developer, November 16, 2026, ITL-1196): "synthesizing a tag is fine — that's not a value. Operator may never add data." `AddTags` (`stream.add_tags(cohort="A", run=3)`) adds tags holding one constant value on every row, after -the input's tags; data columns, source info and system tags pass through unchanged. A value is -exactly a `bool`, `int`, `float`, `str` or `bytes` (Arrow `bool`, `int64`, `double`, -`large_string`, `large_binary`, non-nullable); anything else (`None`, `Decimal`, `datetime`, -`date`, a subclass) is refused. Its identity is the names and values in order. A function form +the input's tags, in name order; data columns, source info and system tags pass through +unchanged. A value is exactly a `bool`, `int`, `float`, `str` or `bytes` (Arrow `bool`, `int64`, +`double`, `large_string`, `large_binary`, non-nullable); anything else (`None`, `Decimal`, +`datetime`, `date`, a subclass) is refused. The new tags are a set (developer, November 18, +2026, ITL-1269: "I absolutely agree to make it entry order independent"): the operator holds +them in name order, and its identity is the names and values in name order, so the order of the +keywords never changes a hash, a stored path or a column name. A function form (new tags computed from a row's tags and data) is future work, not designed yet. Two operators reduce row count many→one. `Batch` groups consecutive rows by count; `GroupBy` diff --git a/changelog.d/ITL-1269.md b/changelog.d/ITL-1269.md new file mode 100644 index 000000000..49c6911e3 --- /dev/null +++ b/changelog.d/ITL-1269.md @@ -0,0 +1,10 @@ +### Breaking changes and migration + +- `AddTags` (`stream.add_tags(...)`) is the same operator for every order of its tags + (ITL-1269; developer, November 18, 2026: "I absolutely agree to make it entry order + independent"). The new tags are a set. The operator holds them in name order and places them + after the input's tags in name order. Its identity and saved config list them that way. + `add_tags(run=3, cohort="A")` and `add_tags(cohort="A", run=3)` now have one content hash, + one pipeline hash and one stored path. Before, the keyword order was part of the identity + and decided the column order. An `AddTags` whose tags were not given in name order gets a + new identity, so the stored path of its node and every node downstream of it moves. diff --git a/docs/concepts/operators.md b/docs/concepts/operators.md index a03ec512c..9ff346c09 100644 --- a/docs/concepts/operators.md +++ b/docs/concepts/operators.md @@ -718,8 +718,17 @@ for tag, data in labelled: # {'subject_id': 'mouse_02', 'session': 2, 'cohort': 'A', 'run': 3} -> {'age': 8, 'weight': 22.1} ``` -The new tags follow the input's tags, in the order given. Data columns, their source info and -the system tags are unchanged. A value's type is the tag's type, with no inference: a `bool` +The new tags follow the input's tags, in name order: they are a set, and the order they are +given in is not kept. `add_tags(run=3, cohort="A")` is the same operator, with the same hashes +and the same columns: + +```python +reordered = sessions.add_tags(run=3, cohort="A") +print(reordered.keys()) # (('subject_id', 'session', 'cohort', 'run'), ('age', 'weight')) +print(reordered.content_hash() == labelled.content_hash()) # True +``` + +Data columns, their source info and the system tags are unchanged. A value's type is the tag's type, with no inference: a `bool` becomes Arrow `bool`, an `int` `int64`, a `float` `double`, a `str` `large_string` and a `bytes` `large_binary`, and every new tag is non-nullable: @@ -740,8 +749,9 @@ except InputValidationError as error: # add_tags: cannot add a tag with an existing column's name: 'age' is a data column ``` -The names and values, in order, are the operator's identity, so two different values are two -operators, with different hashes and stored tables. +The names and values, in name order, are the operator's identity, so two different values are +two operators, with different hashes and stored tables, while two orders of the same tags are +one operator. On a stream with [data-tags](data-tags.md), the data-tags stay data-tags and the new tags are plain: a constant tag is never a data value. diff --git a/docs/reference/hashing.md b/docs/reference/hashing.md index 02a5059a0..9b6d41fc1 100644 --- a/docs/reference/hashing.md +++ b/docs/reference/hashing.md @@ -529,6 +529,7 @@ The table below shows what each class returns from `identity_structure()`. | Operators (binary/N-ary) | `(operator_class_name, argument_symmetry(streams))` | `frozenset` for commutative (Join, MergeJoin); `tuple` for ordered (SemiJoin) | | `SelectTagColumns`, `SelectDataColumns`, `DropTagColumns`, `DropDataColumns`, `SelectColumns`, `DropColumns` | `(operator_class_name, sorted unique column names as a list, strict)` | The operators act on a set of names: a list, a tuple, a set, a single string, a repeated or a reordered name list give one hash (ITL-942) | | `MapTags`, `MapData`, `MapColumns` | `(operator_class_name, name_map, drop_unmapped, strict)` | An operator's identity is its full configuration, `strict` included, as for the column selection operators (ITL-1160) | +| `AddTags` | `(operator_class_name, ((name, value), ...) in name order)` | The new tags are a set: the order they are given in never enters the identity, and the tags are placed in name order (ITL-1269) | **Inputs of a commutative operator are a set (kept by decision, ITL-942).** A pipeline hash covers the structure of the pipeline, not only its schemas. `MergeJoin()(m1, m1)`, a stream diff --git a/src/orcapod/core/operators/add_tags.py b/src/orcapod/core/operators/add_tags.py index ca394d23b..a06f74215 100644 --- a/src/orcapod/core/operators/add_tags.py +++ b/src/orcapod/core/operators/add_tags.py @@ -90,13 +90,17 @@ class AddTags(UnaryOperator): through unchanged, and no data column is added. System tags keep their names and values (name-preserving), so record ids are unchanged. - The new tags follow the input's tags, in the order given. A value's exact + The new tags are a set: whatever the order they are given in, the operator holds + them in name order (developer, November 18, 2026, ITL-1269), places them after the + input's tags in name order, and lists them that way in its identity and config, so + the order of the keywords never changes a hash, a stored path or a column name + downstream. A value's exact Python type is the tag's type, mapped to Arrow by the data context's type converter: ``bool`` to ``bool``, ``int`` to ``int64``, ``float`` to ``double``, ``str`` to ``large_string``, ``bytes`` to ``large_binary``. Every new tag is non-nullable. - The operator's identity is its tags, names and values in order, so two + The operator's identity is its tags, names and values in name order, so two different values are two operators with two stored paths. Data-tags (ITL-1023): the input's data-tags stay data-tags, one column in @@ -129,8 +133,9 @@ def __init__(self, tags: Mapping[str, TagConstant], **kwargs: Any): schema_utils.require_names_not_meta(list(tags)) schema_utils.require_names_not_system(list(tags)) schema_utils.require_names_without_separator(list(tags)) + # In name order: the order the tags are given in is not kept (ITL-1269). self._tags: dict[str, TagConstant] = {} - for name, value in tags.items(): + for name, value in sorted(tags.items(), key=lambda item: item[0]): try: self._tags[name] = _checked_value(value) except (TypeError, ValueError) as error: @@ -142,7 +147,7 @@ def __init__(self, tags: Mapping[str, TagConstant], **kwargs: Any): @property def tags(self) -> Mapping[str, TagConstant]: - """The new tags, names mapped to values, in order; read-only. + """The new tags, names mapped to values, in name order; read-only. Read-only so the identity, the saved config and the cached constants can never disagree. @@ -212,7 +217,7 @@ def _constants(self, converter: TypeConverterProtocol, num_rows: int) -> pa.Tabl num_rows: The number of rows. Returns: - A table of the new tag columns, in the order given. + A table of the new tag columns, in name order. """ cached = self._one_row.get(id(converter)) if cached is None or cached[0] is not converter: diff --git a/tests/test_core/operators/test_add_tags.py b/tests/test_core/operators/test_add_tags.py index a45e4b1a1..f94ec2e14 100644 --- a/tests/test_core/operators/test_add_tags.py +++ b/tests/test_core/operators/test_add_tags.py @@ -53,10 +53,14 @@ def test_every_row_gets_the_values(self) -> None: assert table.column("cohort").to_pylist() == ["A", "A", "A"] assert table.column("run").to_pylist() == [3, 3, 3] - def test_new_tags_follow_the_input_tags_in_the_order_given(self) -> None: - out = _readings().add_tags(run=3, cohort="A") - assert out.keys() == (("subject", "run", "cohort"), ("x", "name")) - assert out.as_table().column_names[:3] == ["subject", "run", "cohort"] + def test_new_tags_follow_the_input_tags_in_name_order(self) -> None: + """The order the keywords are given in is not kept (ITL-1269).""" + for out in ( + _readings().add_tags(run=3, cohort="A"), + _readings().add_tags(cohort="A", run=3), + ): + assert out.keys() == (("subject", "cohort", "run"), ("x", "name")) + assert out.as_table().column_names[:3] == ["subject", "cohort", "run"] def test_arrow_type_of_each_accepted_value_type(self) -> None: out = _readings().add_tags(b=True, i=3, f=1.5, s="A", raw=b"\x01") @@ -135,10 +139,15 @@ def test_different_values_are_different_operators(self) -> None: } assert len(hashes) == 6 - def test_order_is_part_of_the_identity(self) -> None: + def test_order_is_not_part_of_the_identity(self) -> None: + """The tags are a set of items: their order never forms identity (ITL-1269).""" assert ( AddTags({"a": 1, "b": 2}).content_hash() - != AddTags({"b": 2, "a": 1}).content_hash() + == AddTags({"b": 2, "a": 1}).content_hash() + ) + assert ( + AddTags({"a": 1, "b": 2}).pipeline_hash() + == AddTags({"b": 2, "a": 1}).pipeline_hash() ) def test_names_are_part_of_the_identity(self) -> None: @@ -227,7 +236,8 @@ def test_round_trip(self) -> None: op = AddTags({"b": True, "i": 3, "f": 1.5, "s": "A", "raw": b"\x01"}) config = op.to_config() assert config["class_name"] == "AddTags" - assert config["config"]["tags"][4] == { + # Saved in name order: b, f, i, raw, s. + assert config["config"]["tags"][3] == { "name": "raw", "type": "bytes", "value": "01", @@ -236,10 +246,10 @@ def test_round_trip(self) -> None: assert restored.tags == op.tags assert [type(v) for v in restored.tags.values()] == [ bool, - int, float, - str, + int, bytes, + str, ] assert restored.content_hash() == op.content_hash() diff --git a/tests/test_core/operators/test_add_tags_order.py b/tests/test_core/operators/test_add_tags_order.py new file mode 100644 index 000000000..8590be051 --- /dev/null +++ b/tests/test_core/operators/test_add_tags_order.py @@ -0,0 +1,159 @@ +"""``AddTags`` is the same operator for every order of its keywords (ITL-1269). + +Developer, November 18, 2026: "I absolutely agree to make it entry order independent", +under the rule "it shouldn't depend on tag order -- generally nothing should depend on tag +order". The order of ``add_tags(cohort="A", run=3)`` only placed the new columns, yet it +was part of the operator's identity: two keyword orders gave two content and pipeline +hashes, two stored paths and two system-tag column names downstream. Now the new tags are +a set: the operator holds them in name order, its identity and config list them that way, +and they are placed in name order after the input's tags (as ``TagBy`` places its new +tags, ITL-1226). + +Five new tags of every accepted type are given in all 120 keyword orders, on the shared +several-item inputs (three tags, three data columns; plain, data-tag and mixed roles), on +the sync and the async path and in jobs on both orchestrators. +""" + +from __future__ import annotations + +import asyncio +import itertools +from typing import Any + +import pytest + +from orcapod.core.operators import AddTags +from orcapod.databases import InMemoryArrowDatabase +from orcapod.pipeline import ( + AsyncPipelineOrchestrator, + PipelineJob, + SyncPipelineOrchestrator, +) + +from .several_items import ( + MAIN, + ROLES, + TAGS_FIRST, + Arrangement, + async_rows, + fingerprint, + make_source, + ordered_rows_fingerprint, +) + +# One value of each accepted type; the names are not in name order as given. +NEW_TAGS: dict[str, Any] = { + "run": 3, + "cohort": "A", + "weight": 1.5, + "ok": True, + "blob": b"\x01", +} +NAME_ORDER = ("blob", "cohort", "ok", "run", "weight") +KEYWORD_ORDERS = [ + {name: NEW_TAGS[name] for name in order} + for order in itertools.permutations(NEW_TAGS) +] +# A few keyword orders for the heavier checks (streams, jobs). +SOME_ORDERS = [KEYWORD_ORDERS[0], KEYWORD_ORDERS[-1], KEYWORD_ORDERS[57]] +ORCHESTRATORS = pytest.mark.parametrize( + "orchestrator", + [SyncPipelineOrchestrator, AsyncPipelineOrchestrator], + ids=["sync", "async"], +) + + +def _source(roles: str) -> Any: # pyright: ignore[reportExplicitAny] # an ArrowTableSource + return make_source(MAIN, Arrangement(MAIN.tags, TAGS_FIRST, roles)) + + +def test_every_keyword_order_is_one_operator() -> None: + """All 120 orders: one content hash, one pipeline hash, one config, name order.""" + operators = [AddTags(tags) for tags in KEYWORD_ORDERS] + assert len({op.content_hash() for op in operators}) == 1 + assert len({op.pipeline_hash() for op in operators}) == 1 + assert {tuple(op.tags) for op in operators} == {NAME_ORDER} + assert { + tuple(entry["name"] for entry in op.to_config()["config"]["tags"]) + for op in operators + } == {NAME_ORDER} + + +def test_a_saved_config_in_any_order_rebuilds_the_same_operator() -> None: + reference = AddTags(NEW_TAGS) + config = reference.to_config() + entries = config["config"]["tags"] + for order in itertools.permutations(entries): + rebuilt = AddTags.from_config({**config, "config": {"tags": list(order)}}) + assert rebuilt.content_hash() == reference.content_hash() + assert tuple(rebuilt.tags) == NAME_ORDER + + +def test_the_names_and_values_still_count() -> None: + """A set of items is still identity: another name or value is another operator.""" + reference = AddTags(NEW_TAGS).content_hash() + assert AddTags({**NEW_TAGS, "run": 4}).content_hash() != reference + assert AddTags({**NEW_TAGS, "extra": 0}).content_hash() != reference + assert AddTags({k: v for k, v in NEW_TAGS.items() if k != "ok"}).content_hash() != ( + reference + ) + + +@pytest.mark.parametrize("roles", ROLES) +def test_the_stream_is_the_same_for_every_keyword_order(roles: str) -> None: + """Rows, hashes and column names equal; the new tags placed in name order.""" + source = _source(roles) + prints = [] + for tags in SOME_ORDERS: + stream = source.add_tags(**tags) + prints.append(fingerprint(stream)) + tag_keys, _ = stream.keys() + assert tag_keys == (*source.keys()[0], *NAME_ORDER) + for tag, _ in stream.iter_data(): + assert tuple(tag.keys()) == tag_keys + assert all(p == prints[0] for p in prints) + + +@pytest.mark.parametrize("roles", ROLES) +def test_the_async_path_gives_the_sync_rows_for_every_keyword_order(roles: str) -> None: + source = _source(roles) + for tags in SOME_ORDERS: + operator = AddTags(tags) + sync = ordered_rows_fingerprint(list(operator(source).iter_data())) + assert ordered_rows_fingerprint(async_rows(operator, source)) == sync + + +def _job_record(tags: dict[str, Any], roles: str, orchestrator: Any) -> dict[str, Any]: # pyright: ignore[reportExplicitAny] # an orchestrator class + db = InMemoryArrowDatabase() + job = PipelineJob(name="add_tags_order", database=db) + with job: + _source(roles).add_tags(label="tagged", **tags).drop_nulls(label="after") + job.run(orchestrator=orchestrator()) + record: dict[str, Any] = { + "table_paths": sorted("/".join(p) for p in db.list_sources()), + } + for label in sorted(job.nodes): + node = job.nodes[label] + record[label] = ( + node.content_hash().to_string(), + node.pipeline_hash().to_string(), + fingerprint(node)["rows"], + ) + return record + + +@ORCHESTRATORS +@pytest.mark.parametrize("roles", ROLES) +def test_a_job_has_the_same_nodes_and_paths_for_every_keyword_order( + roles: str, orchestrator: Any +) -> None: + records = [_job_record(tags, roles, orchestrator) for tags in SOME_ORDERS] + assert all(record == records[0] for record in records) + + +def test_the_async_runs_match_the_sync_runs() -> None: + assert asyncio.iscoroutinefunction(AddTags.async_execute) + tags = KEYWORD_ORDERS[-1] + assert _job_record(tags, ROLES[2], SyncPipelineOrchestrator) == _job_record( + tags, ROLES[2], AsyncPipelineOrchestrator + ) diff --git a/tests/test_core/operators/test_several_items.py b/tests/test_core/operators/test_several_items.py index 83af880f8..aafb4326d 100644 --- a/tests/test_core/operators/test_several_items.py +++ b/tests/test_core/operators/test_several_items.py @@ -417,17 +417,17 @@ def test_polars_filter_predicate_order_is_not_identity(role: str) -> None: @pytest.mark.parametrize("role", ROLES) -def test_add_tags_order_is_the_order_of_the_new_tags_and_its_identity( +def test_add_tags_order_is_neither_the_order_of_the_new_tags_nor_identity( role: str, ) -> None: + """The new tags are a set, placed in name order (ITL-1269).""" source = make_source(MAIN, Arrangement(MAIN.tags, TAGS_FIRST, role)) xy = AddTags({"x": 1, "y": "z"})(source) yx = AddTags({"y": "z", "x": 1})(source) assert xy.keys()[0] == ("t1", "t2", "t3", "x", "y") - assert yx.keys()[0] == ("t1", "t2", "t3", "y", "x") - assert xy.content_hash() != yx.content_hash() - assert xy.pipeline_hash() != yx.pipeline_hash() - # Same rows: the values of each row do not depend on the order. + assert yx.keys()[0] == ("t1", "t2", "t3", "x", "y") + assert xy.content_hash() == yx.content_hash() + assert xy.pipeline_hash() == yx.pipeline_hash() assert rows_fingerprint(list(xy.iter_data())) == rows_fingerprint( list(yx.iter_data()) ) From f1675590b6a062e3a272e8b0e7ec02dea1d83189 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" <> Date: Wed, 18 Nov 2026 18:18:22 -0800 Subject: [PATCH 2/4] test(golden): re-pin the four AddTags identity entries (ITL-1269) Approved by the developer on 2026-11-18 (recorded on ITL-1269): the identity and pipeline hash of AddTags(every_type) and of its stream, whose keywords are not in name order. Made with the tool's own steps (--remove, then --add); every other entry is byte-identical. Co-Authored-By: Claude Opus 5.5 --- src/orcapod/contexts/data/v1.json | 4 ++-- tests/test_hashing/golden/data/v1/pipeline-02.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/orcapod/contexts/data/v1.json b/src/orcapod/contexts/data/v1.json index a2af6e7ad..9ab1057ee 100644 --- a/src/orcapod/contexts/data/v1.json +++ b/src/orcapod/contexts/data/v1.json @@ -247,10 +247,10 @@ "date": "2026-11-18", "release": null, "added": { - "pipeline-02.json": "7778b4c69ff706debbcbd9fc67dbe5b723df56252158be8253f8751326a5bd41" + "pipeline-02.json": "93a763f7d9bd9bb7cae2c4fb8262d070eeaa539e4e24e3dcff2970203819bea5" }, "previous": "0a789cf9e8d1df9fb762d6dc2fabffcd3383cd6a21ef147e8c6583f963280c2e", - "digest": "b0988d0fa1eb437f87ff825ae4a29ba82a4161afab9e30101c049f2266ad57ed" + "digest": "7e490fa59ee0cff5bb688e09539c39fa585c87af3be21b79f19c944b81191861" } ] }, diff --git a/tests/test_hashing/golden/data/v1/pipeline-02.json b/tests/test_hashing/golden/data/v1/pipeline-02.json index f542d4746..a494a5758 100644 --- a/tests/test_hashing/golden/data/v1/pipeline-02.json +++ b/tests/test_hashing/golden/data/v1/pipeline-02.json @@ -1,6 +1,6 @@ { - "add_tags.every_type.content_hash": "semantic_v1:1d29df8a1a36187ca0239f5d747acb924c73a8487c9263d094286113abc82e7d", - "add_tags.every_type.pipeline_hash": "semantic_v1:4bf3958b20db82ad7fb1a3ef1b32937565799f69f0d95b3c86b1dca78dc3a3e3", + "add_tags.every_type.content_hash": "semantic_v1:3ad41cfd204171984d104e117092ffecbb0e758b673f4c9aa329c93ec38763b4", + "add_tags.every_type.pipeline_hash": "semantic_v1:b10ad59c44d364fe81c6f70ba974281be6e12c5dc9e4d58d08292feb319a6b72", "add_tags.every_type.row[{\"cohort\":\"A\",\"k\":\"r1\",\"ok\":true,\"raw\":\"01\",\"run\":3,\"site\":\"a\",\"w\":1.5}]._tag_record_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f": "row_0", "add_tags.every_type.row[{\"cohort\":\"A\",\"k\":\"r1\",\"ok\":true,\"raw\":\"01\",\"run\":3,\"site\":\"a\",\"w\":1.5}]._tag_source_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f": "golden_nullable", "add_tags.every_type.row[{\"cohort\":\"A\",\"k\":\"r1\",\"ok\":true,\"raw\":\"01\",\"run\":3,\"site\":\"a\",\"w\":1.5}].data_hash": "arrow_v1:0000025c8400b7856fb3a703d4468712ba835fc942a04e99380e7c7285477bf385c1aa", @@ -35,8 +35,8 @@ "_tag_source_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f", "_tag_record_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f" ], - "add_tags.operator[every_type].content_hash": "semantic_v1:6facb9a731655e8e6a695bbb96bb7902f6b212562f7df2b5207508ff3ab9e03e", - "add_tags.operator[every_type].pipeline_hash": "semantic_v1:6facb9a731655e8e6a695bbb96bb7902f6b212562f7df2b5207508ff3ab9e03e", + "add_tags.operator[every_type].content_hash": "semantic_v1:91fce7b9bb879c3d92cd6423e4368f42ebf667cf89af73af107ac1a88a814c30", + "add_tags.operator[every_type].pipeline_hash": "semantic_v1:91fce7b9bb879c3d92cd6423e4368f42ebf667cf89af73af107ac1a88a814c30", "group_by_arrangement.default.interleaved.content_hash": "semantic_v1:33994dc5eb4e5fdc0797c5d090fd91b3b8bfa7dd138763d944bbb390acb848d0", "group_by_arrangement.default.interleaved.pipeline_hash": "semantic_v1:049a1fb3744027bea2a31ca70c960364adf513667b3c09f30441646c43b157f8", "group_by_arrangement.default.interleaved.row[{\"g\":\"a\",\"k\":1}]._tag_record_id::009b87c48e0540870894b8e1434a47f6e9150c21d7a401ecd9b791bdec215ee8::009b87c48e0540870894b8e1434a47f6e9150c21d7a401ecd9b791bdec215ee8": "group_v1:8c07899443ee6fcd1c5063e7b3b539372e18ac38101ddbb53cbb8c35a55bf877", From fe1903b0a5c7f7e55d93c58cbfbd559ef824302a Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" <> Date: Wed, 18 Nov 2026 18:36:47 -0800 Subject: [PATCH 3/4] test(golden): re-pin the four approved AddTags entries on main after PR 448 (ITL-1269) Main's golden files and manifest taken as they are, then --remove the 4 approved entries and --add; the union against origin/main changes exactly those 4, to the approved values. Co-Authored-By: Claude Opus 5.5 --- src/orcapod/contexts/data/v1.json | 4 ++-- tests/test_hashing/golden/data/v1/pipeline-02.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/orcapod/contexts/data/v1.json b/src/orcapod/contexts/data/v1.json index b408839ba..dd784251b 100644 --- a/src/orcapod/contexts/data/v1.json +++ b/src/orcapod/contexts/data/v1.json @@ -247,10 +247,10 @@ "date": "2026-11-18", "release": null, "added": { - "pipeline-02.json": "bde22087ae6bce75ba3234d13b5c7cd92a8625a8e314ccb062e2292d60b56803" + "pipeline-02.json": "35a80cfe7784ac9c65f62b58842a6222edbce806b7d56716d4315c9fb1fc2621" }, "previous": "6e85a3a8c6078a2481f3cbdb9883e7ccd651b6ad89890afecff1a94b1fd7fc62", - "digest": "ad2eb8a6f86a18846a600f54af3420c19253ad989aaeaf8f456430b0fe1fd030" + "digest": "50f43655d9d8b6868ca7f3dbec5c714582bf7d9e96a658396ed510c58b68bdd1" } ] }, diff --git a/tests/test_hashing/golden/data/v1/pipeline-02.json b/tests/test_hashing/golden/data/v1/pipeline-02.json index f5ca60491..14fe8fbb0 100644 --- a/tests/test_hashing/golden/data/v1/pipeline-02.json +++ b/tests/test_hashing/golden/data/v1/pipeline-02.json @@ -1,6 +1,6 @@ { - "add_tags.every_type.content_hash": "semantic_v1:1d29df8a1a36187ca0239f5d747acb924c73a8487c9263d094286113abc82e7d", - "add_tags.every_type.pipeline_hash": "semantic_v1:4bf3958b20db82ad7fb1a3ef1b32937565799f69f0d95b3c86b1dca78dc3a3e3", + "add_tags.every_type.content_hash": "semantic_v1:3ad41cfd204171984d104e117092ffecbb0e758b673f4c9aa329c93ec38763b4", + "add_tags.every_type.pipeline_hash": "semantic_v1:b10ad59c44d364fe81c6f70ba974281be6e12c5dc9e4d58d08292feb319a6b72", "add_tags.every_type.row[{\"cohort\":\"A\",\"k\":\"r1\",\"ok\":true,\"raw\":\"01\",\"run\":3,\"site\":\"a\",\"w\":1.5}]._tag_record_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f": "row_0", "add_tags.every_type.row[{\"cohort\":\"A\",\"k\":\"r1\",\"ok\":true,\"raw\":\"01\",\"run\":3,\"site\":\"a\",\"w\":1.5}]._tag_source_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f": "golden_nullable", "add_tags.every_type.row[{\"cohort\":\"A\",\"k\":\"r1\",\"ok\":true,\"raw\":\"01\",\"run\":3,\"site\":\"a\",\"w\":1.5}].data_hash": "arrow_v1:0000025c8400b7856fb3a703d4468712ba835fc942a04e99380e7c7285477bf385c1aa", @@ -35,8 +35,8 @@ "_tag_source_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f", "_tag_record_id::a4a91ac74561d231cff4ab05fdb7e199d259e8765f3af954e23d2c152b564b4f" ], - "add_tags.operator[every_type].content_hash": "semantic_v1:6facb9a731655e8e6a695bbb96bb7902f6b212562f7df2b5207508ff3ab9e03e", - "add_tags.operator[every_type].pipeline_hash": "semantic_v1:6facb9a731655e8e6a695bbb96bb7902f6b212562f7df2b5207508ff3ab9e03e", + "add_tags.operator[every_type].content_hash": "semantic_v1:91fce7b9bb879c3d92cd6423e4368f42ebf667cf89af73af107ac1a88a814c30", + "add_tags.operator[every_type].pipeline_hash": "semantic_v1:91fce7b9bb879c3d92cd6423e4368f42ebf667cf89af73af107ac1a88a814c30", "default_source_ids.as_source[function_node].source_id": "derived:semantic_v1:6ada754d8fc4292450d3fb8813f05878b8aabbd52da3615519c80c7418bc0b4e", "drop_nulls_job.node[ratio].content_hash": "semantic_v1:09afbbcc0d89147e8bcc05227431ac2a674febbcea331f584bee55927c85e447", "drop_nulls_job.node[ratio].pipeline_hash": "semantic_v1:cf4f9b8dff56193f509a551e7f201a165dd011ec388f9e5c827bb14d82d58376", From 627c3287b2063a076ebc898ce85eae337e711664 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" <> Date: Wed, 18 Nov 2026 20:41:54 -0800 Subject: [PATCH 4/4] docs(add_tags): the stream method places the new tags in name order (ITL-1269) CodeRabbit on PR 457: the add_tags docstring still promised the order given. Co-Authored-By: Claude Opus 5.5 --- src/orcapod/core/streams/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/orcapod/core/streams/base.py b/src/orcapod/core/streams/base.py index f59904d5a..ced3ac79a 100644 --- a/src/orcapod/core/streams/base.py +++ b/src/orcapod/core/streams/base.py @@ -628,7 +628,9 @@ def add_tags( "A"})``), or keyword arguments (``add_tags(cohort="A", run=3)``), not both. A tag named ``label``, or a name that is not a Python identifier, is given through the dict. Each new tag holds the same value on every row and follows - the existing tags, in the order given. A value is a ``bool``, ``int``, + the existing tags, in name order: the new tags are a set, and the order they are + given in is not kept (ITL-1269), so ``add_tags(run=3, cohort="A")`` places + ``cohort`` before ``run``. A value is a ``bool``, ``int``, ``float``, ``str`` or ``bytes``, and its type is the tag's type. Data columns, their values and their source info are unchanged.