Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5b1b578
feat(hashing): hash every schema that enters an identity as its Arrow…
Nov 18, 2026
d5e3817
feat(pipeline): slots hold and save Arrow schemas; bind compares Arro…
Nov 18, 2026
7c49fb9
fix(pipeline): cache source Arrow schemas; pending slots and old save…
Nov 18, 2026
2bccacc
fix(pipeline): unbound slots and loaded function nodes keep their Arr…
Nov 19, 2026
a7077e6
feat(sources): a PollingSource's declared schema fixes its Arrow iden…
Nov 19, 2026
c32bc7a
test(hashing): sources, stores, bind, polling and async under the Arr…
Nov 19, 2026
ef4b06e
docs: the Arrow schema hash in the hashing reference, concepts, agent…
Nov 19, 2026
eb465c0
fix(typing): hash_schema on ArrowHasherProtocol; tutorial outputs fol…
Nov 19, 2026
060cb6c
test(specification): a source's pipeline identity is its Arrow schema…
Nov 19, 2026
0fd7864
Merge remote-tracking branch 'origin/main' into eywalker/itl-640-migr…
Nov 19, 2026
94c52fd
test(sources): node.as_source() keeps its origin's Arrow types before…
Nov 19, 2026
bd2e9a1
Merge remote-tracking branch 'origin/main' into eywalker/itl-640-migr…
Nov 19, 2026
41082d9
docs(dev): the ITL-640 golden analyzer reads the provisional files an…
Nov 19, 2026
73ccc2e
Merge origin/main into eywalker/itl-640-migrate-schema-hashing-from-p…
Nov 21, 2026
83fd7e7
fix(identity): the Arrow schema rule on main's new paths (ITL-640)
Nov 21, 2026
ea29de0
feat(serialization): a saved job holds every node's own Arrow types; …
Nov 21, 2026
0d1164c
Merge origin/main into eywalker/itl-640-migrate-schema-hashing-from-p…
Nov 21, 2026
13a7f6a
test(csv_source): a saved job reloads a source with a decimal column …
Nov 21, 2026
aa64fce
fix(identity): one form for a logical type in every Arrow representat…
Nov 21, 2026
001988e
Merge origin/main into eywalker/itl-640-migrate-schema-hashing-from-p…
Nov 21, 2026
b927cdd
revert(hashing): hold the metadata-form step in hash_schema (ITL-640)
Nov 21, 2026
b69055b
feat(hashing): a schema hash is the hash of the declared schema; nest…
Nov 21, 2026
4f6e8c0
fix(hashing): a missing optional library is raised as itself by hash_…
Nov 21, 2026
dd0f90d
fix(serialization): a saved map keeps its key and item fields exactly…
Nov 21, 2026
81d76aa
test(golden): regenerate the ITL-640 moves and pin the canonical sche…
Nov 21, 2026
78082d2
fix(identity): refuse union and list-view columns; full-suite and Cod…
Nov 21, 2026
7d7389d
fix(identity): refuse run-end-encoded columns too: one rule for every…
Nov 21, 2026
9fc0a05
fix(cached_source): every read of the cache's rows checks their Arrow…
Nov 21, 2026
3dd1433
fix: CodeRabbit review body of 81d76aac (ITL-640)
Nov 21, 2026
f227135
fix(serialization): one rule for quoting nested field names (ITL-640)
Nov 21, 2026
ba932ea
fix(serialization): saved type text declares its grammar: format 0.4.…
Nov 21, 2026
a29abe8
fix(serialization): migrate older type texts at known places only (IT…
Nov 21, 2026
4adf9df
fix(source_node): a loaded slot keeps its saved Arrow types through a…
Nov 21, 2026
7365231
fix(identity): an unresolved loaded slot keeps its saved Arrow types …
Nov 21, 2026
4421c98
fix(serialization): one source of truth for a loaded slot's types; re…
Nov 21, 2026
4335fa3
fix(serialization): refuse a saved file without its nullability or ru…
Nov 21, 2026
e2cd0e4
fix(serialization): struct<> parses; a run hash must be text; a read-…
Nov 21, 2026
5e43933
fix(serialization): decimal32/decimal64 read back; save refuses unrea…
Nov 21, 2026
19c78f3
fix(pipeline): a loaded file with an unregistered logical type saves …
Nov 21, 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
75 changes: 67 additions & 8 deletions .zed/rules
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ Every pipeline element has two parallel hashes:
identity. For a source it is a stable address, not a digest of its rows (developer,
November 11, 2026: "sources content hash is meant to be a stable address and is not
necessarily going to reflect the very data content"). A root source hashes
(class name, output schema, source_id, key columns); given a source_id, changed, added or
(class name, Arrow schema identity, source_id, key columns); given a source_id, changed, added or
reordered rows leave it unchanged. The key columns are the resolved record_id_columns in key
order (() for the position; a database or SpiralDB table's primary key by default): two
sources that differ only in how they name their rows are two sources, with one pipeline
Expand All @@ -916,9 +916,10 @@ Every pipeline element has two parallel hashes:
memoized by. The node's content hash tells apart, inside a shared table, the rows of
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 schemas share database tables.
so that different sources with identical Arrow schemas share database tables.

Base case: RootSource.pipeline_identity_structure() returns (tag_schema, data_schema).
Base case: RootSource.pipeline_identity_structure() returns the Arrow schema identity of
its tag and data schemas (below, "Schemas are hashed as Arrow schemas").
Each downstream node's pipeline hash commits to its own identity plus upstream pipeline
hashes, forming a Merkle chain.

Expand Down Expand Up @@ -1066,6 +1067,51 @@ generation of hashing; rows of the current data context are the current entries.
detection and automatic recomputation.
- Source delegation — CSVSource, DictSource, etc. create an internal ArrowTableSource.

### Schemas are hashed as Arrow schemas

Developer, November 18, 2026 (ITL-640; option B): a schema enters every identity as its Arrow
schema, large-normalized, hashed by the one function StarfixArrowHasher.hash_schema
(label arrow_schema_v1, ARROW_SCHEMA_HASH_LABEL), never as Python types. The places: a
source's pipeline and content identity and an input slot's
(schema_utils.arrow_schema_identity: the tag and data schemas hashed apart, as nested
ContentHash objects), the system-tag column names (compute_schema_hash, the semantic hash
of that pair, bare hex) and the output schema in a function's uri (the converter's Arrow
schema of the declared outputs, fed as a one-schema tuple, bare hex). output_schema() still
reports Python types; a function's INPUT check stays at the Python level; a function's input
types are in no schema hash.

- Which Arrow schema: a source's or node's typed zero-row table (never computed from rows),
cached per source (RootSource.arrow_schemas); a DerivedSource takes its origin's and
refuses a stored read of another type (top-level nullability aside); a CachedSource its
source's, and refuses a cache read of another type by the same rule
(schema_utils.stored_type_mismatch); a slot made from a stream, that stream's (SourceNodeBase.arrow_schemas); a
saved job writes each slot's own Arrow types and a load rebuilds them; an unbound slot with
known Arrow types types its zero-row table from them; a loaded function node types its
zero-row output from its saved Arrow text.
- Declared Python types mean one Arrow type each, the converter's (int is int64,
datetime is timestamp[us, tz=UTC]): a hand-declared slot, an unbound SourceProxy, a
PollingSource whose impl.schema() returns a Python Schema. A source, slot or batch of
another Arrow type is refused (bind: SourceSpecMismatchError; a polled batch:
SchemaInconsistencyError before commit), never converted. The remedy is declaring in
Arrow: SourceNode(name, tag_schema=pa.schema(...), data_schema=pa.schema(...)),
impl.schema() returning a pa.Schema. Never loosen this.
- hash_schema ignores column order, large/non-large, list item field names, dictionary
encoding and field metadata other than ARROW:extension:*; it tells apart width, sign,
nullability at every depth, timestamp unit and zone, decimal precision, date types,
fixed-size against plain lists, struct fields, and a logical type's whole identifier.
- hash_schema hashes the DECLARED schema (developer, November 21, 2026, ITL-640, option
(a)): every logical type, live, in metadata (IPC) form or unregistered in the process, is
first brought to its storage form, its storage type with its identifier as
ARROW:extension:* field metadata, at any depth (canonical_form.storage_form_schema,
applied by hash_schema itself). No value-handler rewrite, no registry lookup: the
identifier pins how the values are hashed. hash_table is unchanged and a separate
procedure; never rely on hash_schema(t.schema) being the schema inside hash_table(t).
The saved-schema writer writes the storage form; an Arrow declaration and a saved schema
read back take declaration_form_schema: a top-level logical type live, a nested one
(inside a plain list, struct or map) always in the storage form, never a nested live
extension type (Arrow cannot build an empty table of one). The tests enumerate every
registered logical type from the converter (test_schema_hash_storage_form.py).

### Arrow types

Governing principle (developer, November 9, 2026): minimize convenient inference and hold to
Expand All @@ -1086,8 +1132,17 @@ per-operator normalization. Names, nullability (top level and nested), field met
logical (extension) types are untouched, and large and non-large variants hash identically, so no
hash or default source id moves. Not covered: what is inside a library value (numpy, pandas,
polars, torch) keeps its library's own distinction. list_view and large_list_view are not
supported: a source refuses them (the Arrow hasher cannot hash them) and a raw ArrowTableStream
holds them as given (ITL-1129).
supported (ITL-1129), and neither is a union (dense or sparse) or a run-end-encoded type: a
source and a raw ArrowTableStream refuse a column whose type is or contains one when they
are built (developer, November 21, 2026, ITL-640, for unions and list views; run-end-encoded
by the same rule, the coordinator the same day: one rule for every type the schema hash
rejects. A stream's identity is its Arrow schema hash, which cannot hold them; a raw stream
used to hold them as given). One rule beside the dictionary refusal,
schema_utils.schema_hash_rejected_columns with schema_hash_rejected_columns_error
(InputValidationError naming each column with its role and type), applied by
ArrowTableStream.__init__ and first by SourceStreamBuilder.build; the rejected kinds are
one constant, SCHEMA_HASH_REJECTED_KINDS, checked by a test against starfix's public schema
hash.

Dictionary-encoded columns are refused, tags and data alike (developer, November 18, 2026,
ITL-1264: "Say it is not currently supported in orcapod. We MAY support but not immediately in
Expand Down Expand Up @@ -1241,14 +1296,18 @@ data. The rules:
columns without a reason. SourceNodeBase.validate is the one check, used by
PipelineJob.bind, the bound_source setter (and SourceJobNode.__init__) and
PipelineJob.load: per column the declared Python type (structural classes of one identity
are one type, equivalent_hints), or T where the slot declares T | None; and exactly
are one type, equivalent_hints), or T where the slot declares T | None, AND the slot's
Arrow type, compared by hash_schema, with only a top-level non-null column accepted where
the slot's is nullable (nested nullability exact; ITL-640); and exactly
one source-id (str) and one record-id (str) system-tag column, no other. Anything
else raises SourceSpecMismatchError before anything is bound. The
source's rows are given as the declared schema at one place, _DeclaredForm (nullable
fields over the same arrays; the system-tag column NAMES of the declared schema hash,
taken from the source's own pair by prefix, the VALUES the source's own; as a stable
convenience, not a guarantee, the declared column order, source id before record id). Limits: the check compares Python types, so a difference in Arrow width only
(int32 against int64) is not yet refused (ITL-949). A source whose system-tag columns
convenience, not a guarantee, the declared column order, source id before record id). A
difference in Arrow width only (int32 against int64) is refused (ITL-949, resolved by
ITL-640); never loosen this for timestamps or widths: a declared Python type means one
Arrow type, and the remedy is declaring the slot from the source or in Arrow. A source whose system-tag columns
are not exactly one source-id and one record-id column (a joined or merged stream, a raw
stream with none) is refused by the same check (developer, November 14, 2026, ITL-1126);
binding one properly is ITL-1127. That includes a pipeline's input: Pipeline.compile
Expand Down
75 changes: 67 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ Every pipeline element has two parallel hashes:
identity. For a source it is a stable *address*, not a digest of its rows (developer,
November 11, 2026: "sources content hash is meant to be a stable address and is not
necessarily going to reflect the very data content"). A root source hashes
`(class name, output schema, source_id, key columns)`; given a `source_id`, changed, added or
`(class name, Arrow schema identity, source_id, key columns)`; given a `source_id`, changed, added or
reordered rows leave it unchanged. The key columns are the resolved `record_id_columns` in key
order (`()` for the position; a database or SpiralDB table's primary key by default): two
sources that differ only in how they name their rows are two sources, with one pipeline
Expand All @@ -936,9 +936,10 @@ Every pipeline element has two parallel hashes:
memoized by. The node's content hash tells apart, inside a shared table, the rows of
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 schemas share database tables.
scoping so that different sources with identical Arrow schemas share database tables.

Base case: `RootSource.pipeline_identity_structure()` returns `(tag_schema, data_schema)`.
Base case: `RootSource.pipeline_identity_structure()` returns the Arrow schema identity of
its tag and data schemas (below, "Schemas are hashed as Arrow schemas").
Each downstream node's pipeline hash commits to its own identity plus the pipeline hashes of
its upstreams, forming a Merkle chain.

Expand Down Expand Up @@ -1110,6 +1111,51 @@ and `as_table()` methods. `all_info=True` sets everything to True.
- **Source delegation** — CSVSource, DictSource, etc. all create an internal
`ArrowTableSource` and delegate every method to it.

### Schemas are hashed as Arrow schemas

Developer, November 18, 2026 (ITL-640; option B): a schema enters every identity as its Arrow
schema, large-normalized, hashed by the one function `StarfixArrowHasher.hash_schema`
(label `arrow_schema_v1`, `ARROW_SCHEMA_HASH_LABEL`), never as Python types. The places: a
source's pipeline and content identity and an input slot's
(`schema_utils.arrow_schema_identity`: the tag and data schemas hashed apart, as nested
`ContentHash` objects), the system-tag column names (`compute_schema_hash`, the semantic hash
of that pair, bare hex) and the output schema in a function's `uri` (the converter's Arrow
schema of the declared outputs, fed as a one-schema tuple, bare hex). `output_schema()` still
reports Python types; a function's INPUT check stays at the Python level; a function's input
types are in no schema hash.

- Which Arrow schema: a source's or node's typed zero-row table (never computed from rows),
cached per source (`RootSource.arrow_schemas`); a `DerivedSource` takes its origin's and
refuses a stored read of another type (top-level nullability aside); a `CachedSource` its
source's, and refuses a cache read of another type by the same rule
(`schema_utils.stored_type_mismatch`); a slot made from a stream, that stream's (`SourceNodeBase.arrow_schemas`); a
saved job writes each slot's own Arrow types and a load rebuilds them; an unbound slot with
known Arrow types types its zero-row table from them; a loaded function node types its
zero-row output from its saved Arrow text.
- Declared Python types mean one Arrow type each, the converter's (`int` is `int64`,
`datetime` is `timestamp[us, tz=UTC]`): a hand-declared slot, an unbound `SourceProxy`, a
`PollingSource` whose `impl.schema()` returns a Python `Schema`. A source, slot or batch of
another Arrow type is refused (bind: `SourceSpecMismatchError`; a polled batch:
`SchemaInconsistencyError` before commit), never converted. The remedy is declaring in
Arrow: `SourceNode(name, tag_schema=pa.schema(...), data_schema=pa.schema(...))`,
`impl.schema()` returning a `pa.Schema`. Never loosen this.
- `hash_schema` ignores column order, large/non-large, list item field names, dictionary
encoding and field metadata other than `ARROW:extension:*`; it tells apart width, sign,
nullability at every depth, timestamp unit and zone, decimal precision, date types,
fixed-size against plain lists, struct fields, and a logical type's whole identifier.
- `hash_schema` hashes the DECLARED schema (developer, November 21, 2026, ITL-640, option
(a)): every logical type, live, in metadata (IPC) form or unregistered in the process, is
first brought to its storage form, its storage type with its identifier as
`ARROW:extension:*` field metadata, at any depth (`canonical_form.storage_form_schema`,
applied by `hash_schema` itself). No value-handler rewrite, no registry lookup: the
identifier pins how the values are hashed. `hash_table` is unchanged and a separate
procedure; never rely on `hash_schema(t.schema)` being the schema inside `hash_table(t)`.
The saved-schema writer writes the storage form; an Arrow declaration and a saved schema
read back take `declaration_form_schema`: a top-level logical type live, a nested one
(inside a plain list, struct or map) always in the storage form, never a nested live
extension type (Arrow cannot build an empty table of one). The tests enumerate every
registered logical type from the converter (`test_schema_hash_storage_form.py`).

