Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0ced6b1
refactor(sources)!: reserve system tags for Orcapod
eywalker Nov 29, 2026
54915fe
test(streams): migrate provenance fixtures and retain pinned values
eywalker Nov 29, 2026
ba5bb06
test(sources): verify reserved tags across readers and saved jobs
eywalker Nov 29, 2026
fe7d2e8
test(provenance): migrate remaining batch and hashing fixtures
eywalker Nov 29, 2026
28b742d
test(datagrams): rebuild tagged rows through the private stream factory
eywalker Nov 29, 2026
8591355
fix(sources): reserve system tags in Python polling schemas
eywalker Nov 29, 2026
918654c
chore: merge main into the system tags branch
eywalker Nov 29, 2026
50e59e2
chore: merge main into the tied Join branch
eywalker Nov 29, 2026
cc7ed44
fix(provenance)!: refuse legacy cache configs and reserved pod outputs
eywalker Nov 29, 2026
a962ddd
fix(join): keep tied provenance bundles together (ITL-1628)
eywalker Nov 29, 2026
68f4a74
Merge remote-tracking branch 'origin/eywalker/itl-1751-system-tags-ar…
eywalker Nov 29, 2026
3f87840
test(join): cover tied source permutations and LOG entry points
eywalker Nov 29, 2026
a354905
test(join): type the stored entry IDs in the LOG regression
eywalker Nov 29, 2026
0eed918
test(sources): use the PostgreSQL double in the ordering audit
eywalker Nov 29, 2026
c3813fe
Merge remote-tracking branch 'origin/eywalker/itl-1751-system-tags-ar…
eywalker Nov 29, 2026
a059a56
test(join): use library identifiers in stream validation fixtures
eywalker Nov 29, 2026
a2c361e
chore: merge main into the tied Join branch
eywalker Nov 30, 2026
0d86c65
docs: describe tied Join provenance ordering
eywalker Nov 30, 2026
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
12 changes: 7 additions & 5 deletions .zed/rules
Original file line number Diff line number Diff line change
Expand Up @@ -1314,8 +1314,9 @@ these preimages anywhere else.
1. Name-preserving — single-stream ops. Column name/value pass through unchanged.
2. Name-extending — multi-input ops. System tag column name gets
::{pipeline_hash}:{canonical_position} appended. Commutative operators sort by
pipeline_hash and sort system tag values per row. MergeJoin is ordered (ITL-1281): the
position is the argument index and nothing is sorted.
pipeline_hash. For tied inputs, Join orders each row's complete provenance bundles,
keeping all of an input's source and record IDs together. MergeJoin is ordered
(ITL-1281): the position is the argument index.
3. Reducing — many→one ops (Batch, GroupBy). Data columns become list[T]; Batch makes every
user tag list[T] and keeps it a tag, while GroupBy keeps its scalar keys and drops every
other user tag (ITL-1070). No tag ever moves to the data group. Source-info columns become
Expand Down Expand Up @@ -1529,9 +1530,10 @@ data. The rules:
and storage reads enter through the private Arrow stream factory. It preserves system-tag
field declarations and requires string values without nulls. Cached source rows also
require non-nullable fields without metadata, pending ITL-1561.
Join's sync and batch sort source and record ID pairs within each printed provenance
path. Join rows infer tied system-tag fields from values. Non-tied system-tag fields
keep their Arrow declarations.
Join sorts each row's complete provenance bundles among tied inputs after all operands
are present, keeping each input's source and record IDs together. The sync table, row
channel, and record-batch paths use the declared Arrow system-tag types and nullability,
widening corresponding fields among tied inputs when any declaration is nullable.
Streams, rows and record batches declare every `_source_*` token field nullable (ITL-1557).
The top-level flag comes from `arrow_utils.source_info_field` and is independent
of the token values and of any list item fields. CachedSource writes these fields
Expand Down
12 changes: 7 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1344,8 +1344,9 @@ are defined in one module, `core/row_ids.py`; never build one of these preimages
through unchanged.
2. **Name-extending** — multi-input ops (join, merge join). Each input's system tag column
name gets `::{pipeline_hash}:{canonical_position}` appended. Commutative operators
canonically order inputs by `pipeline_hash` and sort system tag values per row. `MergeJoin`
is ordered (ITL-1281): the position is the argument index and nothing is sorted.
canonically order inputs by `pipeline_hash`. For tied inputs, `Join` orders each row's
complete provenance bundles, keeping all of an input's source and record IDs together.
`MergeJoin` is ordered (ITL-1281): the position is the argument index.
3. **Reducing** — many→one ops (`Batch`, `GroupBy`). Data columns become `list[T]`; `Batch`
makes every user tag `list[T]` and keeps it a tag, while `GroupBy` keeps its scalar keys and
drops every other user tag (ITL-1070). No tag ever moves to the data group. Source-info
Expand Down Expand Up @@ -1574,9 +1575,10 @@ data. The rules:
and storage reads enter through the private Arrow stream factory. It preserves system-tag
field declarations and requires string values without nulls. Cached source rows also
require non-nullable fields without metadata, pending ITL-1561.
Join's sync and batch sort source and record ID pairs within each printed provenance
path. Join rows infer tied system-tag fields from values. Non-tied system-tag fields
keep their Arrow declarations.
Join sorts each row's complete provenance bundles among tied inputs after all operands
are present, keeping each input's source and record IDs together. The sync table, row
channel, and record-batch paths use the declared Arrow system-tag types and nullability,
widening corresponding fields among tied inputs when any declaration is nullable.
Streams, rows and record batches declare every `_source_*` token field nullable (ITL-1557).
The top-level flag comes from `arrow_utils.source_info_field` and is independent
of the token values and of any list item fields. CachedSource writes these fields
Expand Down
12 changes: 12 additions & 0 deletions changelog.d/ITL-1628.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Breaking changes and migration

