From acb039ffdeede1e517da76343a748dfcf7b898e0 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sat, 28 Nov 2026 12:43:52 -0800 Subject: [PATCH 1/2] fix(storage): record declared function output order (ITL-1253) --- changelog.d/ITL-1253.md | 3 + docs/concepts/pipeline-job.md | 4 +- docs/dev/design_issues/ITL-1244-OK1.md | 6 +- docs/reference/data-function-types.md | 3 +- docs/tutorial/inspecting-results.md | 3 +- src/orcapod/core/cached_function_pod.py | 4 +- src/orcapod/core/data_function.py | 13 +++- src/orcapod/core/result_cache.py | 16 ++++- .../python.function/v1-rev1.json | 7 ++ .../data_function/test_data_function.py | 1 + .../data_function/test_function_record.py | 2 + .../function_pod/test_output_keys_identity.py | 60 ++++++----------- tests/test_data_function_types.py | 66 +++++++++++++++++++ .../test_postgresql_connector_integration.py | 2 +- .../test_databases/test_unstorable_columns.py | 14 ++-- 15 files changed, 146 insertions(+), 58 deletions(-) create mode 100644 changelog.d/ITL-1253.md diff --git a/changelog.d/ITL-1253.md b/changelog.d/ITL-1253.md new file mode 100644 index 000000000..6c10ea46a --- /dev/null +++ b/changelog.d/ITL-1253.md @@ -0,0 +1,3 @@ +### Added + +- Python function result records include `__pf_var_output_keys`, the output names in declared order (ITL-1253). Cache reuse still matches the function identity and input data hash. diff --git a/docs/concepts/pipeline-job.md b/docs/concepts/pipeline-job.md index 5111c077a..c15704663 100644 --- a/docs/concepts/pipeline-job.md +++ b/docs/concepts/pipeline-job.md @@ -263,7 +263,7 @@ reads SpiralDB only. The full list, type by type, is [Data types per database](../reference/database-types.md). Orcapod's own stored tables hold such columns. A function node's result table holds -list-valued executor columns and `__`-prefixed columns. A side-effect node's log holds a UTC +list-valued columns for the declared output names and executor details. A side-effect node's log holds a UTC timestamp and `__data_context`. An operator cache holds `__data_context`, the row's entry id and a UTC timestamp, the time the row was first stored (`__recorded_at`). A cached source holds `__data_context` too. So a job refuses these nodes when it is built, or when a database @@ -296,7 +296,7 @@ try: compute_bmi.pod(mice(cohort_a), label="bmi") except UnstorableColumnError as exc: print(exc) -# node 'bmi': a SQLiteConnector database cannot store column '__pf_exec_executor_info' of Arrow type large_list<...>: SQLite has no column type for it. Use an InMemoryArrowDatabase instead; docs/reference/database-types.md lists what each database keeps. +# node 'bmi': a SQLiteConnector database cannot store column '__pf_var_output_keys' of Arrow type large_list<...>: SQLite has no column type for it. Use an InMemoryArrowDatabase instead; docs/reference/database-types.md lists what each database keeps. ``` ## What a re-run computes diff --git a/docs/dev/design_issues/ITL-1244-OK1.md b/docs/dev/design_issues/ITL-1244-OK1.md index fb628dc14..c5fc883ae 100644 --- a/docs/dev/design_issues/ITL-1244-OK1.md +++ b/docs/dev/design_issues/ITL-1244-OK1.md @@ -23,6 +23,6 @@ a cache hit is not checked, ITL-1253). No code changed. The behaviour is pinned in `tests/test_core/function_pod/test_output_keys_identity.py` (two and three keys in every order, sync and async, in memory and in a job on an in-memory and a Delta database, plain tags and data-tags; input parameters pinned as outside the uri) and -documented in `docs/concepts/identity.md` (*Change detection*). A cache hit whose stored -function variation data differs from the current function is still served silently: that -check is ITL-1253 (a strict xfail test states it). +documented in `docs/concepts/identity.md` (*Change detection*). ITL-1253 records the declared +output order in the function record for a future opt-in check. The test suite pins silent +reuse as the default. diff --git a/docs/reference/data-function-types.md b/docs/reference/data-function-types.md index 51c09f494..a5282f891 100644 --- a/docs/reference/data-function-types.md +++ b/docs/reference/data-function-types.md @@ -106,6 +106,7 @@ Each result row holds these columns about the function (`__pf_var_` prefix): | `function_signature_hash` | `bytes` | `large_binary` | yes | the hash of the function's declared interface | | `function_content_hash` | `bytes \| None` | `large_binary` | yes | the hash of the function as written (a lambda: its enclosing lines); absent when its source cannot be read (a plain REPL, `python -c`, `exec`) or, for a function other than a lambda, does not start at a `def` statement | | `git_hash` | `str` | `large_string` | yes | the git commit of the function's file or working directory, with `-dirty`, `-untracked` and `-` suffixes; `unknown` outside git | +| `output_keys` | `list[str]` | `large_list` | no | the output names in declared order, recorded for a later opt-in check. Nothing compares this column today | and these about how it was computed (`__pf_exec_` prefix): @@ -172,7 +173,7 @@ stored = types_store.get_all_records(next(p for p in types_store.list_sources() print([name for name in stored.column_names if not name.startswith("__pf_")]) # ['__input_data_hash', 'total', 'label', '_source_total', '_source_label', '__pod_ts', '__data_context'] print([name for name in stored.column_names if name.startswith("__pf_var_")]) -# ['__pf_var_function_name', '__pf_var_function_version', '__pf_var_function_module', '__pf_var_function_signature_hash', '__pf_var_function_content_hash', '__pf_var_git_hash'] +# ['__pf_var_function_name', '__pf_var_function_version', '__pf_var_function_module', '__pf_var_function_signature_hash', '__pf_var_function_content_hash', '__pf_var_git_hash', '__pf_var_output_keys'] ``` ## The pipeline columns, `pdb_v2` diff --git a/docs/tutorial/inspecting-results.md b/docs/tutorial/inspecting-results.md index 33f4259a3..86fdc48ac 100644 --- a/docs/tutorial/inspecting-results.md +++ b/docs/tutorial/inspecting-results.md @@ -159,7 +159,7 @@ For each function, the database holds one record per computed result. records = pl.from_arrow(job.nodes["rates"].get_all_records(columns={"meta": True})) meta = [c for c in records.columns if c.startswith("__")] print(meta) -# ['__data_id', '__input_data_hash', '__output_data_hash', '__data_context', '__computed', '__is_ephemeral', '__pipeline_run_id', '__recorded_at', '__input_data_hash_right', '__pf_var_function_name', '__pf_var_function_version', '__pf_var_function_module', '__pf_var_function_signature_hash', '__pf_var_function_content_hash', '__pf_var_git_hash', '__pf_exec_executor_type', '__pf_exec_executor_info', '__pf_exec_python_version', '__pf_exec_extra_info', '__pod_ts'] +# ['__data_id', '__input_data_hash', '__output_data_hash', '__data_context', '__computed', '__is_ephemeral', '__pipeline_run_id', '__recorded_at', '__input_data_hash_right', '__pf_var_function_name', '__pf_var_function_version', '__pf_var_function_module', '__pf_var_function_signature_hash', '__pf_var_function_content_hash', '__pf_var_git_hash', '__pf_var_output_keys', '__pf_exec_executor_type', '__pf_exec_executor_info', '__pf_exec_python_version', '__pf_exec_extra_info', '__pod_ts'] ``` Some important columns: @@ -167,6 +167,7 @@ Some important columns: | Column | Meaning | |---|---| | `__pf_var_function_name` | The function that produced the result | +| `__pf_var_output_keys` | The output names in the order the function declared them | | `__pod_ts` | When the result was computed | | `__pf_exec_python_version` | The Python version it ran under | | `__pf_var_git_hash` | The git commit of the code, when run inside a git repository | diff --git a/src/orcapod/core/cached_function_pod.py b/src/orcapod/core/cached_function_pod.py index f2f116113..19cf7a2eb 100644 --- a/src/orcapod/core/cached_function_pod.py +++ b/src/orcapod/core/cached_function_pod.py @@ -65,10 +65,12 @@ def __init__( **kwargs, ) -> None: super().__init__(function_pod, **kwargs) + declaration = function_pod.data_function.declaration self._cache = ResultCache( result_database=result_database, record_path=self.uri, # no prefix; db is pre-scoped - revision=function_pod.data_function.declaration.revision_component, + revision=declaration.revision_component, + variation_columns=declaration.variation, auto_flush=auto_flush, # A pod that takes the invocation context performs an external action. delivers_side_effects=function_pod.ctx_arg_name is not None, diff --git a/src/orcapod/core/data_function.py b/src/orcapod/core/data_function.py index 334e57413..a52fe7c96 100644 --- a/src/orcapod/core/data_function.py +++ b/src/orcapod/core/data_function.py @@ -724,6 +724,14 @@ def function_content_hash( "the git commit of the function's file or working directory, with " + "-dirty, -untracked and - suffixes; unknown outside git", ), + StoredColumn( + "output_keys", + list[str], + "large_list", + False, + "the output names in declared order, recorded for a later opt-in check. " + + "Nothing compares this column today", + ), ), execution=( StoredColumn( @@ -960,6 +968,7 @@ def get_function_variation_data(self) -> dict[str, Any]: "function_signature_hash": self._function_signature_hash, "function_content_hash": self._function_content_hash, "git_hash": self._git_hash, + "output_keys": list(self._output_keys), } def get_function_variation_data_schema(self) -> Schema: @@ -1594,10 +1603,12 @@ def __init__( super().__init__(data_function, **kwargs) self._result_database = result_database self._record_path_prefix = record_path_prefix + declaration = self.declaration self._cache = ResultCache( result_database=result_database, record_path=record_path_prefix + self.uri, - revision=self.declaration.revision_component, + revision=declaration.revision_component, + variation_columns=declaration.variation, auto_flush=True, # The first uri component is the function's name; no hash before it. name_path=record_path_prefix + self.uri[:1], diff --git a/src/orcapod/core/result_cache.py b/src/orcapod/core/result_cache.py index e341983bf..1de951068 100644 --- a/src/orcapod/core/result_cache.py +++ b/src/orcapod/core/result_cache.py @@ -202,6 +202,8 @@ def __init__( auto_flush: bool = True, delivers_side_effects: bool = False, name_path: tuple[str, ...] | None = None, + *, + variation_columns: tuple[StoredColumn, ...] = (), ) -> None: """Create a result cache over one result table. @@ -221,6 +223,8 @@ def __init__( the part that holds no hash. Result tables written before v0.3 are looked for under it, whatever hashes their paths hold (ITL-954). ``None`` looks at the paths computed from ``record_path`` only. + variation_columns: The type's declared variation columns and their + stored nullability. Undeclared columns are nullable. """ self._result_database = result_database self._record_path = record_path @@ -228,6 +232,9 @@ def __init__( self._auto_flush = auto_flush self._delivers_side_effects = delivers_side_effects self._name_path = name_path + self._variation_nullability = { + column.name: column.nullable for column in variation_columns + } # Set once a read has reported the stored rows it skipped. self._skipped_rows_reported = False # Set once stored results of other generations have been accounted for. @@ -445,10 +452,15 @@ def store( # Use a running counter for insertion position since add_column shifts indices. col_idx = 0 var_table = variation_datagram.as_table() - for name in var_table.column_names: + for field in var_table.schema: + name = field.name data_table = data_table.add_column( col_idx, - f"{constants.PF_VARIATION_PREFIX}{name}", + pa.field( + f"{constants.PF_VARIATION_PREFIX}{name}", + field.type, + nullable=self._variation_nullability.get(name, True), + ), var_table.column(name), ) col_idx += 1 diff --git a/src/orcapod/data_function_types/python.function/v1-rev1.json b/src/orcapod/data_function_types/python.function/v1-rev1.json index 227f2c472..80390b18e 100644 --- a/src/orcapod/data_function_types/python.function/v1-rev1.json +++ b/src/orcapod/data_function_types/python.function/v1-rev1.json @@ -94,6 +94,13 @@ "name": "git_hash", "nullable": true, "python_type": "str" + }, + { + "arrow_type": "large_list", + "meaning": "the output names in declared order, recorded for a later opt-in check. Nothing compares this column today", + "name": "output_keys", + "nullable": false, + "python_type": "list[str]" } ] } diff --git a/tests/test_core/data_function/test_data_function.py b/tests/test_core/data_function/test_data_function.py index fc92b9bf3..f08150952 100644 --- a/tests/test_core/data_function/test_data_function.py +++ b/tests/test_core/data_function/test_data_function.py @@ -366,6 +366,7 @@ def test_returns_expected_keys(self, add_pf): "function_signature_hash", "function_content_hash", "git_hash", + "output_keys", } def test_function_version_is_the_full_declared_version(self): diff --git a/tests/test_core/data_function/test_function_record.py b/tests/test_core/data_function/test_function_record.py index 6c5819ad8..e85b3c507 100644 --- a/tests/test_core/data_function/test_function_record.py +++ b/tests/test_core/data_function/test_function_record.py @@ -3,6 +3,7 @@ Every result row records, beside the function's name and version: * ``function_module``: the function's ``__module__``; +* ``output_keys``: the output names in declared order; * ``function_signature_hash`` (``function_signature_v1``): the declared interface, one hash over ``{"inputs": {: {"type", "default"?}}, "outputs": [{"key", "type"}]}`` from the effective types: inputs by name in no order, outputs in declared order; no @@ -520,6 +521,7 @@ def test_swapped_same_typed_keys_store_different_signature_hashes( "function_signature_hash" ] row = by_signature[expected_signature] + assert row["__pf_var_output_keys"] == list(order) values = fn(index + 1, 2) assert {key: row[key] for key in order} == dict(zip(order, values)), order diff --git a/tests/test_core/function_pod/test_output_keys_identity.py b/tests/test_core/function_pod/test_output_keys_identity.py index fb65038e2..e6ce38760 100644 --- a/tests/test_core/function_pod/test_output_keys_identity.py +++ b/tests/test_core/function_pod/test_output_keys_identity.py @@ -9,8 +9,8 @@ When a name then receives another value (the keys swapped without the returned values, or the reverse), it is like an edit of the body: it changes what the function computes, so it needs a major version bump (the uri holds only the - major); a check of the stored function variation data on a cache hit is ITL-1253 - (strict xfail below). Swapping the keys with the returned values changes nothing; + major). Reuse stays the default while the declared order is recorded for a later + opt-in check (ITL-1253). Swapping the keys with the returned values changes nothing; * the input parameters are in no part of the uri (names and order); * a function with one output key has the identity the golden values pin. @@ -509,55 +509,37 @@ def test_a_saved_and_loaded_job_keeps_the_declared_order( assert _values(node.as_source(), keys) == _expected_values(mixed3, keys) -# --------------------------------------------------------------------------- -# Open issues -# --------------------------------------------------------------------------- - - -@pytest.mark.xfail( - strict=True, - raises=AssertionError, - reason="ITL-1253 (needs ITL-1256: the output keys in the stored signature hash): " - + "a cache hit whose stored function variation data differs from the current " - + "function is served silently", +@pytest.mark.parametrize( + "orchestrator", + [SyncPipelineOrchestrator, AsyncPipelineOrchestrator], + ids=["sync", "async"], ) @pytest.mark.parametrize("shape", list(SHAPES)) @pytest.mark.parametrize("n", [2, 3]) -def test_a_same_typed_swap_is_never_served_the_other_orders_rows_silently( - n: int, shape: str +def test_a_same_typed_swap_reuses_the_first_orders_rows_by_default( + n: int, shape: str, orchestrator: type ) -> None: - """Same-typed keys swapped without the returned values share a uri: the second job - finds the first's rows, which give each name the other value. - - What the safety net must do: either compute the second order's own values, or - say so (a warning or an error); never serve the first order's values under the - second order's names without a word. It needs two changes: the stored variation - data must tell the two orders apart (ITL-1256: the output keys enter the stored - signature hash) and a cache hit must compare it (ITL-1253). Only the assertion is - the expected failure (``raises=AssertionError``): an error from the run, such as a - future mismatch error, fails the test instead of hiding as an expected failure. - """ + """ITL-1253 keeps reuse without an output-order check as the decided default.""" fn = FUNCTIONS[("same", n)] first, second = _orders(n)[0], _orders(n)[-1] database = InMemoryArrowDatabase() - warned = False - job = None - for keys in (first, second): + + def build_job(keys: tuple[str, ...]) -> PipelineJob: job = PipelineJob(name="outputs", database=database) with job: FunctionPod.from_fn(fn, output_keys=list(keys))( _source(PLAIN, shape), label="outputs" ) - with warnings.catch_warnings(record=True) as recorded: - warnings.simplefilter("always") - job.run() - # Only the last (second) run's warnings count. - warned = bool(recorded) - assert job is not None - served_its_own = _values(job.nodes["outputs"], second) == _expected_values( - fn, second - ) - assert served_its_own or warned + return job + + build_job(first).run(orchestrator=orchestrator()) + job = build_job(second) + with warnings.catch_warnings(record=True) as recorded: + warnings.simplefilter("always") + counts = job.run(orchestrator=orchestrator()).nodes["outputs"] + assert not recorded + assert (counts.computed, counts.reused) == (0, 6) + assert _values(job.nodes["outputs"], first) == _expected_values(fn, first) def test_a_dict_returned_for_a_tuple_annotation_is_refused() -> None: diff --git a/tests/test_data_function_types.py b/tests/test_data_function_types.py index 25cdfa226..9a25f39c2 100644 --- a/tests/test_data_function_types.py +++ b/tests/test_data_function_types.py @@ -22,6 +22,7 @@ from pathlib import Path from typing import Any +import pyarrow as pa import pytest from orcapod import PipelineJob, function_pod @@ -54,6 +55,7 @@ GATE = REPO_ROOT / "scripts" / "check_golden_tags.py" SNAPSHOTS = REPO_ROOT / "src" / "orcapod" / "data_function_types" RECORD_ID = "_record_id" +OUTPUT_KEYS = "__pf_var_output_keys" # Functions with one, two and three outputs of different types. @@ -247,6 +249,70 @@ def test_a_job_writes_its_result_and_pipeline_tables_at_the_declared_paths( assert _stored_columns(database, result[0]) == _expected_result_columns( PythonDataFunction(fn, output_keys=keys) ) + stored = database.get_all_records(result[0]) + assert stored is not None + field = stored.schema.field(OUTPUT_KEYS) + assert field.type == pa.large_list(pa.large_string()) + assert not field.nullable + assert stored[OUTPUT_KEYS].to_pylist() == [keys, keys] + + records = job.nodes["fn"].get_all_records() + assert records is not None + expected = { + "one": [(7,), (11,)], + "two": [(12, "3-4"), (30, "5-6")], + "three": [(-1, 0.75, "4"), (-1, 1.25, "6")], + } + assert ( + sorted(tuple(row[k] for k in keys) for row in records.to_pylist()) + == (expected[name]) + ) + + +@pytest.mark.parametrize( + "orchestrator", + [SyncPipelineOrchestrator, AsyncPipelineOrchestrator], + ids=["sync", "async"], +) +def test_a_job_reads_and_reuses_results_from_before_output_keys_were_stored( + orchestrator: type, tmp_path: Path +) -> None: + """A prerelease result table is read as stored, with no output order metadata.""" + pod = FunctionPod.from_fn(two, output_keys=["product", "label"]) + + def build_job(database: InMemoryArrowDatabase) -> PipelineJob: + job = PipelineJob(name="types", database=database) + with job: + pod(_source(), label="fn") + return job + + database = InMemoryArrowDatabase() + job = build_job(database) + job.run(orchestrator=orchestrator()) + path = tmp_path / "job.json" + job.save(path) + + old_database = InMemoryArrowDatabase() + for table_path in database.list_table_paths(): + stored = database.get_all_records(table_path, record_id_column=RECORD_ID) + assert stored is not None + if "_result" in table_path: + stored = stored.drop_columns([OUTPUT_KEYS]) + old_database.add_records(table_path, stored, record_id_column=RECORD_ID) + old_database.flush() + + loaded = PipelineJob.load(path, database=old_database) + records = loaded.nodes["fn"].get_all_records(columns={"meta": True}) + assert records is not None + assert OUTPUT_KEYS not in records.column_names + assert sorted((r["product"], r["label"]) for r in records.to_pylist()) == [ + (12, "3-4"), + (30, "5-6"), + ] + + replay = build_job(old_database) + counts = replay.run(orchestrator=orchestrator()).nodes["fn"] + assert (counts.computed, counts.reused) == (0, 2) # --------------------------------------------------------------------------- diff --git a/tests/test_databases/test_postgresql_connector_integration.py b/tests/test_databases/test_postgresql_connector_integration.py index 9e8006978..78132b437 100644 --- a/tests/test_databases/test_postgresql_connector_integration.py +++ b/tests/test_databases/test_postgresql_connector_integration.py @@ -588,7 +588,7 @@ def double(x: int) -> int: with pytest.raises(UnstorableColumnError) as exc_info: with job: _ = double.pod(source, label="dbl") - assert exc_info.value.column == "__pf_exec_executor_info" + assert exc_info.value.column == "__pf_var_output_keys" assert connector.get_table_names() == [] diff --git a/tests/test_databases/test_unstorable_columns.py b/tests/test_databases/test_unstorable_columns.py index 288db7f32..552ad52d9 100644 --- a/tests/test_databases/test_unstorable_columns.py +++ b/tests/test_databases/test_unstorable_columns.py @@ -34,7 +34,7 @@ CALLS: list[int] = [] DELIVERED: list[int] = [] -EXECUTOR_INFO = "__pf_exec_executor_info" +OUTPUT_KEYS = "__pf_var_output_keys" EXECUTOR_INFO_TYPE = pa.large_list( pa.struct([("key", pa.large_string()), ("value", pa.large_string())]) ) @@ -113,12 +113,12 @@ def test_function_node_on_sqlite_refused_before_anything_runs( err = exc_info.value assert err.node_label == "dbl" assert err.database_kind == "SQLiteConnector" - assert err.column == EXECUTOR_INFO - assert err.arrow_type == EXECUTOR_INFO_TYPE + assert err.column == OUTPUT_KEYS + assert err.arrow_type == pa.large_list(pa.large_string()) message = str(err) assert "node 'dbl'" in message assert "SQLiteConnector" in message - assert EXECUTOR_INFO in message + assert OUTPUT_KEYS in message assert "InMemoryArrowDatabase" in message # Only the database that keeps every type is suggested (CodeRabbit on PR 471). assert "docs/reference/database-types.md" in message @@ -145,7 +145,7 @@ def test_side_effect_node_on_sqlite_refused_before_delivery( assert database.list_table_paths() == [] def test_function_node_on_postgresql_refused(self): - """PostgreSQL has no column type for the list-of-struct executor columns.""" + """PostgreSQL cannot create the result table's output-key list column.""" with patch("psycopg.connect") as mock_connect: mock_connect.return_value = MagicMock() connector = PostgreSQLConnector("postgresql://localhost/test") @@ -159,7 +159,7 @@ def test_function_node_on_postgresql_refused(self): err = exc_info.value assert err.node_label == "dbl" assert err.database_kind == "PostgreSQLConnector" - assert err.column == EXECUTOR_INFO + assert err.column == OUTPUT_KEYS assert CALLS == [] def test_in_memory_database_still_runs_function_node(self): @@ -620,7 +620,7 @@ def test_ephemeral_database_checked_before_anything_changes( job.set_ephemeral_database(_sqlite_database(tmp_path)) assert exc_info.value.node_label == "dbl" - assert exc_info.value.column == EXECUTOR_INFO + assert exc_info.value.column == OUTPUT_KEYS # No node took the database: a run computes and stores as before. assert job.nodes["dbl"].ephemeral_result_database is None _ = job.run() From 7086b50e98c79f8c0ad343b7c0360cdc6d0b14ae Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sat, 28 Nov 2026 13:04:27 -0800 Subject: [PATCH 2/2] fix(storage): read legacy function output metadata as nullable --- changelog.d/ITL-1253.md | 2 +- docs/reference/data-function-types.md | 5 +- docs/tutorial/inspecting-results.md | 2 +- src/orcapod/core/data_function.py | 11 +- src/orcapod/core/nodes/function_node.py | 13 +- src/orcapod/core/result_cache.py | 31 ++++ .../python.function/v1-rev1.json | 6 +- tests/test_data_function_types.py | 135 +++++++++++++++++- 8 files changed, 185 insertions(+), 20 deletions(-) diff --git a/changelog.d/ITL-1253.md b/changelog.d/ITL-1253.md index 6c10ea46a..9bb4a211d 100644 --- a/changelog.d/ITL-1253.md +++ b/changelog.d/ITL-1253.md @@ -1,3 +1,3 @@ ### Added -- Python function result records include `__pf_var_output_keys`, the output names in declared order (ITL-1253). Cache reuse still matches the function identity and input data hash. +- Python function result records include `__pf_var_output_keys`, the output names in declared order (ITL-1253). Older result rows read with null in this column. Cache reuse still matches the function identity and input data hash. diff --git a/docs/reference/data-function-types.md b/docs/reference/data-function-types.md index a5282f891..d4d517c73 100644 --- a/docs/reference/data-function-types.md +++ b/docs/reference/data-function-types.md @@ -106,7 +106,7 @@ Each result row holds these columns about the function (`__pf_var_` prefix): | `function_signature_hash` | `bytes` | `large_binary` | yes | the hash of the function's declared interface | | `function_content_hash` | `bytes \| None` | `large_binary` | yes | the hash of the function as written (a lambda: its enclosing lines); absent when its source cannot be read (a plain REPL, `python -c`, `exec`) or, for a function other than a lambda, does not start at a `def` statement | | `git_hash` | `str` | `large_string` | yes | the git commit of the function's file or working directory, with `-dirty`, `-untracked` and `-` suffixes; `unknown` outside git | -| `output_keys` | `list[str]` | `large_list` | no | the output names in declared order, recorded for a later opt-in check. Nothing compares this column today | +| `output_keys` | `list[str] \| None` | `large_list` | yes | the output names in declared order on every new row. Null means the row predates this column. Nothing compares this column today | and these about how it was computed (`__pf_exec_` prefix): @@ -126,6 +126,9 @@ The two hashes, each stored as `