From 0a718cc35a4965d69832062d2eec974f0e2dc417 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 16:26:48 -0800 Subject: [PATCH 01/12] docs(sources): use synthetic SpiralDB names in examples and tests --- CHANGELOG.md | 24 ++-- RELEASING.md | 16 +++ docs/concepts/notebooks.md | 2 +- docs/concepts/sources.md | 110 ++++++++++-------- docs/concepts/streams.md | 2 +- .../core/sources/spiraldb_table_source.py | 16 +-- src/orcapod/databases/spiraldb_connector.py | 2 +- .../test_group_by_data_tag_non_key.py | 2 +- ..._end.py => test_time_series_end_to_end.py} | 10 +- .../test_derived_source_tags_as_data.py | 26 ++--- .../sources/test_spiraldb_table_source.py | 2 +- .../test_spiraldb_table_source_fake.py | 29 +++-- .../test_spiraldb_table_source_live.py | 104 ++++++++--------- .../test_spiraldb_table_source_streaming.py | 2 +- ...test_spiraldb_table_source_tags_as_data.py | 4 +- .../streams/test_head_and_preview.py | 4 +- 16 files changed, 184 insertions(+), 171 deletions(-) rename tests/test_core/data_tags/{test_edi_end_to_end.py => test_time_series_end_to_end.py} (95%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a52e373ca..a98e73dad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -389,7 +389,7 @@ the dataframe methods. See "Reading a Spiral table" in `docs/concepts/sources.md What changes for existing code: - **Default `source_id`.** It is now `/.@`, for - example `edi-tutorial-v1-841226/default.session@table_Jo7J0lpkLcOM` (it was + example `my-project-123456/my_dataset.session@table_example12345` (it was `//
`). SpiralDB's own table id makes it unique: a table dropped and created again under the same name is a different source. For a Spiral source built without `source_id`, the `content_hash`, every record ID and every source-info token @@ -681,28 +681,22 @@ format 2, prefix `00 00 02`) is lossless; this is a fix, so the old values are n #### A Spiral source's default `source_id` is `//
` (ITL-926) `SpiralDBTableSource` used the bare table name as its default `source_id`. Tables with the -same name in different projects (the EDI sample projects all share their table names) then -had the same `content_hash`, record IDs and source-info tokens. In one store, a job on one +same name in different projects then had the same `content_hash`, record IDs and source-info +tokens. In one store, a job on one project read back the other project's pipeline records along with its own (cached results were never mixed up: they are keyed on the row's data). The default is now the project id, -the dataset and the table name, for example `edi-sample-v1-855632/default/session`. +the dataset and the table name, for example `my-project-123456/my_dataset/session`. For a Spiral source built without `source_id`, the `content_hash`, every record ID and every source-info token change, so pipeline records stored by 0.2 for such a source are not found again. The rows are recorded once more and no result is recomputed, because function results -are keyed on the data. For example, table `subject` (key `subject_id`, one row) in project -`edi-sample-v1-855632`: - -- `source_id`: `subject` becomes `edi-sample-v1-855632/default/subject`. -- `content_hash`: `semantic_v0.1:0380725acb90...e7f4f6` becomes - `semantic_v0.1:3a659ed610bb...29a93`. -- Row 0's record ID: `18d1efa53fbc52b6a40f406eca35ca81` becomes - `096c4e22981c52daa2b088bffe729ee7`. +are keyed on the data. In the example above, the default `source_id` changes from +`session` to `my-project-123456/my_dataset/session`. `pipeline_hash` does not change (it depends only on the schema), nor does anything for a source given an explicit `source_id`. To keep 0.2 identities, pass the old value: -`SpiralDBTableSource(project, "subject", source_id="subject")`. Jobs saved by 0.2 store -their `source_id` explicitly and keep it when loaded. +`SpiralDBTableSource(project, "session", dataset="my_dataset", source_id="session")`. +Jobs saved by 0.2 store their `source_id` explicitly and keep it when loaded. #### The Delta store keeps every column's Arrow type; rebuild a Delta store written by an earlier v0.3 build (ITL-928) @@ -1390,7 +1384,7 @@ hash changes: only declarations that used to be accepted are refused. properties, and `orcapod.errors.SourceTooLargeError` (ITL-186). - A `SpiralDBTableSource` shown in a notebook (its `head()`) reads only its first 10 rows, in one scan to which `max_rows` does not apply, and its header says how many rows the - table has, for example `first 10 rows of about 63,349` (ITL-186). + table has, for example `first 10 rows of about 25,000` (ITL-186). - `SpiralDBConnector.scan_batches(table, where=, limit=, asof=)`, `get_arrow_schema`, `get_spiral_table_id`, `get_table_version` and `get_row_count_estimate`: a restricted scan and metadata-only reads (ITL-186). diff --git a/RELEASING.md b/RELEASING.md index 72aa1fd26..1a26f506a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -334,6 +334,22 @@ If the key may have been exposed (for example printed in a log), remove it from first (`spiral workloads keys rm`), so it stops signing in at once, then add a new key and replace the secret as above. The job fails in between; that is the price of containment. +### Live SpiralDB source tests + +The read-only `SpiralDBTableSource` tests are opt-in. Sign in with spiral-sdk and set +`ORCAPOD_SPIRALDB_TEST_PROJECT`, `ORCAPOD_SPIRALDB_TEST_DATASET` and +`ORCAPOD_SPIRALDB_TEST_TABLE` to select a keyed table you can read. The table needs +`unit_id` and `timestamp` key columns and a floating-point `spike_amplitude_uv` data +column. For full coverage, use more than 1,000 rows across multiple units, with at +least eight timestamps for the first unit. + +```sh +uv run --extra spiraldb pytest tests/test_core/sources/test_spiraldb_table_source_live.py +``` + +These tests skip when any of the three settings is missing. The `spiral-integration` +job runs the connector conformance tests on a separate test project. + ### Moving the spiral-sdk pin `pyproject.toml` pins one version of `spiral-sdk` (the `spiraldb` extra): a pre-alpha that diff --git a/docs/concepts/notebooks.md b/docs/concepts/notebooks.md index 71485d4ce..f8360282c 100644 --- a/docs/concepts/notebooks.md +++ b/docs/concepts/notebooks.md @@ -69,7 +69,7 @@ What it shows ([Looking at data](streams.md#looking-at-data) states each rule in - **The header line** names the object (its kind and its name) and says which rows are shown: here `first 10 of 64 rows, sorted by tags`. A source that reads only part of its table says so, as a [SpiralDB source](sources.md) does ("10 rows read, sorted by tags, of about - 63,349"). + 25,000"). - **Tag columns** come first and are marked, and so are data columns: in a notebook a tag's header is bold (in an accent colour), a data column's is underlined, a vertical rule separates the tags from the data columns, and a line under the header names the marks, diff --git a/docs/concepts/sources.md b/docs/concepts/sources.md index 60b3771c2..c67bb59f0 100644 --- a/docs/concepts/sources.md +++ b/docs/concepts/sources.md @@ -543,13 +543,14 @@ Orcapod only reads SpiralDB for now. Writing a SpiralDB table (`SpiralDBConnecto whose database is on one) raises `SpiralDBWriteNotSupportedError`; store a job's results in another database, such as `DeltaTableDatabase`. -To find the tables of a project and their key columns: +Replace the example project, dataset and table names with identifiers you can access. +To find the tables of a dataset and their key columns: ```python from orcapod.databases import SpiralDBConnector -with SpiralDBConnector("edi-sample-v1-855632") as spiral: +with SpiralDBConnector("my-project-123456", dataset="my_dataset") as spiral: print(spiral.get_table_names()) print(spiral.get_pk_columns("session")) ``` @@ -560,8 +561,8 @@ The table's key columns become the tag columns, and every other column is a data ```python from orcapod.sources import SpiralDBTableSource -sessions = SpiralDBTableSource("edi-sample-v1-855632", "session") -experiments = SpiralDBTableSource("edi-sample-v1-855632", "experiment") +sessions = SpiralDBTableSource("my-project-123456", "session", dataset="my_dataset") +events = SpiralDBTableSource("my-project-123456", "session_event", dataset="my_dataset") print(sessions.output_schema()) sessions.as_df() # also as_polars_df(), as_pandas_df(), as_lazy_frame(), as_table() ``` @@ -581,7 +582,7 @@ Things to know about Spiral tables: - **Source identity.** A Spiral source is identified by where its table is, never by its rows. The default `source_id` is `spiraldb_table_v1:..
@`, for example - `spiraldb_table_v1:edi-tutorial-v1-841226.default.session@table_Jo7J0lpkLcOM`. The table id is + `spiraldb_table_v1:my-project-123456.my_dataset.session@table_example12345`. The table id is SpiralDB's own, so tables with the same name in different projects stay apart, and a table that is dropped and created again under the same name is a different source: nothing recorded for the old table is reused. A renamed table also gets a new `source_id`. @@ -609,9 +610,11 @@ Orcapod applies to the rows it receives, and then the limit): ```python -first = SpiralDBTableSource("edi-tutorial-v1-841226", "spike_event", limit=1000) -unit = SpiralDBTableSource( - "edi-tutorial-v1-841226", "spike_event", where={"unit_id": 106} +first = SpiralDBTableSource( + "my-project-123456", "sensor_reading", dataset="my_dataset", limit=1000 +) +sensor = SpiralDBTableSource( + "my-project-123456", "sensor_reading", dataset="my_dataset", where={"sensor_id": 106} ) print(first.row_count_estimate) # rows in the whole table; reads every key to count them ``` @@ -642,12 +645,12 @@ rows, in one scan to which the row cap does not apply, so a table of any size ca at; `head(n)` reads `n`. The preview shows the rows it read in tag order (it asks for `sort_by_tags`, as does `head(columns={"sort_by_tags": True})` or `all_info=True`): the rows read, sorted, not the first `n` of the table in tag order. The header line says what is -shown, for example `SpiralDBTableSource[spike_event] — 10 rows read, sorted by tags, of -about 63,349` (the table's row count, from its keys; above 100,000 rows, or `max_rows` when +shown, for example `SpiralDBTableSource[sensor_reading] — 10 rows read, sorted by tags, of +about 25,000` (the table's row count, from its keys; above 100,000 rows, or `max_rows` when that is smaller, it says `of more than 100,000`), `all 4 rows, sorted by tags` when the source reads no more than that, or `10 matching rows read, sorted by tags -(where unit_id=106); the table has about 63,349 rows` with `where=`. The unsorted `head()` -says `first 10 rows of about 63,349`. Tag columns come first, and the line above the table +(where sensor_id=106); the table has about 25,000 rows` with `where=`. The unsorted `head()` +says `first 10 rows of about 25,000`. Tag columns come first, and the line above the table names them. To see more rows, use `as_df()` with a `limit=` or `where=` source. **Restrictions are not part of identity.** `where`, `limit` and `asof` choose rows of the @@ -722,7 +725,7 @@ A restriction is not an operator: still keeps its record ID. It adds no node, so a job bound to a restricted source is the same job, run over fewer rows. -Use a restriction to work on part of a table (one subject, one session) with the pipeline you +Use a restriction to work on part of a table (one sensor, one site) with the pipeline you will later run on all of it: results computed under the restriction are stored under the same identities and reused by the full run. Use an operator when selecting rows is part of what the pipeline computes. Restrict on tag (key) columns where you can; a condition on a data @@ -743,14 +746,18 @@ selection lives: ```python from orcapod import col +readings = SpiralDBTableSource( + "my-project-123456", "sensor_reading", dataset="my_dataset", source_id="readings" +) + # Exploring: the source reads only these rows; no step is added and no hash moves. -explore = events.where(unit_id=106, session_index=2) +explore = readings.where(sensor_id=106, site_id=2) # The pipeline: the same selection as a step, part of every downstream identity. -kept = events.filter(unit_id=106, session_index=2) +kept = readings.filter(sensor_id=106, site_id=2) # Use a filter for conditions such as is_in that where cannot apply. -late = events.filter(col("spike_time_us") >= 1_000_000, col("unit_id").is_in([106, 107])) +late = readings.filter(col("timestamp") >= 1_000_000, col("sensor_id").is_in([106, 107])) ``` A filter directly over a source reads every row the source reads (the whole table, or what @@ -760,7 +767,7 @@ pushed into the source. `where` reads only the matching rows. On a large table, above apply to the source. This holds for equalities on integer, string, bytes, bool, date and timestamp columns, on a source without a `limit`. With a `limit` it does not: the source reads the first rows that match the `where`, so the `filter` sees other rows than it would -over the source alone (with `limit=2` and unit ids `[1, 2, 2]`, `filter(unit_id=2)` alone +over the source alone (with `limit=2` and sensor ids `[1, 2, 2]`, `filter(sensor_id=2)` alone keeps one row, the `where` and the `filter` together keep two). On a float column it does not either when the value is `0.0`: `where` matches by the table system's equality (`0.0` does not match `-0.0`), `filter` by Orcapod's (it does), so `where` can drop rows the `filter` @@ -768,31 +775,33 @@ alone would keep. For such a value, use `filter` on its own. ```python -events = SpiralDBTableSource("my-project-123456", "spike_event", source_id="spikes") -one_unit = events.where(unit_id=106) # or events.where({"unit_id": 106}) -one_session = one_unit.where(session_index=2) # conditions add up -same_session = events.where(unit_id=106, session_index=2) # both in one call -print(one_session.condition) -# unit_id=106, session_index=2 -print(one_session.row_limit) +readings = SpiralDBTableSource( + "my-project-123456", "sensor_reading", dataset="my_dataset", source_id="readings" +) +one_sensor = readings.where(sensor_id=106) # or readings.where({"sensor_id": 106}) +one_site = one_sensor.where(site_id=2) # conditions add up +same_site = readings.where(sensor_id=106, site_id=2) # both in one call +print(one_site.condition) +# sensor_id=106, site_id=2 +print(one_site.row_limit) # None -assert same_session.to_config() == one_session.to_config() -assert one_unit.content_hash() == events.content_hash() -job.bind(sources={"spikes": one_unit}) # the slot the unrestricted source fills +assert same_site.to_config() == one_site.to_config() +assert one_sensor.content_hash() == readings.content_hash() +job.bind(sources={"readings": one_sensor}) # the slot the unrestricted source fills summary = job.run() print(summary.conditions) -# {'spikes': Condition.of({'unit_id': 106})} +# {'readings': Condition.of({'sensor_id': 106})} print(summary.restricted_source_ids) -# {'spikes': 'spikes'} +# {'readings': 'readings'} ``` (This sample needs a SpiralDB project, so it is not run with the documentation; `job` is a -job built over `events`, whose slot is named by the source id.) +job built over `readings`, whose slot is named by the source id.) To restrict on two columns, pass separate equality keywords such as -`events.where(unit_id=106, session_index=2)`. Combining comparisons as -`(col("unit_id") == 106) and (col("session_index") == 2)` raises `TypeError`. +`readings.where(sensor_id=106, site_id=2)`. Combining comparisons as +`(col("sensor_id") == 106) and (col("site_id") == 2)` raises `TypeError`. When building a `Condition` to pass to `where()`, combine parenthesized equalities with `&`. ```python @@ -800,13 +809,13 @@ from orcapod import col from orcapod.types import Condition try: - Condition.of((col("unit_id") == 106) and (col("session_index") == 2)) + Condition.of((col("sensor_id") == 106) and (col("site_id") == 2)) except TypeError as error: print(str(error).split(".")[0]) # Condition has no truth value -both = (col("unit_id") == 106) & (col("session_index") == 2) -assert both == Condition.of(unit_id=106, session_index=2) +both = (col("sensor_id") == 106) & (col("site_id") == 2) +assert both == Condition.of(sensor_id=106, site_id=2) ``` A date or a time written as text is converted explicitly, with the function of its column's @@ -932,30 +941,29 @@ type, never null: ```python -spikes = SpiralDBTableSource( - "edi-tutorial-v1-841226", "spike_event", tags_as_data={"timestamp": "spike_time_us"} +readings = SpiralDBTableSource( + "my-project-123456", + "sensor_reading", + dataset="my_dataset", + tag_only_columns=True, + tags_as_data={"timestamp": "reading_time"}, ) -unit_key = [ - "spike_extraction_hash", "subject_id", "session_start_datetime", - "recording_index", "probe_index", "unit_id", -] -per_unit = spikes.group_by(unit_key) -print(per_unit.keys()) -# (('spike_extraction_hash', 'subject_id', 'session_start_datetime', 'recording_index', 'probe_index', 'unit_id'), ('spike_amplitude_uv', 'spike_time_us')) +per_sensor = readings.group_by(["sensor_id", "site_id"]) +print(per_sensor.keys()) +# (('sensor_id', 'site_id'), ('temperature', 'reading_time')) ``` -`per_unit` has one row per unit, and its `spike_time_us` list is in time order: `group_by` -orders the members of a group by the tags outside the group key, and on the full unit key -the only such tag is `timestamp`. The `timestamp` tag itself is dropped, as `group_by` drops -every tag outside the key; its copy `spike_time_us` is data and stays. `group_by(["unit_id"])` alone sorts by -`spike_extraction_hash`, subject, session, recording, probe, then `timestamp`, so time order -holds only within one session and probe; group on the full unit key. +The example table is keyed by `sensor_id`, `site_id` and `timestamp` and stores `temperature`. +`per_sensor` has one row per sensor and site. `group_by` orders the members by `timestamp`, +the only tag outside the group key. It drops the `timestamp` tag and keeps its copy as the +time-ordered `reading_time` list. Grouping by `sensor_id` alone would order the members by +`site_id` and then `timestamp`, so time order would hold only within a site. The copies are data columns, so they are part of the schema, the `content_hash` and the `pipeline_hash`; the mapping itself is part of the `content_hash` too, because two mappings can give the same schema while the copy holds different values. The `source_id` and every row's record id are the same as without the option. Compared with -`DerivedSource(spikes, tags_as_data=...)`, which reads the whole table as soon as its schema +`DerivedSource(readings, tags_as_data=...)`, which reads the whole table as soon as its schema or rows are asked for (building a job asks for the schema), the option keeps a Spiral source, whose schema is known without a scan. diff --git a/docs/concepts/streams.md b/docs/concepts/streams.md index b6c5b891c..004c7390a 100644 --- a/docs/concepts/streams.md +++ b/docs/concepts/streams.md @@ -282,7 +282,7 @@ whatever order the rows were computed in. A stream that has only some of its row those: a source that reads a bounded number of rows (such as a `SpiralDBTableSource`) shows the rows it read, in tag order, and a stream computed only in part shows the rows computed so far in tag order. It is not "the first `n` rows in tag order" of rows it never read, and the -preview's header line says so ("10 rows read, sorted by tags, of about 63,349"). A stream +preview's header line says so ("10 rows read, sorted by tags, of about 25,000"). A stream with no tag columns previews its rows in stream order. A head of an operator is never the operator applied to the heads of its inputs: a group over diff --git a/src/orcapod/core/sources/spiraldb_table_source.py b/src/orcapod/core/sources/spiraldb_table_source.py index eff376f2d..5ac322105 100644 --- a/src/orcapod/core/sources/spiraldb_table_source.py +++ b/src/orcapod/core/sources/spiraldb_table_source.py @@ -15,29 +15,29 @@ Example:: # Default dataset, PK columns become tag columns automatically - source = SpiralDBTableSource("my-project-123456", "spike_event", limit=1000) + source = SpiralDBTableSource("my-project-123456", "sensor_reading", limit=1000) - # Only the rows of one unit + # Only the rows of one sensor source = SpiralDBTableSource( - "my-project-123456", "spike_event", where={"unit_id": 106} + "my-project-123456", "sensor_reading", where={"sensor_id": 106} ) # The same restriction added to a built source: a new source, same identity - source = SpiralDBTableSource("my-project-123456", "spike_event").where(unit_id=106) + source = SpiralDBTableSource("my-project-123456", "sensor_reading").where(sensor_id=106) # Only a window of a column, half-open: col("timestamp") >= start and < stop - source = SpiralDBTableSource("my-project-123456", "spike_event").where( + source = SpiralDBTableSource("my-project-123456", "sensor_reading").where( col("timestamp") >= start, col("timestamp") < stop ) - # The spike time is a key column (a tag); also offer it as data + # The reading time is a key column (a tag); also offer it as data source = SpiralDBTableSource( - "my-project-123456", "spike_event", tags_as_data={"timestamp": "spike_time_us"} + "my-project-123456", "sensor_reading", tags_as_data={"timestamp": "reading_time"} ) # Explicit dataset, tag columns overridden source = SpiralDBTableSource( - "my-project-123456", "spike_event", dataset="prod", tag_columns=["unit_id"] + "my-project-123456", "sensor_reading", dataset="my_dataset", tag_columns=["sensor_id"] ) """ diff --git a/src/orcapod/databases/spiraldb_connector.py b/src/orcapod/databases/spiraldb_connector.py index f3e3726a4..d39d0240f 100644 --- a/src/orcapod/databases/spiraldb_connector.py +++ b/src/orcapod/databases/spiraldb_connector.py @@ -1002,7 +1002,7 @@ def get_arrow_schema(self, table_name: str) -> pa.Schema: return self.lookup_table(table_name).arrow_schema() def get_spiral_table_id(self, table_name: str) -> str: - """Return SpiralDB's own id of the table (for example ``table_W7C01nkLTmEJ``). + """Return SpiralDB's own id of the table (for example ``table_example12345``). The id stays the same when the table is renamed. A table dropped and created again under the same name gets a new one. diff --git a/tests/test_core/data_tags/test_group_by_data_tag_non_key.py b/tests/test_core/data_tags/test_group_by_data_tag_non_key.py index 0b434bcfa..6a288363b 100644 --- a/tests/test_core/data_tags/test_group_by_data_tag_non_key.py +++ b/tests/test_core/data_tags/test_group_by_data_tag_non_key.py @@ -194,7 +194,7 @@ def test_sync_table_keeps_the_pinned_key_token() -> None: assert table.column("_source_v").to_pylist() == [V_TOKENS["m1"], V_TOKENS["m2"]] -# An EDI-shaped series: the rows of trial 1 are not in time order, so the record-id +# A synthetic time series: the rows of trial 1 are not in time order, so the record-id # order and the time order differ. SERIES = [ {"trial": 1, "timestamp": 30, "value": "c"}, diff --git a/tests/test_core/data_tags/test_edi_end_to_end.py b/tests/test_core/data_tags/test_time_series_end_to_end.py similarity index 95% rename from tests/test_core/data_tags/test_edi_end_to_end.py rename to tests/test_core/data_tags/test_time_series_end_to_end.py index d72b96537..8ba2f1ee4 100644 --- a/tests/test_core/data_tags/test_edi_end_to_end.py +++ b/tests/test_core/data_tags/test_time_series_end_to_end.py @@ -1,8 +1,8 @@ -"""An EDI-shaped pipeline on data-tags, end to end (ITL-1023). +"""A time-series pipeline on data-tags, end to end (ITL-1023). Specification "Orcapod v0.4 — Referential Tags" (ITL-1004), section 15.7: two time series -(spikes, gaze) share five key columns and each has a key column ``timestamp`` (as the real -EDI tables do); a third table is keyed on a subset of the keys. Each ``timestamp`` is +(spikes, gaze) share five key columns and each has a key column ``timestamp``. +A third table is keyed on a subset of the keys. Each ``timestamp`` is renamed in both roles with ``map_tags`` (developer, November 12, 2026) so the join does not equate them, both time series are grouped by the shared keys, the three are joined, and a function reads the timestamp lists and a key column by name. A source's declared tags are @@ -103,7 +103,7 @@ def _streams() -> tuple[Any, Any, Any]: def _build(job: PipelineJob) -> None: - """Record the EDI-shaped pipeline in ``job``.""" + """Record the time-series pipeline in ``job``.""" with job: # Automatic join and automatic select of the pod call (ITL-807). align.pod(*_streams(), label="align") @@ -142,7 +142,7 @@ def _delta(tmp_path: Path) -> ArrowDatabaseProtocol: [SyncPipelineOrchestrator, AsyncPipelineOrchestrator], ids=["sync", "async"], ) -def test_edi_shaped_pipeline_runs_and_second_run_computes_nothing( +def test_time_series_pipeline_runs_and_second_run_computes_nothing( tmp_path: Path, make_store: Callable[[Path], ArrowDatabaseProtocol], orchestrator: type[SyncPipelineOrchestrator | AsyncPipelineOrchestrator], diff --git a/tests/test_core/sources/test_derived_source_tags_as_data.py b/tests/test_core/sources/test_derived_source_tags_as_data.py index f144d72e8..dbc2bcf7a 100644 --- a/tests/test_core/sources/test_derived_source_tags_as_data.py +++ b/tests/test_core/sources/test_derived_source_tags_as_data.py @@ -4,7 +4,7 @@ job node. Its tags are the origin's tags; its data columns are the origin's data columns plus a copy of each mapped tag column under the given name. It has source provenance of its own. -Fixtures are shaped like the EDI ``session`` and ``experiment`` tables, where +The synthetic ``session`` and ``experiment`` tables model a case where ``session_start_datetime`` is a key that a pod also needs as an input for time arithmetic. """ @@ -54,7 +54,7 @@ def _micros(t: dt.datetime) -> int: def _experiment_table(*, nullable_keys: bool = False) -> pa.Table: - """Return the EDI-shaped ``experiment`` table (two experiments per session).""" + """Return the synthetic ``experiment`` table (two experiments per session).""" schema = pa.schema( [ pa.field("subject_id", pa.large_string(), nullable=nullable_keys), @@ -79,7 +79,7 @@ def _experiment_table(*, nullable_keys: bool = False) -> pa.Table: def _session_table() -> pa.Table: - """Return the EDI-shaped ``session`` table (subject ``m1`` has two sessions).""" + """Return the synthetic ``session`` table (subject ``m1`` has two sessions).""" schema = pa.schema( [ pa.field("subject_id", pa.large_string(), nullable=False), @@ -688,7 +688,7 @@ def _probe_job(db_path: str, name: str = "probes") -> PipelineJob: class TestPipelineJob: @pytest.mark.parametrize("orchestrator", [None, AsyncPipelineOrchestrator()]) def test_sync_and_async_runs_give_the_same_rows(self, tmp_path, orchestrator): - job = _probe_job(_make_probe_db(tmp_path / "edi.db")) + job = _probe_job(_make_probe_db(tmp_path / "fixture.db")) job.run(orchestrator=orchestrator) node = job.nodes["len"] assert node.keys() == (("probe_id", "name"), ("n",)) @@ -696,7 +696,7 @@ def test_sync_and_async_runs_give_the_same_rows(self, tmp_path, orchestrator): assert rows == {"alpha": 5, "beta": 4, "gamma": 5} def test_origin_and_derived_source_in_one_job(self, tmp_path): - db_path = _make_probe_db(tmp_path / "edi.db") + db_path = _make_probe_db(tmp_path / "fixture.db") job = PipelineJob(name="both", database=InMemoryArrowDatabase()) with job: probe = SQLiteTableSource(db_path, "probe", tag_only_columns=True) @@ -713,7 +713,7 @@ def test_origin_and_derived_source_in_one_job(self, tmp_path): assert job.nodes["back"].as_table().num_rows == 3 def test_saved_job_reloads_the_derived_source(self, tmp_path): - job = _probe_job(_make_probe_db(tmp_path / "edi.db")) + job = _probe_job(_make_probe_db(tmp_path / "fixture.db")) job.run() (source_name,) = job.sources original = job.sources[source_name] @@ -734,7 +734,7 @@ def test_saved_job_reloads_the_derived_source(self, tmp_path): assert loaded.nodes["len"].content_hash() == job.nodes["len"].content_hash() def test_config_round_trip_keeps_an_explicit_source_id(self, tmp_path): - db_path = _make_probe_db(tmp_path / "edi.db") + db_path = _make_probe_db(tmp_path / "fixture.db") derived = DerivedSource( SQLiteTableSource(db_path, "probe", tag_only_columns=True), tags_as_data={"name": "name_copy"}, @@ -1059,7 +1059,7 @@ class TestRequiredSourceIdConfig: "mapping", [PROBE_COPIES, PROBE_COPIES_REVERSED], ids=["given", "reversed"] ) def test_config_round_trip_keeps_the_source_id(self, tmp_path, mapping): - db_path = _make_probe_db(tmp_path / "edi.db") + db_path = _make_probe_db(tmp_path / "fixture.db") derived = DerivedSource( SQLiteTableSource(db_path, "probe", tag_only_columns=True), tags_as_data=mapping, @@ -1073,7 +1073,7 @@ def test_config_round_trip_keeps_the_source_id(self, tmp_path, mapping): assert rebuilt.as_table(all_info=True).equals(derived.as_table(all_info=True)) def test_a_config_without_a_source_id_is_refused(self, tmp_path, monkeypatch): - db_path = _make_probe_db(tmp_path / "edi.db") + db_path = _make_probe_db(tmp_path / "fixture.db") config = DerivedSource( SQLiteTableSource(db_path, "probe", tag_only_columns=True), tags_as_data=PROBE_COPIES, @@ -1119,7 +1119,7 @@ def _two_copies_job(db_path: str) -> PipelineJob: def _saved(tmp_path: Path) -> tuple[Path, dict[str, Any]]: import json - job = _two_copies_job(_make_probe_db(tmp_path / "edi.db")) + job = _two_copies_job(_make_probe_db(tmp_path / "fixture.db")) path = tmp_path / "job.json" job.save(path) return path, json.loads(path.read_text()) @@ -1154,7 +1154,7 @@ def test_refused_at_load(self, tmp_path, how, broken): def test_refused_in_a_derived_origin(self, tmp_path): """A tags_as_data origin of a saved derived source is checked too.""" - db_path = _make_probe_db(tmp_path / "edi.db") + db_path = _make_probe_db(tmp_path / "fixture.db") job = PipelineJob(name="nested", database=InMemoryArrowDatabase()) with job: inner = DerivedSource( @@ -1181,7 +1181,7 @@ def test_refused_inside_a_cached_source(self, tmp_path, shape): """A tags_as_data config under a cached source's inner_source is checked too.""" import json - db_path = _make_probe_db(tmp_path / "edi.db") + db_path = _make_probe_db(tmp_path / "fixture.db") job = PipelineJob(name="cached", database=InMemoryArrowDatabase()) with job: inner = DerivedSource( @@ -1217,6 +1217,6 @@ def test_control_both_ids_present_loads_bound(self, tmp_path): def test_control_an_unavailable_source_still_loads_unbound(self, tmp_path): path, _ = _saved(tmp_path) - (tmp_path / "edi.db").unlink() + (tmp_path / "fixture.db").unlink() loaded = PipelineJob.load(path, database=InMemoryArrowDatabase()) assert sorted(loaded.unbound_sources) == ["copies_a", "copies_b"] diff --git a/tests/test_core/sources/test_spiraldb_table_source.py b/tests/test_core/sources/test_spiraldb_table_source.py index ec50f508f..ed77d1387 100644 --- a/tests/test_core/sources/test_spiraldb_table_source.py +++ b/tests/test_core/sources/test_spiraldb_table_source.py @@ -3,7 +3,7 @@ SpiralDB needs network access and credentials, so these tests run against the disk-backed pyspiral fake (``tests/test_databases/fake_spiral_sdk.py``): the source goes through the real ``SpiralDBConnector``. Reading in batches, restrictions, the row cap and -record identity are in ``test_spiraldb_table_source_streaming.py``; the workshop path is in +record identity are in ``test_spiraldb_table_source_streaming.py``; the end-to-end test is in ``test_spiraldb_table_source_fake.py``. Test sections: diff --git a/tests/test_core/sources/test_spiraldb_table_source_fake.py b/tests/test_core/sources/test_spiraldb_table_source_fake.py index f6e99765f..eefd09bf9 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_fake.py +++ b/tests/test_core/sources/test_spiraldb_table_source_fake.py @@ -1,6 +1,6 @@ """SpiralDBTableSource end to end against the disk-backed pyspiral fake (no live SpiralDB). -Covers the workshop path (ITL-926) through the public interface: EDI-shaped tables (every +Covers the public interface (ITL-926): keyed-table-shaped tables (every column nullable, composite keys with string, timestamp and uint32 columns) -> Join of two Spiral sources -> function pod -> PipelineJob with a Delta store -> re-run -> save and load. See ``tests/test_databases/fake_spiral_sdk.py`` for the storage behaviour modelled. @@ -25,7 +25,7 @@ from orcapod.types import Schema from tests.test_databases import fake_spiral_sdk -_PROJECT = "edi-sample" +_PROJECT = "example-project" _TS = pa.timestamp("us") _SESSION_KEYS = pa.schema( [pa.field("subject_id", pa.string()), pa.field("session_start_datetime", _TS)] @@ -37,13 +37,13 @@ def _all_nullable(table: pa.Table) -> pa.Table: - """Mark every column nullable, as the EDI sample tables are.""" + """Mark every column nullable, as the fake reports unrecorded columns.""" return table.cast(pa.schema([pa.field(f.name, f.type, True) for f in table.schema])) @pytest.fixture() def spiral_root(tmp_path: Path): - """Provide a fake root with EDI-shaped, all-nullable ``session`` and ``experiment``.""" + """Provide a fake root with keyed-table-shaped, all-nullable ``session`` and ``experiment``.""" root = tmp_path / "spiral" with fake_spiral_sdk.install(root): project = fake_spiral_sdk.ExternalProject(_PROJECT) @@ -261,7 +261,7 @@ def two_projects(self, tmp_path: Path): with fake_spiral_sdk.install(tmp_path / "spiral"): rows = pa.table({"subject_id": ["m1"], "sex": ["F"]}, schema=self._SUBJECT) keys = pa.schema([pa.field("subject_id", pa.string(), False)]) - for project in ("edi-sample-a", "edi-sample-b"): + for project in ("example-project-a", "example-project-b"): fake = fake_spiral_sdk.ExternalProject(project) fake.create_table("default.subject", key_schema=keys) fake.table("default.subject").write(rows) @@ -289,15 +289,19 @@ def test_default_source_id_is_project_dataset_table_and_table_id( self, two_projects ): """The default source id is the project, dataset, table and table id.""" - source = SpiralDBTableSource("edi-sample-a", "subject", tag_only_columns=True) - expected = f"spiraldb_table_v1:edi-sample-a.default.subject@{source.table_id}" + source = SpiralDBTableSource( + "example-project-a", "subject", tag_only_columns=True + ) + expected = ( + f"spiraldb_table_v1:example-project-a.default.subject@{source.table_id}" + ) assert source.source_id == expected assert self._identity(source)[2] == f"{expected}::{self._M1}::sex" def test_same_table_in_two_projects_does_not_collide(self, two_projects): """One table in two projects shares the pipeline hash only.""" - a = SpiralDBTableSource("edi-sample-a", "subject", tag_only_columns=True) - b = SpiralDBTableSource("edi-sample-b", "subject", tag_only_columns=True) + a = SpiralDBTableSource("example-project-a", "subject", tag_only_columns=True) + b = SpiralDBTableSource("example-project-b", "subject", tag_only_columns=True) assert a.pipeline_hash() == b.pipeline_hash() # schema only (hash_a, rid_a, token_a), (hash_b, rid_b, token_b) = ( self._identity(a), @@ -318,7 +322,10 @@ def test_unrecorded_table_hashes_are_unchanged(self, two_projects): # nullability record, because key fields are hashed as non-nullable. """An unrecorded table reads all-optional, with its pinned hashes.""" source = SpiralDBTableSource( - "edi-sample-a", "unrecorded", source_id="subject", tag_only_columns=True + "example-project-a", + "unrecorded", + source_id="subject", + tag_only_columns=True, ) assert source.output_schema() == ( Schema({"subject_id": str | None}), @@ -348,7 +355,7 @@ def test_explicit_source_id_keeps_its_hashes(self, two_projects): # hashes are those of the table as written. """A recorded table with a given source id keeps its pinned hashes.""" source = SpiralDBTableSource( - "edi-sample-a", "subject", source_id="subject", tag_only_columns=True + "example-project-a", "subject", source_id="subject", tag_only_columns=True ) # The content hash and the token moved once for ITL-1425 (the source id gained # its kind part, and the class name left the identity). diff --git a/tests/test_core/sources/test_spiraldb_table_source_live.py b/tests/test_core/sources/test_spiraldb_table_source_live.py index bc89fb2da..050e26b3c 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_live.py +++ b/tests/test_core/sources/test_spiraldb_table_source_live.py @@ -1,12 +1,12 @@ """SpiralDBTableSource against a live SpiralDB project (ITL-186). Opt-in. -Skipped unless ``ORCAPOD_SPIRAL_LIVE_PROJECT`` names a project that spiral-sdk's sign-in -can read, with a ``default.spike_event`` table of more than 1,000 rows (the workshop -project is ``edi-tutorial-v1-841226``, 63,349 rows); the tests that need that many skip -when the table holds fewer. Every test is read-only. +Set ``ORCAPOD_SPIRALDB_TEST_PROJECT``, ``ORCAPOD_SPIRALDB_TEST_DATASET`` and +``ORCAPOD_SPIRALDB_TEST_TABLE`` to select a keyed table that spiral-sdk can read. +The table needs ``unit_id`` and ``timestamp`` key columns and a floating-point +``spike_amplitude_uv`` data column. Use a table with more than 1,000 rows across +multiple units for full coverage. Every test is read-only. - ORCAPOD_SPIRAL_LIVE_PROJECT=edi-tutorial-v1-841226 \\ - uv run --extra spiraldb pytest tests/test_core/sources/test_spiraldb_table_source_live.py + uv run --extra spiraldb pytest tests/test_core/sources/test_spiraldb_table_source_live.py """ from __future__ import annotations @@ -26,34 +26,47 @@ from orcapod.pipeline.async_orchestrator import AsyncPipelineOrchestrator from orcapod.sources import SpiralDBTableSource -PROJECT = os.environ.get("ORCAPOD_SPIRAL_LIVE_PROJECT", "") +_SETTINGS = ( + "ORCAPOD_SPIRALDB_TEST_PROJECT", + "ORCAPOD_SPIRALDB_TEST_DATASET", + "ORCAPOD_SPIRALDB_TEST_TABLE", +) +_PROJECT, _DATASET, _TABLE = (os.environ.get(name, "") for name in _SETTINGS) +_MISSING_SETTINGS = [name for name in _SETTINGS if not os.environ.get(name)] pytestmark = pytest.mark.skipif( - not PROJECT, reason="Set ORCAPOD_SPIRAL_LIVE_PROJECT to run the live Spiral tests" + bool(_MISSING_SETTINGS), + reason=f"Set {', '.join(_MISSING_SETTINGS)} to run the live SpiralDB source tests", ) -# The rows ``default.spike_event`` must record for the tests that read or refuse many. _MIN_ROWS = 1_000 +def _live_source(**options: Any) -> SpiralDBTableSource: + """Build a source for the configured keyed table.""" + return SpiralDBTableSource( + _PROJECT, _TABLE, dataset=_DATASET, tag_only_columns=True, **options + ) + + def _require_a_large_table() -> None: - """Skip the calling test unless ``spike_event`` records more than ``_MIN_ROWS`` rows.""" - recorded = SpiralDBTableSource( - PROJECT, "spike_event", tag_only_columns=True - ).row_count_estimate + """Skip the calling test unless the table records more than ``_MIN_ROWS`` rows.""" + recorded = _live_source().row_count_estimate if recorded <= _MIN_ROWS: - pytest.skip(f"spike_event records {recorded} rows; these tests need more") + pytest.skip( + f"The configured table has {recorded} rows; need more than {_MIN_ROWS}" + ) def test_building_a_source_is_quick_and_names_the_table(): """Building a source takes under 10 seconds and names the table and its id.""" start = time.monotonic() - source = SpiralDBTableSource(PROJECT, "spike_event", tag_only_columns=True) + source = _live_source() elapsed = time.monotonic() - start assert elapsed < 10 assert source.source_id == ( - f"spiraldb_table_v1:{PROJECT}.default.spike_event@{source.table_id}" + f"spiraldb_table_v1:{_PROJECT}.{_DATASET}.{_TABLE}@{source.table_id}" ) assert source.table_id.startswith("table_") assert "unit_id" in source.keys()[0] @@ -63,9 +76,7 @@ def test_building_a_source_is_quick_and_names_the_table(): def test_limit_reads_the_first_rows(): """``limit=1000`` reads 1,000 rows with distinct record ids.""" _require_a_large_table() - source = SpiralDBTableSource( - PROJECT, "spike_event", limit=1000, tag_only_columns=True - ) + source = _live_source(limit=1000) table = source.as_table(all_info=True) @@ -80,17 +91,9 @@ def test_limit_reads_the_first_rows(): def test_where_reads_only_matching_rows_with_the_same_record_ids(): """``where`` reads only matching rows, each with its unfiltered record id.""" - first = SpiralDBTableSource( - PROJECT, "spike_event", limit=1, tag_only_columns=True - ).as_table(all_info=True) + first = _live_source(limit=1).as_table(all_info=True) unit_id = first.column("unit_id")[0].as_py() - source = SpiralDBTableSource( - PROJECT, - "spike_event", - where={"unit_id": unit_id}, - max_rows=None, - tag_only_columns=True, - ) + source = _live_source(where={"unit_id": unit_id}, max_rows=None) table = source.as_table(all_info=True) @@ -103,9 +106,7 @@ def test_where_reads_only_matching_rows_with_the_same_record_ids(): def test_a_whole_table_over_the_cap_is_refused_without_reading(): """A table over ``max_rows`` is refused within 10 seconds, without a read.""" _require_a_large_table() - source = SpiralDBTableSource( - PROJECT, "spike_event", max_rows=10, tag_only_columns=True - ) + source = _live_source(max_rows=10) start = time.monotonic() with pytest.raises(SourceTooLargeError, match="limit="): @@ -127,12 +128,7 @@ def run() -> PipelineJob: """Build the job over a 500-row read and run it asynchronously.""" job = PipelineJob(name="live", database=DeltaTableDatabase(tmp_path / "store")) with job: - double.pod( - SpiralDBTableSource( - PROJECT, "spike_event", limit=500, tag_only_columns=True - ), - label="double", - ) + double.pod(_live_source(limit=500), label="double") job.run(orchestrator=AsyncPipelineOrchestrator()) return job @@ -143,31 +139,25 @@ def run() -> PipelineJob: assert calls == [] -def test_tags_as_data_gives_each_unit_its_spike_times_in_time_order(): +def test_tags_as_data_keeps_grouped_timestamps_in_order(): """Grouped on the unit key, each unit's copied spike times are in time order (ITL-996). ``timestamp`` is the only key column outside the unit key, so it alone orders the members of a group. """ _require_a_large_table() - spikes = SpiralDBTableSource( - PROJECT, - "spike_event", - tags_as_data={"timestamp": "spike_time_us"}, - limit=20_000, - tag_only_columns=True, - ) - unit_key = [c for c in spikes.keys()[0] if c != "timestamp"] + source = _live_source(tags_as_data={"timestamp": "event_time"}, limit=20_000) + unit_key = [c for c in source.keys()[0] if c != "timestamp"] # GroupBy keeps only its keys, so ``timestamp`` is dropped already (ITL-1070). - per_unit = spikes.group_by(unit_key) + per_unit = source.group_by(unit_key) - assert "spike_time_us" in per_unit.keys()[1] + assert "event_time" in per_unit.keys()[1] rows = per_unit.as_table().to_pylist() assert len(rows) > 1 - assert sum(len(r["spike_time_us"]) for r in rows) == spikes.as_table().num_rows + assert sum(len(r["event_time"]) for r in rows) == source.as_table().num_rows for row in rows: - assert row["spike_time_us"] == sorted(row["spike_time_us"]) + assert row["event_time"] == sorted(row["event_time"]) def _one_unit() -> tuple[SpiralDBTableSource, list[Any]]: @@ -177,12 +167,10 @@ def _one_unit() -> tuple[SpiralDBTableSource, list[Any]]: PR 574): ``unit_id`` alone can name units of several sessions or probes, whose timestamps the scan reads one group after another, not in one sorted run. """ - first = SpiralDBTableSource(PROJECT, "spike_event", limit=1, tag_only_columns=True) + first = _live_source(limit=1) row = first.as_table().to_pylist()[0] unit_key = {c: row[c] for c in first.keys()[0] if c != "timestamp"} - unit = SpiralDBTableSource( - PROJECT, "spike_event", max_rows=None, tag_only_columns=True - ).where(unit_key) + unit = _live_source(max_rows=None).where(unit_key) times: list[Any] = sorted( t for t in unit.as_table().column("timestamp").to_pylist() if t is not None ) @@ -229,9 +217,9 @@ def test_a_window_with_a_limit_and_head_reads_its_first_rows(): .to_pylist() == first[:3] ) - limited = SpiralDBTableSource( - PROJECT, "spike_event", limit=2, max_rows=None, tag_only_columns=True - ).where(unit.condition, col("timestamp") >= times[2]) + limited = _live_source(limit=2, max_rows=None).where( + unit.condition, col("timestamp") >= times[2] + ) assert limited.as_table()["timestamp"].to_pylist() == first[:2] diff --git a/tests/test_core/sources/test_spiraldb_table_source_streaming.py b/tests/test_core/sources/test_spiraldb_table_source_streaming.py index 2b91d9b74..a10dedc09 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_streaming.py +++ b/tests/test_core/sources/test_spiraldb_table_source_streaming.py @@ -23,7 +23,7 @@ from orcapod.sources import SpiralDBTableSource from tests.test_databases import fake_spiral_sdk -_PROJECT = "edi-sample" +_PROJECT = "example-project" _KEYS = pa.schema( [pa.field("subject_id", pa.string()), pa.field("timestamp", pa.uint64())] ) diff --git a/tests/test_core/sources/test_spiraldb_table_source_tags_as_data.py b/tests/test_core/sources/test_spiraldb_table_source_tags_as_data.py index cd2a0e8c9..acaf7564d 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_tags_as_data.py +++ b/tests/test_core/sources/test_spiraldb_table_source_tags_as_data.py @@ -1,7 +1,7 @@ """SpiralDBTableSource copies named key columns into data as rows are read (ITL-996). Runs against the disk-backed pyspiral fake, whose ``scan_log`` records every scan a source -opens. The ``spike`` table mirrors the EDI ``spike_event`` table: its key holds +opens. The synthetic ``spike`` table has a composite key with ``timestamp`` before ``unit_id``, and it is read 2 rows per batch. """ @@ -38,7 +38,7 @@ "ignore:tags_as_data is provisional:orcapod.errors.ProvisionalHashWarning" ) -_PROJECT = "edi-sample" +_PROJECT = "example-project" _KEYS = pa.schema( [ pa.field("subject_id", pa.string()), diff --git a/tests/test_core/streams/test_head_and_preview.py b/tests/test_core/streams/test_head_and_preview.py index 68e49fd28..c71b2ada7 100644 --- a/tests/test_core/streams/test_head_and_preview.py +++ b/tests/test_core/streams/test_head_and_preview.py @@ -663,9 +663,9 @@ def test_an_unlabelled_source_is_shown_by_its_source_id() -> None: [{"id": 1, "x": 2}], tag_columns=["id"], tag_only_columns=True, - source_id="spike_event", + source_id="sensor_reading", ) - assert source.head().header() == "DictSource[spike_event] — all 1 row" + assert source.head().header() == "DictSource[sensor_reading] — all 1 row" assert source.label == "DictSource" From b83520c15cf4174888e8e34b42f1f9fb02d525ac Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 20:00:12 -0800 Subject: [PATCH 02/12] docs: use synthetic SpiralDB examples in development notes --- RELEASING.md | 6 +- changelog.d/ITL-186.md | 4 + docs/dev/design_issues/ITL-186-SP4.md | 2 +- docs/dev/design_issues/ITL-926-SP2.md | 11 ++- docs/dev/design_issues/ITL-936-SP3.md | 2 +- ...26-11-11-itl-926-spiral-source-reverify.md | 2 +- ...11-11-itl-936-spiral-nullability-record.md | 6 +- .../2026-11-12-itl-186-notebook-preview.md | 6 +- ...6-11-12-itl-186-streaming-spiral-source.md | 4 +- .../2026-11-12-itl-996-spiral-tags-as-data.md | 17 +++-- ...11-13-itl-1017-merged-source-info-token.md | 9 +-- ...-itl-186-spiral-streaming-source-design.md | 13 ++-- ...1-itl-939-tag-and-data-same-name-design.md | 2 +- ...-itl-186-streaming-spiral-source-design.md | 51 ++++++------- .../2026-11-12-itl-186-what-a-job-keeps.md | 4 +- ...-itl-991-stream-head-and-preview-design.md | 4 +- .../2026-11-13-itl-1074-test-inventory.md | 2 +- .../dev/specs/itl-1347-job-table-transport.md | 2 +- docs/dev/specs/itl-1347/stage-0.md | 4 +- docs/dev/specs/itl-926-live/FINDINGS.md | 76 ++++++++----------- docs/dev/specs/itl-926-live/error_messages.py | 5 +- docs/dev/specs/itl-926-live/inspect_tables.py | 7 +- docs/dev/specs/itl-926-live/live_verify.py | 27 +++---- .../repros/c2_fixed_size_list_cannot_hash.py | 2 +- .../itl-926-live/repros/c3_source_memory.py | 4 +- .../source_id_collision_across_projects.py | 23 +++--- .../dev/specs/itl-926-live/scan_cost_probe.py | 4 +- docs/dev/specs/itl-926-live/size_probe.py | 2 +- .../specs/itl-936-live/live_nullability.py | 19 +++-- .../spiraldb_derived_source_check.py | 30 ++++---- .../test_spiraldb_table_source_live.py | 32 ++++---- 31 files changed, 186 insertions(+), 196 deletions(-) create mode 100644 changelog.d/ITL-186.md diff --git a/RELEASING.md b/RELEASING.md index 1a26f506a..df80ce7f2 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -339,9 +339,9 @@ replace the secret as above. The job fails in between; that is the price of cont The read-only `SpiralDBTableSource` tests are opt-in. Sign in with spiral-sdk and set `ORCAPOD_SPIRALDB_TEST_PROJECT`, `ORCAPOD_SPIRALDB_TEST_DATASET` and `ORCAPOD_SPIRALDB_TEST_TABLE` to select a keyed table you can read. The table needs -`unit_id` and `timestamp` key columns and a floating-point `spike_amplitude_uv` data -column. For full coverage, use more than 1,000 rows across multiple units, with at -least eight timestamps for the first unit. +`sensor_id` and `timestamp` key columns and a floating-point `reading_value` data +column. For full coverage, use more than 1,000 rows across multiple sensors, with at +least eight timestamps for the first sensor. ```sh uv run --extra spiraldb pytest tests/test_core/sources/test_spiraldb_table_source_live.py diff --git a/changelog.d/ITL-186.md b/changelog.d/ITL-186.md new file mode 100644 index 000000000..cab429eb6 --- /dev/null +++ b/changelog.d/ITL-186.md @@ -0,0 +1,4 @@ +### Changed + +- SpiralDB source examples use synthetic identifiers. The read-only live source tests accept + the project, dataset and table through environment variables. diff --git a/docs/dev/design_issues/ITL-186-SP4.md b/docs/dev/design_issues/ITL-186-SP4.md index 2cf386e49..ff5c5b0ae 100644 --- a/docs/dev/design_issues/ITL-186-SP4.md +++ b/docs/dev/design_issues/ITL-186-SP4.md @@ -6,7 +6,7 @@ **Issue:** ITL-186 `SpiralDBTableSource` inherited `DBTableSource`'s constructor, which read every row and built -provenance for the whole table: about 4.6 GB for the 8,087,906-row `spike_event`. Design and +provenance for the whole table: about 4.6 GB for a table with roughly 8 million rows. Design and measurements: `docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md`. **Fix:** the source is built from metadata only (schema, key columns, SpiralDB's table id) and diff --git a/docs/dev/design_issues/ITL-926-SP2.md b/docs/dev/design_issues/ITL-926-SP2.md index 02f4b62e0..165e6aacf 100644 --- a/docs/dev/design_issues/ITL-926-SP2.md +++ b/docs/dev/design_issues/ITL-926-SP2.md @@ -5,8 +5,7 @@ **Severity:** high **Issue:** ITL-926 (follow-ups: ITL-186 streaming source) -Re-verified against the EDI sample project (`edi-sample-v1-855632`, read-only) and a -disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`). The workshop path works: +Re-verified against a live project (read-only) and a disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`). The workshop path works: a `SpiralDBTableSource` with a composite key, a `Join` of two Spiral sources, a function pod, a Delta database, a re-run with no function calls, save and load, and the same hashes in a fresh process. Findings, with repro scripts, are in `docs/dev/specs/itl-926-live/FINDINGS.md`. @@ -25,13 +24,13 @@ process. Findings, with repro scripts, are in `docs/dev/specs/itl-926-live/FINDI **Open (developer decisions pending):** -* Every column of the EDI sample tables is nullable, so a function pod over them must +* Every column of the tables examined is nullable, so a function pod over them must annotate `T | None`; recorded columns arrive as `T` (SP3, ITL-936). * `fixed_size_list` columns could not be hashed with starfix 0.4.0; they are hashed since Orcapod adopted starfix 0.5.0 (ITL-910, ITL-927). `map` columns are still refused: the - source raises `ValueError` naming every refused column (none in the EDI tables). -* The whole table is read at construction, which rules out tables such as `spike_event` - (8.1M rows); the streaming design is in + source raises `ValueError` naming every refused column (none in the tables examined). +* The whole table is read at construction, which rules out tables with millions of rows. + The streaming design is in `docs/dev/specs/2026-11-11-itl-186-spiral-streaming-source-design.md`. * Record IDs are positional; key-based IDs are approved for the streaming source work (ITL-186). diff --git a/docs/dev/design_issues/ITL-936-SP3.md b/docs/dev/design_issues/ITL-936-SP3.md index ace1c4dd1..1161ccfc9 100644 --- a/docs/dev/design_issues/ITL-936-SP3.md +++ b/docs/dev/design_issues/ITL-936-SP3.md @@ -5,7 +5,7 @@ **Severity:** high **Issue:** ITL-936 -Live, pyspiral 0.16.33, scratch table in `edi-tutorial-v1-841226` (November 11, 2026): a +Live, pyspiral 0.16.33, a scratch table in a live project (November 11, 2026): a table written with `k`, `v`, struct `g` and its field `g.x`, and list `l` with its items all declared non-null reports `Schema({k=i64?, l=fixed_size_list(f32)[2]?, v=i32?, w=i32?, g={x=i32?, y=i32?}?})`: every top-level column and struct field nullable; only list items keep diff --git a/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md b/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md index 47153140b..11c5684ca 100644 --- a/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md +++ b/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md @@ -52,7 +52,7 @@ DESIGN_ISSUES entry, full suite one Python version at a time, PR. - 2026-11-11 Phase 1 done: fake (`tests/test_databases/fake_pyspiral.py`), live kit (`superpowers/specs/itl-926-live/live_verify.py` read-only + write modes, `inspect_tables.py`), findings in `superpowers/specs/itl-926-live/FINDINGS.md`. - Developer decisions so far: workshop runs read-only on `edi-sample-v1-855632`; writes only + Developer decisions so far: examples run read-only on a live project; writes only to a separate test project (being provisioned); stay on a working pyspiral; CI restore nice-to-have. Live read-only probing from this terminal was blocked by the permission classifier after one successful call. Sent the Phase 1 `ask`; waiting for decisions. diff --git a/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md b/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md index 7df6413cb..cfe6c8241 100644 --- a/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md +++ b/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md @@ -66,7 +66,7 @@ into a struct of null fields ("SpiralDB doesn't allow struct-level nullability") * A path is a list of segments: the top-level column name, then a struct field name, or `"[]"` for the item of a `list` / `large_list` / `fixed_size_list`. Segments are read against the type, so a struct field literally named `"[]"` is not ambiguous. Map interiors are not - recorded (no EDI table has maps; SpiralDB maps unverified): writing a table whose map item + recorded (the inspected tables had no maps; SpiralDB maps unverified): writing a table whose map item field is declared non-null raises rather than silently widening it. * It asserts exactly: each listed field is non-nullable (Arrow meaning: no null in its array). Every field not listed keeps whatever nullability SpiralDB reports (list items stay @@ -225,7 +225,7 @@ if read_nullability_record(table.get_metadata()) != read_nullability_record(kv): - [ ] Full suite (one Python version), ruff, basedpyright, golden hashes unchanged. - [ ] Live check script under `superpowers/specs/itl-936-live/` + exact commands for the - coordinator on `edi-tutorial-v1-841226`. + coordinator to run against a test project. - [ ] Merge origin/main, push, PR (stacked on #305), attach, worker_done. ## Notes @@ -245,7 +245,7 @@ non-null flag SpiralDB does not keep: ### Pinned hashes for an UNRECORDED table (computed at 49956a6a, before any library change) -One-row `edi-sample-a/default/subject` (`subject_id`, `sex`; written non-null, stored nullable), +One-row synthetic fixture (`subject_id`, `sex`; written non-null, stored nullable), `source_id="subject"`: * `output_schema`: `({'subject_id': str | None}, {'sex': str | None})` diff --git a/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md b/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md index d05f90197..76dc0bddc 100644 --- a/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md +++ b/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md @@ -39,9 +39,9 @@ manifest row count only when the head is not the whole read. A private class swi | Case | Header after `SpiralDBTableSource[
` only**, the readable name shown in `label`, `repr` and the saved file. A renamed table keeps its whole identity. Cost: every provenance token - in stored data reads `edi-tutorial-v1-841226/table_W7C01nkLTmEJ::...`, which no longer says - `spike_event`. + in stored data reads `my-project-123456/table_example12345::...`, which no longer says + `sensor_reading`. * **C: readable source id, table id only in `identity_structure`.** Rejected: the content hash is unique, but record ids and tokens of a recreated table collide with the old table's. @@ -132,10 +131,10 @@ FIXED: from the primary key, never from row content. to fewer, non-unique columns. `record_id_column` is no longer needed for this source and is removed from it. * Token format, options: - * **(recommended) readable**: `subject_id=Goliath,unit_id=106,...` in key order, values as + * **(recommended) readable**: `site_id=north,sensor_id=106,...` in key order, values as Arrow renders them, with `%`, `,`, `=` and `:` percent-escaped. Escaping is required: the real `spike_extraction_hash` values contain `::`, the separator inside source-info - values. About 290 characters for `spike_event`. + values. About 290 characters for `sensor_reading`. * short: a hex digest of the key values. Fixed length, but a person can no longer find the row from a provenance token. * Record id stays `uuid5(source_id + "::" + token)`, as for every source. @@ -149,7 +148,7 @@ FIXED: from the primary key, never from row content. One scan per read: `scan(table.select(), where=, limit=, asof=).to_record_batches()`. Each Spiral batch is cut into slices of at most `batch_rows` rows (default **8,192**; Spiral's own -batches were up to 48,578 rows), normalized to large types, checked against the nullability +batches exceeded the default), normalized to large types, checked against the nullability record (#308), enriched in Arrow, and yielded row by row. Nothing is accumulated. No `to_pylist()` of a table, no table hash. Memory: about 90 MB at the default. @@ -166,8 +165,8 @@ hash; `SelectDataColumns` exists downstream). | `as_table`, `as_df`, `as_polars_df`, `as_pandas_df`, `as_lazy_frame` | read the (restricted) rows into one Arrow table; `as_lazy_frame` stays `as_polars_df().lazy()` | | `len` / count | none exists today; none added | -First N rows: `SpiralDBTableSource(project, "spike_event", limit=1000)`. A subset: -`where={"subject_id": "Goliath", "unit_id": 106}` (equality only, combined with "and"; it is +First N rows: `SpiralDBTableSource(project, "sensor_reading", limit=1000)`. A subset: +`where={"site_id": "north", "sensor_id": 106}` (equality only, combined with "and"; it is saved in the job file). Key ranges are not offered (see the measurements). The size guard, options: @@ -177,7 +176,7 @@ The size guard, options: fails when row `max_rows + 1` arrives. The message gives the count and the three ways out: `limit=`, `where=`, or a larger `max_rows` (`None` removes the cap). 100,000 rows is about 0.5 GB per job node. -* Cap only on the `as_table` family: `job.run()` on the full `spike_event` would then exhaust +* Cap only on the `as_table` family: `job.run()` on the full `sensor_reading` would then exhaust a laptop's memory. * No cap. @@ -189,8 +188,8 @@ The size guard, options: PostgreSQL and SQLite sources are untouched. ```python - SpiralDBTableSource("edi-tutorial-v1-841226", "spike_event", - where={"unit_id": 106}, limit=None, max_rows=100_000) + SpiralDBTableSource("my-project-123456", "sensor_reading", + dataset="my_dataset", where={"sensor_id": 106}, max_rows=100_000) ``` Saved form (`source_type` stays `spiraldb_table`): `{project_id, dataset, table_name, table_id, where, limit, asof, max_rows, batch_rows, @@ -268,8 +267,8 @@ counter: * a job on both orchestrators: function pod, Join with a small source, second run computes nothing, appended row is the only one computed; save and load. -Opt-in live tests (skipped unless `ORCAPOD_SPIRAL_LIVE_PROJECT` is set), read-only on -`edi-tutorial-v1-841226`: construction of `spike_event` makes no scan and takes under 5 s; +Opt-in live tests (skipped unless `ORCAPOD_SPIRAL_LIVE_PROJECT` is set), read-only against a configured project: +construction of the selected table makes no scan and takes under 5 s; `limit=1000`; one `where`; an async job over `limit=2000`. One write test confined to a `scratch.` table of that project: append rows between two runs. diff --git a/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md b/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md index 74f13557a..77b18e94c 100644 --- a/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md +++ b/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md @@ -1,7 +1,7 @@ # What a pipeline job keeps in memory (finding from ITL-186, input to ITL-858) November 12, 2026. Read from the code on `main` at 25650c42 and measured on synthetic -spike_event-shaped rows (7 tag columns, 1 data column). Not a proposal. +sensor_reading-shaped rows (7 tag columns, 1 data column). Not a proposal. ## Measured @@ -27,7 +27,7 @@ above. ## Consequence On either orchestrator a job over N rows holds roughly N × 5 KB for each node that keeps its -output. 100,000 rows: about 0.5 GB per node. The 8,087,906-row `spike_event`: about 43 GB per +output. 100,000 rows: about 0.5 GB per node. A keyed table with roughly 8 million rows needs about 43 GB per node, and 15 minutes of row iteration before any pod runs. A source that streams in bounded memory (ITL-186) does not change this. diff --git a/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md b/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md index 209df2dc6..7f07d2417 100644 --- a/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md +++ b/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md @@ -98,7 +98,7 @@ Header line (rendered by `StreamHead`, one wording table so #333 and every class |---|---| | ROWS, total known, total > n | `ArrowTableSource[readings] — first 10 of 1,234 rows` | | ROWS, total ≤ n | `ArrowTableSource[readings] — all 7 rows` | -| ROWS, estimate | `SpiralDBTableSource[spike_event] — first 10 rows of about 63,349` | +| ROWS, estimate | `SpiralDBTableSource[sensor_reading] — first 10 rows of about 25,000` | | ROWS, total unknown | `… — first 10 rows` | | ROWS from a node's store | `FunctionJobNode[score] — first 10 of 1,234 stored rows` | | ROWS from a stream's cache | `FunctionPodStream[score] — first 10 of 500 computed rows` | @@ -323,7 +323,7 @@ no slack). #333 adds `StreamBase._preview(columns, all_info) -> (pl.DataFrame, note)` (default: today's behaviour) and a Spiral override that reads ≤ 10 rows with Spiral's `limit` and -renders `SpiralDBTableSource[spike_event] — first 10 rows of about 63,349`. +renders `SpiralDBTableSource[sensor_reading] — first 10 rows of about 25,000`. - `StreamBase._preview` is removed; `head` is the override point. - The Spiral override becomes: diff --git a/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md b/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md index 5d34a3d34..43b6b6aa2 100644 --- a/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md +++ b/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md @@ -38,7 +38,7 @@ the same commit, the static marks in the tree, and local runs of the files that | Group | Count | Stated reason | Verified cause | Verdict | |---|---|---|---|---| -| Live Spiral source: `tests/test_core/sources/test_spiraldb_table_source_live.py` | 8 | "Set ORCAPOD_SPIRAL_LIVE_PROJECT to run" | The variable is set nowhere in `.github/`. The tests need a real Spiral project holding a `spike_event` table of more than 1,000 rows, credentials and network. | Correct to skip in `Run Tests`. Could run in the `spiral-integration` job once that job works and a project with the table exists (needs a developer decision and Spiral data). | +| Live Spiral source: `tests/test_core/sources/test_spiraldb_table_source_live.py` | 8 | "Set ORCAPOD_SPIRAL_LIVE_PROJECT to run" | The variable is set nowhere in `.github/`. The tests need a real Spiral project holding a `sensor_reading` table of more than 1,000 rows, credentials and network. | Correct to skip in `Run Tests`. Could run in the `spiral-integration` job once that job works and a project with the table exists (needs a developer decision and Spiral data). | | Spiral connector integration: `test_spiraldb_connector_integration.py` | 9 | "Set SPIRAL_INTEGRATION_TESTS=1" | Run by the `spiral-integration` job (push to `main` only), which sets the variable. In that job all 9 **fail** (section 3.2). | Correct to skip in `Run Tests`; the job that runs them is broken. | | S3 / MinIO: `test_delta_table_database_s3.py` (7), `test_list_table_paths.py::test_s3_lists_tables_and_nested_tables` (1) | 8 | "MinIO container could not be started: 404 ... pull access denied for minio/minio" | See 3.3. The fixture starts MinIO with testcontainers and skips on any exception; in CI the image cannot be pulled, so the S3 path is never tested. | Should run in CI but does not; needs a SpiralDB workload credential (3.3, ITL-1079, ITL-1008). | | Delta tables under special-character roots: `test_delta_native_fs_read.py` (`x#y`, `q?r`, two tests each) | 4 | "deltalake cannot write a table at ..." | `_write_or_skip` skips when `deltalake` itself cannot write a table under a root named `x#y` or `q?r`. The other six special names run and pass. | Correct to skip: a limit of `deltalake`, not of Orcapod. Re-check on each `deltalake` upgrade. | diff --git a/docs/dev/specs/itl-1347-job-table-transport.md b/docs/dev/specs/itl-1347-job-table-transport.md index 21769a847..c830fafd5 100644 --- a/docs/dev/specs/itl-1347-job-table-transport.md +++ b/docs/dev/specs/itl-1347-job-table-transport.md @@ -113,7 +113,7 @@ The ITL-1345 profile (workshop-scale notebook on 0.4.0rc1, local Delta copy, no | Warm run: rebuilding Arrow tables from those rows (`_rows_to_table`, `_materialize_as_stream`) | ~32% (~14 s) | | Warm run: operator compute / reads / all hashing | ~8% / ~1% / ~0.3% | | `Data.__init__` calls; `normalize_schema_to_large_types` calls | 121,139; 363,466 (three per row) | -| One source of 63,349 rows: `as_table()` / `list(iter_data())` | 0.29 s / 9.1 s | +| One source of about 60,000 rows: `as_table()` / `list(iter_data())` | 0.29 s / 9.1 s | About 90% of a warm run converts Arrow tables into rows and back. diff --git a/docs/dev/specs/itl-1347/stage-0.md b/docs/dev/specs/itl-1347/stage-0.md index d4ba53b47..479292cea 100644 --- a/docs/dev/specs/itl-1347/stage-0.md +++ b/docs/dev/specs/itl-1347/stage-0.md @@ -17,7 +17,7 @@ records stay outside the repository. - **Machine**: Python 3.14 on an Apple silicon Mac. One heavy process at a time; the 1-minute load average is given with each number. - **Workload**: a workshop-shaped pipeline on a local Delta copy. It has two sources - (63,349 and 28,780 rows), eight operator nodes (`GroupBy` ×2, `DropNulls`, `MapData` ×2, + (roughly 60,000 and 30,000 rows), eight operator nodes (`GroupBy` ×2, `DropNulls`, `MapData` ×2, `SelectDataColumns` ×2, `Join`) and two function nodes. Every edge has one successor. ## Workshop-shaped job: time @@ -52,7 +52,7 @@ first count on job-speed missed them, because ITL-1348 builds rows without The 121,041 edge rows split by producer as follows: - the two sources: 92,129 rows; -- the operator nodes: 28,911 rows, of which 28,780 come from one node (`DropNulls`); +- the operator nodes: roughly 29,000 rows, most of them from one node (`DropNulls`); - the function node feeding the join: 1 row. On job-speed, `_rows_to_table` still costs about 15.4 s of the 29 s warm run: 11.6 s on diff --git a/docs/dev/specs/itl-926-live/FINDINGS.md b/docs/dev/specs/itl-926-live/FINDINGS.md index 3de5195a0..b448f8ed3 100644 --- a/docs/dev/specs/itl-926-live/FINDINGS.md +++ b/docs/dev/specs/itl-926-live/FINDINGS.md @@ -2,19 +2,16 @@ Audit of `SpiralDBTableSource` / `DBTableSource` / `SpiralDBConnector`, an end-to-end run of the workshop path through a disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`), -a pyspiral 0.14.9 → 0.16.33 API check, and one read-only live call against -`edi-sample-v1-855632`. Repro scripts: `superpowers/specs/itl-926-live/` and the session -scratchpad (listed in the plan). +a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scripts are in `docs/dev/specs/itl-926-live/`. -## Live facts (EDI sample V1, read-only) +## Live facts (read-only) * Schema dump (developer): **every column is nullable, key columns included** (`utf8?`, - `u32?`, `vortex.timestamp[µs](i64?)`). Keys are composite: string hashes, `subject_id`, - `session_start_datetime` (timestamp µs), `u32` indexes. Value types include `u32`/`u64`, - `f32`, `list(...)`, `fixed_size_list(...)[n]`, structs with nested lists (`unit`), - `binary` (`frame_jpeg`), `date[days]`. + `u32?`, `vortex.timestamp[µs](i64?)`). Keys are composite: strings, a microsecond timestamp and `u32` indexes. Value types include `u32`/`u64`, + `f32`, `list(...)`, `fixed_size_list(...)[n]`, structs with nested lists, + `binary`, `date[days]`. * pyspiral **0.16.33** (overlay env, repo code unchanged) authenticates with the developer's - login, lists the 27 tables in 1.2 s and scans `atlas` (limit 3) in 1.2 s. + login, lists the tables in 1.2 s and scans one with a small limit, also in 1.2 s. * pyspiral **0.14.9** (the repo lock) does **not** use that login: it started a device-login flow, which was aborted at once. * A second read-only probe was blocked by the Claude Code permission classifier in this @@ -25,24 +22,20 @@ scratchpad (listed in the plan). ### Critical: workshop blockers -1. **All-nullable columns make every function pod with a plain type fail.** With the EDI - schemas every tag and data column is `T | None`. `@function_pod def f(x: float)` on such a +1. **All-nullable columns make every function pod with a plain type fail.** With a nullable schema every tag and data column is `T | None`. `@function_pod def f(x: float)` on such a stream raises `ValueError: ... column 'x' has type float | None, the function expects float`. Pods annotated `x: float | None` work. Repro: `repros/c1_nullable_columns_refuse_plain_pods.py`. 2. **`fixed_size_list` columns crash source construction.** `starfix` 0.4.0 (latest) raises `NotImplementedError: Unsupported leaf type: fixed_size_list<...>` from - `arrow_hasher.hash_table`. General: `ArrowTableSource` fails the same way. EDI tables hit: - `experiment_display_params`, `experiment_freeviewing_params`, - `experiment_screen_capture_event`, `lfp_timeseries`. Repro: + `arrow_hasher.hash_table`. General: `ArrowTableSource` fails the same way. Any table with that column type is affected. Repro: `repros/c2_fixed_size_list_cannot_hash.py`. **Status:** starfix support is implemented (nauticalab/starfix#22, ITL-927) and ships in starfix 0.5.0; Orcapod gets it when it adopts 0.5.0 (ITL-910). 3. **Large tables cannot be used.** The source reads the whole table eagerly and `SourceStreamBuilder` calls `table.to_pylist()` for provenance tokens. Measured: 200k - spike_event-shaped rows take 0.9 s and add about 210 MB of peak RSS for 8.6 MB of Arrow + sensor_reading-shaped rows take 0.9 s and add about 210 MB of peak RSS for 8.6 MB of Arrow data (about 25×). There is no column projection, row filter or limit on the source. - `spike_event`, `lfp_timeseries`, `experiment_gaze_online_timeseries` and - `experiment_screen_capture_frame_270p` are at risk. Repro: `repros/c3_source_memory.py`. + Tables with many rows or wide binary columns are at risk. Repro: `repros/c3_source_memory.py`. **Status:** this PR removes the whole-table `to_pylist()` (C3b, byte-identical), so the same 200k rows now add about 115 MB; reading large tables at all is the streaming source (ITL-186). @@ -53,8 +46,7 @@ scratchpad (listed in the plan). 5. **Naive timestamp tags become UTC on one read path.** `FunctionJobNode.as_table()` returns a `timestamp[us]` tag as `timestamp[us, tz=UTC]`; `get_all_records()` and an in-memory pod keep `timestamp[us]`. General (not Spiral); repro `repros/h1_timestamp_tag_becomes_utc.py`. - Being filed as a separate issue. EDI keys include - `session_start_datetime`. + Being filed as a separate issue. Composite keys can include a naive timestamp. 6. **Record identity is positional by default.** Inserting a row whose key sorts first re-keys every later row, giving duplicate pipeline entries; function results are still cached (one call). Repro: `repros/h2_positional_record_ids.py`. `record_id_column` takes one column only, so a composite primary key @@ -75,7 +67,7 @@ scratchpad (listed in the plan). 10. **Logical (extension) types do not survive a Spiral source.** An Orcapod `Path` column comes back as `large_string`: the connector's KV metadata (ITL-471) stores `field.metadata` only (the extension lives in the type), and `DBTableSource` rebuilds - fields without metadata. The EDI tables have none. + fields without metadata. 11. **ITL-40:** the asymmetry is fixed at top level (`get_column_info` and `iter_batches` both map `string`/`binary` to the large variants). Nested types (`list`, struct children) are normalized by neither, which breaks the "normalize recursively" @@ -85,7 +77,7 @@ scratchpad (listed in the plan). `to_config()` go through Python types, so an `int32`/`uint32` key is saved as `int64`, and a `SourceProxy` fallback gets the wrong width. General. 13. **`source_id` defaults to the bare table name.** Same-named tables in two projects or - datasets (for example, two EDI sample projects) get the same `source_id`, and therefore + datasets (for example, two test projects) get the same `source_id`, and therefore the same record IDs and provenance tokens. 14. **Docs:** credentials live at `typer.get_app_dir("pyspiral")/auth.json` (`~/Library/Application Support/pyspiral/` on macOS), not `~/.config/pyspiral/` as the @@ -93,8 +85,7 @@ scratchpad (listed in the plan). ### Low -15. `decimal128` and dictionary columns map to `typing.Any` (a general converter gap; the EDI - tables have none). Spiral refuses struct-level nulls on write (write side only). +15. `decimal128` and dictionary columns map to `typing.Any` (a general converter gap). Spiral refuses struct-level nulls on write. ## Verified working (fake; same code path as live) @@ -132,14 +123,13 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` ## Live read-only run (coordinator, November 11, 2026, pyspiral 0.16.33) -* `inspect_tables.py`: all 27 tables. The scan types are `string` (non-large), `timestamp[us]` +* `inspect_tables.py`: all tables. The scan types are `string` (non-large), `timestamp[us]` with **no timezone**, `date32`, `uint32`/`uint64`, `int16`/`int32`, `float`, `list<...>`, - `fixed_size_list<...>[n]`, structs with nested lists (`unit`), and `large_binary` - (`frame_jpeg`). Every field is nullable, key fields included. A 3-row scan takes 0.7–1.7 s; - `experiment_display_params` takes 9.2 s and `unit` 14.5 s. -* `live_verify.py` read-only on `session,experiment`: all 7 checks pass. Every tag and data + `fixed_size_list<...>[n]`, structs with nested lists, and `large_binary`. Every field is nullable, key fields included. A 3-row scan takes 0.7–1.7 s; + two tables took 9.2 s and 14.5 s respectively. +* `live_verify.py` read-only on two related keyed tables: all 7 checks pass. Every tag and data column is `T | None` (C1 confirmed live), and `content_hash` and `pipeline_hash` are - identical in a fresh process. Both tables have 1 row in this sample. + identical in a fresh process. * The protobuf `UserWarning` lines on import came from the locked `substrait` 0.26.0 (protobuf 5 generated code under the protobuf 6 runtime). A fresh `pip install orcapod[spiraldb]` resolves substrait 0.30.0 and shows no warning, so attendees @@ -148,8 +138,8 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` ## The attendee path: Orcapod only, after one `spiral login` 1. **Eager read.** Construction reads the whole table (`DBTableSource.__init__`). For - spike_event-shaped data, 200k rows take 0.9 s and +210 MB of peak RSS (+115 MB with C3b), - so `spike_event` (8,087,906 rows) needs roughly 8.5 GB (about 4.6 GB with C3b) and minutes. + sensor_reading-shaped data, 200k rows take 0.9 s and +210 MB of peak RSS (+115 MB with C3b), + so a table with about 8 million rows needs roughly 8.5 GB (about 4.6 GB with C3b) and minutes. That is not usable on a laptop. `size_probe.py` gives per-table row counts from the manifests (no scan) and measured build costs for tables under a cap. 2. **Restricting rows or columns.** Nothing is pushed down to Spiral today: no projection, @@ -186,7 +176,7 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` pyspiral's `ProjectId`: the API resource id, created from an `id_prefix` plus a server-generated suffix, and distinct from the display `description`. Repro of the problem it fixes: `repros/source_id_collision_across_projects.py`. Before the - fix, with two projects, the same `subject` table and one store, project B's job + fix, with two projects, the same `item` table and one store, project B's job `get_all_records()` returned 4 rows (A's 2 and B's 2) with nothing to tell them apart. After the fix it returns B's 2. Results were never served across projects (they are keyed on row data). `PostgreSQLTableSource` and `SQLiteTableSource` still default to the bare @@ -198,13 +188,11 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` Spiral, so it cannot override declared nullability in either direction. * **C2**: starfix will support FixedSizeList (ITL-927); the type is kept intact here. -## Why `unit` (100 rows) takes about 35 s live +## Why a small table with nested columns takes about 35 s live -Orcapod's share is small: the same 100-row shape (4 structs with 31, 7 list, 10 and 8 -fields) builds in 0.41 s in the fake, mostly struct and list hashing. The live 3-row `scan` -of `unit` alone took 14.5 s, against about 1 s for other tables, so the time is the Spiral -scan: likely one column group or fragment fetched after another. `scan_cost_probe.py unit -unit_location` reports column groups, fragments, and scan times for keys only, full, and +Orcapod's share is small: a synthetic 100-row table with similarly nested structs builds in 0.41 s in the fake, mostly struct and list hashing. The live 3-row `scan` +of the table alone took 14.5 s, against about 1 s for other tables, so the time is the Spiral +scan: likely one column group or fragment fetched after another. `scan_cost_probe.py` reports column groups, fragments, and scan times for keys only, full, and full again. Compacting the table may help; that is for the developer or Spiral to judge. ## Found during the CodeRabbit round (November 11, 2026) @@ -213,20 +201,18 @@ full again. Compacting the table may help; that is for the developer or Spiral t Unsupported leaf type: map<...>` from `arrow_hasher.hash_table`, the same failure as `fixed_size_list` (C2), so no source can be built on a table with a map column. The connector itself reads maps correctly (large-normalized, key/item names and nullability - kept; tested). The EDI sample tables have no map columns. Whether starfix 0.5.0 covers maps + kept; tested). The tables examined had no map columns. Whether starfix 0.5.0 covers maps is to check (ITL-927/ITL-910). ## Second live read-only run (coordinator, November 11, 2026) -* `live_verify.py --tables unit,sample_unit --value-column firing_rate_hz`: all 7 checks pass - (100 calls for 100 distinct values and 100 rows; no calls on run 2; hashes identical in a - fresh process; the loaded job reads 100 rows). +* `live_verify.py` on two keyed tables with a numeric data column: all 7 checks pass + (one call per distinct value on run 1, no calls on run 2, identical hashes in a fresh + process, and all rows returned by the loaded job). * Every Delta write prints `deltalake_core::writer::stats` WARN lines ("Skipping column __node_content_hash because it's a binary field", ...). Attendees will see them. This is the known `RUST_LOG` item held from ITL-821. -* `unit` has 5 column groups (the root group, empty, plus one for each struct column: - `labels`, `quality_metrics`, `rolling_quality_metrics`, `waveform_metrics`), each 1 - fragment of 100 rows. SpiralDB cannot scan key columns alone ("Reading key columns without +* The table has an empty root column group and one group per struct column. SpiralDB cannot scan key columns alone ("Reading key columns without including at least one column from any column group is currently not supported"), so `scan_cost_probe.py` now times one scan per column group instead. diff --git a/docs/dev/specs/itl-926-live/error_messages.py b/docs/dev/specs/itl-926-live/error_messages.py index 36685f073..dc7406a58 100644 --- a/docs/dev/specs/itl-926-live/error_messages.py +++ b/docs/dev/specs/itl-926-live/error_messages.py @@ -2,11 +2,10 @@ Run after ``spiral login``, from the repository root: - uv run python superpowers/specs/itl-926-live/error_messages.py edi-sample-v1-855632 + uv run python docs/dev/specs/itl-926-live/error_messages.py my-project-123456 Each case only lists tables or reads a table's schema; nothing is written. The made-up -project id is random, so it cannot name a real project (in particular, never a full EDI -project). Prints the exception type and message for each case, and how long it took. +project id is generated at random to exercise the missing-project error. Prints the exception type and message for each case, and how long it took. """ from __future__ import annotations diff --git a/docs/dev/specs/itl-926-live/inspect_tables.py b/docs/dev/specs/itl-926-live/inspect_tables.py index b651880bc..1b6d3822b 100644 --- a/docs/dev/specs/itl-926-live/inspect_tables.py +++ b/docs/dev/specs/itl-926-live/inspect_tables.py @@ -1,11 +1,10 @@ """READ-ONLY inspection of a SpiralDB project's tables for ITL-926. Calls only read methods (``list_tables``, ``Table.schema``, ``Table.key_schema``, -``Table.get_metadata`` and a ``limit``-ed scan), so it is safe on the workshop's EDI sample -projects. Run after ``spiral login``, from the repository root: +``Table.get_metadata`` and a ``limit``-ed scan), so it can inspect a project without writing. Run after ``spiral login``, from the repository root: - uv run python superpowers/specs/itl-926-live/inspect_tables.py edi-sample-v1-855632 \ - [--tables session,experiment] [--limit 3] > inspect.txt + uv run python docs/dev/specs/itl-926-live/inspect_tables.py my-project-123456 \ + [--tables session,session_event] [--limit 3] > inspect.txt For every table it prints the key schema, the Arrow schema ``Table.schema().to_arrow()`` reports (``!`` marks a non-null field), the Arrow type and nullability a ``limit``-ed scan diff --git a/docs/dev/specs/itl-926-live/live_verify.py b/docs/dev/specs/itl-926-live/live_verify.py index 8a4927859..2d6157b17 100644 --- a/docs/dev/specs/itl-926-live/live_verify.py +++ b/docs/dev/specs/itl-926-live/live_verify.py @@ -5,13 +5,12 @@ Two modes. -**Read-only (default)** -- for an existing project such as the workshop's EDI sample -(``edi-sample-v1-855632``). Nothing is written to the project: no table creation, no writes, +**Read-only (default)** -- for an existing project. Nothing is written to the project: no table creation, no writes, no maintenance. Results go to a local Delta store in a temporary directory: - uv run python superpowers/specs/itl-926-live/live_verify.py \ - --project edi-sample-v1-855632 --tables session,experiment \ - --value-column total_trials [--report ro.json] + uv run python docs/dev/specs/itl-926-live/live_verify.py \ + --project my-project-123456 --tables session,session_event \ + --value-column event_count [--report ro.json] It builds ``SpiralDBTableSource`` on each of ``--tables`` (keep them small: the source reads the whole table into memory), records schemas, row counts and hashes, then joins the first @@ -20,11 +19,11 @@ sources' ``content_hash`` / ``pipeline_hash`` are unchanged and that the loaded job's ``get_all_records()`` returns every row. -**Write mode** -- only for a dedicated test project, never an ``edi-*`` project. It must be -asked for by repeating the project id: +**Write mode** -- for a dedicated project whose ID starts with ``test-``. +Opt in by repeating the project ID: - uv run python superpowers/specs/itl-926-live/live_verify.py \ - --project --allow-writes [--keep] + uv run python docs/dev/specs/itl-926-live/live_verify.py \ + --project test-example --allow-writes test-example [--keep] It works in scratch tables named ``itl926__*`` in ``--dataset`` (dropped at the end unless ``--keep``): @@ -490,7 +489,7 @@ def _load_phase(args: argparse.Namespace) -> None: # --------------------------------------------------------------------------------------- -# Read-only mode: an existing project (the workshop's EDI sample). No writes of any kind. +# Read-only mode: an existing project. No writes of any kind. # --------------------------------------------------------------------------------------- @@ -666,7 +665,7 @@ def main() -> int: default=None, metavar="PROJECT", help="write mode: create, write and drop scratch tables in PROJECT, which must " - "equal --project and must not be an edi-* project. Without it nothing is written.", + "equal --project and start with 'test-'. Without it nothing is written.", ) parser.add_argument( "--tables", @@ -700,8 +699,10 @@ def main() -> int: else: if args.allow_writes != args.project: parser.error("--allow-writes must name the same project as --project") - if args.project.startswith("edi-"): - parser.error("refusing to write to an edi-* project; they are read-only") + if not args.project.startswith("test-"): + parser.error( + "write mode requires a dedicated project whose ID starts with 'test-'" + ) run = Run(args) try: with tempfile.TemporaryDirectory() as tmp: diff --git a/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py b/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py index 5141e7c71..ac4a9fced 100644 --- a/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py +++ b/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py @@ -9,7 +9,7 @@ Since PR #305 the source names the column: ``cannot hash column 'rgb' of type fixed_size_list[3]: ...``. EDI sample tables with such columns: experiment_display_params, experiment_freeviewing_params, -experiment_screen_capture_event, lfp_timeseries (``fixed_size_list(f32)[384]``). +a synthetic sensor timeseries (``fixed_size_list(f32)[384]``). """ import pyarrow as pa diff --git a/docs/dev/specs/itl-926-live/repros/c3_source_memory.py b/docs/dev/specs/itl-926-live/repros/c3_source_memory.py index f7a5641fe..ee94001de 100644 --- a/docs/dev/specs/itl-926-live/repros/c3_source_memory.py +++ b/docs/dev/specs/itl-926-live/repros/c3_source_memory.py @@ -1,4 +1,4 @@ -"""C3 repro: memory used to build a source over a spike_event-shaped table. +"""C3 repro: memory used to build a source over a sensor_reading-shaped table. Run from the repository root: @@ -38,7 +38,7 @@ ) # ru_maxrss: bytes on macOS, KiB on Linux before = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / scale start = time.time() -ArrowTableSource(table, tag_columns=table.column_names[:7], source_id="spike_event") +ArrowTableSource(table, tag_columns=table.column_names[:7], source_id="sensor_reading") after = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / scale print( f"rows={n} arrow={table.nbytes / 1e6:.1f} MB build={time.time() - start:.1f}s " diff --git a/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py b/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py index 4e9a1b7f7..abc9d6d54 100644 --- a/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py +++ b/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py @@ -4,7 +4,7 @@ uv run python superpowers/specs/itl-926-live/repros/source_id_collision_across_projects.py -Uses the pyspiral fake. Two projects each have a ``subject`` table with the same schema but +Uses the pyspiral fake. Two projects each have a ``item`` table with the same schema but different rows; the same job (same name, same store) runs on project A, then on project B, with the default ``source_id``. Prints each source's ``source_id`` and ``content_hash``, the function calls each run makes, and what ``get_all_records()`` returns after the B run. @@ -36,30 +36,30 @@ def to_kg(weight_g: float) -> float: schema = pa.schema( [ - pa.field("subject_id", pa.string(), False), + pa.field("item_id", pa.string(), False), pa.field("weight_g", pa.float64(), False), ] ) with fake_pyspiral.install(work / "spiral"): for project, weights in ( - ("edi-sample-a", [1000.0, 2000.0]), - ("edi-sample-b", [3000.0, 4000.0]), + ("test-project-a", [1000.0, 2000.0]), + ("test-project-b", [3000.0, 4000.0]), ): table = ( fake_pyspiral.FakeSpiral() .project(project) .create_table( - "default.subject", - key_schema=pa.schema([pa.field("subject_id", pa.string(), False)]), + "my_dataset.item", + key_schema=pa.schema([pa.field("item_id", pa.string(), False)]), ) ) table.write( - pa.table({"subject_id": ["m1", "m2"], "weight_g": weights}, schema=schema) + pa.table({"item_id": ["a", "b"], "weight_g": weights}, schema=schema) ) - for project in ("edi-sample-a", "edi-sample-b"): + for project in ("test-project-a", "test-project-b"): calls.clear() - source = SpiralDBTableSource(project, "subject") + source = SpiralDBTableSource(project, "item", dataset="my_dataset") job = PipelineJob(name="workshop", database=DeltaTableDatabase(work / "store")) with job: to_kg.pod(source, label="kg") @@ -72,7 +72,10 @@ def to_kg(weight_g: float) -> float: later = PipelineJob(name="workshop", database=DeltaTableDatabase(work / "store")) with later: - to_kg.pod(SpiralDBTableSource("edi-sample-b", "subject"), label="kg") + to_kg.pod( + SpiralDBTableSource("test-project-b", "item", dataset="my_dataset"), + label="kg", + ) records = later.nodes["kg"].get_all_records() print( "project B job, get_all_records():", diff --git a/docs/dev/specs/itl-926-live/scan_cost_probe.py b/docs/dev/specs/itl-926-live/scan_cost_probe.py index df8c2065a..ca602ab8e 100644 --- a/docs/dev/specs/itl-926-live/scan_cost_probe.py +++ b/docs/dev/specs/itl-926-live/scan_cost_probe.py @@ -2,8 +2,8 @@ Run after ``spiral login``, from the repository root: - uv run python superpowers/specs/itl-926-live/scan_cost_probe.py edi-sample-v1-855632 \ - unit unit_location > scan_cost.txt + uv run python docs/dev/specs/itl-926-live/scan_cost_probe.py my-project-123456 \ + sensor_reading sensor_location > scan_cost.txt For each table it prints the number of column groups and fragments (from the manifests, no data scan), then times one scan per column group (SpiralDB cannot scan the key columns diff --git a/docs/dev/specs/itl-926-live/size_probe.py b/docs/dev/specs/itl-926-live/size_probe.py index ef5fdc6a5..1c9c5045d 100644 --- a/docs/dev/specs/itl-926-live/size_probe.py +++ b/docs/dev/specs/itl-926-live/size_probe.py @@ -2,7 +2,7 @@ Run after ``spiral login``, from the repository root: - uv run python superpowers/specs/itl-926-live/size_probe.py edi-sample-v1-855632 \ + uv run python docs/dev/specs/itl-926-live/size_probe.py my-project-123456 \ [--max-rows 200000] > sizes.txt Step 1 reads each table's row count and size from Spiral's manifests (no data is scanned). diff --git a/docs/dev/specs/itl-936-live/live_nullability.py b/docs/dev/specs/itl-936-live/live_nullability.py index dc0521259..449065e08 100644 --- a/docs/dev/specs/itl-936-live/live_nullability.py +++ b/docs/dev/specs/itl-936-live/live_nullability.py @@ -3,10 +3,11 @@ Run from the repository root after ``spiral login``, with the ``spiraldb`` extra (``uv sync --all-extras``). Prints a JSON report; exit status 0 when every check passed. -**Write mode** (scratch tables only; repeat the project id to allow writes): +**Write mode** uses scratch tables in a dedicated project whose ID starts with ``test-``. +Repeat the project ID to allow writes: - uv run python superpowers/specs/itl-936-live/live_nullability.py write \ - --project edi-tutorial-v1-841226 --allow-writes edi-tutorial-v1-841226 \ + uv run python docs/dev/specs/itl-936-live/live_nullability.py write \ + --project test-example --allow-writes test-example \ [--dataset meta] [--report write.json] # dataset defaults to meta Creates tables ``.itl936__*`` and drops every one of them at the end, even on @@ -32,10 +33,10 @@ 5. ``metadata``: several keys in one ``set_metadata`` call; a 400-column record (chunked); an entry over 8 KiB (expected refused). -**Read mode** (read-only; for the tutorial tables once they carry the record): +**Read mode** checks existing tables that carry the record: - uv run python superpowers/specs/itl-936-live/live_nullability.py read \ - --project edi-tutorial-v1-841226 --tables session,experiment \ + uv run python docs/dev/specs/itl-936-live/live_nullability.py read \ + --project my-project-123456 --tables session,session_event \ --float-column [--report read.json] For each table: the record, the source's ``output_schema``, and that every recorded @@ -510,8 +511,10 @@ def main() -> int: if args.mode == "write": if args.allow_writes != args.project: parser.error("write mode needs --allow-writes repeating --project") - if args.project.startswith("edi-sample-v"): - parser.error("never write to an edi-sample-v* project") + if not args.project.startswith("test-"): + parser.error( + "write mode requires a dedicated project whose ID starts with 'test-'" + ) ok = write_mode(args.project, args.dataset or "meta", report) else: tables = [t for t in args.tables.split(",") if t] diff --git a/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py b/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py index 09e78f574..2df1d5423 100644 --- a/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py +++ b/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py @@ -1,17 +1,15 @@ """Read-only live check of ``DerivedSource(tags_as_data=...)`` on SpiralDB (ITL-939). -Reads the ``session`` and ``experiment`` tables of a SpiralDB project, derives a source from -``experiment`` that also offers ``session_start_datetime`` as data, runs a pod on the copy +Reads the ``session`` and ``session_event`` tables of a SpiralDB project, derives a source from +``session_event`` that also offers ``session_started_at`` as data, runs a pod on the copy in memory and joins the result with ``session``. The pod only converts the copied start time -to epoch seconds: it makes no assumption about the meaning of any other EDI column (a first -version subtracted it from ``experiment_start_timestamp``, which in the tutorial dataset is a -relative clock, not microseconds since the epoch). It writes nothing: no database, no store, no -file. +to epoch seconds. The event timestamp may use a relative clock. The check performs no +writes. Needs ``pyspiral`` (the ``spiraldb`` extra) and ``spiral login`` credentials. Usage:: - uv run --extra spiraldb python superpowers/specs/itl-939-live-check/spiraldb_derived_source_check.py \\ - edi-tutorial-v1-841226 [dataset] + uv run --extra spiraldb python docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py \\ + my-project-123456 my_dataset """ from __future__ import annotations @@ -23,9 +21,9 @@ from orcapod.operators import Join from orcapod.sources import DerivedSource, SpiralDBTableSource -TAG = "session_start_datetime" +TAG = "session_started_at" COPY = "session_start" -TIMESTAMP = "experiment_start_timestamp" +TIMESTAMP = "event_timestamp" @function_pod(output_keys="start_epoch_s") @@ -39,18 +37,18 @@ def start_epoch_s(session_start: datetime | None) -> float | None: def main(project: str, dataset: str) -> None: """Run the check and print what it finds.""" session = SpiralDBTableSource(project, "session", dataset=dataset) - experiment = SpiralDBTableSource(project, "experiment", dataset=dataset) - derived = DerivedSource(experiment, tags_as_data={TAG: COPY}) + session_event = SpiralDBTableSource(project, "session_event", dataset=dataset) + derived = DerivedSource(session_event, tags_as_data={TAG: COPY}) - origin_table = experiment.as_table() + origin_table = session_event.as_table() table = derived.as_table(all_info=True) - print("origin keys():", experiment.keys()) + print("origin keys():", session_event.keys()) print("derived keys():", derived.keys()) print("rows origin / derived:", origin_table.num_rows, "/", table.num_rows) print("tag field :", origin_table.schema.field(TAG)) print("copy field:", table.schema.field(COPY)) print("copy equals tag:", table[COPY].equals(table[TAG])) - print("source_id:", experiment.source_id, "->", derived.source_id) + print("source_id:", session_event.source_id, "->", derived.source_id) print("first token:", table[f"_source_{COPY}"][0].as_py()) print("timestamp field:", table.schema.field(TIMESTAMP)) @@ -70,4 +68,4 @@ def main(project: str, dataset: str) -> None: if __name__ == "__main__": - main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else "default") + main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else "my_dataset") diff --git a/tests/test_core/sources/test_spiraldb_table_source_live.py b/tests/test_core/sources/test_spiraldb_table_source_live.py index 050e26b3c..6beee5d1a 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_live.py +++ b/tests/test_core/sources/test_spiraldb_table_source_live.py @@ -2,9 +2,9 @@ Set ``ORCAPOD_SPIRALDB_TEST_PROJECT``, ``ORCAPOD_SPIRALDB_TEST_DATASET`` and ``ORCAPOD_SPIRALDB_TEST_TABLE`` to select a keyed table that spiral-sdk can read. -The table needs ``unit_id`` and ``timestamp`` key columns and a floating-point -``spike_amplitude_uv`` data column. Use a table with more than 1,000 rows across -multiple units for full coverage. Every test is read-only. +The table needs ``sensor_id`` and ``timestamp`` key columns and a floating-point +``reading_value`` data column. Use a table with more than 1,000 rows across +multiple sensors for full coverage. Every test is read-only. uv run --extra spiraldb pytest tests/test_core/sources/test_spiraldb_table_source_live.py """ @@ -69,7 +69,7 @@ def test_building_a_source_is_quick_and_names_the_table(): f"spiraldb_table_v1:{_PROJECT}.{_DATASET}.{_TABLE}@{source.table_id}" ) assert source.table_id.startswith("table_") - assert "unit_id" in source.keys()[0] + assert "sensor_id" in source.keys()[0] assert source.row_count_estimate > 0 @@ -92,13 +92,13 @@ def test_limit_reads_the_first_rows(): def test_where_reads_only_matching_rows_with_the_same_record_ids(): """``where`` reads only matching rows, each with its unfiltered record id.""" first = _live_source(limit=1).as_table(all_info=True) - unit_id = first.column("unit_id")[0].as_py() - source = _live_source(where={"unit_id": unit_id}, max_rows=None) + sensor_id = first.column("sensor_id")[0].as_py() + source = _live_source(where={"sensor_id": sensor_id}, max_rows=None) table = source.as_table(all_info=True) assert table.num_rows > 0 - assert set(table.column("unit_id").to_pylist()) == {unit_id} + assert set(table.column("sensor_id").to_pylist()) == {sensor_id} record_id = next(n for n in table.column_names if n.startswith("_tag_record_id::")) assert first.column(record_id)[0].as_py() in table.column(record_id).to_pylist() @@ -119,10 +119,10 @@ def test_an_async_job_over_a_limited_read(tmp_path: Path): calls: list[float | None] = [] @function_pod(output_keys="doubled") - def double(spike_amplitude_uv: float | None) -> float | None: - """Return twice ``spike_amplitude_uv``, recording the call.""" - calls.append(spike_amplitude_uv) - return None if spike_amplitude_uv is None else 2 * spike_amplitude_uv + def double(reading_value: float | None) -> float | None: + """Return twice ``reading_value``, recording the call.""" + calls.append(reading_value) + return None if reading_value is None else 2 * reading_value def run() -> PipelineJob: """Build the job over a 500-row read and run it asynchronously.""" @@ -140,9 +140,9 @@ def run() -> PipelineJob: def test_tags_as_data_keeps_grouped_timestamps_in_order(): - """Grouped on the unit key, each unit's copied spike times are in time order (ITL-996). + """Grouping by the non-timestamp keys orders each group's copied timestamps (ITL-996). - ``timestamp`` is the only key column outside the unit key, so it alone orders the + ``timestamp`` is the only key column outside the group key, so it alone orders the members of a group. """ _require_a_large_table() @@ -161,10 +161,10 @@ def test_tags_as_data_keeps_grouped_timestamps_in_order(): def _one_unit() -> tuple[SpiralDBTableSource, list[Any]]: - """Return a source on the first unit's rows, and that unit's sorted timestamps. + """Return a source on the first sensor's rows, and that unit's sorted timestamps. The unit is every key column of the first row but ``timestamp`` (CodeRabbit on - PR 574): ``unit_id`` alone can name units of several sessions or probes, whose + PR 574): ``sensor_id`` alone can name units of several sites, whose timestamps the scan reads one group after another, not in one sorted run. """ first = _live_source(limit=1) @@ -175,7 +175,7 @@ def _one_unit() -> tuple[SpiralDBTableSource, list[Any]]: t for t in unit.as_table().column("timestamp").to_pylist() if t is not None ) if len(times) < 8: - pytest.skip("the first unit holds too few rows for a window") + pytest.skip("the first sensor holds too few rows for a window") return unit, times From 25c830feee4329db6caed8f4c21e9b8bec0c42bb Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 20:00:12 -0800 Subject: [PATCH 03/12] docs(changelog): replace historical SpiralDB identifiers --- CHANGELOG.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a52e373ca..5fe8feac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -389,7 +389,7 @@ the dataframe methods. See "Reading a Spiral table" in `docs/concepts/sources.md What changes for existing code: - **Default `source_id`.** It is now `/.
@`, for - example `edi-tutorial-v1-841226/default.session@table_Jo7J0lpkLcOM` (it was + example `my-project-123456/my_dataset.session@table_example12345` (it was `//
`). SpiralDB's own table id makes it unique: a table dropped and created again under the same name is a different source. For a Spiral source built without `source_id`, the `content_hash`, every record ID and every source-info token @@ -681,28 +681,22 @@ format 2, prefix `00 00 02`) is lossless; this is a fix, so the old values are n #### A Spiral source's default `source_id` is `//
` (ITL-926) `SpiralDBTableSource` used the bare table name as its default `source_id`. Tables with the -same name in different projects (the EDI sample projects all share their table names) then -had the same `content_hash`, record IDs and source-info tokens. In one store, a job on one -project read back the other project's pipeline records along with its own (cached results +same name in different projects then had the same `content_hash`, record IDs and source-info +tokens. In one store, a job on one project read back the other project's pipeline records +along with its own (cached results were never mixed up: they are keyed on the row's data). The default is now the project id, -the dataset and the table name, for example `edi-sample-v1-855632/default/session`. +the dataset and the table name, for example `my-project-123456/my_dataset/session`. For a Spiral source built without `source_id`, the `content_hash`, every record ID and every source-info token change, so pipeline records stored by 0.2 for such a source are not found again. The rows are recorded once more and no result is recomputed, because function results -are keyed on the data. For example, table `subject` (key `subject_id`, one row) in project -`edi-sample-v1-855632`: - -- `source_id`: `subject` becomes `edi-sample-v1-855632/default/subject`. -- `content_hash`: `semantic_v0.1:0380725acb90...e7f4f6` becomes - `semantic_v0.1:3a659ed610bb...29a93`. -- Row 0's record ID: `18d1efa53fbc52b6a40f406eca35ca81` becomes - `096c4e22981c52daa2b088bffe729ee7`. +are keyed on the data. In the example above, the default `source_id` changes from `session` +to `my-project-123456/my_dataset/session`. `pipeline_hash` does not change (it depends only on the schema), nor does anything for a source given an explicit `source_id`. To keep 0.2 identities, pass the old value: -`SpiralDBTableSource(project, "subject", source_id="subject")`. Jobs saved by 0.2 store -their `source_id` explicitly and keep it when loaded. +`SpiralDBTableSource(project, "session", dataset="my_dataset", source_id="session")`. +Jobs saved by 0.2 store their `source_id` explicitly and keep it when loaded. #### The Delta store keeps every column's Arrow type; rebuild a Delta store written by an earlier v0.3 build (ITL-928) @@ -1389,8 +1383,8 @@ hash changes: only declarations that used to be accepted are refused. - `SpiralDBTableSource(..., max_rows=, batch_rows=)`, the `row_count_estimate` and `table_id` properties, and `orcapod.errors.SourceTooLargeError` (ITL-186). - A `SpiralDBTableSource` shown in a notebook (its `head()`) reads only its first 10 rows, - in one scan to which `max_rows` does not apply, and its header says how many rows the - table has, for example `first 10 rows of about 63,349` (ITL-186). + in one scan to which `max_rows` does not apply, and its header includes an estimate of the + table's row count (ITL-186). - `SpiralDBConnector.scan_batches(table, where=, limit=, asof=)`, `get_arrow_schema`, `get_spiral_table_id`, `get_table_version` and `get_row_count_estimate`: a restricted scan and metadata-only reads (ITL-186). From 2c5202433aa7780c889dc0ec36660f2244a50126 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 20:52:29 -0800 Subject: [PATCH 04/12] test(spiraldb): check grouping against the bounded live sample --- .../2026-11-12-itl-186-streaming-spiral-source-design.md | 3 ++- .../test_core/sources/test_spiraldb_table_source_live.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md b/docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md index 65e307743..0df56bbb8 100644 --- a/docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md +++ b/docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md @@ -267,7 +267,8 @@ counter: * a job on both orchestrators: function pod, Join with a small source, second run computes nothing, appended row is the only one computed; save and load. -Opt-in live tests (skipped unless `ORCAPOD_SPIRAL_LIVE_PROJECT` is set), read-only against a configured project: +The opt-in live tests require `ORCAPOD_SPIRALDB_TEST_PROJECT`, +`ORCAPOD_SPIRALDB_TEST_DATASET`, and `ORCAPOD_SPIRALDB_TEST_TABLE` to select a keyed table: construction of the selected table makes no scan and takes under 5 s; `limit=1000`; one `where`; an async job over `limit=2000`. One write test confined to a `scratch.` table of that project: append rows between two runs. diff --git a/tests/test_core/sources/test_spiraldb_table_source_live.py b/tests/test_core/sources/test_spiraldb_table_source_live.py index 6beee5d1a..0a8d3957e 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_live.py +++ b/tests/test_core/sources/test_spiraldb_table_source_live.py @@ -154,8 +154,13 @@ def test_tags_as_data_keeps_grouped_timestamps_in_order(): assert "event_time" in per_unit.keys()[1] rows = per_unit.as_table().to_pylist() - assert len(rows) > 1 - assert sum(len(r["event_time"]) for r in rows) == source.as_table().num_rows + sample = source.as_table() + expected_keys = { + tuple(row[key] for key in unit_key) + for row in sample.select(unit_key).to_pylist() + } + assert len(rows) == len(expected_keys) + assert sum(len(r["event_time"]) for r in rows) == sample.num_rows for row in rows: assert row["event_time"] == sorted(row["event_time"]) From 747cda13beafe5325cf7dd9c9df1284ac24dff49 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 21:50:58 -0800 Subject: [PATCH 05/12] revert(changelog): restore the historical release entries This reverts commit 25c830feee4329db6caed8f4c21e9b8bec0c42bb. --- CHANGELOG.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe8feac6..a52e373ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -389,7 +389,7 @@ the dataframe methods. See "Reading a Spiral table" in `docs/concepts/sources.md What changes for existing code: - **Default `source_id`.** It is now `/.
@`, for - example `my-project-123456/my_dataset.session@table_example12345` (it was + example `edi-tutorial-v1-841226/default.session@table_Jo7J0lpkLcOM` (it was `//
`). SpiralDB's own table id makes it unique: a table dropped and created again under the same name is a different source. For a Spiral source built without `source_id`, the `content_hash`, every record ID and every source-info token @@ -681,22 +681,28 @@ format 2, prefix `00 00 02`) is lossless; this is a fix, so the old values are n #### A Spiral source's default `source_id` is `//
` (ITL-926) `SpiralDBTableSource` used the bare table name as its default `source_id`. Tables with the -same name in different projects then had the same `content_hash`, record IDs and source-info -tokens. In one store, a job on one project read back the other project's pipeline records -along with its own (cached results +same name in different projects (the EDI sample projects all share their table names) then +had the same `content_hash`, record IDs and source-info tokens. In one store, a job on one +project read back the other project's pipeline records along with its own (cached results were never mixed up: they are keyed on the row's data). The default is now the project id, -the dataset and the table name, for example `my-project-123456/my_dataset/session`. +the dataset and the table name, for example `edi-sample-v1-855632/default/session`. For a Spiral source built without `source_id`, the `content_hash`, every record ID and every source-info token change, so pipeline records stored by 0.2 for such a source are not found again. The rows are recorded once more and no result is recomputed, because function results -are keyed on the data. In the example above, the default `source_id` changes from `session` -to `my-project-123456/my_dataset/session`. +are keyed on the data. For example, table `subject` (key `subject_id`, one row) in project +`edi-sample-v1-855632`: + +- `source_id`: `subject` becomes `edi-sample-v1-855632/default/subject`. +- `content_hash`: `semantic_v0.1:0380725acb90...e7f4f6` becomes + `semantic_v0.1:3a659ed610bb...29a93`. +- Row 0's record ID: `18d1efa53fbc52b6a40f406eca35ca81` becomes + `096c4e22981c52daa2b088bffe729ee7`. `pipeline_hash` does not change (it depends only on the schema), nor does anything for a source given an explicit `source_id`. To keep 0.2 identities, pass the old value: -`SpiralDBTableSource(project, "session", dataset="my_dataset", source_id="session")`. -Jobs saved by 0.2 store their `source_id` explicitly and keep it when loaded. +`SpiralDBTableSource(project, "subject", source_id="subject")`. Jobs saved by 0.2 store +their `source_id` explicitly and keep it when loaded. #### The Delta store keeps every column's Arrow type; rebuild a Delta store written by an earlier v0.3 build (ITL-928) @@ -1383,8 +1389,8 @@ hash changes: only declarations that used to be accepted are refused. - `SpiralDBTableSource(..., max_rows=, batch_rows=)`, the `row_count_estimate` and `table_id` properties, and `orcapod.errors.SourceTooLargeError` (ITL-186). - A `SpiralDBTableSource` shown in a notebook (its `head()`) reads only its first 10 rows, - in one scan to which `max_rows` does not apply, and its header includes an estimate of the - table's row count (ITL-186). + in one scan to which `max_rows` does not apply, and its header says how many rows the + table has, for example `first 10 rows of about 63,349` (ITL-186). - `SpiralDBConnector.scan_batches(table, where=, limit=, asof=)`, `get_arrow_schema`, `get_spiral_table_id`, `get_table_version` and `get_row_count_estimate`: a restricted scan and metadata-only reads (ITL-186). From 18dbd4c89c5f3c9566d336cf9bd1d4c8a35f58bb Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 21:51:07 -0800 Subject: [PATCH 06/12] docs(dev): restore development material from main --- docs/dev/design_issues/ITL-1165-RN1.md | 19 ++++- .../design_issues/ITL-1767-PJCOLLISION1.md | 17 +++++ docs/dev/design_issues/ITL-186-SP4.md | 2 +- docs/dev/design_issues/ITL-926-SP2.md | 11 +-- docs/dev/design_issues/ITL-936-SP3.md | 2 +- ...26-11-11-itl-926-spiral-source-reverify.md | 2 +- ...11-11-itl-936-spiral-nullability-record.md | 6 +- .../2026-11-12-itl-186-notebook-preview.md | 6 +- ...6-11-12-itl-186-streaming-spiral-source.md | 4 +- .../2026-11-12-itl-996-spiral-tags-as-data.md | 17 ++--- ...11-13-itl-1017-merged-source-info-token.md | 9 ++- ...-itl-186-spiral-streaming-source-design.md | 13 ++-- ...1-itl-939-tag-and-data-same-name-design.md | 2 +- ...-itl-186-streaming-spiral-source-design.md | 52 ++++++------- .../2026-11-12-itl-186-what-a-job-keeps.md | 4 +- ...-itl-991-stream-head-and-preview-design.md | 4 +- .../2026-11-13-itl-1074-test-inventory.md | 2 +- .../dev/specs/itl-1347-job-table-transport.md | 2 +- docs/dev/specs/itl-1347/stage-0.md | 4 +- docs/dev/specs/itl-926-live/FINDINGS.md | 76 +++++++++++-------- docs/dev/specs/itl-926-live/error_messages.py | 5 +- docs/dev/specs/itl-926-live/inspect_tables.py | 7 +- docs/dev/specs/itl-926-live/live_verify.py | 27 ++++--- .../repros/c2_fixed_size_list_cannot_hash.py | 2 +- .../itl-926-live/repros/c3_source_memory.py | 4 +- .../source_id_collision_across_projects.py | 23 +++--- .../dev/specs/itl-926-live/scan_cost_probe.py | 4 +- docs/dev/specs/itl-926-live/size_probe.py | 2 +- .../specs/itl-936-live/live_nullability.py | 19 ++--- .../spiraldb_derived_source_check.py | 30 ++++---- 30 files changed, 212 insertions(+), 165 deletions(-) create mode 100644 docs/dev/design_issues/ITL-1767-PJCOLLISION1.md diff --git a/docs/dev/design_issues/ITL-1165-RN1.md b/docs/dev/design_issues/ITL-1165-RN1.md index a71fd0d3a..9727988e6 100644 --- a/docs/dev/design_issues/ITL-1165-RN1.md +++ b/docs/dev/design_issues/ITL-1165-RN1.md @@ -1,7 +1,7 @@ ## Cross-cutting ### RN1 — Reserved `_` column names: sources silently drop them, `Pick` / `Index` accept them as new names -**Status:** open +**Status:** resolved **Severity:** medium **Issue:** ITL-1165 @@ -25,3 +25,20 @@ November 16, 2026 while fixing ITL-1160, probed on that branch): To decide: which names are reserved; then a source refuses such a column with an error naming it instead of dropping it, and `Pick` / `Index` refuse a reserved `out` name through the same helper as the mappers. + +**Fix:** Reserve all leading-underscore column names for Orcapod. Raw source readers +report the offending columns and how to remove or rename them. The same rule covers +new operator names and function pod output keys, including user data returned by custom +functions before caching or emission and user keys read from stored results. Operator +caches and cached sources check user columns before exposing rows, including when an +operator's records feed a derived source. +Manual function result cache writes also check output keys, and an invalid cached +result fails the run as a stored-table read error. +`DataFrameSource` checks the names on incoming frames and on the frame Polars infers +from Python inputs. Polling checks the columns Polars infers from Python batches. List +sources validate callback user tags before asking for further tags. DictSource checks +declared schemas before consuming rows and each row of a custom collection before advancing +it. A saved operator schema +identifies legacy user names even when a mixed table alone cannot distinguish them +from system tags. +SpiralDB validates the pinned snapshot's column names for historical reads. diff --git a/docs/dev/design_issues/ITL-1767-PJCOLLISION1.md b/docs/dev/design_issues/ITL-1767-PJCOLLISION1.md new file mode 100644 index 000000000..78ea0c2ab --- /dev/null +++ b/docs/dev/design_issues/ITL-1767-PJCOLLISION1.md @@ -0,0 +1,17 @@ +## `src/orcapod/pipeline/job.py` — job execution graph identity + +### PJCOLLISION1 — Equal steps in separate slots share one execution vertex +**Status:** open +**Severity:** high +**Issue:** ITL-1767 + +The capture graph keeps steps over different named source declarations. After those +slots are bound, a direct self-join and a two-slot join can compare equal as keys +in the execution graph, and a step below either join can do the same. Both steps +are visible in `job.nodes`, but only one receives current-run rows. Identical +unary pods over different slots bound to the same source have the same problem. + +**Mitigation:** Job compilation refuses distinct steps that share an execution +vertex, even when no keys match or both steps already hold current results. +Sharing the source itself still works. The follow-up is to let both steps run +and read their rows independently. diff --git a/docs/dev/design_issues/ITL-186-SP4.md b/docs/dev/design_issues/ITL-186-SP4.md index ff5c5b0ae..2cf386e49 100644 --- a/docs/dev/design_issues/ITL-186-SP4.md +++ b/docs/dev/design_issues/ITL-186-SP4.md @@ -6,7 +6,7 @@ **Issue:** ITL-186 `SpiralDBTableSource` inherited `DBTableSource`'s constructor, which read every row and built -provenance for the whole table: about 4.6 GB for a table with roughly 8 million rows. Design and +provenance for the whole table: about 4.6 GB for the 8,087,906-row `spike_event`. Design and measurements: `docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md`. **Fix:** the source is built from metadata only (schema, key columns, SpiralDB's table id) and diff --git a/docs/dev/design_issues/ITL-926-SP2.md b/docs/dev/design_issues/ITL-926-SP2.md index 165e6aacf..02f4b62e0 100644 --- a/docs/dev/design_issues/ITL-926-SP2.md +++ b/docs/dev/design_issues/ITL-926-SP2.md @@ -5,7 +5,8 @@ **Severity:** high **Issue:** ITL-926 (follow-ups: ITL-186 streaming source) -Re-verified against a live project (read-only) and a disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`). The workshop path works: +Re-verified against the EDI sample project (`edi-sample-v1-855632`, read-only) and a +disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`). The workshop path works: a `SpiralDBTableSource` with a composite key, a `Join` of two Spiral sources, a function pod, a Delta database, a re-run with no function calls, save and load, and the same hashes in a fresh process. Findings, with repro scripts, are in `docs/dev/specs/itl-926-live/FINDINGS.md`. @@ -24,13 +25,13 @@ process. Findings, with repro scripts, are in `docs/dev/specs/itl-926-live/FINDI **Open (developer decisions pending):** -* Every column of the tables examined is nullable, so a function pod over them must +* Every column of the EDI sample tables is nullable, so a function pod over them must annotate `T | None`; recorded columns arrive as `T` (SP3, ITL-936). * `fixed_size_list` columns could not be hashed with starfix 0.4.0; they are hashed since Orcapod adopted starfix 0.5.0 (ITL-910, ITL-927). `map` columns are still refused: the - source raises `ValueError` naming every refused column (none in the tables examined). -* The whole table is read at construction, which rules out tables with millions of rows. - The streaming design is in + source raises `ValueError` naming every refused column (none in the EDI tables). +* The whole table is read at construction, which rules out tables such as `spike_event` + (8.1M rows); the streaming design is in `docs/dev/specs/2026-11-11-itl-186-spiral-streaming-source-design.md`. * Record IDs are positional; key-based IDs are approved for the streaming source work (ITL-186). diff --git a/docs/dev/design_issues/ITL-936-SP3.md b/docs/dev/design_issues/ITL-936-SP3.md index 1161ccfc9..ace1c4dd1 100644 --- a/docs/dev/design_issues/ITL-936-SP3.md +++ b/docs/dev/design_issues/ITL-936-SP3.md @@ -5,7 +5,7 @@ **Severity:** high **Issue:** ITL-936 -Live, pyspiral 0.16.33, a scratch table in a live project (November 11, 2026): a +Live, pyspiral 0.16.33, scratch table in `edi-tutorial-v1-841226` (November 11, 2026): a table written with `k`, `v`, struct `g` and its field `g.x`, and list `l` with its items all declared non-null reports `Schema({k=i64?, l=fixed_size_list(f32)[2]?, v=i32?, w=i32?, g={x=i32?, y=i32?}?})`: every top-level column and struct field nullable; only list items keep diff --git a/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md b/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md index 11c5684ca..47153140b 100644 --- a/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md +++ b/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md @@ -52,7 +52,7 @@ DESIGN_ISSUES entry, full suite one Python version at a time, PR. - 2026-11-11 Phase 1 done: fake (`tests/test_databases/fake_pyspiral.py`), live kit (`superpowers/specs/itl-926-live/live_verify.py` read-only + write modes, `inspect_tables.py`), findings in `superpowers/specs/itl-926-live/FINDINGS.md`. - Developer decisions so far: examples run read-only on a live project; writes only + Developer decisions so far: workshop runs read-only on `edi-sample-v1-855632`; writes only to a separate test project (being provisioned); stay on a working pyspiral; CI restore nice-to-have. Live read-only probing from this terminal was blocked by the permission classifier after one successful call. Sent the Phase 1 `ask`; waiting for decisions. diff --git a/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md b/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md index cfe6c8241..7df6413cb 100644 --- a/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md +++ b/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md @@ -66,7 +66,7 @@ into a struct of null fields ("SpiralDB doesn't allow struct-level nullability") * A path is a list of segments: the top-level column name, then a struct field name, or `"[]"` for the item of a `list` / `large_list` / `fixed_size_list`. Segments are read against the type, so a struct field literally named `"[]"` is not ambiguous. Map interiors are not - recorded (the inspected tables had no maps; SpiralDB maps unverified): writing a table whose map item + recorded (no EDI table has maps; SpiralDB maps unverified): writing a table whose map item field is declared non-null raises rather than silently widening it. * It asserts exactly: each listed field is non-nullable (Arrow meaning: no null in its array). Every field not listed keeps whatever nullability SpiralDB reports (list items stay @@ -225,7 +225,7 @@ if read_nullability_record(table.get_metadata()) != read_nullability_record(kv): - [ ] Full suite (one Python version), ruff, basedpyright, golden hashes unchanged. - [ ] Live check script under `superpowers/specs/itl-936-live/` + exact commands for the - coordinator to run against a test project. + coordinator on `edi-tutorial-v1-841226`. - [ ] Merge origin/main, push, PR (stacked on #305), attach, worker_done. ## Notes @@ -245,7 +245,7 @@ non-null flag SpiralDB does not keep: ### Pinned hashes for an UNRECORDED table (computed at 49956a6a, before any library change) -One-row synthetic fixture (`subject_id`, `sex`; written non-null, stored nullable), +One-row `edi-sample-a/default/subject` (`subject_id`, `sex`; written non-null, stored nullable), `source_id="subject"`: * `output_schema`: `({'subject_id': str | None}, {'sex': str | None})` diff --git a/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md b/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md index 76dc0bddc..d05f90197 100644 --- a/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md +++ b/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md @@ -39,9 +39,9 @@ manifest row count only when the head is not the whole read. A private class swi | Case | Header after `SpiralDBTableSource[
` only**, the readable name shown in `label`, `repr` and the saved file. A renamed table keeps its whole identity. Cost: every provenance token - in stored data reads `my-project-123456/table_example12345::...`, which no longer says - `sensor_reading`. + in stored data reads `edi-tutorial-v1-841226/table_W7C01nkLTmEJ::...`, which no longer says + `spike_event`. * **C: readable source id, table id only in `identity_structure`.** Rejected: the content hash is unique, but record ids and tokens of a recreated table collide with the old table's. @@ -131,10 +132,10 @@ FIXED: from the primary key, never from row content. to fewer, non-unique columns. `record_id_column` is no longer needed for this source and is removed from it. * Token format, options: - * **(recommended) readable**: `site_id=north,sensor_id=106,...` in key order, values as + * **(recommended) readable**: `subject_id=Goliath,unit_id=106,...` in key order, values as Arrow renders them, with `%`, `,`, `=` and `:` percent-escaped. Escaping is required: the real `spike_extraction_hash` values contain `::`, the separator inside source-info - values. About 290 characters for `sensor_reading`. + values. About 290 characters for `spike_event`. * short: a hex digest of the key values. Fixed length, but a person can no longer find the row from a provenance token. * Record id stays `uuid5(source_id + "::" + token)`, as for every source. @@ -148,7 +149,7 @@ FIXED: from the primary key, never from row content. One scan per read: `scan(table.select(), where=, limit=, asof=).to_record_batches()`. Each Spiral batch is cut into slices of at most `batch_rows` rows (default **8,192**; Spiral's own -batches exceeded the default), normalized to large types, checked against the nullability +batches were up to 48,578 rows), normalized to large types, checked against the nullability record (#308), enriched in Arrow, and yielded row by row. Nothing is accumulated. No `to_pylist()` of a table, no table hash. Memory: about 90 MB at the default. @@ -165,8 +166,8 @@ hash; `SelectDataColumns` exists downstream). | `as_table`, `as_df`, `as_polars_df`, `as_pandas_df`, `as_lazy_frame` | read the (restricted) rows into one Arrow table; `as_lazy_frame` stays `as_polars_df().lazy()` | | `len` / count | none exists today; none added | -First N rows: `SpiralDBTableSource(project, "sensor_reading", limit=1000)`. A subset: -`where={"site_id": "north", "sensor_id": 106}` (equality only, combined with "and"; it is +First N rows: `SpiralDBTableSource(project, "spike_event", limit=1000)`. A subset: +`where={"subject_id": "Goliath", "unit_id": 106}` (equality only, combined with "and"; it is saved in the job file). Key ranges are not offered (see the measurements). The size guard, options: @@ -176,7 +177,7 @@ The size guard, options: fails when row `max_rows + 1` arrives. The message gives the count and the three ways out: `limit=`, `where=`, or a larger `max_rows` (`None` removes the cap). 100,000 rows is about 0.5 GB per job node. -* Cap only on the `as_table` family: `job.run()` on the full `sensor_reading` would then exhaust +* Cap only on the `as_table` family: `job.run()` on the full `spike_event` would then exhaust a laptop's memory. * No cap. @@ -188,8 +189,8 @@ The size guard, options: PostgreSQL and SQLite sources are untouched. ```python - SpiralDBTableSource("my-project-123456", "sensor_reading", - dataset="my_dataset", where={"sensor_id": 106}, max_rows=100_000) + SpiralDBTableSource("edi-tutorial-v1-841226", "spike_event", + where={"unit_id": 106}, limit=None, max_rows=100_000) ``` Saved form (`source_type` stays `spiraldb_table`): `{project_id, dataset, table_name, table_id, where, limit, asof, max_rows, batch_rows, @@ -267,9 +268,8 @@ counter: * a job on both orchestrators: function pod, Join with a small source, second run computes nothing, appended row is the only one computed; save and load. -The opt-in live tests require `ORCAPOD_SPIRALDB_TEST_PROJECT`, -`ORCAPOD_SPIRALDB_TEST_DATASET`, and `ORCAPOD_SPIRALDB_TEST_TABLE` to select a keyed table: -construction of the selected table makes no scan and takes under 5 s; +Opt-in live tests (skipped unless `ORCAPOD_SPIRAL_LIVE_PROJECT` is set), read-only on +`edi-tutorial-v1-841226`: construction of `spike_event` makes no scan and takes under 5 s; `limit=1000`; one `where`; an async job over `limit=2000`. One write test confined to a `scratch.` table of that project: append rows between two runs. diff --git a/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md b/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md index 77b18e94c..74f13557a 100644 --- a/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md +++ b/docs/dev/specs/2026-11-12-itl-186-what-a-job-keeps.md @@ -1,7 +1,7 @@ # What a pipeline job keeps in memory (finding from ITL-186, input to ITL-858) November 12, 2026. Read from the code on `main` at 25650c42 and measured on synthetic -sensor_reading-shaped rows (7 tag columns, 1 data column). Not a proposal. +spike_event-shaped rows (7 tag columns, 1 data column). Not a proposal. ## Measured @@ -27,7 +27,7 @@ above. ## Consequence On either orchestrator a job over N rows holds roughly N × 5 KB for each node that keeps its -output. 100,000 rows: about 0.5 GB per node. A keyed table with roughly 8 million rows needs about 43 GB per +output. 100,000 rows: about 0.5 GB per node. The 8,087,906-row `spike_event`: about 43 GB per node, and 15 minutes of row iteration before any pod runs. A source that streams in bounded memory (ITL-186) does not change this. diff --git a/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md b/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md index 7f07d2417..209df2dc6 100644 --- a/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md +++ b/docs/dev/specs/2026-11-12-itl-991-stream-head-and-preview-design.md @@ -98,7 +98,7 @@ Header line (rendered by `StreamHead`, one wording table so #333 and every class |---|---| | ROWS, total known, total > n | `ArrowTableSource[readings] — first 10 of 1,234 rows` | | ROWS, total ≤ n | `ArrowTableSource[readings] — all 7 rows` | -| ROWS, estimate | `SpiralDBTableSource[sensor_reading] — first 10 rows of about 25,000` | +| ROWS, estimate | `SpiralDBTableSource[spike_event] — first 10 rows of about 63,349` | | ROWS, total unknown | `… — first 10 rows` | | ROWS from a node's store | `FunctionJobNode[score] — first 10 of 1,234 stored rows` | | ROWS from a stream's cache | `FunctionPodStream[score] — first 10 of 500 computed rows` | @@ -323,7 +323,7 @@ no slack). #333 adds `StreamBase._preview(columns, all_info) -> (pl.DataFrame, note)` (default: today's behaviour) and a Spiral override that reads ≤ 10 rows with Spiral's `limit` and -renders `SpiralDBTableSource[sensor_reading] — first 10 rows of about 25,000`. +renders `SpiralDBTableSource[spike_event] — first 10 rows of about 63,349`. - `StreamBase._preview` is removed; `head` is the override point. - The Spiral override becomes: diff --git a/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md b/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md index 43b6b6aa2..5d34a3d34 100644 --- a/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md +++ b/docs/dev/specs/2026-11-13-itl-1074-test-inventory.md @@ -38,7 +38,7 @@ the same commit, the static marks in the tree, and local runs of the files that | Group | Count | Stated reason | Verified cause | Verdict | |---|---|---|---|---| -| Live Spiral source: `tests/test_core/sources/test_spiraldb_table_source_live.py` | 8 | "Set ORCAPOD_SPIRAL_LIVE_PROJECT to run" | The variable is set nowhere in `.github/`. The tests need a real Spiral project holding a `sensor_reading` table of more than 1,000 rows, credentials and network. | Correct to skip in `Run Tests`. Could run in the `spiral-integration` job once that job works and a project with the table exists (needs a developer decision and Spiral data). | +| Live Spiral source: `tests/test_core/sources/test_spiraldb_table_source_live.py` | 8 | "Set ORCAPOD_SPIRAL_LIVE_PROJECT to run" | The variable is set nowhere in `.github/`. The tests need a real Spiral project holding a `spike_event` table of more than 1,000 rows, credentials and network. | Correct to skip in `Run Tests`. Could run in the `spiral-integration` job once that job works and a project with the table exists (needs a developer decision and Spiral data). | | Spiral connector integration: `test_spiraldb_connector_integration.py` | 9 | "Set SPIRAL_INTEGRATION_TESTS=1" | Run by the `spiral-integration` job (push to `main` only), which sets the variable. In that job all 9 **fail** (section 3.2). | Correct to skip in `Run Tests`; the job that runs them is broken. | | S3 / MinIO: `test_delta_table_database_s3.py` (7), `test_list_table_paths.py::test_s3_lists_tables_and_nested_tables` (1) | 8 | "MinIO container could not be started: 404 ... pull access denied for minio/minio" | See 3.3. The fixture starts MinIO with testcontainers and skips on any exception; in CI the image cannot be pulled, so the S3 path is never tested. | Should run in CI but does not; needs a SpiralDB workload credential (3.3, ITL-1079, ITL-1008). | | Delta tables under special-character roots: `test_delta_native_fs_read.py` (`x#y`, `q?r`, two tests each) | 4 | "deltalake cannot write a table at ..." | `_write_or_skip` skips when `deltalake` itself cannot write a table under a root named `x#y` or `q?r`. The other six special names run and pass. | Correct to skip: a limit of `deltalake`, not of Orcapod. Re-check on each `deltalake` upgrade. | diff --git a/docs/dev/specs/itl-1347-job-table-transport.md b/docs/dev/specs/itl-1347-job-table-transport.md index c830fafd5..21769a847 100644 --- a/docs/dev/specs/itl-1347-job-table-transport.md +++ b/docs/dev/specs/itl-1347-job-table-transport.md @@ -113,7 +113,7 @@ The ITL-1345 profile (workshop-scale notebook on 0.4.0rc1, local Delta copy, no | Warm run: rebuilding Arrow tables from those rows (`_rows_to_table`, `_materialize_as_stream`) | ~32% (~14 s) | | Warm run: operator compute / reads / all hashing | ~8% / ~1% / ~0.3% | | `Data.__init__` calls; `normalize_schema_to_large_types` calls | 121,139; 363,466 (three per row) | -| One source of about 60,000 rows: `as_table()` / `list(iter_data())` | 0.29 s / 9.1 s | +| One source of 63,349 rows: `as_table()` / `list(iter_data())` | 0.29 s / 9.1 s | About 90% of a warm run converts Arrow tables into rows and back. diff --git a/docs/dev/specs/itl-1347/stage-0.md b/docs/dev/specs/itl-1347/stage-0.md index 479292cea..d4ba53b47 100644 --- a/docs/dev/specs/itl-1347/stage-0.md +++ b/docs/dev/specs/itl-1347/stage-0.md @@ -17,7 +17,7 @@ records stay outside the repository. - **Machine**: Python 3.14 on an Apple silicon Mac. One heavy process at a time; the 1-minute load average is given with each number. - **Workload**: a workshop-shaped pipeline on a local Delta copy. It has two sources - (roughly 60,000 and 30,000 rows), eight operator nodes (`GroupBy` ×2, `DropNulls`, `MapData` ×2, + (63,349 and 28,780 rows), eight operator nodes (`GroupBy` ×2, `DropNulls`, `MapData` ×2, `SelectDataColumns` ×2, `Join`) and two function nodes. Every edge has one successor. ## Workshop-shaped job: time @@ -52,7 +52,7 @@ first count on job-speed missed them, because ITL-1348 builds rows without The 121,041 edge rows split by producer as follows: - the two sources: 92,129 rows; -- the operator nodes: roughly 29,000 rows, most of them from one node (`DropNulls`); +- the operator nodes: 28,911 rows, of which 28,780 come from one node (`DropNulls`); - the function node feeding the join: 1 row. On job-speed, `_rows_to_table` still costs about 15.4 s of the 29 s warm run: 11.6 s on diff --git a/docs/dev/specs/itl-926-live/FINDINGS.md b/docs/dev/specs/itl-926-live/FINDINGS.md index b448f8ed3..3de5195a0 100644 --- a/docs/dev/specs/itl-926-live/FINDINGS.md +++ b/docs/dev/specs/itl-926-live/FINDINGS.md @@ -2,16 +2,19 @@ Audit of `SpiralDBTableSource` / `DBTableSource` / `SpiralDBConnector`, an end-to-end run of the workshop path through a disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`), -a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scripts are in `docs/dev/specs/itl-926-live/`. +a pyspiral 0.14.9 → 0.16.33 API check, and one read-only live call against +`edi-sample-v1-855632`. Repro scripts: `superpowers/specs/itl-926-live/` and the session +scratchpad (listed in the plan). -## Live facts (read-only) +## Live facts (EDI sample V1, read-only) * Schema dump (developer): **every column is nullable, key columns included** (`utf8?`, - `u32?`, `vortex.timestamp[µs](i64?)`). Keys are composite: strings, a microsecond timestamp and `u32` indexes. Value types include `u32`/`u64`, - `f32`, `list(...)`, `fixed_size_list(...)[n]`, structs with nested lists, - `binary`, `date[days]`. + `u32?`, `vortex.timestamp[µs](i64?)`). Keys are composite: string hashes, `subject_id`, + `session_start_datetime` (timestamp µs), `u32` indexes. Value types include `u32`/`u64`, + `f32`, `list(...)`, `fixed_size_list(...)[n]`, structs with nested lists (`unit`), + `binary` (`frame_jpeg`), `date[days]`. * pyspiral **0.16.33** (overlay env, repo code unchanged) authenticates with the developer's - login, lists the tables in 1.2 s and scans one with a small limit, also in 1.2 s. + login, lists the 27 tables in 1.2 s and scans `atlas` (limit 3) in 1.2 s. * pyspiral **0.14.9** (the repo lock) does **not** use that login: it started a device-login flow, which was aborted at once. * A second read-only probe was blocked by the Claude Code permission classifier in this @@ -22,20 +25,24 @@ a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scrip ### Critical: workshop blockers -1. **All-nullable columns make every function pod with a plain type fail.** With a nullable schema every tag and data column is `T | None`. `@function_pod def f(x: float)` on such a +1. **All-nullable columns make every function pod with a plain type fail.** With the EDI + schemas every tag and data column is `T | None`. `@function_pod def f(x: float)` on such a stream raises `ValueError: ... column 'x' has type float | None, the function expects float`. Pods annotated `x: float | None` work. Repro: `repros/c1_nullable_columns_refuse_plain_pods.py`. 2. **`fixed_size_list` columns crash source construction.** `starfix` 0.4.0 (latest) raises `NotImplementedError: Unsupported leaf type: fixed_size_list<...>` from - `arrow_hasher.hash_table`. General: `ArrowTableSource` fails the same way. Any table with that column type is affected. Repro: + `arrow_hasher.hash_table`. General: `ArrowTableSource` fails the same way. EDI tables hit: + `experiment_display_params`, `experiment_freeviewing_params`, + `experiment_screen_capture_event`, `lfp_timeseries`. Repro: `repros/c2_fixed_size_list_cannot_hash.py`. **Status:** starfix support is implemented (nauticalab/starfix#22, ITL-927) and ships in starfix 0.5.0; Orcapod gets it when it adopts 0.5.0 (ITL-910). 3. **Large tables cannot be used.** The source reads the whole table eagerly and `SourceStreamBuilder` calls `table.to_pylist()` for provenance tokens. Measured: 200k - sensor_reading-shaped rows take 0.9 s and add about 210 MB of peak RSS for 8.6 MB of Arrow + spike_event-shaped rows take 0.9 s and add about 210 MB of peak RSS for 8.6 MB of Arrow data (about 25×). There is no column projection, row filter or limit on the source. - Tables with many rows or wide binary columns are at risk. Repro: `repros/c3_source_memory.py`. + `spike_event`, `lfp_timeseries`, `experiment_gaze_online_timeseries` and + `experiment_screen_capture_frame_270p` are at risk. Repro: `repros/c3_source_memory.py`. **Status:** this PR removes the whole-table `to_pylist()` (C3b, byte-identical), so the same 200k rows now add about 115 MB; reading large tables at all is the streaming source (ITL-186). @@ -46,7 +53,8 @@ a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scrip 5. **Naive timestamp tags become UTC on one read path.** `FunctionJobNode.as_table()` returns a `timestamp[us]` tag as `timestamp[us, tz=UTC]`; `get_all_records()` and an in-memory pod keep `timestamp[us]`. General (not Spiral); repro `repros/h1_timestamp_tag_becomes_utc.py`. - Being filed as a separate issue. Composite keys can include a naive timestamp. + Being filed as a separate issue. EDI keys include + `session_start_datetime`. 6. **Record identity is positional by default.** Inserting a row whose key sorts first re-keys every later row, giving duplicate pipeline entries; function results are still cached (one call). Repro: `repros/h2_positional_record_ids.py`. `record_id_column` takes one column only, so a composite primary key @@ -67,7 +75,7 @@ a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scrip 10. **Logical (extension) types do not survive a Spiral source.** An Orcapod `Path` column comes back as `large_string`: the connector's KV metadata (ITL-471) stores `field.metadata` only (the extension lives in the type), and `DBTableSource` rebuilds - fields without metadata. + fields without metadata. The EDI tables have none. 11. **ITL-40:** the asymmetry is fixed at top level (`get_column_info` and `iter_batches` both map `string`/`binary` to the large variants). Nested types (`list`, struct children) are normalized by neither, which breaks the "normalize recursively" @@ -77,7 +85,7 @@ a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scrip `to_config()` go through Python types, so an `int32`/`uint32` key is saved as `int64`, and a `SourceProxy` fallback gets the wrong width. General. 13. **`source_id` defaults to the bare table name.** Same-named tables in two projects or - datasets (for example, two test projects) get the same `source_id`, and therefore + datasets (for example, two EDI sample projects) get the same `source_id`, and therefore the same record IDs and provenance tokens. 14. **Docs:** credentials live at `typer.get_app_dir("pyspiral")/auth.json` (`~/Library/Application Support/pyspiral/` on macOS), not `~/.config/pyspiral/` as the @@ -85,7 +93,8 @@ a pyspiral 0.14.9 → 0.16.33 API check, and a read-only live check. Repro scrip ### Low -15. `decimal128` and dictionary columns map to `typing.Any` (a general converter gap). Spiral refuses struct-level nulls on write. +15. `decimal128` and dictionary columns map to `typing.Any` (a general converter gap; the EDI + tables have none). Spiral refuses struct-level nulls on write (write side only). ## Verified working (fake; same code path as live) @@ -123,13 +132,14 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` ## Live read-only run (coordinator, November 11, 2026, pyspiral 0.16.33) -* `inspect_tables.py`: all tables. The scan types are `string` (non-large), `timestamp[us]` +* `inspect_tables.py`: all 27 tables. The scan types are `string` (non-large), `timestamp[us]` with **no timezone**, `date32`, `uint32`/`uint64`, `int16`/`int32`, `float`, `list<...>`, - `fixed_size_list<...>[n]`, structs with nested lists, and `large_binary`. Every field is nullable, key fields included. A 3-row scan takes 0.7–1.7 s; - two tables took 9.2 s and 14.5 s respectively. -* `live_verify.py` read-only on two related keyed tables: all 7 checks pass. Every tag and data + `fixed_size_list<...>[n]`, structs with nested lists (`unit`), and `large_binary` + (`frame_jpeg`). Every field is nullable, key fields included. A 3-row scan takes 0.7–1.7 s; + `experiment_display_params` takes 9.2 s and `unit` 14.5 s. +* `live_verify.py` read-only on `session,experiment`: all 7 checks pass. Every tag and data column is `T | None` (C1 confirmed live), and `content_hash` and `pipeline_hash` are - identical in a fresh process. + identical in a fresh process. Both tables have 1 row in this sample. * The protobuf `UserWarning` lines on import came from the locked `substrait` 0.26.0 (protobuf 5 generated code under the protobuf 6 runtime). A fresh `pip install orcapod[spiraldb]` resolves substrait 0.30.0 and shows no warning, so attendees @@ -138,8 +148,8 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` ## The attendee path: Orcapod only, after one `spiral login` 1. **Eager read.** Construction reads the whole table (`DBTableSource.__init__`). For - sensor_reading-shaped data, 200k rows take 0.9 s and +210 MB of peak RSS (+115 MB with C3b), - so a table with about 8 million rows needs roughly 8.5 GB (about 4.6 GB with C3b) and minutes. + spike_event-shaped data, 200k rows take 0.9 s and +210 MB of peak RSS (+115 MB with C3b), + so `spike_event` (8,087,906 rows) needs roughly 8.5 GB (about 4.6 GB with C3b) and minutes. That is not usable on a laptop. `size_probe.py` gives per-table row counts from the manifests (no scan) and measured build costs for tables under a cap. 2. **Restricting rows or columns.** Nothing is pushed down to Spiral today: no projection, @@ -176,7 +186,7 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` pyspiral's `ProjectId`: the API resource id, created from an `id_prefix` plus a server-generated suffix, and distinct from the display `description`. Repro of the problem it fixes: `repros/source_id_collision_across_projects.py`. Before the - fix, with two projects, the same `item` table and one store, project B's job + fix, with two projects, the same `subject` table and one store, project B's job `get_all_records()` returned 4 rows (A's 2 and B's 2) with nothing to tell them apart. After the fix it returns B's 2. Results were never served across projects (they are keyed on row data). `PostgreSQLTableSource` and `SQLiteTableSource` still default to the bare @@ -188,11 +198,13 @@ secret (GitHub OIDC), `vars.SPIRAL_PROJECT_ID` and `vars.SPIRAL_SERVER_URL` Spiral, so it cannot override declared nullability in either direction. * **C2**: starfix will support FixedSizeList (ITL-927); the type is kept intact here. -## Why a small table with nested columns takes about 35 s live +## Why `unit` (100 rows) takes about 35 s live -Orcapod's share is small: a synthetic 100-row table with similarly nested structs builds in 0.41 s in the fake, mostly struct and list hashing. The live 3-row `scan` -of the table alone took 14.5 s, against about 1 s for other tables, so the time is the Spiral -scan: likely one column group or fragment fetched after another. `scan_cost_probe.py` reports column groups, fragments, and scan times for keys only, full, and +Orcapod's share is small: the same 100-row shape (4 structs with 31, 7 list, 10 and 8 +fields) builds in 0.41 s in the fake, mostly struct and list hashing. The live 3-row `scan` +of `unit` alone took 14.5 s, against about 1 s for other tables, so the time is the Spiral +scan: likely one column group or fragment fetched after another. `scan_cost_probe.py unit +unit_location` reports column groups, fragments, and scan times for keys only, full, and full again. Compacting the table may help; that is for the developer or Spiral to judge. ## Found during the CodeRabbit round (November 11, 2026) @@ -201,18 +213,20 @@ full again. Compacting the table may help; that is for the developer or Spiral t Unsupported leaf type: map<...>` from `arrow_hasher.hash_table`, the same failure as `fixed_size_list` (C2), so no source can be built on a table with a map column. The connector itself reads maps correctly (large-normalized, key/item names and nullability - kept; tested). The tables examined had no map columns. Whether starfix 0.5.0 covers maps + kept; tested). The EDI sample tables have no map columns. Whether starfix 0.5.0 covers maps is to check (ITL-927/ITL-910). ## Second live read-only run (coordinator, November 11, 2026) -* `live_verify.py` on two keyed tables with a numeric data column: all 7 checks pass - (one call per distinct value on run 1, no calls on run 2, identical hashes in a fresh - process, and all rows returned by the loaded job). +* `live_verify.py --tables unit,sample_unit --value-column firing_rate_hz`: all 7 checks pass + (100 calls for 100 distinct values and 100 rows; no calls on run 2; hashes identical in a + fresh process; the loaded job reads 100 rows). * Every Delta write prints `deltalake_core::writer::stats` WARN lines ("Skipping column __node_content_hash because it's a binary field", ...). Attendees will see them. This is the known `RUST_LOG` item held from ITL-821. -* The table has an empty root column group and one group per struct column. SpiralDB cannot scan key columns alone ("Reading key columns without +* `unit` has 5 column groups (the root group, empty, plus one for each struct column: + `labels`, `quality_metrics`, `rolling_quality_metrics`, `waveform_metrics`), each 1 + fragment of 100 rows. SpiralDB cannot scan key columns alone ("Reading key columns without including at least one column from any column group is currently not supported"), so `scan_cost_probe.py` now times one scan per column group instead. diff --git a/docs/dev/specs/itl-926-live/error_messages.py b/docs/dev/specs/itl-926-live/error_messages.py index dc7406a58..36685f073 100644 --- a/docs/dev/specs/itl-926-live/error_messages.py +++ b/docs/dev/specs/itl-926-live/error_messages.py @@ -2,10 +2,11 @@ Run after ``spiral login``, from the repository root: - uv run python docs/dev/specs/itl-926-live/error_messages.py my-project-123456 + uv run python superpowers/specs/itl-926-live/error_messages.py edi-sample-v1-855632 Each case only lists tables or reads a table's schema; nothing is written. The made-up -project id is generated at random to exercise the missing-project error. Prints the exception type and message for each case, and how long it took. +project id is random, so it cannot name a real project (in particular, never a full EDI +project). Prints the exception type and message for each case, and how long it took. """ from __future__ import annotations diff --git a/docs/dev/specs/itl-926-live/inspect_tables.py b/docs/dev/specs/itl-926-live/inspect_tables.py index 1b6d3822b..b651880bc 100644 --- a/docs/dev/specs/itl-926-live/inspect_tables.py +++ b/docs/dev/specs/itl-926-live/inspect_tables.py @@ -1,10 +1,11 @@ """READ-ONLY inspection of a SpiralDB project's tables for ITL-926. Calls only read methods (``list_tables``, ``Table.schema``, ``Table.key_schema``, -``Table.get_metadata`` and a ``limit``-ed scan), so it can inspect a project without writing. Run after ``spiral login``, from the repository root: +``Table.get_metadata`` and a ``limit``-ed scan), so it is safe on the workshop's EDI sample +projects. Run after ``spiral login``, from the repository root: - uv run python docs/dev/specs/itl-926-live/inspect_tables.py my-project-123456 \ - [--tables session,session_event] [--limit 3] > inspect.txt + uv run python superpowers/specs/itl-926-live/inspect_tables.py edi-sample-v1-855632 \ + [--tables session,experiment] [--limit 3] > inspect.txt For every table it prints the key schema, the Arrow schema ``Table.schema().to_arrow()`` reports (``!`` marks a non-null field), the Arrow type and nullability a ``limit``-ed scan diff --git a/docs/dev/specs/itl-926-live/live_verify.py b/docs/dev/specs/itl-926-live/live_verify.py index 2d6157b17..8a4927859 100644 --- a/docs/dev/specs/itl-926-live/live_verify.py +++ b/docs/dev/specs/itl-926-live/live_verify.py @@ -5,12 +5,13 @@ Two modes. -**Read-only (default)** -- for an existing project. Nothing is written to the project: no table creation, no writes, +**Read-only (default)** -- for an existing project such as the workshop's EDI sample +(``edi-sample-v1-855632``). Nothing is written to the project: no table creation, no writes, no maintenance. Results go to a local Delta store in a temporary directory: - uv run python docs/dev/specs/itl-926-live/live_verify.py \ - --project my-project-123456 --tables session,session_event \ - --value-column event_count [--report ro.json] + uv run python superpowers/specs/itl-926-live/live_verify.py \ + --project edi-sample-v1-855632 --tables session,experiment \ + --value-column total_trials [--report ro.json] It builds ``SpiralDBTableSource`` on each of ``--tables`` (keep them small: the source reads the whole table into memory), records schemas, row counts and hashes, then joins the first @@ -19,11 +20,11 @@ sources' ``content_hash`` / ``pipeline_hash`` are unchanged and that the loaded job's ``get_all_records()`` returns every row. -**Write mode** -- for a dedicated project whose ID starts with ``test-``. -Opt in by repeating the project ID: +**Write mode** -- only for a dedicated test project, never an ``edi-*`` project. It must be +asked for by repeating the project id: - uv run python docs/dev/specs/itl-926-live/live_verify.py \ - --project test-example --allow-writes test-example [--keep] + uv run python superpowers/specs/itl-926-live/live_verify.py \ + --project --allow-writes [--keep] It works in scratch tables named ``itl926__*`` in ``--dataset`` (dropped at the end unless ``--keep``): @@ -489,7 +490,7 @@ def _load_phase(args: argparse.Namespace) -> None: # --------------------------------------------------------------------------------------- -# Read-only mode: an existing project. No writes of any kind. +# Read-only mode: an existing project (the workshop's EDI sample). No writes of any kind. # --------------------------------------------------------------------------------------- @@ -665,7 +666,7 @@ def main() -> int: default=None, metavar="PROJECT", help="write mode: create, write and drop scratch tables in PROJECT, which must " - "equal --project and start with 'test-'. Without it nothing is written.", + "equal --project and must not be an edi-* project. Without it nothing is written.", ) parser.add_argument( "--tables", @@ -699,10 +700,8 @@ def main() -> int: else: if args.allow_writes != args.project: parser.error("--allow-writes must name the same project as --project") - if not args.project.startswith("test-"): - parser.error( - "write mode requires a dedicated project whose ID starts with 'test-'" - ) + if args.project.startswith("edi-"): + parser.error("refusing to write to an edi-* project; they are read-only") run = Run(args) try: with tempfile.TemporaryDirectory() as tmp: diff --git a/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py b/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py index ac4a9fced..5141e7c71 100644 --- a/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py +++ b/docs/dev/specs/itl-926-live/repros/c2_fixed_size_list_cannot_hash.py @@ -9,7 +9,7 @@ Since PR #305 the source names the column: ``cannot hash column 'rgb' of type fixed_size_list[3]: ...``. EDI sample tables with such columns: experiment_display_params, experiment_freeviewing_params, -a synthetic sensor timeseries (``fixed_size_list(f32)[384]``). +experiment_screen_capture_event, lfp_timeseries (``fixed_size_list(f32)[384]``). """ import pyarrow as pa diff --git a/docs/dev/specs/itl-926-live/repros/c3_source_memory.py b/docs/dev/specs/itl-926-live/repros/c3_source_memory.py index ee94001de..f7a5641fe 100644 --- a/docs/dev/specs/itl-926-live/repros/c3_source_memory.py +++ b/docs/dev/specs/itl-926-live/repros/c3_source_memory.py @@ -1,4 +1,4 @@ -"""C3 repro: memory used to build a source over a sensor_reading-shaped table. +"""C3 repro: memory used to build a source over a spike_event-shaped table. Run from the repository root: @@ -38,7 +38,7 @@ ) # ru_maxrss: bytes on macOS, KiB on Linux before = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / scale start = time.time() -ArrowTableSource(table, tag_columns=table.column_names[:7], source_id="sensor_reading") +ArrowTableSource(table, tag_columns=table.column_names[:7], source_id="spike_event") after = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / scale print( f"rows={n} arrow={table.nbytes / 1e6:.1f} MB build={time.time() - start:.1f}s " diff --git a/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py b/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py index abc9d6d54..4e9a1b7f7 100644 --- a/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py +++ b/docs/dev/specs/itl-926-live/repros/source_id_collision_across_projects.py @@ -4,7 +4,7 @@ uv run python superpowers/specs/itl-926-live/repros/source_id_collision_across_projects.py -Uses the pyspiral fake. Two projects each have a ``item`` table with the same schema but +Uses the pyspiral fake. Two projects each have a ``subject`` table with the same schema but different rows; the same job (same name, same store) runs on project A, then on project B, with the default ``source_id``. Prints each source's ``source_id`` and ``content_hash``, the function calls each run makes, and what ``get_all_records()`` returns after the B run. @@ -36,30 +36,30 @@ def to_kg(weight_g: float) -> float: schema = pa.schema( [ - pa.field("item_id", pa.string(), False), + pa.field("subject_id", pa.string(), False), pa.field("weight_g", pa.float64(), False), ] ) with fake_pyspiral.install(work / "spiral"): for project, weights in ( - ("test-project-a", [1000.0, 2000.0]), - ("test-project-b", [3000.0, 4000.0]), + ("edi-sample-a", [1000.0, 2000.0]), + ("edi-sample-b", [3000.0, 4000.0]), ): table = ( fake_pyspiral.FakeSpiral() .project(project) .create_table( - "my_dataset.item", - key_schema=pa.schema([pa.field("item_id", pa.string(), False)]), + "default.subject", + key_schema=pa.schema([pa.field("subject_id", pa.string(), False)]), ) ) table.write( - pa.table({"item_id": ["a", "b"], "weight_g": weights}, schema=schema) + pa.table({"subject_id": ["m1", "m2"], "weight_g": weights}, schema=schema) ) - for project in ("test-project-a", "test-project-b"): + for project in ("edi-sample-a", "edi-sample-b"): calls.clear() - source = SpiralDBTableSource(project, "item", dataset="my_dataset") + source = SpiralDBTableSource(project, "subject") job = PipelineJob(name="workshop", database=DeltaTableDatabase(work / "store")) with job: to_kg.pod(source, label="kg") @@ -72,10 +72,7 @@ def to_kg(weight_g: float) -> float: later = PipelineJob(name="workshop", database=DeltaTableDatabase(work / "store")) with later: - to_kg.pod( - SpiralDBTableSource("test-project-b", "item", dataset="my_dataset"), - label="kg", - ) + to_kg.pod(SpiralDBTableSource("edi-sample-b", "subject"), label="kg") records = later.nodes["kg"].get_all_records() print( "project B job, get_all_records():", diff --git a/docs/dev/specs/itl-926-live/scan_cost_probe.py b/docs/dev/specs/itl-926-live/scan_cost_probe.py index ca602ab8e..df8c2065a 100644 --- a/docs/dev/specs/itl-926-live/scan_cost_probe.py +++ b/docs/dev/specs/itl-926-live/scan_cost_probe.py @@ -2,8 +2,8 @@ Run after ``spiral login``, from the repository root: - uv run python docs/dev/specs/itl-926-live/scan_cost_probe.py my-project-123456 \ - sensor_reading sensor_location > scan_cost.txt + uv run python superpowers/specs/itl-926-live/scan_cost_probe.py edi-sample-v1-855632 \ + unit unit_location > scan_cost.txt For each table it prints the number of column groups and fragments (from the manifests, no data scan), then times one scan per column group (SpiralDB cannot scan the key columns diff --git a/docs/dev/specs/itl-926-live/size_probe.py b/docs/dev/specs/itl-926-live/size_probe.py index 1c9c5045d..ef5fdc6a5 100644 --- a/docs/dev/specs/itl-926-live/size_probe.py +++ b/docs/dev/specs/itl-926-live/size_probe.py @@ -2,7 +2,7 @@ Run after ``spiral login``, from the repository root: - uv run python docs/dev/specs/itl-926-live/size_probe.py my-project-123456 \ + uv run python superpowers/specs/itl-926-live/size_probe.py edi-sample-v1-855632 \ [--max-rows 200000] > sizes.txt Step 1 reads each table's row count and size from Spiral's manifests (no data is scanned). diff --git a/docs/dev/specs/itl-936-live/live_nullability.py b/docs/dev/specs/itl-936-live/live_nullability.py index 449065e08..dc0521259 100644 --- a/docs/dev/specs/itl-936-live/live_nullability.py +++ b/docs/dev/specs/itl-936-live/live_nullability.py @@ -3,11 +3,10 @@ Run from the repository root after ``spiral login``, with the ``spiraldb`` extra (``uv sync --all-extras``). Prints a JSON report; exit status 0 when every check passed. -**Write mode** uses scratch tables in a dedicated project whose ID starts with ``test-``. -Repeat the project ID to allow writes: +**Write mode** (scratch tables only; repeat the project id to allow writes): - uv run python docs/dev/specs/itl-936-live/live_nullability.py write \ - --project test-example --allow-writes test-example \ + uv run python superpowers/specs/itl-936-live/live_nullability.py write \ + --project edi-tutorial-v1-841226 --allow-writes edi-tutorial-v1-841226 \ [--dataset meta] [--report write.json] # dataset defaults to meta Creates tables ``.itl936__*`` and drops every one of them at the end, even on @@ -33,10 +32,10 @@ 5. ``metadata``: several keys in one ``set_metadata`` call; a 400-column record (chunked); an entry over 8 KiB (expected refused). -**Read mode** checks existing tables that carry the record: +**Read mode** (read-only; for the tutorial tables once they carry the record): - uv run python docs/dev/specs/itl-936-live/live_nullability.py read \ - --project my-project-123456 --tables session,session_event \ + uv run python superpowers/specs/itl-936-live/live_nullability.py read \ + --project edi-tutorial-v1-841226 --tables session,experiment \ --float-column [--report read.json] For each table: the record, the source's ``output_schema``, and that every recorded @@ -511,10 +510,8 @@ def main() -> int: if args.mode == "write": if args.allow_writes != args.project: parser.error("write mode needs --allow-writes repeating --project") - if not args.project.startswith("test-"): - parser.error( - "write mode requires a dedicated project whose ID starts with 'test-'" - ) + if args.project.startswith("edi-sample-v"): + parser.error("never write to an edi-sample-v* project") ok = write_mode(args.project, args.dataset or "meta", report) else: tables = [t for t in args.tables.split(",") if t] diff --git a/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py b/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py index 2df1d5423..09e78f574 100644 --- a/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py +++ b/docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py @@ -1,15 +1,17 @@ """Read-only live check of ``DerivedSource(tags_as_data=...)`` on SpiralDB (ITL-939). -Reads the ``session`` and ``session_event`` tables of a SpiralDB project, derives a source from -``session_event`` that also offers ``session_started_at`` as data, runs a pod on the copy +Reads the ``session`` and ``experiment`` tables of a SpiralDB project, derives a source from +``experiment`` that also offers ``session_start_datetime`` as data, runs a pod on the copy in memory and joins the result with ``session``. The pod only converts the copied start time -to epoch seconds. The event timestamp may use a relative clock. The check performs no -writes. +to epoch seconds: it makes no assumption about the meaning of any other EDI column (a first +version subtracted it from ``experiment_start_timestamp``, which in the tutorial dataset is a +relative clock, not microseconds since the epoch). It writes nothing: no database, no store, no +file. Needs ``pyspiral`` (the ``spiraldb`` extra) and ``spiral login`` credentials. Usage:: - uv run --extra spiraldb python docs/dev/specs/itl-939-live-check/spiraldb_derived_source_check.py \\ - my-project-123456 my_dataset + uv run --extra spiraldb python superpowers/specs/itl-939-live-check/spiraldb_derived_source_check.py \\ + edi-tutorial-v1-841226 [dataset] """ from __future__ import annotations @@ -21,9 +23,9 @@ from orcapod.operators import Join from orcapod.sources import DerivedSource, SpiralDBTableSource -TAG = "session_started_at" +TAG = "session_start_datetime" COPY = "session_start" -TIMESTAMP = "event_timestamp" +TIMESTAMP = "experiment_start_timestamp" @function_pod(output_keys="start_epoch_s") @@ -37,18 +39,18 @@ def start_epoch_s(session_start: datetime | None) -> float | None: def main(project: str, dataset: str) -> None: """Run the check and print what it finds.""" session = SpiralDBTableSource(project, "session", dataset=dataset) - session_event = SpiralDBTableSource(project, "session_event", dataset=dataset) - derived = DerivedSource(session_event, tags_as_data={TAG: COPY}) + experiment = SpiralDBTableSource(project, "experiment", dataset=dataset) + derived = DerivedSource(experiment, tags_as_data={TAG: COPY}) - origin_table = session_event.as_table() + origin_table = experiment.as_table() table = derived.as_table(all_info=True) - print("origin keys():", session_event.keys()) + print("origin keys():", experiment.keys()) print("derived keys():", derived.keys()) print("rows origin / derived:", origin_table.num_rows, "/", table.num_rows) print("tag field :", origin_table.schema.field(TAG)) print("copy field:", table.schema.field(COPY)) print("copy equals tag:", table[COPY].equals(table[TAG])) - print("source_id:", session_event.source_id, "->", derived.source_id) + print("source_id:", experiment.source_id, "->", derived.source_id) print("first token:", table[f"_source_{COPY}"][0].as_py()) print("timestamp field:", table.schema.field(TIMESTAMP)) @@ -68,4 +70,4 @@ def main(project: str, dataset: str) -> None: if __name__ == "__main__": - main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else "my_dataset") + main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else "default") From 1518d954809bd9499a7f3cd5d1047a65db70bfce Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 21:52:22 -0800 Subject: [PATCH 07/12] docs: make current keyed table examples consistent --- docs/concepts/sources.md | 27 +++++++++---------- .../data_tags/test_time_series_end_to_end.py | 2 +- .../test_derived_source_tags_as_data.py | 7 +++-- .../test_spiraldb_table_source_fake.py | 4 +-- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/docs/concepts/sources.md b/docs/concepts/sources.md index 4db7a375d..536eb0d2b 100644 --- a/docs/concepts/sources.md +++ b/docs/concepts/sources.md @@ -559,7 +559,7 @@ from orcapod.databases import SpiralDBConnector with SpiralDBConnector("my-project-123456", dataset="my_dataset") as spiral: print(spiral.get_table_names()) - print(spiral.get_pk_columns("session")) + print(spiral.get_pk_columns("sensor_reading")) ``` The table's key columns become the tag columns, and every other column is a data column: @@ -568,10 +568,9 @@ The table's key columns become the tag columns, and every other column is a data ```python from orcapod.sources import SpiralDBTableSource -sessions = SpiralDBTableSource("my-project-123456", "session", dataset="my_dataset") -events = SpiralDBTableSource("my-project-123456", "session_event", dataset="my_dataset") -print(sessions.output_schema()) -sessions.as_df() # also as_polars_df(), as_pandas_df(), as_lazy_frame(), as_table() +readings = SpiralDBTableSource("my-project-123456", "sensor_reading", dataset="my_dataset") +print(readings.output_schema()) +readings.as_df() # also as_polars_df(), as_pandas_df(), as_lazy_frame(), as_table() ``` Things to know about Spiral tables: @@ -589,12 +588,12 @@ Things to know about Spiral tables: - **Source identity.** A Spiral source is identified by where its table is, never by its rows. The default `source_id` is `spiraldb_table_v1:..
@`, for example - `spiraldb_table_v1:my-project-123456.my_dataset.session@table_example12345`. The table id is + `spiraldb_table_v1:my-project-123456.my_dataset.sensor_reading@table_example12345`. The table id is SpiralDB's own, so tables with the same name in different projects stay apart, and a table that is dropped and created again under the same name is a different source: nothing recorded for the old table is reused. A renamed table also gets a new `source_id`. - **Record identity.** A row is identified by its primary key: its record ID is the - canonical JSON of its key columns (`{"session_id":"s1"}`). A row keeps its record ID when + canonical JSON of its key columns (`{"sensor_id":106,"site_id":2,"timestamp":0}`). A row keeps its record ID when other rows are added, and has the same one whichever read returned it. @@ -680,11 +679,11 @@ sent downstream during a run are only the rows that run read. `source.where(column=value, ...)` returns a new source on the same table that reads only the rows in which every named column equals its value. Several conditions can be given in one call, as keywords or as a mapping, or across chained calls: -`events.where(unit_id=106, session_index=2)` and -`events.where(unit_id=106).where(session_index=2)` are the same restriction, reading the +`readings.where(sensor_id=106, site_id=2)` and +`readings.where(sensor_id=106).where(site_id=2)` are the same restriction, reading the same rows. The conditions are a `Condition` (`orcapod.types`): `where(...)` builds one with `Condition.of(...)`, which takes the same arguments, and a `Condition` built beforehand can be -given instead (`events.where(Condition.of(unit_id=106, session_index=2))`). A source +given instead (`readings.where(Condition.of(sensor_id=106, site_id=2))`). A source restricted by a condition, a `limit=`, or both is **restricted**. Every source states its restriction through two read-only properties: `condition` (the empty `Condition` when it reads every row) and `row_limit` (`None` without a limit). @@ -703,9 +702,9 @@ when it has none. from orcapod import col hour = 3_600_000_000 -first_hour = events.where(col("timestamp") >= 0, col("timestamp") < hour) -second_hour = events.where(col("timestamp") >= hour, col("timestamp") < 2 * hour) -one_unit = first_hour.where(unit_id=106) # a range and an equality +first_hour = readings.where(col("timestamp") >= 0, col("timestamp") < hour) +second_hour = readings.where(col("timestamp") >= hour, col("timestamp") < 2 * hour) +one_sensor = first_hour.where(sensor_id=106) # a range and an equality ``` Ranges and equalities all must hold, on one column or several, given in one call or across @@ -895,7 +894,7 @@ print(Condition.of(day=day, started=started, recorded=recorded)) two 01:30 of a daylight-saving overlap (`fold`) are two. This equality decides whether two restrictions are one restriction (for the one-restriction rule above); it does not decide which rows a source returns. - `str(condition)` (or `condition.text()`) reads `unit_id=106, session_index=2`, and + `str(condition)` (or `condition.text()`) reads `sensor_id=106, site_id=2`, and `condition.equalities` maps each column to its value. A `Condition` has a Python hash, consistent with that equality, so it can be a dictionary key or a set member; it never enters an Orcapod source or pipeline hash. diff --git a/tests/test_core/data_tags/test_time_series_end_to_end.py b/tests/test_core/data_tags/test_time_series_end_to_end.py index 8ba2f1ee4..5a7098bcd 100644 --- a/tests/test_core/data_tags/test_time_series_end_to_end.py +++ b/tests/test_core/data_tags/test_time_series_end_to_end.py @@ -1,7 +1,7 @@ """A time-series pipeline on data-tags, end to end (ITL-1023). Specification "Orcapod v0.4 — Referential Tags" (ITL-1004), section 15.7: two time series -(spikes, gaze) share five key columns and each has a key column ``timestamp``. +share five key columns and each has a key column ``timestamp``. A third table is keyed on a subset of the keys. Each ``timestamp`` is renamed in both roles with ``map_tags`` (developer, November 12, 2026) so the join does not equate them, both time series are grouped by the shared keys, the three are joined, and a diff --git a/tests/test_core/sources/test_derived_source_tags_as_data.py b/tests/test_core/sources/test_derived_source_tags_as_data.py index a08c76ae1..7206504da 100644 --- a/tests/test_core/sources/test_derived_source_tags_as_data.py +++ b/tests/test_core/sources/test_derived_source_tags_as_data.py @@ -4,8 +4,7 @@ job node. Its tags are the origin's tags; its data columns are the origin's data columns plus a copy of each mapped tag column under the given name. It has source provenance of its own. -The synthetic ``session`` and ``experiment`` tables model a case where -``session_start_datetime`` is a key that a pod also needs as an input for time arithmetic. +The synthetic tables share a time key that a pod also needs for time arithmetic. """ from __future__ import annotations @@ -54,7 +53,7 @@ def _micros(t: dt.datetime) -> int: def _experiment_table(*, nullable_keys: bool = False) -> pa.Table: - """Return the synthetic ``experiment`` table (two experiments per session).""" + """Return the fixture with two rows for each start time.""" schema = pa.schema( [ pa.field("subject_id", pa.large_string(), nullable=nullable_keys), @@ -79,7 +78,7 @@ def _experiment_table(*, nullable_keys: bool = False) -> pa.Table: def _session_table() -> pa.Table: - """Return the synthetic ``session`` table (subject ``m1`` has two sessions).""" + """Return the fixture with distinct start times for the same entity.""" schema = pa.schema( [ pa.field("subject_id", pa.large_string(), nullable=False), diff --git a/tests/test_core/sources/test_spiraldb_table_source_fake.py b/tests/test_core/sources/test_spiraldb_table_source_fake.py index eefd09bf9..4983e67bb 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_fake.py +++ b/tests/test_core/sources/test_spiraldb_table_source_fake.py @@ -1,6 +1,6 @@ """SpiralDBTableSource end to end against the disk-backed pyspiral fake (no live SpiralDB). -Covers the public interface (ITL-926): keyed-table-shaped tables (every +Covers the public interface (ITL-926): synthetic keyed tables (every column nullable, composite keys with string, timestamp and uint32 columns) -> Join of two Spiral sources -> function pod -> PipelineJob with a Delta store -> re-run -> save and load. See ``tests/test_databases/fake_spiral_sdk.py`` for the storage behaviour modelled. @@ -43,7 +43,7 @@ def _all_nullable(table: pa.Table) -> pa.Table: @pytest.fixture() def spiral_root(tmp_path: Path): - """Provide a fake root with keyed-table-shaped, all-nullable ``session`` and ``experiment``.""" + """Provide a fake root with two keyed tables whose columns are all nullable.""" root = tmp_path / "spiral" with fake_spiral_sdk.install(root): project = fake_spiral_sdk.ExternalProject(_PROJECT) From c236b76e74f550faba5b8c18a75b0cb1ba6de7e4 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 29 Nov 2026 22:24:05 -0800 Subject: [PATCH 08/12] test(spiraldb): exercise the documented sensor range example --- .../sources/test_spiraldb_table_source_ranges.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_core/sources/test_spiraldb_table_source_ranges.py b/tests/test_core/sources/test_spiraldb_table_source_ranges.py index d5d8871da..bc0d48fef 100644 --- a/tests/test_core/sources/test_spiraldb_table_source_ranges.py +++ b/tests/test_core/sources/test_spiraldb_table_source_ranges.py @@ -247,27 +247,29 @@ def test_documented_windows_over_integer_microseconds( (sample,) = ( block.source for block in extract_blocks(page.read_text(encoding="utf-8")) - if "first_hour = events.where(" in block.source + if "first_hour = " in block.source ) hour = 3_600_000_000 project.create_table( - "default.events", key_schema=[("timestamp", pa.uint64())] + "default.sensor_reading", key_schema=[("timestamp", pa.uint64())] ).write( pa.table( { "timestamp": pa.array([0, hour - 1, hour, 2 * hour], pa.uint64()), - "unit_id": [106, 107, 106, 106], + "sensor_id": [106, 107, 106, 106], } ) ) scope: dict[str, Any] = { - "events": SpiralDBTableSource(_PROJECT, "events", tag_only_columns=True) + "readings": SpiralDBTableSource( + _PROJECT, "sensor_reading", tag_only_columns=True + ) } exec(sample, scope) assert scope["first_hour"].as_table()["timestamp"].to_pylist() == [0, hour - 1] assert scope["second_hour"].as_table()["timestamp"].to_pylist() == [hour] - assert scope["one_unit"].as_table()["timestamp"].to_pylist() == [0] + assert scope["one_sensor"].as_table()["timestamp"].to_pylist() == [0] def test_both_ends_of_an_integer_type(self, project): assert _keys(_source().where(col("n") >= 0, col("n") <= 255)) == _keys( From 603dcd7ee1474ba2135305b8438952639447d02a Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Wed, 2 Dec 2026 16:20:00 -0800 Subject: [PATCH 09/12] docs(spiraldb): finish replacing identifying examples --- RELEASING.md | 6 +- docs/dev/design_issues/ITL-186-SP4.md | 2 +- docs/dev/design_issues/ITL-926-SP2.md | 11 +- docs/dev/design_issues/ITL-936-SP3.md | 2 +- docs/dev/design_issues/ITL-939-TD1.md | 3 +- docs/dev/design_issues/ITL-943-DN1.md | 2 +- docs/dev/design_issues/ITL-996-SP5.md | 2 +- .../2026-06-23-pyspiral-upgrade-plt-1773.md | 2 +- ...26-11-11-itl-926-spiral-source-reverify.md | 2 +- ...11-11-itl-936-spiral-nullability-record.md | 6 +- ...-11-itl-939-derived-source-tags-as-data.md | 2 +- ...11-itl-939-tag-and-data-same-name-spike.md | 6 +- .../2026-11-12-itl-1007-public-release.md | 8 +- ...6-11-12-itl-1023-referential-tags-slice.md | 4 +- .../2026-11-12-itl-186-notebook-preview.md | 6 +- ...6-11-12-itl-186-streaming-spiral-source.md | 4 +- .../2026-11-12-itl-996-spiral-tags-as-data.md | 17 +-- ...11-13-itl-1017-merged-source-info-token.md | 9 +- ...-groupby-referential-non-key-keeps-data.md | 2 +- docs/dev/plans/itl-998-plan.md | 2 +- ...2026-07-14-itl-523-post-run-hook-design.md | 2 +- ...6-07-14-itl-524-side-effect-pods-design.md | 2 +- ...-itl-186-spiral-streaming-source-design.md | 13 +-- ...1-itl-939-tag-and-data-same-name-design.md | 105 +++++++----------- .../2026-11-11-public-release-readiness.md | 2 +- ...-itl-186-streaming-spiral-source-design.md | 57 +++++----- .../2026-11-12-itl-186-what-a-job-keeps.md | 4 +- ...-itl-991-stream-head-and-preview-design.md | 4 +- .../2026-11-13-itl-1074-test-inventory.md | 2 +- .../specs/itl-1236-several-item-test-audit.md | 2 +- .../dev/specs/itl-1347-job-table-transport.md | 2 +- docs/dev/specs/itl-1347/stage-0.md | 4 +- docs/dev/specs/itl-926-live/FINDINGS.md | 76 ++++++------- docs/dev/specs/itl-926-live/error_messages.py | 5 +- docs/dev/specs/itl-926-live/inspect_tables.py | 7 +- docs/dev/specs/itl-926-live/live_verify.py | 27 ++--- .../c1_nullable_columns_refuse_plain_pods.py | 8 +- .../repros/c2_fixed_size_list_cannot_hash.py | 4 +- .../itl-926-live/repros/c3_source_memory.py | 6 +- .../repros/h1_timestamp_tag_becomes_utc.py | 2 +- .../source_id_collision_across_projects.py | 23 ++-- .../dev/specs/itl-926-live/scan_cost_probe.py | 4 +- docs/dev/specs/itl-926-live/size_probe.py | 2 +- .../specs/itl-936-live/live_nullability.py | 19 ++-- .../exp01_same_name_today.py | 2 +- .../exp02_workarounds_today.py | 8 +- .../exp03_copy_tag_prototype.py | 2 +- .../exp04_foreign_key_promotion.out | 2 +- .../exp04_foreign_key_promotion.py | 14 +-- .../exp05_hash_comparison.py | 2 +- .../exp07_derived_source_prototype.py | 2 +- .../exp08_group_by_tags_into_data.py | 2 +- .../spiraldb_derived_source_check.py | 30 +++-- docs/dev/specs/itl-998-range-restriction.md | 2 +- .../test_spiraldb_table_source_fake.py | 93 +++++++++------- .../test_spiraldb_table_source_live.py | 61 +++++----- .../test_spiraldb_table_source_streaming.py | 4 +- .../test_spiraldb_table_source_where.py | 4 +- 58 files changed, 336 insertions(+), 372 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 585b475da..a0bd0b297 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -339,9 +339,9 @@ replace the secret as above. The job fails in between; that is the price of cont The read-only `SpiralDBTableSource` tests are opt-in. Sign in with spiral-sdk and set `ORCAPOD_SPIRALDB_TEST_PROJECT`, `ORCAPOD_SPIRALDB_TEST_DATASET` and `ORCAPOD_SPIRALDB_TEST_TABLE` to select a keyed table you can read. The table needs -`sensor_id` and `timestamp` key columns and a floating-point `reading_value` data -column. For full coverage, use more than 1,000 rows across multiple sensors, with at -least eight timestamps for the first sensor. +`sensor_id` in its key, with `timestamp` as the last key column, and a floating-point +`reading_value` data column. For full coverage, use more than 1,000 rows across +multiple sensors and at least eight timestamps for the first key prefix. ```sh uv run --extra spiraldb pytest tests/test_core/sources/test_spiraldb_table_source_live.py diff --git a/docs/dev/design_issues/ITL-186-SP4.md b/docs/dev/design_issues/ITL-186-SP4.md index 2cf386e49..ff5c5b0ae 100644 --- a/docs/dev/design_issues/ITL-186-SP4.md +++ b/docs/dev/design_issues/ITL-186-SP4.md @@ -6,7 +6,7 @@ **Issue:** ITL-186 `SpiralDBTableSource` inherited `DBTableSource`'s constructor, which read every row and built -provenance for the whole table: about 4.6 GB for the 8,087,906-row `spike_event`. Design and +provenance for the whole table: about 4.6 GB for a table with roughly 8 million rows. Design and measurements: `docs/dev/specs/2026-11-12-itl-186-streaming-spiral-source-design.md`. **Fix:** the source is built from metadata only (schema, key columns, SpiralDB's table id) and diff --git a/docs/dev/design_issues/ITL-926-SP2.md b/docs/dev/design_issues/ITL-926-SP2.md index 02f4b62e0..165e6aacf 100644 --- a/docs/dev/design_issues/ITL-926-SP2.md +++ b/docs/dev/design_issues/ITL-926-SP2.md @@ -5,8 +5,7 @@ **Severity:** high **Issue:** ITL-926 (follow-ups: ITL-186 streaming source) -Re-verified against the EDI sample project (`edi-sample-v1-855632`, read-only) and a -disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`). The workshop path works: +Re-verified against a live project (read-only) and a disk-backed pyspiral fake (`tests/test_databases/fake_pyspiral.py`). The workshop path works: a `SpiralDBTableSource` with a composite key, a `Join` of two Spiral sources, a function pod, a Delta database, a re-run with no function calls, save and load, and the same hashes in a fresh process. Findings, with repro scripts, are in `docs/dev/specs/itl-926-live/FINDINGS.md`. @@ -25,13 +24,13 @@ process. Findings, with repro scripts, are in `docs/dev/specs/itl-926-live/FINDI **Open (developer decisions pending):** -* Every column of the EDI sample tables is nullable, so a function pod over them must +* Every column of the tables examined is nullable, so a function pod over them must annotate `T | None`; recorded columns arrive as `T` (SP3, ITL-936). * `fixed_size_list` columns could not be hashed with starfix 0.4.0; they are hashed since Orcapod adopted starfix 0.5.0 (ITL-910, ITL-927). `map` columns are still refused: the - source raises `ValueError` naming every refused column (none in the EDI tables). -* The whole table is read at construction, which rules out tables such as `spike_event` - (8.1M rows); the streaming design is in + source raises `ValueError` naming every refused column (none in the tables examined). +* The whole table is read at construction, which rules out tables with millions of rows. + The streaming design is in `docs/dev/specs/2026-11-11-itl-186-spiral-streaming-source-design.md`. * Record IDs are positional; key-based IDs are approved for the streaming source work (ITL-186). diff --git a/docs/dev/design_issues/ITL-936-SP3.md b/docs/dev/design_issues/ITL-936-SP3.md index ace1c4dd1..1161ccfc9 100644 --- a/docs/dev/design_issues/ITL-936-SP3.md +++ b/docs/dev/design_issues/ITL-936-SP3.md @@ -5,7 +5,7 @@ **Severity:** high **Issue:** ITL-936 -Live, pyspiral 0.16.33, scratch table in `edi-tutorial-v1-841226` (November 11, 2026): a +Live, pyspiral 0.16.33, a scratch table in a live project (November 11, 2026): a table written with `k`, `v`, struct `g` and its field `g.x`, and list `l` with its items all declared non-null reports `Schema({k=i64?, l=fixed_size_list(f32)[2]?, v=i32?, w=i32?, g={x=i32?, y=i32?}?})`: every top-level column and struct field nullable; only list items keep diff --git a/docs/dev/design_issues/ITL-939-TD1.md b/docs/dev/design_issues/ITL-939-TD1.md index e6676dcd2..778cbd031 100644 --- a/docs/dev/design_issues/ITL-939-TD1.md +++ b/docs/dev/design_issues/ITL-939-TD1.md @@ -5,8 +5,7 @@ **Severity:** medium **Issue:** ITL-939 -A name cannot be in both the tag and the data group, so a key that a pod needs as data (EDI -`session_start_datetime`, for elapsed-time arithmetic) could not reach a pod without a +A name cannot be in both the tag and the data group, so a key that a pod needs as data (a session start timestamp for elapsed-time arithmetic) could not reach a pod without a workaround, and two of the obvious workarounds (keeping the column out of `tag_columns`, or reading the table twice and joining) give silently wrong joins. The developer rejected an operator for this (an operator must not put new content into the data group) and chose a diff --git a/docs/dev/design_issues/ITL-943-DN1.md b/docs/dev/design_issues/ITL-943-DN1.md index c5c1f03ac..d1d091382 100644 --- a/docs/dev/design_issues/ITL-943-DN1.md +++ b/docs/dev/design_issues/ITL-943-DN1.md @@ -5,7 +5,7 @@ **Severity:** medium **Issue:** ITL-943 -Many value columns are nullable by specification (EDI, Spiral tables), and a pod written as +Many value columns are nullable by specification (for example, in a SpiralDB table), and a pod written as `def f(x: int)` is refused on an `int | None` column. `PolarsFilter` could drop the null rows, but the column stayed `T | None`, so the pod was still refused; a nullable key column likewise could not be joined with a non-nullable one. diff --git a/docs/dev/design_issues/ITL-996-SP5.md b/docs/dev/design_issues/ITL-996-SP5.md index c14819687..f7b5b1e78 100644 --- a/docs/dev/design_issues/ITL-996-SP5.md +++ b/docs/dev/design_issues/ITL-996-SP5.md @@ -5,7 +5,7 @@ **Severity:** medium **Issue:** ITL-996 -In the EDI tables every time series has `timestamp` in its key, so the time of a spike is a +When a keyed time series includes `timestamp` in its key, the time of a reading is a tag, and a function pod never sees tags. Copying it into data took `DerivedSource(src, tags_as_data=...)`, which reads the whole origin as soon as its schema or rows are asked for, as building a job does (7 to 8 seconds per source, measured), and is no diff --git a/docs/dev/plans/2026-06-23-pyspiral-upgrade-plt-1773.md b/docs/dev/plans/2026-06-23-pyspiral-upgrade-plt-1773.md index b23adc2ed..537927681 100644 --- a/docs/dev/plans/2026-06-23-pyspiral-upgrade-plt-1773.md +++ b/docs/dev/plans/2026-06-23-pyspiral-upgrade-plt-1773.md @@ -133,7 +133,7 @@ integration tests. Project and server URL are configurable via env vars: -- ``SPIRAL_PROJECT_ID`` (default: ``test-orcapod-362211``) +- ``SPIRAL_PROJECT_ID`` (the configured integration test project) - ``SPIRAL_SERVER_URL`` (default: ``http://api.spiraldb.dev``) Version compatibility note (PLT-1773) diff --git a/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md b/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md index 47153140b..11c5684ca 100644 --- a/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md +++ b/docs/dev/plans/2026-11-11-itl-926-spiral-source-reverify.md @@ -52,7 +52,7 @@ DESIGN_ISSUES entry, full suite one Python version at a time, PR. - 2026-11-11 Phase 1 done: fake (`tests/test_databases/fake_pyspiral.py`), live kit (`superpowers/specs/itl-926-live/live_verify.py` read-only + write modes, `inspect_tables.py`), findings in `superpowers/specs/itl-926-live/FINDINGS.md`. - Developer decisions so far: workshop runs read-only on `edi-sample-v1-855632`; writes only + Developer decisions so far: examples run read-only on a live project; writes only to a separate test project (being provisioned); stay on a working pyspiral; CI restore nice-to-have. Live read-only probing from this terminal was blocked by the permission classifier after one successful call. Sent the Phase 1 `ask`; waiting for decisions. diff --git a/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md b/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md index 7df6413cb..cfe6c8241 100644 --- a/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md +++ b/docs/dev/plans/2026-11-11-itl-936-spiral-nullability-record.md @@ -66,7 +66,7 @@ into a struct of null fields ("SpiralDB doesn't allow struct-level nullability") * A path is a list of segments: the top-level column name, then a struct field name, or `"[]"` for the item of a `list` / `large_list` / `fixed_size_list`. Segments are read against the type, so a struct field literally named `"[]"` is not ambiguous. Map interiors are not - recorded (no EDI table has maps; SpiralDB maps unverified): writing a table whose map item + recorded (the inspected tables had no maps; SpiralDB maps unverified): writing a table whose map item field is declared non-null raises rather than silently widening it. * It asserts exactly: each listed field is non-nullable (Arrow meaning: no null in its array). Every field not listed keeps whatever nullability SpiralDB reports (list items stay @@ -225,7 +225,7 @@ if read_nullability_record(table.get_metadata()) != read_nullability_record(kv): - [ ] Full suite (one Python version), ruff, basedpyright, golden hashes unchanged. - [ ] Live check script under `superpowers/specs/itl-936-live/` + exact commands for the - coordinator on `edi-tutorial-v1-841226`. + coordinator to run against a test project. - [ ] Merge origin/main, push, PR (stacked on #305), attach, worker_done. ## Notes @@ -245,7 +245,7 @@ non-null flag SpiralDB does not keep: ### Pinned hashes for an UNRECORDED table (computed at 49956a6a, before any library change) -One-row `edi-sample-a/default/subject` (`subject_id`, `sex`; written non-null, stored nullable), +One-row synthetic fixture (`subject_id`, `sex`; written non-null, stored nullable), `source_id="subject"`: * `output_schema`: `({'subject_id': str | None}, {'sex': str | None})` diff --git a/docs/dev/plans/2026-11-11-itl-939-derived-source-tags-as-data.md b/docs/dev/plans/2026-11-11-itl-939-derived-source-tags-as-data.md index c0b3c12a6..c2ebc2ced 100644 --- a/docs/dev/plans/2026-11-11-itl-939-derived-source-tags-as-data.md +++ b/docs/dev/plans/2026-11-11-itl-939-derived-source-tags-as-data.md @@ -83,7 +83,7 @@ origin is a `RootSource`), plus `_identity_config()`. `from_config` rebuilds the **Files:** Create `tests/test_core/sources/test_derived_source_tags_as_data.py` -- [x] Fixtures: EDI-shaped `session` and `experiment` Arrow tables (`session_start_datetime` +- [x] Fixtures: synthetic `session` and `experiment` Arrow tables (`session_start_datetime` `timestamp[us, tz=UTC]`, not null; `experiment_index` `uint32`), `ArrowTableSource`s. - [x] Tests: columns and schema; copy equals tag; exact Arrow field (type, not-null, nullable, logical type `Path`, field metadata); fresh provenance (system-tag names differ from the diff --git a/docs/dev/plans/2026-11-11-itl-939-tag-and-data-same-name-spike.md b/docs/dev/plans/2026-11-11-itl-939-tag-and-data-same-name-spike.md index d9e8d5e05..ab7e938cc 100644 --- a/docs/dev/plans/2026-11-11-itl-939-tag-and-data-same-name-spike.md +++ b/docs/dev/plans/2026-11-11-itl-939-tag-and-data-same-name-spike.md @@ -9,7 +9,7 @@ and as data, compares four designs, and recommends the smallest safe feature. **Architecture:** throwaway experiment scripts under `superpowers/specs/itl-939-experiments/` drive only the public API (sources, stream methods, operators, `function_pod`) on a small -EDI-shaped table (`session`, `experiment`, keys `subject_id`, `session_start_datetime`, +synthetic table (`session`, `experiment`, keys `subject_id`, `session_start_datetime`, `experiment_index`). Each script prints what it observes; the outputs are pasted into the doc. **Tech Stack:** orcapod (this repo), pyarrow, `uv run`. @@ -27,7 +27,7 @@ EDI-shaped table (`session`, `experiment`, keys `subject_id`, `session_start_dat - [x] `function_pod` whose output key equals a tag name. - [x] Run with `uv run python ...`; save stdout to `exp01_same_name_today.out`. -### Task 2: Experiment 02, today's workarounds on the EDI-shaped table +### Task 2: Experiment 02, today's workarounds on the synthetic table **Files:** Create `superpowers/specs/itl-939-experiments/exp02_workarounds_today.py` @@ -51,7 +51,7 @@ EDI-shaped table (`session`, `experiment`, keys `subject_id`, `session_start_dat hashes. - [x] Save stdout to `exp03_copy_tag_prototype.out`. -### Task 4: Need analysis from the EDI schemas +### Task 4: Need analysis from representative keyed schemas - [x] List key columns that are plausibly computation inputs; 3-5 workshop computations. diff --git a/docs/dev/plans/2026-11-12-itl-1007-public-release.md b/docs/dev/plans/2026-11-12-itl-1007-public-release.md index f3146a9fc..c73260c67 100644 --- a/docs/dev/plans/2026-11-12-itl-1007-public-release.md +++ b/docs/dev/plans/2026-11-12-itl-1007-public-release.md @@ -1,10 +1,8 @@ # ITL-1007: make the repository ready for public release from nauticalab -Scope after the developer's decisions of 2026-11-12: Spiral project ids stay as they are (they -name only the sample dataset and sit behind credentials), and anything workshop related moves -to the ediop repository. So: no id scrub, no guard test; the workshop tool, its tests and its -plan are removed (they stay in git history); URLs, workflow repository guards, `lint.yml`, -`RELEASING.md` and the agent instructions stay. +The 2026-11-12 release plan scoped identifier cleanup separately. It removed the +workshop tool, tests and plan, with the originals preserved in git history. The +repository retained its URLs, workflow guards, lint workflow and release instructions. Facts checked: nauticalab main is 61d0f18e, an ancestor of our main; nauticalab has `tests.yml`, deleted on our main by 07e5a2ea (#267), so a fast-forward push deletes it. diff --git a/docs/dev/plans/2026-11-12-itl-1023-referential-tags-slice.md b/docs/dev/plans/2026-11-12-itl-1023-referential-tags-slice.md index f82257de7..ae8ad2474 100644 --- a/docs/dev/plans/2026-11-12-itl-1023-referential-tags-slice.md +++ b/docs/dev/plans/2026-11-12-itl-1023-referential-tags-slice.md @@ -79,7 +79,7 @@ keeps chosen tags plain, exactly v0.3. Hash terms enter only when a reference ex ## Tasks (in the order of the brief; keep every step green; push after each) -### Task 0: failing end-to-end EDI-shaped test +### Task 0: failing end-to-end synthetic test - [ ] `tests/test_core/referential_tags/test_edi_end_to_end.py`: spikes (k1..k5, spike_time, amplitude) and gaze (k1..k5, gaze_time, gx) as `DictSource` with tag_columns keys + time (referential by default); `trials` keyed on (k1, k2) with explicit `tag_only_columns`; @@ -142,7 +142,7 @@ keeps chosen tags plain, exactly v0.3. Hash terms enter only when a reference ex - 2026-11-12: developer: option is `tag_only_columns`; references become plain tags at a pod boundary. - Task 0 done: fc22de6a, draft PR #342. - 2026-11-12: Tasks 1-8 implemented (02b62358, c3c5e995, c42eece8, 853da828). Developer rename - rule implemented (map_tags both roles, tag_only=True, map_data data-only). EDI test uses + rule implemented (map_tags both roles, tag_only=True, map_data data-only). The synthetic test uses `timestamp` in both series. Existing tests pinned to `tag_only_columns=True` (79 files, 569 call sites). Remaining: full suite on 3.11/3.12/3.13, basedpyright, final report. - 2026-11-13: fall-through (ReferenceFallThroughPod) per developer ruling; format 0.3.0 with diff --git a/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md b/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md index d05f90197..76dc0bddc 100644 --- a/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md +++ b/docs/dev/plans/2026-11-12-itl-186-notebook-preview.md @@ -39,9 +39,9 @@ manifest row count only when the head is not the whole read. A private class swi | Case | Header after `SpiralDBTableSource[