From 2e27e6ed3097a45e471eba30efc11338f7707712 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Sun, 22 Nov 2026 17:02:24 -0800 Subject: [PATCH 01/11] docs(specs): design for building a pipeline job from registered streams (ITL-1387) Co-Authored-By: Claude Opus 5.5 --- docs/dev/specs/itl-1387-job-from-streams.md | 410 ++++++++++++++++++++ 1 file changed, 410 insertions(+) create mode 100644 docs/dev/specs/itl-1387-job-from-streams.md diff --git a/docs/dev/specs/itl-1387-job-from-streams.md b/docs/dev/specs/itl-1387-job-from-streams.md new file mode 100644 index 000000000..678ab7204 --- /dev/null +++ b/docs/dev/specs/itl-1387-job-from-streams.md @@ -0,0 +1,410 @@ +# Build a pipeline job from streams made while exploring (ITL-1387) + +Status: DESIGN ONLY, for the developer's approval. Measured on `origin/main` fc1df420 +(2026-11-22). No library code changes with this document. + +Developer's words (2026-11-22): "we can build a feature whereby we can register one or more +streams against a pipeline job and it will create a full pipeline based off of the passed on +streams + all of its upstreams up till and including sources. That can simplify the +exploration -> pipeline development process." Also: "there should be a point between +separating exploration code from proper executable research code so the need to redefine all +steps plainly in a pipeline_job is actually acceptable", and reopening `with pipeline_job:` to +add steps over the nodes so far should still work. Nice to have for the workshop +(2026-11-25), not a blocker. + +Evidence. Every claim below about today's behaviour is backed by a script run against +fc1df420. The scripts are kept with the ITL-1387 working notes, outside the repository: + +| Script | What it shows | +|---|---| +| `reopen_job.py` | reopening `with job:` adds a step over `job.doubled`; it runs | +| `reopen_renumbers.py` | a second unlabelled step of one kind renames the first (`MapData` to `MapData_1`) and every node object is rebuilt | +| `prebuilt_stream.py` | what a job records when a step is built over a stream made before the job (F07); a refused join stays recorded (an empty second `with` block is refused again) | +| `same_step_two_labels.py` | one step recorded under two labels: the last recorded wins | +| `prototype_register.py` | a prototype of the walk, OUTSIDE the library, and the property checked on it | +| `edge_cases.py` | raw-stream roots, side-effect pods, another job's nodes under the prototype walk | + +## 1. What exists today + +### 1.1 Recording + +A `PipelineJob` is a tracker. While a `with job:` block is open, every pod call +(`FunctionPod.process`, `StaticOutputPod.process` for operators, `SideEffectPod.process`, +`CachedFunctionPod.process`, `FallThroughPod.process`) calls the tracker manager, which calls +`AbstractPipelineBase._record_invocation` with a `FunctionInvocation`, `OperatorInvocation` +or `SideEffectInvocation` holding the pod, the exact input streams and the `label` argument. +The invocation is keyed by its content hash (`_invocation_lut`); each input stream whose hash +is not a recorded invocation is kept as a leaf (`_source_streams`). `_record_invocation` +first checks the ITL-1218 rule (`require_one_restriction` over every held stream and the new +inputs). On exit, `compile()` rebuilds the whole DAG from scratch: each leaf becomes a +`SourceJobNode.from_stream(leaf)` (binding it through the `SourceNodeBase.validate` check), +each invocation a `FunctionJobNode` / `OperatorJobNode` / `SideEffectJobNode`, and labels are +disambiguated: a label held by several nodes becomes `