Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
7091585
feat(identity): compute structure, source and name chains
eywalker Nov 28, 2026
a629f2b
Merge remote-tracking branch 'origin/main' into eywalker/itl-1559-thr…
eywalker Nov 28, 2026
4b21055
fix(identity): preserve chains across binding and persistence
eywalker Nov 28, 2026
5da977a
Merge remote-tracking branch 'origin/main' into eywalker/itl-1559-thr…
eywalker Nov 28, 2026
f393077
fix(identity): address three-chain review findings
eywalker Nov 28, 2026
bd7ac08
chore: merge origin/main into three-chain step 1
eywalker Nov 28, 2026
12c6d38
fix(identity): preserve saved job bytes and chain inputs
eywalker Nov 28, 2026
3bb81bf
fix(identity): reject combined hashes for collapsed symmetry
eywalker Nov 28, 2026
a3e9a92
fix(identity): resolve live bindings and canonical chain order
eywalker Nov 28, 2026
d7512fa
fix(identity): guard row reads and unbound derived origins
eywalker Nov 28, 2026
c49e36e
fix(identity): preserve safe polling and loaded Index chains
eywalker Nov 28, 2026
0d2bb9a
fix(identity): keep step-one chain reads callback-free
eywalker Nov 28, 2026
3e4f03e
fix(identity): reuse polling digests through source wrappers
eywalker Nov 28, 2026
060f54a
fix(identity): restore chains for saved single-input built-ins
eywalker Nov 28, 2026
6c4accb
docs(identity): clarify saved single-input operator chains
eywalker Nov 28, 2026
824f370
chore(pipeline): merge main into three-chain step 1
eywalker Nov 28, 2026
31136af
docs(identity): clarify step-one hash limits and review coverage
eywalker Nov 28, 2026
86a8a43
chore(pipeline): merge main after declared provenance fixes
eywalker Nov 28, 2026
54692cd
chore(pipeline): merge main after context hashing and job resave fixes
eywalker Nov 28, 2026
58b3c87
feat(identity): hash typed source and name entries at every node
eywalker Nov 29, 2026
1318293
chore(identity): merge main with the three-chain specification
eywalker Nov 29, 2026
558d3b5
docs(identity): record typed chain tree decisions
eywalker Nov 29, 2026
560edb8
fix(identity): preserve explicit empty source slot names
eywalker Nov 29, 2026
ed48fa2
chore(identity): merge main after step one
eywalker Nov 29, 2026
60b4181
feat(identity)!: use the source chain for content hashes
eywalker Nov 29, 2026
0e30b95
fix(identity): handle graph declarations and refresh bound identity
eywalker Nov 29, 2026
0ebff08
test(identity): update content and record hash pins
eywalker Nov 29, 2026
ffaf537
fix(pipeline): reuse the captured key for active slots
eywalker Nov 29, 2026
7397e7e
fix(identity): handle unbound slot copies and partial job saves
eywalker Nov 29, 2026
9d32042
docs(hashing): inventory graph declarations and drop unused slot memo
eywalker Nov 29, 2026
d020746
test(identity): distinguish slot hashes in invocation transitions
eywalker Nov 29, 2026
d79971a
test(identity): align remaining hash callers and diagram examples
eywalker Nov 29, 2026
d6a7d3d
fix(identity): report source execution without a binding
eywalker Nov 29, 2026
7ccaf72
chore(identity): merge main and retain observer reporting
eywalker Nov 29, 2026
cc0ad6e
test(observers): compare attribution across content hash versions
eywalker Nov 29, 2026
b082d2e
chore: merge main into the content hash switch
eywalker Nov 29, 2026
792b284
fix(identity): keep main's behaviour for slot keys, repeated inputs a…
eywalker Nov 29, 2026
5a57972
chore: merge main into the content hash switch
eywalker Nov 29, 2026
2234f0d
test(pipeline): pin implicit slot names after the content hash switch
eywalker Nov 29, 2026
522b9f2
docs(pipeline): reference the follow-up for implicit slot names
eywalker Nov 29, 2026
3e35bcb
Merge remote-tracking branch 'origin/main' into eywalker/itl-1559-ste…
eywalker Nov 29, 2026
48babc7
test(golden): regenerate the approved content-hash entries (ITL-1559)
eywalker Nov 29, 2026
d7a7b41
chore(merge): integrate main into the content hash switch
eywalker Nov 29, 2026
30417cb
fix(identity): honor explicit hashers for raw stream leaves
eywalker Nov 29, 2026
fbff796
Merge remote-tracking branch 'origin/main' into eywalker/itl-1559-ste…
eywalker Nov 29, 2026
6e782ea
fix(pipeline): reject outputs from earlier slot bindings
eywalker Nov 29, 2026
f7ca95a
fix(streams): preserve reads without graph metadata
eywalker Nov 29, 2026
b310a4e
chore: merge main into the content hash switch
eywalker Nov 29, 2026
9a40968
fix(pipeline): refresh rebound lazy streams and stored sources
eywalker Nov 29, 2026
c1ba18a
fix(sources): refresh direct cached reads after the origin reruns
eywalker Nov 29, 2026
b1a032d
test(pipeline): use stable identities to exercise proxy cycles
eywalker Nov 29, 2026
d637a34
fix(pipeline): reject retained reads after source rebinding
eywalker Nov 29, 2026
9a20fbe
fix(sources): refresh derived output after lineage changes
eywalker Nov 29, 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
13 changes: 8 additions & 5 deletions .zed/rules
Original file line number Diff line number Diff line change
Expand Up @@ -931,9 +931,9 @@ keeps its old identity; do not change it (ITL-956).
The tags_as_data argument is provisional and may be removed (ITL-1020), so when in
doubt start with a data-tag, or start with data and promote it to a data-tag if needed.