- Entry IDs can change for rows from a Join with structurally tied inputs, such
as a diamond whose old output mixed branches' provenance. Recompute affected
outputs and any downstream results keyed by their entry IDs. The same stored
path can contain old and corrected records if it is reused.

### Fixed

- Join keeps all source and record IDs of each tied input together, including
joined and folded provenance. Tables, row channels, and record batches use
the same ordering and keep the declared nullability of the identifiers.
13 changes: 13 additions & 0 deletions docs/dev/design_issues/ITL-1628-CJ1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## `src/orcapod/core/operators/join.py` — tied inputs

### CJ1 — Tied diamond Joins mix provenance between branches
**Status:** resolved
**Severity:** high
**Issue:** ITL-1628

Sorting each source/record pair independently could mix leaves of tied nested
Joins. For example, branches over `(0, a, z)` and `(0, b, c)` could become
`(0, a, c)` and `(0, b, z)`.

**Fix:** Join compares each tied operand's complete provenance tuple and moves
all of its source and record IDs together.
13 changes: 13 additions & 0 deletions docs/dev/design_issues/ITL-1629-CJ2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## `src/orcapod/core/operators/join.py` — tied inputs

### CJ2 — Pairwise row joins diverged from tables on sparse system tags
**Status:** resolved
**Severity:** high
**Issue:** ITL-1629

A custom system tag missing from one tied operand could appear at different
positions on row channels and tables.

**Fix:** ITL-1751 reserves system tags for the library. For its paired
identifiers, the row channel, table and batch kernel use the same whole-bundle
ordering after the last join step. The regression covers three tied operands.
12 changes: 12 additions & 0 deletions docs/dev/design_issues/ITL-1631-CJ3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## `src/orcapod/core/operators/join.py` — tied inputs

### CJ3 — Tied Join rows narrowed record ID declarations
**Status:** resolved
**Severity:** high
**Issue:** ITL-1631

Row channels and table iteration inferred tied record ID fields from individual
values, even when the table declared those fields nullable.

**Fix:** Join preserves Arrow field declarations on every path. A position's
record ID field is nullable when any corresponding input field is nullable.
10 changes: 6 additions & 4 deletions docs/reference/hashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -1263,10 +1263,12 @@ and `k` such stages stacked carry each one `2 ** k` times (ITL-1114). The table
`head()` and the notebook preview of a stream that has not run are built from carries the system
tag columns too, so those calls are as wide as the joins make them (ITL-1132).

