Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 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
d5c6832
chore(identity): merge main after step 1 landed
eywalker Nov 29, 2026
250a8db
docs: correct three-chain hash examples
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
1 change: 1 addition & 0 deletions changelog.d/ITL-1559.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- 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.
- 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.

### Known limitations

Expand Down
6 changes: 5 additions & 1 deletion docs/dev/design_issues/ITL-1559-TC1.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ when a commutative operator receives equal-structure inputs.

The step 1 follow-up serializes binding and chain reads. Saved jobs retain the
existing file format. An unavailable built-in with one input uses its saved structure
and that input's chains. An unavailable operator with multiple inputs needs its input
and hashes that input's chains. An unavailable operator with multiple inputs needs its input
symmetry to report the new chains. Schema-less polling sources report a node hash
before their first batch, including when wrapped in a cache.

Expand All @@ -35,3 +35,7 @@ upstream rows or hash cold raw Arrow rows. Custom operators report that the new
identities are undefined in this step without calling their symmetry method.
Plain derived source chains, including cached bindings, are absent while an origin
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.
111 changes: 67 additions & 44 deletions docs/dev/specs/itl-1559-three-chain-hash.md

Large diffs are not rendered by default.

33 changes: 18 additions & 15 deletions docs/reference/hashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ Hash labels:
| `batch_v1` | the folded source id and record id of `Batch` (site 6b) | `BATCH_FOLD_LABEL`, `core/operators/batch.py` |
| `group_v1` | the folded source id and record id of `GroupBy` (site 6b), and the merged source-info token of a data-tag group key | `GROUP_BY_FOLD_LABEL`, `core/operators/group_by.py` |
| `join_v1` | the merged source-info token of a key that is a data-tag on several inputs of a `Join` (site 6b) | `JOIN_FOLD_LABEL`, `core/operators/join.py` |
| `slot_name_v1` | SHA-256 of the canonical tuple `("slot", name)` | `SLOT_NAME_HASH_LABEL`, `core/identity_chains.py` |
| `source_chain_v1` | SHA-256 of the canonical tuple of upstream source chains, with any local contribution | `SOURCE_CHAIN_HASH_LABEL`, `core/identity_chains.py` |
| `name_chain_v1` | SHA-256 of the canonical tuple of upstream name chains, with any local contribution | `NAME_CHAIN_HASH_LABEL`, `core/identity_chains.py` |
| `source_chain_v1` | SHA-256 of the canonical tuple `(entry, [upstream source chains])` | `SOURCE_CHAIN_HASH_LABEL`, `core/identity_chains.py` |
| `name_chain_v1` | SHA-256 of the canonical tuple `(entry, [upstream name chains])` | `NAME_CHAIN_HASH_LABEL`, `core/identity_chains.py` |
| `content_hash_v1` | SHA-256 of the canonical tuple of the pipeline hash and source chain | `CONTENT_HASH_LABEL`, `core/identity_chains.py` |
| `node_hash_v1` | SHA-256 of the canonical tuple of the pipeline hash and name chain | `NODE_HASH_LABEL`, `core/identity_chains.py` |
| `sha256` | the file content hash: SHA-256 of the file's bytes | `SHA256_ALGORITHM`, `hashing/hash_utils.py` |
Expand Down Expand Up @@ -299,22 +298,26 @@ reordered.
## Structure, source and name chains

A stream, invocation or job node carries three chains. `pipeline_hash()` describes the
structure. `source_chain()` starts at each slot with the bound source's own content hash.
`name_chain()` starts with the slot's name. A raw stream outside a slot contributes
an anonymous name term. Display labels do not participate. A single-input step passes both chains
through unchanged unless the step contributes a term of its own. Ordered groups pool
inputs in argument order. Commutative groups use the pipeline hash's canonical order,
including when a group contains other groups. Within a tie the source and name chains
each sort their own values. Repeated inputs contribute at every position.
structure. Each node hashes its typed source or name entry with the list of upstream
values for that chain. A slot uses `("source", bound_source_identity)` and
`("slot", slot_name)` as its entries. An uncaptured root source uses its source name,
and a raw stream uses `("slot", None)`. An entry of `None` marks a step with no local
contribution. Display labels do not participate.

Ordered groups use argument order. Commutative groups use the pipeline hash's canonical
order, including when a group contains other groups. Each chain sorts its own values
within a structural tie. Repeated inputs contribute at every position, and a shared
upstream is hashed once per chain.

`node_hash()` combines the pipeline hash and the name chain. The chain-based content
hash combines the pipeline hash and the source chain and is undefined while any
contributing slot is unbound. The chain-based content hash is available internally as
hash combines the pipeline hash and the source chain. Reading either the source chain
or the chain-based content hash raises `UnboundSourceError` while a contributing slot
is unbound. The chain-based content hash is available internally as
`_chain_content_hash()` until the switch to `content_hash()`. Orcapod continues to use
the existing hashes for graph keys and persistence. ITL-1590 tracks cases where the
existing pipeline hash depends on source equality within a commutative input tie.
The saved job format does not carry input symmetry yet. A loaded built-in with one
input uses the saved pipeline hash and passes through that input's chains, even when
input uses the saved pipeline hash and hashes that input's chains, even when
its operator implementation is unavailable. An unavailable operator with multiple
inputs needs its input symmetry and reports an undefined identity for either chain
or combined hash.
Expand All @@ -337,7 +340,7 @@ schema. The legacy symmetry check uses the inputs' content digests to form a
set. The step 1 accessors report an undefined identity when that check needs
the polling implementation.