### Arrow types

Governing principle (developer, November 9, 2026): minimize convenient inference and hold to
Expand All @@ -1130,8 +1176,17 @@ per-operator normalization. Names, nullability (top level and nested), field met
logical (extension) types are untouched, and large and non-large variants hash identically, so no
hash or default source id moves. Not covered: what is inside a library value (numpy, pandas,
polars, torch) keeps its library's own distinction. `list_view` and `large_list_view` are not
supported: a source refuses them (the Arrow hasher cannot hash them) and a raw `ArrowTableStream`
holds them as given (ITL-1129).
supported (ITL-1129), and neither is a union (dense or sparse) or a run-end-encoded type: a
source and a raw `ArrowTableStream` refuse a column whose type is or contains one when they
are built (developer, November 21, 2026, ITL-640, for unions and list views; run-end-encoded
by the same rule, the coordinator the same day: one rule for every type the schema hash
rejects. A stream's identity is its Arrow schema hash, which cannot hold them; a raw stream
used to hold them as given). One rule beside the dictionary refusal,
`schema_utils.schema_hash_rejected_columns` with `schema_hash_rejected_columns_error`
(`InputValidationError` naming each column with its role and type), applied by
`ArrowTableStream.__init__` and first by `SourceStreamBuilder.build`; the rejected kinds are
one constant, `SCHEMA_HASH_REJECTED_KINDS`, checked by a test against starfix's public schema
hash.

