Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4938378
fix(pipeline): reject conflicting fixed source rows (ITL-1469)
eywalker Nov 25, 2026
18abc8e
fix(pipeline): name the function step in projection conflicts
eywalker Nov 25, 2026
4f1526b
Merge remote-tracking branch 'origin/main' into eywalker/itl-1469-two…
eywalker Nov 26, 2026
51acf6d
fix(pipeline): validate refreshed and rebound source rows
eywalker Nov 26, 2026
4bfcc2c
fix(pipeline): compare a bound proxy using its live schema
eywalker Nov 26, 2026
1e181e8
Merge remote-tracking branch 'origin/main' into eywalker/itl-1469-two…
eywalker Nov 26, 2026
2f44c80
test(pipeline): cover the shared source ID key-column stopgap
eywalker Nov 27, 2026
3e8544f
fix(pipeline): explain the temporary key-column slot collision
eywalker Nov 27, 2026
f2dfb38
test(pipeline): compare readings of one dataset by rows when key colu…
eywalker Nov 27, 2026
cad47d9
fix(pipeline): compare one dataset's readings by rows, not record ids
eywalker Nov 27, 2026
b197756
fix(pipeline): refuse one source id with different key columns in any…
eywalker Nov 27, 2026
2addf67
test(pipeline): unknown keys, three-way order and node run source checks
eywalker Nov 27, 2026
3c17de4
fix(pipeline): order-free source checks, unknown keys, and node run c…
eywalker Nov 27, 2026
8e21ee2
test(pipeline): count fixed-row digests per consistency check
eywalker Nov 27, 2026
08bb410
perf(pipeline): compute each fixed-row digest at most once per check
eywalker Nov 27, 2026
9d32705
test(pipeline): digest per check, proxies once, mutated frames rechecked
eywalker Nov 27, 2026
98a8ed9
fix(pipeline): memoize fixed-row digests per check by underlying source
eywalker Nov 27, 2026
aa8b0ff
docs(sources): holds_fixed_rows does not assume constant values
eywalker Nov 27, 2026
38b2537
test(pipeline): capture-time refusals, two-copy derived sources, node…
eywalker Nov 27, 2026
a40296c
fix(pipeline): claim key-only differences only when every source was …
eywalker Nov 27, 2026
0312a9e
refactor(sources): keep source consistency properties private
eywalker Nov 27, 2026
c6d9f72
fix(pipeline): require one source object per content hash
eywalker Nov 27, 2026
990d595
fix(pipeline): preserve source registration across slot changes
eywalker Nov 28, 2026
4830aca
fix(pipeline): validate captures against live source slots
eywalker Nov 28, 2026
9971756
fix(pipeline): block capture until source bindings are restored
eywalker Nov 28, 2026
244f5b6
fix(pipeline): make slot capture stable and atomic
eywalker Nov 28, 2026
1031834
fix(pipeline): refuse foreign bindable source slots
eywalker Nov 28, 2026
a31fd56
test(pipeline): cover explicit foreign slot registration
eywalker Nov 28, 2026
c9e0a04
fix(pipeline): refuse graph changes on loaded jobs (ITL-1560)
eywalker Nov 28, 2026
47257e5
fix(pipeline): follow live inputs through source wrappers
eywalker Nov 28, 2026
504f83a
fix(pipeline): protect loaded graphs during capture and save
eywalker Nov 28, 2026
91eead8
chore: merge main into the source registration branch
eywalker Nov 28, 2026
44fd581
chore(pipeline): sync updated source validation base
eywalker Nov 28, 2026
f0cc88e
chore(pipeline): sync main after API reference fix
eywalker Nov 28, 2026
7ec4fb4
chore: merge the upstream API reference fix
eywalker Nov 28, 2026
3857c77
test(spiraldb): expect source registration to reject distinct windows
eywalker Nov 28, 2026
8afbc1b
chore(pipeline): sync stacked SpiralDB test correction
eywalker Nov 28, 2026
61c55fa
chore(pipeline): sync current main into loaded-job stack
eywalker Nov 28, 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
28 changes: 25 additions & 3 deletions .zed/rules
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,9 @@ data. The rules:
commit clears only the nodes that ran; nodes it held keep their earlier run. A load-only run's rows have status
loaded_only. Only job nodes' run() takes an argument (load_only).
A loaded job (PipelineJob.load) runs only with load_only=True.
As a stopgap (ITL-1560), the loaded job and its cached blueprint refuse capture
and recompilation. Build the job from its pipeline to change the graph.
Source binding is supported.
job.run()/run_async() use the same state rule and plan (node_run.plan_run): a current node is
held (not run; its rows feed its successors, both orchestrators take held rows), sources
are read only for nodes that run, a failed end-of-run commit clears only the nodes that ran,
Expand Down Expand Up @@ -1598,16 +1601,35 @@ data. The rules:
match its previous one (bind does not compare the two), but bind refuses, before replacing
any binding, a bind after which two slots would read one source identity under different
restrictions (below). A job run over a restricted source feeding GroupBy, Batch or MergeJoin issues one RestrictedAggregationWarning.
Each source content hash belongs to one source object per pipeline or job
(ITL-1469). Capture, compile, binding through either API, loading and running
check the sources the graph reads. A slot binding replaces its former source.
A job accepts new steps only while every slot holds the exact source object
it held when that slot was first compiled. A slot originally compiled unbound
must be unbound. Rebinding or unbinding a slot blocks recording until all
original bindings are restored. InconsistentSourceError names the changed
slots. Restore the original bindings or build a new job. A job can compile
and run with its replacement bindings. ITL-1559 tracks capture after rebinding.
As a stopgap pending ITL-1559, a job refuses another job's or a standalone
SourceJobNode, including through prebuilt streams. Its bound_source can change
even if currently unbound. Pass the source itself, or use node.as_source()
for another job's stored results. The job's own slots are allowed with their
original bindings. A schema-only SourceNode declares a new unbound slot.
Call where() once and reuse the resulting object. A source object conflict
raises InconsistentSourceError before the separate restriction check, which
can see restrictions beneath wrappers.
A pipeline keeps one restriction (or none) per source identity (a restriction leaves the
identity unchanged), so one table restricted two ways (or with and without a restriction) in
one pipeline is refused (restrictions.require_one_restriction, over the sources the streams
read now, sources_read; nothing is remembered between checks, since a rebound slot changes
what they read) at capture, at compile, by bind before it binds and at the start of every
run (refuse_restriction_conflicts), whatever streams lead there: projections, operator
chains, streams built before the capture. A bind's walk matches the job's own slots by object
(Rebinding), never by name. RunSummary keeps one condition and one limit per slot (ITL-1293). Every restriction walk goes through a slot's bound source,
a SourceProxy's delegate and a CachedSource's source (_streams_beneath); a
DerivedSource is a root. A CachedSource
(Rebinding), never by name. RunSummary keeps one condition and one limit per slot (ITL-1293).
Capture and restriction checks follow job bindings and the live_source_inputs
declared by wrappers. A wrapper over stored results ends this walk. Source
registration uses the wrapper itself and its content hash.
A CachedSource
over a restricted source is refused at construction (a cache is kept under the table's
identity; developer, November 18, 2026), and so is an operator job node that caches (LOG or
REPLAY) over a restricted source (developer, November 19, 2026: its cache is kept under the
Expand Down
28 changes: 25 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,9 @@ data. The rules:
commit clears only the nodes that ran; nodes it held keep their earlier run. A load-only run's rows have status
`loaded_only`. Only job nodes' `run()` takes an argument (`load_only`).
A loaded job (`PipelineJob.load`) runs only with `load_only=True`.
As a stopgap (ITL-1560), the loaded job and its cached blueprint refuse capture
and recompilation. Build the job from its pipeline to change the graph.
Source binding is supported.
`job.run()`/`run_async()` use the same state rule and plan (`node_run.plan_run`): a current node is
held (not run; its rows feed its successors, both orchestrators take held rows), sources
are read only for nodes that run, a failed end-of-run commit clears only the nodes that ran,
Expand Down Expand Up @@ -1647,16 +1650,35 @@ data. The rules:
match its previous one (bind does not compare the two), but `bind` refuses, before replacing
any binding, a bind after which two slots would read one source identity under different
restrictions (below). A job run over a restricted source feeding `GroupBy`, `Batch` or `MergeJoin` issues one `RestrictedAggregationWarning`.
Each source content hash belongs to one source object per pipeline or job
(ITL-1469). Capture, compile, binding through either API, loading and running
check the sources the graph reads. A slot binding replaces its former source.
A job accepts new steps only while every slot holds the exact source object
it held when that slot was first compiled. A slot originally compiled unbound
must be unbound. Rebinding or unbinding a slot blocks recording until all
original bindings are restored. InconsistentSourceError names the changed
slots. Restore the original bindings or build a new job. A job can compile
and run with its replacement bindings. ITL-1559 tracks capture after rebinding.
As a stopgap pending ITL-1559, a job refuses another job's or a standalone
SourceJobNode, including through prebuilt streams. Its bound_source can change
even if currently unbound. Pass the source itself, or use node.as_source()
for another job's stored results. The job's own slots are allowed with their
original bindings. A schema-only SourceNode declares a new unbound slot.
Call where() once and reuse the resulting object. A source object conflict
raises InconsistentSourceError before the separate restriction check, which
can see restrictions beneath wrappers.
A pipeline keeps one restriction (or none) per source identity (a restriction leaves the
identity unchanged), so one table restricted two ways (or with and without a restriction) in
one pipeline is refused (`restrictions.require_one_restriction`, over the sources the streams
read now, `sources_read`; nothing is remembered between checks, since a rebound slot changes
what they read) at capture, at compile, by `bind` before it binds and at the start of every
run (`refuse_restriction_conflicts`), whatever streams lead there: projections, operator
chains, streams built before the capture. A bind's walk matches the job's own slots by object
(`Rebinding`), never by name. `RunSummary` keeps one condition and one limit per slot (ITL-1293). Every restriction walk goes through a slot's bound source,
a `SourceProxy`'s delegate and a `CachedSource`'s source (`_streams_beneath`); a
`DerivedSource` is a root. A `CachedSource`
(`Rebinding`), never by name. `RunSummary` keeps one condition and one limit per slot (ITL-1293).
Capture and restriction checks follow job bindings and the live_source_inputs
declared by wrappers. A wrapper over stored results ends this walk. Source
registration uses the wrapper itself and its content hash.
A `CachedSource`
over a restricted source is refused at construction (a cache is kept under the table's
identity; developer, November 18, 2026), and so is an operator job node that caches (`LOG` or
`REPLAY`) over a restricted source (developer, November 19, 2026: its cache is kept under the
Expand Down
21 changes: 21 additions & 0 deletions changelog.d/ITL-1469.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Fixed

- A pipeline or job accepts one source object per content hash. Capture, binding,
loading and execution reject distinct objects with the same hash, even if
their rows agree. Build a source once and reuse it, or give each source its own
source ID. Rebinding replaces a slot's source, and loading shares one rebuilt
object across slots with identical source configurations.
- Sources with the same source ID must agree on their Arrow schema and key
columns, including when they occupy different slots.
- A capture refused by any active pipeline or job leaves all their graphs
unchanged.

### Known limitations

- ITL-1506 tracks distinct readings of one dataset in distinct slots. ITL-1531
tracks sources that read their rows later. ITL-1553 tracks accepting distinct
objects that represent the same source.
- As a stopgap pending ITL-1559, a job refuses foreign and standalone bindable
slots (`SourceJobNode`), including through streams built from them. Pass the
source itself, or use `node.as_source()` for another job's stored results.
Schema-only `SourceNode` declarations still create independent slots.
6 changes: 6 additions & 0 deletions changelog.d/ITL-1560.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Known limitations

- As a stopgap (ITL-1560), loaded pipeline jobs and their cached blueprints raise
`RuntimeError` on step capture or `compile()` to protect the restored graph.
Build the job from its pipeline to change the graph. Source binding and
load-only runs are supported.
4 changes: 4 additions & 0 deletions docs/concepts/function-pods.md
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,10 @@ print(loaded.nodes["bmi"].as_table().num_rows, summary.nodes["bmi"].not_stored)

To compute again, build the job from your code as before.

As a stopgap (ITL-1560), a loaded job and its cached `job.pipeline` blueprint raise
`RuntimeError` if you try to capture steps into either or call `compile()`.
Build the job from its pipeline to change the graph.

The database is the source of truth: a loaded job's stored views show what the database holds for
it. The job file names each run's rows by the content hash the run stored them under, so a
loaded node's stored view reads exactly what the same node built from your code would read
Expand Down
14 changes: 8 additions & 6 deletions docs/concepts/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The content hash captures schema, topology, and the **identity of the sources**
pipeline. It is computed recursively: each element's content hash depends on its own identity
plus the content hashes of all its upstream elements, all the way back to the sources.

A source's identity is its class, its schema, its `source_id` and its key columns (the
A source's identity is its schema, its `source_id` and its key columns (the
`record_id_columns` that name its rows, or none when rows are named by position). What the
`source_id` is depends on how the source was created:

Expand All @@ -23,13 +23,15 @@ A source's identity is its class, its schema, its `source_id` and its key column
- File- and table-backed sources default to a name derived from their location (the file
path for `CSVSource`, the table folder's path or URI for `DeltaTableSource`), not from the
rows.
- If you pass `source_id` yourself, you are naming the source: two sources with the same
class, schema, `source_id` and key columns have the same content hash even when their rows
differ.
- If you pass `source_id` yourself, you are naming the source. The kind is part of the
canonical ID. Two sources with the same ID, schema and key columns have the same
content hash even when their rows differ. A pipeline or job registers one source
object per content hash at capture, binding, loading and execution.
See [source consistency](sources.md#source-ids-name-the-kind-that-reads-the-data).

Two sources that differ only in their key columns name the same rows differently, so they
are two sources: different content hashes (each gets its own cache), the same pipeline hash
and the same `source_id`.
have different content hashes and the same pipeline hash and `source_id`. A pipeline or
job currently refuses to use both readings under that shared ID (ITL-1506).

Rows are still identified individually. Each row carries its own content hash, and that
per-row hash is what caching uses.
Expand Down
13 changes: 13 additions & 0 deletions docs/concepts/pipeline-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ Three more things a job node offers:
the node has run in this process, to use as the input of another pipeline.
- **`upstreams`** and **`label`** let you walk the pipeline backwards.

As a stopgap pending ITL-1559, a job cannot absorb steps from another job by
capturing compiled nodes or other streams that depend on the other job's
bindable source slots (`SourceJobNode`). The same restriction applies to
standalone `SourceJobNode` objects, even when unbound. Pass the source itself to
record a new chain, or use `node.as_source()` to read the stored results of an
earlier job. A job can use its own slots while their original bindings are in
place. A schema-only `SourceNode` declares an independent slot for each job.

## The database

Any Orcapod database can hold a job's results. Two are used most:
Expand Down Expand Up @@ -537,6 +545,11 @@ print(loaded.nodes["bmi"].as_table().num_rows, summary.nodes["bmi"].not_stored)
# 3 0
```

As a stopgap (ITL-1560), a loaded job and its cached `job.pipeline` blueprint raise
`RuntimeError` if you try to capture steps into either or call `compile()`.
Build the job from its pipeline to change the graph.
Binding sources and running with `load_only=True` remain supported.

The full rules (which sources are rebuilt from the file, operators, side effects, a
database that holds other rows than the file expects) are in
[Saving and loading a job](function-pods.md#saving-and-loading-a-job).
Expand Down
87 changes: 81 additions & 6 deletions docs/concepts/sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,72 @@ same rows read by another kind, or by another version of one kind, are another s
record id names a row within its source and never holds the source id. A job names an input
slot by the source's name (`job.bind(sources={"units": ...})`).

Each source content hash is registered to one Python object per pipeline or job.
Build the source once and reuse that object wherever you read it. For sources
whose hash includes their `source_id`, each source can instead have its own ID.
Two distinct objects with the same content hash raise
`InconsistentSourceError` even when their rows agree, including sources that read
rows later. Capture, binding, loading and execution all check for conflicts.
Rebinding replaces a slot's source. On load, slots with identical saved source
configurations share one reconstructed object.

A job accepts new steps only while every slot holds the exact source object
it held when that slot was first compiled. A slot originally compiled unbound
must be unbound. Rebinding or unbinding a slot blocks recording until all
original bindings are restored. InconsistentSourceError names the changed
slots. Restore the original bindings or build a new job. A job can compile
and run with its replacement bindings. ITL-1559 tracks capture after rebinding.

As a stopgap pending ITL-1559, a job refuses bindable source slots
(`SourceJobNode`) from another job or created standalone, including through a
stream built from one. Pass the source itself, or use `node.as_source()` to read
another job's stored results. A schema-only `SourceNode` declares a new unbound
slot for each job that captures it.

The capture and restriction checks follow wrappers that can read live inputs.
This includes tag-copy `DerivedSource` over a live source. A `DerivedSource`
over a job node reads stored results, so the checks stop there. Source object
registration uses the wrapper itself and its content hash.

Capturing into a loaded job or recompiling it can lose its restored graph
(ITL-1560). Recompilation preserves the loaded job's public `sources` mapping.

The same rule applies to wrappers. Each of these pairs raises
`InconsistentSourceError` when the objects share one content hash.

| Sources used together | How to share the source |
| --- | --- |
| A source and a `CachedSource` over it | Build the cache once and use it in both places. |
| Two caches over one source, or a cache and its inner cache | Choose one cache object and reuse it. |
| Two calls to `node.as_source()` on one node | Call `as_source()` once and reuse the result. |
| Two `DerivedSource(tags_as_data=...)` objects with the same hash | Build one derived source and reuse it. |
| A source or its cache paired with a `SourceProxy` restored for it | Choose one source object and reuse it. |

ITL-1553 tracks accepting distinct objects that represent the same source.
ITL-1531 tracks sources that read their rows later.

```python
from orcapod import Pipeline, function_pod
from orcapod.errors import InconsistentSourceError
from orcapod.sources import DictSource


@function_pod(output_keys="adjusted")
def adjust(rate: float) -> float:
return rate + 1


first = DictSource([{"rate": 3.5}], source_id="rates")
second = DictSource([{"rate": 3.5}], source_id="rates")
try:
with Pipeline("rates"):
adjust.pod(first, label="first")
adjust.pod(second, label="second")
except InconsistentSourceError as error:
print(error)
# Source 'dict_v1:rates' has distinct source objects with one content hash in step 'first' and step 'second'. Build the source once and reuse the object. If the source ID contributes to the hash, give each source its own source_id.
```

A kind's version moves when a row read before a change of its implementation could read
differently after it (other values, other Arrow types, another record id). Saved jobs keep
each source's name and version apart; a job loaded where a kind's version moved rebuilds the
Expand Down Expand Up @@ -629,12 +695,15 @@ print(Condition.of(day=day, started=started, recorded=recorded))
`{"float": "-inf"}`, since JSON has no such number.
- **One restriction per source identity in a pipeline.** Restrictions are equal by statement.
On an integer column, `t >= 3` and `t > 2` select the same rows but count as two
restrictions. A restriction leaves the `source_id` and `content_hash` unchanged, so reading
one table under two windows with the same source identity in one pipeline raises
`ValueError`. Give each window its own `source_id` to use both in the same pipeline. The
same check covers restricted and unrestricted reads of one source identity, including
reads through projections, operator chains, and source wrappers. It runs at pipeline
construction, compilation, binding, and the start of each run.
restrictions. A restriction leaves the `source_id` and `content_hash` unchanged. Each
call to `where()` returns a new source object. Call `where()` once and reuse its result
when several parts of the pipeline need the same restriction. Distinct source objects
with the same content hash raise `InconsistentSourceError` even when their restrictions
are equal. The separate one-restriction check looks through projections, operator
chains and live source wrappers. It rejects different restrictions on the same source,
including a restricted and an unrestricted read. Give each window its own `source_id`
to use both in the same pipeline. These checks run at construction, compilation,
binding and the start of each run.
- **With `limit=`.** A source built with `limit=n` reads the first `n` rows that match, in
key order: the conditions are applied first.
- **Conditions as values.** Equality compares the columns, operators and values in any
Expand Down Expand Up @@ -1020,6 +1089,12 @@ order or content can vary between runs, pass an explicit, stable `source_id` **a
key columns that are unique per row; this avoids both the duplicate entries and the repeated
deliveries.

Sources with one `source_id` must agree on their Arrow schema and key columns.
Differences raise `InconsistentSourceError` during capture, binding, loading and
execution through `job.run()` or a node's `run()`. ITL-1506 tracks support for
distinct readings of one dataset in distinct named slots. Give each reading its
own `source_id` for now.

An in-memory source with key columns and no `source_id` can instead hash its rows in key
order: pass `hash_in_key_order=True` (`ArrowTableSource`, `DictSource`, `DataFrameSource`,
`ListSource`; ITL-1272). The table is hashed sorted by the key columns, in the order you list
Expand Down
Loading
Loading