### Two identity chains
### Three identity chains

Every pipeline element has two parallel hashes:
Pipeline structure, bound sources, and slot names contribute to three hashes:

1. content_hash() — the pipeline bound to its named sources: schema, topology and source
identity. For a source it is a stable address, not a digest of its rows (developer,
Expand All @@ -950,9 +950,9 @@ Every pipeline element has two parallel hashes:
in the order given, or sorted by the key columns with hash_in_key_order=True, ITL-1272). A
ListSource has no rule of its own (developer, November 21, 2026, ITL-1272): its elements
and tag function enter only through that default and its output schema (their types), and
with a given source_id it is an address like every other source (the review of every source's identity is ITL-1311). A downstream stream or node hashes its
pod's identity plus its upstreams' content hashes; a function pod's identity is its uri,
not its body. The uri holds the hash of the output schema, a set of named, typed outputs
with a given source_id it is an address like every other source (the review of every source's identity is ITL-1311). A downstream stream or node hashes the pair of its pipeline hash and
source chain under the label defined in `core/identity_chains.py`. A function pod's
identity is its uri, not its body. The uri holds the hash of the output schema, a set of named, typed outputs
in no order (developer, November 17, 2026, ITL-1244): reordering output_keys changes it
only when a key's type changes; when a name now receives another value (same-typed keys
reordered without the returned values, or the reverse), what the function computes
Expand All @@ -964,6 +964,9 @@ Every pipeline element has two parallel hashes:
pipelines bound to different sources (__node_content_hash).
2. pipeline_hash() — schema + topology only. Ignores data content. Used for DB path scoping
so that different sources with identical Arrow schemas share database tables.
3. node_hash() — the pipeline hash with its name chain. The name chain still exists
when a contributing slot is unbound. Bound graph keys use content identity while
unbound graph declarations use name-based identity.

Base case: RootSource.pipeline_identity_structure() returns the Arrow schema identity of
its tag and data schemas (below, "Schemas are hashed as Arrow schemas").
Expand Down
13 changes: 8 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,9 @@ keeps its old identity; do not change it (ITL-956).
The `tags_as_data` argument is provisional and may be removed (ITL-1020), so when in
doubt start with a data-tag, or start with data and promote it to a data-tag if needed.

### Two identity chains
### Three identity chains

Every pipeline element has two parallel hashes:
Pipeline structure, bound sources, and slot names contribute to three hashes:

1. **`content_hash()`** — the pipeline bound to its named sources: schema, topology and source
identity. For a source it is a stable *address*, not a digest of its rows (developer,
Expand All @@ -970,9 +970,9 @@ Every pipeline element has two parallel hashes:
in the order given, or sorted by the key columns with `hash_in_key_order=True`, ITL-1272). A
`ListSource` has no rule of its own (developer, November 21, 2026, ITL-1272): its elements
and tag function enter only through that default and its output schema (their types), and
with a given `source_id` it is an address like every other source (the review of every source's identity is ITL-1311). A downstream stream or node hashes its
pod's identity plus its upstreams' content hashes; a function pod's identity is its uri,
not its body. The uri holds the hash of the output schema, a set of named, typed outputs
with a given `source_id` it is an address like every other source (the review of every source's identity is ITL-1311). A downstream stream or node hashes the pair of its pipeline hash and
source chain under the label defined in `core/identity_chains.py`. A function pod's
identity is its uri, not its body. The uri holds the hash of the output schema, a set of named, typed outputs
in no order (developer, November 17, 2026, ITL-1244): reordering `output_keys` changes it
only when a key's type changes; when a name now receives another value (same-typed keys
reordered without the returned values, or the reverse), what the function computes
Expand All @@ -984,6 +984,9 @@ Every pipeline element has two parallel hashes:
pipelines bound to different sources (`__node_content_hash`).
2. **`pipeline_hash()`** — schema + topology only. Ignores data content. Used for DB path
scoping so that different sources with identical Arrow schemas share database tables.
3. **`node_hash()`** — the pipeline hash with its name chain. The name chain still
exists when a contributing slot is unbound. Bound graph keys use content identity
while unbound graph declarations use name-based identity.

Base case: `RootSource.pipeline_identity_structure()` returns the Arrow schema identity of
its tag and data schemas (below, "Schemas are hashed as Arrow schemas").
Expand Down
36 changes: 32 additions & 4 deletions changelog.d/ITL-1559.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,51 @@
previously processed inputs are acceptable.
(ITL-1559)

- Streams, invocations, and bound nodes now combine the pipeline hash and source
chain in `content_hash()`. Bound nodes write new record ids and new
`__node_content_hash` values. Pipeline-scoped table paths stay the same. An
upgraded job computes its pipeline records again because the new ids do not
match rows written at those paths by the earlier development version.
Unbound slots and their live downstream nodes raise `UnboundSourceError` when
asked for a content hash, also in a loaded job whose saved run recorded no hash
for them; once bound they return the live content hash. Steps that share a name
and have no label are numbered in the order of this hash, so a saved job can
give `x_1` and `x_2` to the other step than before. The hash segment of a run's
pipeline URI, which observers receive and the status observer stores, moves.
Implicit input slots for prebuilt streams without a root source name now end in
the new content hash's hex digest, so rebinds of upgraded jobs must use the new
slot key (ITL-1700 tracks content-independent slot names).
(ITL-1559)

### Added

- Streams, recorded invocations, and job nodes expose `source_chain()`, `name_chain()`, and `node_hash()`. The node hash identifies a computation by its structure and input slot names, so it is available on an unbound pipeline. A polling source can report its node hash before its first batch supplies the schema. Existing pipeline and content hashes keep their values.
- Streams, recorded invocations, and job nodes expose `source_chain()`, `name_chain()`, and `node_hash()`. The node hash identifies a computation by its structure and input slot names, so it is available on an unbound pipeline. A polling source can report its node hash before its first batch supplies the schema.

- A job loaded without an operator implementation still exposes its saved hashes. A loaded built-in with one input can also report the new chains from its saved structure and its input's chains. Operators whose input symmetry is unavailable report an error for the new chains.

### Fixed

- Retained outputs from source slots raise `StaleOutputError` after a contributing
slot is rebound. Read the node again for the current binding. This prevents
downstream operator logs from recording old rows under the new binding's hash.
Buffered batches and retained iterators check for rebinding at the end of a read
as well. A node that refuses stale input clears the rows from its previous run.

- Loading a saved job restores context-taking function nodes, their stored results,
and their downstream dependencies. (ITL-1559)

- Source chains follow rebindings inside composite input bindings. Name chains can be read without fetching a polling source's rows, and downstream identities that need its missing schema report that they are undefined. Nested commutative groups use the pipeline hash's canonical input order.
- Source chains follow rebindings inside composite input bindings. Name chains can be read without fetching a polling source's rows, and a standalone node hash that needs its missing schema reports that it is undefined. Live content hashing and job capture can obtain the schema from the first batch. Nested commutative groups use the pipeline hash's canonical input order.
- Identity accessors reuse a memoized raw Arrow stream's legacy digest and report an undefined identity when they would have to materialize a lazy upstream or hash Arrow rows. Plain derived sources, including cached bindings, report no source chain while an origin slot is unbound.
- Polling source chain reads reuse a memoized legacy content hash from the polling source, a cache at any level of wrapping, or a bound job slot. A plain `DerivedSource` can use that digest without calling the polling implementation. A cold polling identity remains undefined.
- Custom operators report an undefined identity for the new accessors without calling their argument symmetry method.
- Standalone chain and node identity reads report an undefined identity for custom operators without calling their argument symmetry method.
- The source and name chains hash a typed entry at every node, preserving the position of each contribution and the pairing of upstream branches. An unbound slot leaves its node hash available and raises an undefined-identity error when its source chain is requested.

- Lazy operators and function pods refresh their rows after an upstream job
slot is rebound. Sources over another job's stored results, including cached
sources, refresh for the new binding and mark downstream job nodes stale.
- Derived sources track slots added by upstream replacement and preview the
origin's stored rows once its run with the replacement binding completes.

### Known limitations

- The new combined hashes raise an error when a commutative group drops content-equal inputs from its argument symmetry (ITL-1590). The legacy pipeline and content hashes remain available.
- Standalone node hashing raises an error when a commutative group drops content-equal inputs from its argument symmetry. Live content hashing and job capture still accept those inputs (ITL-1590).
2 changes: 2 additions & 0 deletions docs/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ These exceptions and warnings report problems running pipelines, processing rows

::: orcapod.errors.UpstreamFailedError

::: orcapod.errors.StaleOutputError

::: orcapod.errors.EmptyDataAccessError

::: orcapod.errors.EmptyDataHashMissingError
Expand Down
22 changes: 16 additions & 6 deletions docs/concepts/identity.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Identity & Hashing

Every pipeline element in Orcapod -- [sources](sources.md), [streams](streams.md),
[operators](operators.md), and [function pods](function-pods.md) -- carries two parallel
identity hashes. These hashes enable Orcapod to deduplicate computations, scope database
[operators](operators.md), and [function pods](function-pods.md) -- has identities for its structure, source bindings and slot names. These hashes enable Orcapod to deduplicate computations, scope database
storage, and detect when a pipeline's structure or data has changed.

## Two identity chains
## Three identity chains

### `content_hash()` -- recursive source-inclusive identity
### `content_hash()` — source-inclusive identity

The content hash captures schema, topology, and the **identity of the sources** feeding the
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.
pipeline. A stream, invocation, or node combines its pipeline hash with its source chain.
The source chain follows the input tree and includes each bound source’s address. An unbound
slot leaves the content hash undefined.

When a job captures a prebuilt stream without a root source name as an implicit input
slot, the slot name is `<label>:<content hash hex>`, so a rebind of the upgraded job
needs the new name after the content-hash switch (ITL-1700 tracks content-independent
slot names).

Most sources use their schema, `source_id` and key columns in their identity (the
`record_id_columns` that name its rows, or none when rows are named by position). What the
Expand Down Expand Up @@ -64,6 +69,11 @@ they are two schemas, with two pipeline hashes and two tables.
This is a powerful feature: it means that running the same function on new data automatically
benefits from results already cached for previous data with the same schema.

### `node_hash()` — structure and slot names

This hash combines the pipeline hash and name chain. It is available for an unbound
slot and stays the same when a source is replaced.

## How it works in practice

Consider two sources with the same schema but different data:
Expand Down
19 changes: 19 additions & 0 deletions docs/concepts/sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ 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.

An output stream returned by a run uses the slot bindings that were in effect when
its rows were produced. Binding any slot that feeds it makes that output stale,
even if you bind A to B and then back to A, or never hashed the output before
rebinding. A stale output raises `StaleOutputError` when you read its rows, request
its identity, or call `head()`. The notebook preview shows the error message.
Read the node again to get an output for the current binding.

Standalone lazy operators and function pods over a job node discard their
cached rows after a contributing slot is rebound. The next read uses the
node's current rows. Run the job again to produce rows for the new binding.

A source created with `node.as_source()` reads the stored results for the
origin's current binding, including when wrapped in a `CachedSource`. The
rebind makes any job that uses this source stale so it recomputes on the next
run. If the origin has no stored results for its current binding, the source
returns an empty table with the origin's columns. A cache whose path was
used for an earlier binding reads the origin directly when that path would
otherwise mix bindings.

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
Expand Down
20 changes: 20 additions & 0 deletions docs/dev/design_issues/ITL-1559-TC1.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,23 @@ slot is unbound.
Step 1b hashes a typed entry at every node in the source and name trees. Moving a
name contribution between otherwise identical steps now changes the node hash.
The source-chain accessor reports an undefined identity for unbound slots.

Step 5 switches live content identity and stored row attribution to the pipeline
hash paired with the source chain. Binding invalidates that hash downstream. Bound
graph keys still use content identity.

Materialized outputs record the generation of each slot that feeds them. After
any of those slots is rebound, the output raises `StaleOutputError` on use, so a
downstream operator cannot log old rows under the new source identity.

Standalone lazy streams discard their cached results when a contributing slot
is rebound and recompute from the node's current rows. A stored-result source
and a cache that wraps it discard their in-memory view, move their modified
time, and read the current binding's stored rows. This also addresses ITL-1692.
Binding checks memoize the fixed stream lineage and follow only the live slot
bindings between those cached subgraphs.

Buffered record batches and iterators retain their producing generations and
check them when read, including at iterator exhaustion. A stale-input refusal
clears the previous job-node run, and a cache preview whose view was invalidated
falls back to the wrapped source's zero-row preview.
Loading
Loading