A plain derived source, including one wrapped in a cache, has no source chain while
A plain derived source, including one wrapped in a cache, reports an undefined source chain while
a contributing slot of its origin is unbound. Chain accessors report an undefined
identity when they would have to build a lazy upstream from rows or hash a raw
Arrow stream's rows. A raw Arrow stream can report its node hash from its schema
Expand Down Expand Up @@ -369,7 +372,7 @@ test session with `-p tests.test_hashing.hash_site_trace`.
| Location | What is hashed | Algorithm / label | Used as | Call sites |
|---|---|---|---|---|
| structure hasher | a Python value as a tagged JSON tree | SHA-256 of canonical JSON, `semantic_v1` | every `content_hash()` / `pipeline_hash()`, type and function hash; the names built on schema hashes | `hashing/semantic_hashing/semantic_hasher.py:SemanticAwarePythonHasher._hash_to_content_hash` |
| three-chain hashes | a slot name, a pool of upstream chains, or the pipeline hash paired with one chain | SHA-256 of canonical JSON, with the corresponding chain or combined-hash label | into a hash for chain pooling and combining, or returned by an identity accessor | `core/identity_chains.py:_hash`, `core/identity_chains.py:_pool`, `core/identity_chains.py:IdentityChainsMixin._identity_hash`, `core/identity_chains.py:IdentityChainsMixin._compute_identity_chains.<locals>.<genexpr>`, `core/identity_chains.py:IdentityChainsMixin._chain_content_hash`, `core/identity_chains.py:IdentityChainsMixin.node_hash`, `core/sources/polling_source.py:PollingSource._identity_node_pipeline_hash` |
| three-chain hashes | a typed entry with its list of upstream chains, or the pipeline hash paired with one chain | SHA-256 of canonical JSON, with the corresponding chain or combined-hash label | into a hash for chain construction and combining, or returned by an identity accessor | `core/identity_chains.py:_hash`, `core/identity_chains.py:_pool_group`, `core/identity_chains.py:IdentityChainsMixin._identity_hash`, `core/identity_chains.py:IdentityChainsMixin._identity_chain_hash`, `core/identity_chains.py:IdentityChainsMixin._compute_identity_chains`, `core/identity_chains.py:IdentityChainsMixin._compute_identity_chains.<locals>.hash_chain`, `core/identity_chains.py:IdentityChainsMixin._compute_identity_chains.<locals>.<genexpr>`, `core/identity_chains.py:IdentityChainsMixin._chain_content_hash`, `core/identity_chains.py:IdentityChainsMixin.node_hash`, `core/sources/polling_source.py:PollingSource._identity_node_pipeline_hash` |
| Arrow hasher | a table after the semantic visitor | starfix, `arrow_v1` (a table Orcapod built: float rule on); `hash_table_strict`: `arrow_strict_v1` (a pyarrow table given as a value: every bit counts); `hash_table_ordered`: `arrow_ordered_v1` (a library value's digest: every bit counts); `hash_schema`: `arrow_schema_v1` | row data hashes, entry ids, row keys, default source ids, table values; every schema in an identity | `hashing/arrow_hashers.py:StarfixArrowHasher.hash_table`, `hashing/arrow_hashers.py:StarfixArrowHasher.hash_table_strict`, `hashing/arrow_hashers.py:StarfixArrowHasher.hash_table_ordered`, `hashing/arrow_hashers.py:StarfixArrowHasher.hash_schema`, `hashing/arrow_hashers.py:StarfixArrowHasher._digest`, `hashing/starfix_digest.py:_digest_table`, `hashing/starfix_digest.py:digest_schema` |
| file hasher | a file's bytes | SHA-256 of the bytes, label `sha256`. Hashers, cache writes, and data context loading reject other algorithms. Direct cache lookups for other labels miss (ITL-1155). Custom file hasher results are verified against SHA-256 of the file bytes. | `File` value hash | `hashing/hash_utils.py:hash_file`, `hashing/semantic_hashing/builtin_handlers.py:FileHandler.handle`, `hashing/file_hashers.py:verified_file_hash`, `hashing/file_hashers.py:canonical_file_hash`, `hashing/file_hashers.py:_validated_file_digest`, `hashing/hash_cachers.py:InMemoryHashCacher.put`, `hashing/hash_cachers.py:SqliteHashCacher.get`, `hashing/hash_cachers.py:SqliteHashCacher.put`, `hashing/postgres_hash_cacher.py:PostgresHashCacher.get`, `hashing/postgres_hash_cacher.py:PostgresHashCacher.put` |
| directory hasher | a directory tree | Merkle tree of SHA-256 entries, `directory_v1`; file leaves taken with their label. The handler verifies custom directory hashes against the library Merkle procedure. | `Directory` value hash | `hashing/directory_hashers.py:BasicDirectoryHasher.hash_directory`, `hashing/directory_hashers.py:_hash_dir`, `hashing/semantic_hashing/builtin_handlers.py:DirectoryHandler.handle`, `hashing/directory_hashers.py:verified_directory_hash`, `hashing/directory_hashers.py:canonical_directory_hash` |
Expand Down
Loading
Loading