Join sorts source and record IDs as pairs within each printed provenance path.
Sync and record-batch tables keep custom system tags in their input positions.
Standalone row channels sort custom tags on the same path with the ID pair.
Join rows on these tied paths infer their system-tag fields from values.
For inputs with the same pipeline hash, Join orders each row's complete provenance bundles.
All source and record IDs of one input travel together, including IDs from earlier joins
and folds. It orders provenance paths by name and compares the source ID before the record
ID at each path. A standalone raw stream has an empty provenance bundle, which comes first.
Tables, row channels, and record batches keep the same field declarations. A field is
nullable if any corresponding field that can move into it is nullable.

---

Expand Down
4 changes: 2 additions & 2 deletions src/orcapod/contexts/data/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@
"date": "2026-11-29",
"release": null,
"added": {
"pipeline-02.json": "cca93cb45ed48622bc58e77d344f8e536a89ee1d5da63c6a8d0b121361c64b5f"
"pipeline-02.json": "b4566234fe4fe71cb0eece34ee2987c95dac503beb40896df1d7acb4d17121f6"
},
"previous": "4d7e6efa1eb0e72175a18d6b40b933d61c6817b1499d590b10e7d016b642f6ba",
"digest": "a900909f035bbec5eb67869b6b0c87648bcf3446171f2d16a862f5f3e672c437"
"digest": "5f06ae2f640b36fe24b6c04648495dd2d6643d7d4c501cfaa3f87803ebf8a917"
}
],
"provisional": {
Expand Down
19 changes: 1 addition & 18 deletions src/orcapod/core/datagrams/tag_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import logging
import uuid
from collections.abc import Collection, Iterator, Mapping, Sequence
from collections.abc import Iterator, Mapping, Sequence
from typing import cast, TYPE_CHECKING, Any, Self

import pyarrow as pa
Expand Down Expand Up @@ -204,8 +204,6 @@ def rows_of(
cls,
table: "pa.Table",
data_context: "str | contexts.DataContext | None" = None,
*,
infer_system_tags: Collection[str] = (),
) -> Iterator[Self]:
"""Yield the tag of each row of ``table``, in row order.

Expand All @@ -220,7 +218,6 @@ def rows_of(
table: The rows: user-tag and system-tag columns.
data_context: The data context of every tag; ``None`` reads each row's own
from the table's data-context column, or takes the default.
infer_system_tags: Tied Join fields built from Python values.

Yields:
One tag per row.
Expand All @@ -234,20 +231,6 @@ def rows_of(
for tag, system_tag_row, _ in rows:
if system_tag_row is None:
tag._set_system_tags({})
elif infer_system_tags:
names = system_tag_row.column_names
infer = [name for name in names if name in infer_system_tags]
values = tag.converter.arrow_table_to_python_dicts(
system_tag_row.select(infer)
)[0]
tag._set_system_tags(values)
if len(infer) != len(names):
kept = system_tag_row.drop_columns(infer)
tag._set_system_tag_table(
arrow_utils.hstack_tables(
kept, tag._ensure_system_tags_table()
).select(names)
)
else:
tag._set_system_tag_table(system_tag_row)
yield tag
Expand Down
16 changes: 1 addition & 15 deletions src/orcapod/core/nodes/operator_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1490,17 +1490,6 @@ def _store_output_stream(self, stream: StreamProtocol) -> None:

declared = self._typed_zero_row_table()
if declared is not None:
from orcapod.core.operators.join import Join

# On tied Join paths, the table describes the input declarations
# while rows infer their own provenance fields from the values.
row_inferred = (
self._operator.row_inferred_system_tags(
self._input_streams, declared.column_names
)
if isinstance(self._operator, Join)
else frozenset()
)
expected_fields = {field.name: field for field in declared.schema}
actual_fields = {field.name: field for field in output_table.schema}
for name in sorted(expected_fields.keys() | actual_fields.keys()):
Expand All @@ -1509,10 +1498,7 @@ def _store_output_stream(self, stream: StreamProtocol) -> None:
if (
expected is not None
and actual is not None
and (
name in row_inferred
or expected.equals(actual, check_metadata=True)
)
and expected.equals(actual, check_metadata=True)
):
continue
raise InputValidationError(
Expand Down
Loading
Loading