Dictionary-encoded columns are refused, tags and data alike (developer, November 18, 2026,
ITL-1264: "Say it is not currently supported in orcapod. We MAY support but not immediately in
Expand Down Expand Up @@ -1285,14 +1340,18 @@ data. The rules:
columns without a reason. `SourceNodeBase.validate` is the one check, used by
`PipelineJob.bind`, the `bound_source` setter (and `SourceJobNode.__init__`) and
`PipelineJob.load`: per column the declared Python type (structural classes of one identity
are one type, `equivalent_hints`), or `T` where the slot declares `T | None`; and exactly
are one type, `equivalent_hints`), or `T` where the slot declares `T | None`, AND the slot's
Arrow type, compared by `hash_schema`, with only a top-level non-null column accepted where
the slot's is nullable (nested nullability exact; ITL-640); and exactly
one source-id (`str`) and one record-id (`str`) system-tag column, no other. Anything
else raises `SourceSpecMismatchError` before anything is bound. The
source's rows are given as the declared schema at one place, `_DeclaredForm` (nullable
fields over the same arrays; the system-tag column NAMES of the declared schema hash,
taken from the source's own pair by prefix, the VALUES the source's own; as a stable
convenience, not a guarantee, the declared column order, source id before record id). Limits: the check compares Python types, so a difference in Arrow width only
(`int32` against `int64`) is not yet refused (ITL-949). A source whose system-tag columns
convenience, not a guarantee, the declared column order, source id before record id). A
difference in Arrow width only (`int32` against `int64`) is refused (ITL-949, resolved by
ITL-640); never loosen this for timestamps or widths: a declared Python type means one
Arrow type, and the remedy is declaring the slot from the source or in Arrow. A source whose system-tag columns
are not exactly one source-id and one record-id column (a joined or merged stream, a raw
stream with none) is refused by the same check (developer, November 14, 2026, ITL-1126);
binding one properly is ITL-1127. That includes a pipeline's input: `Pipeline.compile`
Expand Down
8 changes: 3 additions & 5 deletions changelog.d/ITL-1023.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
the tags stay data-tags (`FallThroughPod`). The function, its result identity
and its result store are the plain pod's. `pod.process(stream)` is unchanged: its
output data is the function's outputs and every output tag is plain.
- Saved job and pipeline files are at format `0.3.0`; files at `0.1.0` and `0.2.0` load
with every declared source tag plain, as they were written.
- Saved job and pipeline files state every tag binding (see below).

- `Batch` works on data-tags (ITL-1017; developer decision, November 16, 2026:
"Batch always simply takes anything and puts into list"). As for plain tags, every tag
Expand Down Expand Up @@ -155,9 +154,8 @@

- Saved files of format `0.3.0` state every binding: each source config that takes the
option writes `tag_only_columns` (`True` when every tag is plain), and each function
node writes `fall_through_tags` (empty for a plain pod). The format version decides
what a file means, never a missing key: a file at `0.1.0` or `0.2.0` holds only plain
tags, and a `0.3.0` file without these keys, or whose keys disagree with its saved
node writes `fall_through_tags` (empty for a plain pod). A missing key is never read
as a default: a file without these keys, or whose keys disagree with its saved
schemas, is refused on load.

- Errors that a data-tag causes name it and the way out; no behaviour changes.
Expand Down
Loading
Loading