Skip to content

refactor(pipeline): key the graph by node hash (ITL-1559, step 3) - #662

Closed
eywalker wants to merge 109 commits into
mainfrom
eywalker/itl-1559-step-3-graph-keyed-by-node-hash
Closed

eywalker wants to merge 109 commits into
mainfrom
eywalker/itl-1559-step-3-graph-keyed-by-node-hash

Conversation

@eywalker

@eywalker eywalker commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implement step 3 of ITL-1559 against the final capture specification. The receiving graph names and validates leaves before recording a step. Graph keys are fixed at capture, and saved files and runs use the legacy projection. The capture specification documents 87 cases and maps them to tests. Cached pod outputs keep their recording provenance when a later step consumes them.

Standalone OrcaDAG and NetworkxBackend keep main’s behavior for caller-supplied keys, equal aliases, live vertex attributes, edge endpoints, adjacency, traversal, and cycle and missing-vertex errors. Standalone runs also keep main’s result lookup, stale-output diagnostics, and provenance across joins of separately bound jobs. One differential runs 11 scenarios against main at 26efe35a, exercising all 14 public DAG operations on the standalone adapters and compiled pipeline and job DAGs, plus the vertex views, async result reads, and join tracing. It compares shared behavior directly and asserts the specified compiled membership and mutation rules.

Reference, key, identity and membership

  • Reference uses job.<label> or job.nodes[label]. A bind or rebind keeps the label. Saved labels follow main's choice. BL16 orders same-named unlabelled steps by node hash. Step and input-slot label collisions keep main's numbering.
  • Key is the receiving graph's captured node hash. A custom operator without a node hash has a stable legacy fallback.
  • Identity comes from the declaration for blueprints and from content for job nodes. Python equality and hashing keep main's answers.
  • Membership with in and a stream, node, or invocation object raises UndefinedGraphMembershipError. Use job.nodes[label] or pipeline.nodes[label]. DAG adjacency uses the receiving graph's own nodes (rows 42–51).

Refusals and migration

Rows Refusal Migration
6, 7 One source object on two job slots can leave a branch unread. This includes setter changes and loading repeated source configs. Bind one slot and branch from it. Step 6 restores the two-slot route.
12, 19, 35 A second object would take an existing slot name. Reuse the original object or give the other object a distinct name. ITL-1553 will define source equivalence.
21–28, 52 A blueprint cannot name a foreign job node, slot or a prebuilt stream over one consistently. Pass the source itself or use node.as_source() for stored results. ITL-1700 will define implicit names.
37, 38 An explicit slot and a root source both claim one name. Rename the explicit slot or pass the root source directly.
53–54 One source is captured directly and through its explicit slot declaration. Choose one capture form and branch from it until ITL-1553 defines source and stream equivalence.
67, 74 A slot shares an execution identity with another slot or an in-graph step. Bind distinct sources or capture the step inside the graph and reuse its output.
71 The same declaration reaches multiple receivers in one tracker call. All graph captures are refused atomically. Create a declaration for each receiver.
85 A later blueprint capture uses a compiled step as input. Pass the original invocation stream.
87 Reusing a pod and its input objects after rewiring would change their graph key. Create a new descriptor for the rewired inputs.
R4 Replacing a compiled function or operator step's inputs would change the recorded topology. Build a new graph for new edges, or bind a different source to an existing job slot.

Main's existing refusals retain their error class and message. The new refusals occur before recording or binding. All tests that used shared-slot bindings now branch from a single slot, use distinct sources, or assert the refusal. The direct blueprint test for a late live-slot collision is covered by the capture refusal in row 52.

Updated tests and documentation

  • tests/test_hashing/test_identity_chains.py gives the nested symmetry fixture four distinct bindings and rebinds y_slot to a distinct reading.
  • tests/test_pipeline/test_source_id_conflicts.py asserts the prospective binding refusal and the state preserved after it.
  • tests/test_pipeline/test_source_object_registration.py covers refusal at bind, at the setter and on load. It reuses one projection object and checks the original diagnostics with separate root objects. A one-call rotation remains covered.
  • The tracker specification fixture now marks its ID as a plain tag so it records a valid function invocation.
  • docs/concepts/sources.md and docs/concepts/identity.md document the migration. The documentation samples already use supported capture routes and continue to use the label-keyed job API.

Row-to-test table

| Row | Test | Decision asserted |
| 1 | test_r01_step_inside_graph | Accept |
| 2 | test_r02_own_node_later_capture | Accept |
| 3 | test_r03_root_once | Accept |
| 4 | test_r04_same_object_same_pod | One node, label d1 |
| 5 | test_r05_same_object_two_pods | Accept |
| 6 | test_r06_one_object_two_slots_bind_refused | Refused at bind; both slots keep their bindings |
| 7 | test_r07_one_object_two_slots_capture_refused | Refused at the step bringing y |
| 8 | test_r08_equal_content_objects_refused | main's error |
| 9 | test_r09_one_name_other_keys_refused | main's error |
| 10 | test_r10_prebuilt_once | Accept |
| 11 | test_r11_prebuilt_same_object_twice | One node, label p1 |
| 12 | test_r12_prebuilt_equal_builds_refused | Refused, names the slot and both streams |
| 13 | test_r13_prebuilt_other_content | Accept |
| 14 | test_r14_prebuilt_and_its_root | Accept |
| 15 | test_r15_prebuilt_over_own_slot_refused | main's error |
| 16 | test_r16_raw_without_system_tags_refused | main's error |
| 17 | test_r17_raw_once | Accept |
| 18 | test_r18_raw_two_distinct (job and blueprint) | Accept |
| 19 | test_r19_raw_two_equal_refused | Refused |
| 20 | test_r20_other_job_into_job_refused | main's error |
| 21 | test_r21_other_job_bound_node_refused | Refused, main's text for a pipeline |
| 22 | test_r22_other_job_unbound_node_refused | Refused |
| 23 | test_r23_instances_same_binding_refused | Refused |
| 24 | test_r24_instances_other_binding_refused | Refused |
| 25 | test_r25_other_job_bound_slot_refused | Refused |
| 26 | test_r26_other_job_unbound_slot_refused | Refused |
| 27 | test_r27_instance_slots_other_binding_refused | Refused |
| 28 | test_r28_loaded_job_node_refused | Refused; also a prebuilt stream over it |
| 29 | test_r29_derived_source | Accept |
| 30 | test_r30_two_derived_objects_refused | main's error |
| 31 | test_r31_loaded_derived_source_refused | main's error |
| 32 | test_r32_cached_source | Accept |
| 33 | test_r33_cached_and_wrapped_refused | main's error |
| 34 | test_r34_slot_name_same_leaf | Accept, one slot |
| 35 | test_r35_slot_name_other_leaf_refused | Refused |
| 36 | test_r36_slot_name_other_schema_refused | main's error |
| 37 | test_r37_slot_and_root_name_blueprint_refused | Refused at the root's step |
| 38 | test_r38_slot_and_root_name_job_refused | Refused at the root's step |
| 39 | test_r39_slot_name_equals_step_label, test_r39_automatic_step_shares_its_new_slot_name | Main’s slot and step labels in both cases |
| 40 | test_r40_merge_join_repeated_input | Accept |
| 41 | test_r41_label_kept_as_main | One node, label r1 |
| 42 | test_r42_foreign_object_lookup | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 43 | test_r43_instances_different_sources | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 44 | test_r44_instances_same_source_object | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 45 | test_r45_instances_equal_source_objects | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 46 | test_r46_unbound_instances | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 47 | test_r47_bound_and_unbound_instance | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 48 | test_r48_own_node_after_from_pipeline_bind | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 49 | test_r49_own_node_captured_job | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 50 | test_r50_own_node_unbound_then_bind | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 51 | test_r51_blueprint_membership | Object membership raises UndefinedGraphMembershipError. Label access and owned-node adjacency remain available. |
| 52 | test_r52_standalone_job_slot_into_blueprint_refused | Refused |

The byte fixtures come from main at 39be606a. The fixture writer version is pinned so test installs at different revisions can compare every byte. In row 39, main gives the explicit step a and gives its slot the automatic display label a_1. The fixture preserves those labels and the slot name a.

Follow-up

Step 4 moves the saved format to the new hashes and records the slot name and source identity. It also makes the most recent explicit label win for saved nodes. Step 6 lifts the shared-source binding refusal, runs both branches, and can accept equivalent objects when ITL-1553 defines source equivalence.

Decisions for the developer

Rows 53–54. The developer confirmed that step 3 refuses capturing the same source object directly and through its explicit slot declaration in either order. ITL-1553 tracks accepting both forms with one bound slot and both branches running once source and stream equivalence is defined.

The third review tested both orders in sync and async, with and without compilation between captures. Main has two live slots named a, leaves the declaration branch unbound, and reports a partial run with declared=[] and direct=[9,12]. It stores two triple results and two corresponding pipeline records. Reviewed head afd1c7ad completed both branches and added declared=[6,8], two double results and two corresponding pipeline records. With the version and run ID pinned, the saved job changed from 6,857 to 6,841 bytes. The run URI changed from job@af03287e39c266ad to job@3dd6f83f7f5c657e. CSV/Delta readback in both directions reproduced the writer’s rows.

Row 85. Step 3 refuses late capture from a compiled blueprint step. Approving a direct edge from first to second would save three vertices. Main saves four vertices with a separate implicit slot feeding second. In the pinned sync and async review fixture, the saved blueprint would change from 6,317 to 5,114 bytes. With only the original source bound, second would return [7, 9] instead of []. Passing the original invocation stream already saves identical 5,123-byte blueprints and returns [7, 9] on both revisions.

Other capture decisions

    1. Refuse a compiled node from another blueprint.
    1. Refuse a compiled slot from another blueprint.
    1. Refuse a recorded invocation stream from another blueprint.
    1. Refuse a prebuilt projection over another blueprint's node.
    1. Refuse a loaded blueprint's node, slot, or projection.
    1. Refuse unknown input types at direct registration and name the type in the error.
    1. Refuse new capture into a loaded blueprint.
    1. Refuse new capture into a loaded job.
    1. Accept a side-effect pod over a root source and deliver both rows as on main.
    1. Accept a stored-result source with a custom ID and promoted tags as on main.
    1. Keep main's numbering for duplicate explicit step labels, including content-hash order.
    1. Refuse mixed explicit and implicit names for a single leaf in either order.
    1. Refuse either capture order and all job binding routes when a prebuilt slot and an in-graph step share a legacy execution identity. The shared validation checks prospective records at both capture and bind.
    1. Apply row 66 even when the implicit name matches one of two names already declared for the leaf.
    1. Refuse foreign live streams through instantiation, bind, and the slot setter, retaining main's existing binding diagnostics.
    1. Refuse additions to a job-derived blueprint and preserve its compiled graph.
    1. Refuse another receiver's declaration from the first successful capture, including before compile. A refused tracker dispatch leaves every receiver’s graph and registries unchanged.
    1. Refuse unrelated slot and step name collisions and new claims on numbered labels, preserving main's numbering in rows 39 and 65.
    1. Keep main's binding and load-only behavior for executable nodes constructed independently of any graph.
    1. Refuse two equal prebuilt streams with different inferred slot names before recording the second slot. Main’s reproducer returns [70, 90] from the downstream step in both run modes. The refused capture preserves the original branch.

Slot and node registration sites

Registration site Validation boundary
AbstractPipelineBase.record_function_pod_invocation, record_operator_pod_invocation and record_side_effect_pod_invocation Direct calls and tracker dispatch from functions, cached functions, operators and side effects enter _record_invocation. The execution-role index checks new leaves and the retained step before publication. Stacked trackers stage their publications together.
AbstractPipelineBase.prepare_invocation Preparation checks the proposal, and the returned callback enters _record_invocation again against the current graph.
AbstractPipelineBase.from_invocations The imported source-only registry is checked as a whole. Every imported step then enters _record_invocation before the new graph is returned.
PipelineJob.from_pipeline, PipelineJob.bind and the owned SourceJobNode.bound_source setter Instantiation imports the blueprint and binds through bind. PipelineJob.bind and the owned setter call _bind_sources. The transaction checks the prospective identities of the compiled and pending captured records before changing slots. from_pipeline(sources=...) reaches it through bind. Standalone slots have no job registry.
AbstractPipelineBase.compile and PipelineJob.as_pipeline Compilation materializes validated capture records. The job-to-blueprint projection copies the compiled graph as schema-only nodes and refuses additive capture.
Pipeline.load and PipelineJob.load Loaders restore serialized graph records and saved addresses for readback. PipelineJob.load calls _bind_sources to restore bindings against the saved step identities. Loaded graphs refuse live captures.

Fifth review

  • Schema-only slots can use an example whose digest matches a recorded step. Capture defers execution identity checks that depend on binding. Once bound, the two branches return [7, 9] and [17, 19] in all 16 added cases, matching main.
  • Each capture checks only new slots and its retained step against the index. With compilation disabled, 1,000 and 2,000 graph nodes visited 1,000 and 2,000 role records. Median capture times over five runs were 0.699 s and 2.414 s, compared with 1.196 s and 7.102 s on main.

Pre-existing on main are the missing as_slot helper, failure to instantiate a loaded function blueprint's saved stub, and refusal to capture after changing a slot binding.

Sixth review

  • The job binding transaction checks the proposed identities of both compiled nodes and captured branches awaiting compile. Batch bind, owned SourceJobNode.bound_source assignment, from_pipeline(sources=...) via bind, and PipelineJob.load all reach _bind_sources. Fresh concrete capture checks its execution roles in _record_invocation before publishing them. Compile materializes those checked captures and preserves accepted bindings.
  • The 960-case differential matrix matched current main's downstream rows in all 290 accepted cases. The other 670 cases raised the expected validation errors. Two-way Delta reads in both run modes reused stored rows with the same run URI and zero function calls. All six golden groups matched in check mode. Review pass 16 replayed the matrices on main at 26efe35a, with 223 variants per revision, 139 exact refusal and atomicity checks, 36 byte-identical saved fixtures, and 63 matching comparable store and URI observations. The remaining eight paired store observations exercise the specified refusals in rows 67 and 74.

Public graph migration

The November 29, 2026 developer decision removes Pipeline.graph and PipelineJob.graph (rows 76 and 78). Use dag for topology and adjacency, nodes[label] for node metadata, and diagram() for rendering. The implementation retains its private capture and compiled graphs.

Reader Migration
Capture and compile in src/orcapod/pipeline/base.py, blueprint loading in src/orcapod/pipeline/graph.py, and job-to-blueprint projection and job loading in src/orcapod/pipeline/job.py Removed the projection that populated, copied, or enriched the public NetworkX graph. Capture, execution, and serialization retain their internal graph paths.
tests/test_pipeline/test_pipeline.py Uses dag and nodes[label] for topology and node information. The internal pipeline-hash assertion reads _hash_graph.
tests/test_pipeline/test_pipeline_base_recording.py, tests/test_pipeline/test_source_object_registration.py, and test-specification/unit/test_tracker.py Traverse the public DAG or inspect the label mapping.
tests/test_pipeline/test_capture_boundary.py and tests/test_pipeline/test_source_id_conflicts.py Snapshot the private capture and compiled graphs to check refused transactions. The removed NetworkX compatibility tests are replaced by an API removal check.
tests/test_hashing/test_identity_chains.py Checks the saved wire key against the internal loaded node attribute and uses the public label mapping to access the node.
docs/concepts/pipeline-job.md and docs/reference/hashing.md Document DAG traversal, label access, and diagram rendering. Published Python samples already use these accessors.

Pending source and database bindings preflight captured steps before publishing a source, attaching a database, or changing the execution context (row 79).

Main integration and ITL-1767

Merged main at d5c7f14f. That merge includes #675, #671, #672, #676, #669 and #673. Six conflict hunks were resolved. A second merge at 511b7847 picked up #616 without conflicts. Blueprint capture keeps the reserved-column check from #616 for source proxy declarations. Main advanced to 26efe35a during review pass 16 CI and merged cleanly.

File Resolution
docs/reference/hashing.md Kept the inventory of compiled graph keys, source checks and exported keys. Updated the compile reference to the merged implementation.
src/orcapod/pipeline/job.py Kept the loaded-job context guard and main's empty-block refresh. Marked pending compilation when recording publishes.
src/orcapod/pipeline/job.py Kept main's validation before compiled-node publication, and cleared the pending slots after successful compilation.
src/orcapod/pipeline/job.py Kept main's runnable-step preflight and run-state update, with the job's explicit execution DAG keys.
src/orcapod/pipeline/job.py Kept restored-node provenance and assigned each saved node its graph key before adding it to the keyed DAG.
tests/test_pipeline/test_source_object_registration.py Kept the shared-object binding refusal and checked that it preserves the existing sources.

For the overlapping ITL-1767 cases, the ITL-1559 capture or binding diagnostic takes precedence. It covers the same source-alias fixtures earlier and also covers aliases between slots whose consumers use different pods. Distinct steps that would share a legacy execution vertex still receive the ITL-1767 step diagnostic, including when a compiled node's input setter would create the collision. Compile and binding preflight use the execution-role index to select the candidate steps.

Review pass 15

  • Standalone OrcaDAG uses Python object-key semantics. Distinct bound job nodes keep their own vertices, attributes, membership, and edges.
  • Pipeline.from_invocations and PipelineJob.from_invocations defer declaration claims and descriptor registrations until the import compiles. A refused import leaves the caller's input objects reusable.
  • Both function and operator upstreams setters check newly introduced edges for foreign inputs before installing them. Both run modes continue to return the original rows after a refused edit.

Review pass 16

  • Standalone NetworkxBackend uses NetworkX's native object keys and views. Two independently bound nodes keep separate vertices and attributes, with the edge between them.
  • Compiled job setters refuse a new input before execution can diverge from the recorded predecessors. The same preflight covers instantiated and restored jobs.
  • Compiled blueprint setters classify foreign inputs before replacement. Captured, restored and job-derived blueprints refuse topology changes at the setter. Assigning the same input objects in the same positions succeeds as a no-op.
  • Blueprint capture retains main's ReservedColumnNameError when a bound proxy declares system tags. A proxy declaring user fields still retains the delegate's Arrow types.

Review pass 17

  • Custom source factories inherit the receiver's capture rules. Row 85 refuses late capture from a compiled blueprint step. Explicit declarations from one example remain separate, export as slots and take independent bindings. Job subclasses keep the foreign-job diagnostic.
  • Stacked tracker dispatch calls the public prepare_invocation validation hook for functions, operators and side effects before staging any capture.
  • A standalone descriptor held by a job checks proposed edges through the shared live binding walk before changing its inputs. A live dependency on a job slot or its owned invocation stream is refused at the setter, preserving the current binding and rows.
  • Function and operator as_node() descriptors go through the same capture walk as other prebuilt inputs. A wrapper over a foreign job slot reports that slot and the stored-result remedy.
  • Sync and async orchestration of standalone DAGs and NetworkX graphs use the adapter's object keys for result maps and operand wiring. Different bindings of one blueprint retain independent rows.

Mutation-route audit

Public route Validation
Context entry and exit, set_active, tracker registration and deregistration, record_function_pod_invocation, record_operator_pod_invocation, record_side_effect_pod_invocation, and prepare_invocation and its callback Tracker registration controls who sees a call. Each receiver uses the shared capture classifier and validates execution roles before recording. Stacked dispatch calls the public preflight hook on every receiver that exposes it before staging any publication. The prepared callback checks the current graph again.
Pipeline.from_invocations and PipelineJob.from_invocations Public source inputs and new invocation inputs use the same classifier. A refused import leaves the caller's declarations and descriptors reusable.
Pipeline.compile, PipelineJob.compile, and the source, function, operator and side-effect node factory attributes Compilation checks captured sources and resolves predecessors from the recorded graph before publishing the compiled DAG. The factory attributes select node classes during construction. Receiver policy and exported source roles remain independent of the factory class.
Pipeline.load, PipelineJob.load, PipelineJob.from_pipeline, as_pipeline, pipeline and compiled_pipeline These routes restore or reconstruct topology and register the compiled setter preflight on function and operator nodes. Job bindings use the shared binding transaction.
FunctionNode.upstreams, OperatorNode.upstreams, FunctionJobNode.upstreams and OperatorJobNode.upstreams Both setters use StreamBase._rewire. A compiled graph classifies newly introduced objects, preserves the job's shadowed-step error for colliding owned proposals, and refuses changed inputs before installing them. A standalone descriptor held by a job checks its prospective live bindings and execution roles before publishing the edit. A standalone descriptor used by a blueprint protects its saved input identities.
SourceNode.upstreams, SourceJobNode.upstreams, and live and restored side-effect upstreams Source setters require an empty tuple. Side-effect inputs have a getter only.
PipelineJob.bind and SourceJobNode.bound_source The shared job transaction checks ownership, source consistency and the proposed execution roles before binding or attaching databases. Standalone slots validate locally.
SourceProxy.bind and unbind These change an external delegate. A receiving graph checks live dependencies on later capture, binding or reads, and validates the declared schema when creating a blueprint slot.
Published OrcaDAG.add_node and add_edge, standalone OrcaDAG.add_node and add_edge, and NetworkxBackend.add_node and add_edge Published DAGs refuse topology edits. Both standalone adapters and the orchestrators' result and operand maps use caller-supplied objects under Python equality and hashing. Their node-attribute dictionaries hold metadata; changing an attribute installs no edge.
dag.node_attrs, dag.nodes().mapping, the adapter's native node and edge views, nodes, source_pods, function_pods, operator_pods and sources DAG and adapter attribute maps expose metadata. The label and source listings are copies. Use the corresponding topology or binding route to change connections.
label, exposed data_context, executor, node_config, apply_node_config, node_type, and exposed tracker_manager These attributes and methods change labels, interpretation, execution settings, or tracker selection. They never assign upstreams.
database, result_database, execution_context, cache_mode, attach_databases, set_ephemeral_database, ephemeral_result_database, clear_cache and add_pipeline_record Job accessors and the cache-mode property are read-only. The attachment, cache and record routes maintain storage or run state without editing the recorded topology.
run, run_async, execute, async_execute, execute_data, save, node from_stream / from_descriptor factories and reset Job runs preflight live source dependencies and shadowed steps. Node execution can consume supplied data for that call. Saving writes a descriptor. Node factories construct standalone objects. Capturing an as_node() descriptor traces its retained inputs through the shared classifier. reset leaves recording state as it was.

A stored-result source can follow a binding in another job. Receiving capture refreshes the execution-role index when that dependency changes. Job reads and runs validate the live dependencies.

Verification

Five matrices cover 1,104 cases in sync and async, including 48 mutation cases. The 504 new cases cross inferred, explicit and mixed names with sources, prebuilt streams and declarations, equal and distinct legacy content, and both orders. They cover direct capture into both graph kinds, instantiation, batch bind, and slot setters on direct and blueprint-derived jobs. The 290 accepted cases returned the same downstream rows on current main. Refused cases preserved the receiving graph and binding state.

Against main at 511b7847, the 96 custom-operator cases and the 48 mutation cases passed in both run modes. Main starts rewired controls with their final inputs. All 36 comparable row observations and saved byte fixtures matched, as did 34 accepted run URI comparisons. Each revision read the other revision’s Delta rows for functions and for both ordered and commutative operators. All six golden groups matched in check mode. Review pass 16 replayed the matrices on main at 26efe35a, with 223 variants per revision, 139 exact refusal and atomicity checks, 36 byte-identical saved fixtures, and 63 matching comparable store and URI observations. The remaining eight paired store observations exercise the specified refusals in rows 67 and 74.

Pass 17 rechecked 290 accepted cases, 223 row variants per revision, 139 exact refusals, 36 saved files byte for byte, and 63 comparable stored-row and run-URI observations against current main. The 34 additional compatibility cases include two-way Delta reads in both run modes. All six golden hash groups matched.

Summary by CodeRabbit

  • Breaking Changes

    • Replaced the public graph accessor with dag for inspecting pipeline topology and adjacency. Object-membership checks on public graphs are not supported.
    • Captures and bindings now reject foreign graph objects, duplicate slot names, and assigning one source object to multiple slots. Loaded pipelines cannot accept new captures.
  • Bug Fixes

    • Corrected commutative input ordering and automatic step labels.
    • Improved validation before source binding and database updates, including checks for null values in required system tags.
    • Fixed function results not being returned in some cases.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

This PR replaces object- and content-hash-based graph addressing with keyed DAGs. It changes capture and binding validation, save/load identity mapping, and graph-key use in execution and provenance paths. It also removes the public graph accessors and documents the changed graph and source constraints.

Changes: Graph identity and capture

Layer / File(s) Summary
Identity and legacy-key helpers
src/orcapod/core/base.py, src/orcapod/core/identity_chains.py, src/orcapod/core/function_pod.py, src/orcapod/pipeline/pod_invocation.py, tests/test_hashing/*, tests/test_core/test_order_invariance.py, docs/concepts/identity.md, docs/reference/hashing.md
Graph keys use node identity, with legacy identity projections retained for specified boundaries. Identity walks, symmetric argument grouping, and automatic label ordering are updated.
Keyed DAGs and graph views
src/orcapod/pipeline/dag.py, src/orcapod/pipeline/networkx_backend.py, src/orcapod/pipeline/diagram.py, src/orcapod/errors.py, tests/test_pipeline/test_graph_node_keys.py, tests/test_pipeline/test_pipeline.py, docs/concepts/pipeline-job.md
DAG storage, adjacency, node views, and graph consumers resolve nodes through keys. Public graph membership raises UndefinedGraphMembershipError for objects without defined membership.
Capture and binding validation
src/orcapod/pipeline/base.py, src/orcapod/pipeline/job.py, src/orcapod/pipeline/source_consistency.py, src/orcapod/core/tracker.py, src/orcapod/core/nodes/*, src/orcapod/side_effects.py, tests/test_pipeline/test_capture_boundary.py, tests/test_pipeline/test_source_object_registration.py, docs/concepts/sources.md, docs/dev/specs/itl-1559-step-3-capture-boundary.md
Capture and binding validate graph ownership, slot names, source reuse, execution identities, and storage compatibility. Tracker callbacks can stage capture publications until callbacks succeed.
Save/load and legacy projections
src/orcapod/pipeline/graph.py, src/orcapod/pipeline/job.py, tests/test_pipeline/fixtures/itl_1559_capture/*, tests/test_pipeline/test_step3_main_compatibility.py, changelog.d/ITL-1559.md
Pipeline and job persistence maps saved keys to graph keys and rebuilds keyed DAGs. Save and run paths retain legacy projections where specified.
Keyed execution and graph consumers
src/orcapod/pipeline/node_run.py, src/orcapod/pipeline/sync_orchestrator.py, src/orcapod/pipeline/async_orchestrator.py, src/orcapod/pipeline/provenance.py, src/orcapod/pipeline/restrictions.py, src/orcapod/pipeline/result.py, tests/test_pipeline/*
Run planning, sync and async orchestration, provenance lookup, restrictions, and result caching use keyed graph state and DAG helpers.

Estimated code review effort: 5 (Critical) | ~150 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant StreamBase
  participant BasicTrackerManager
  participant AbstractPipelineBase
  StreamBase->>BasicTrackerManager: record pod invocation
  BasicTrackerManager->>AbstractPipelineBase: stage and validate capture
  AbstractPipelineBase-->>BasicTrackerManager: return publication callback
  BasicTrackerManager->>AbstractPipelineBase: publish after callbacks succeed
Loading

Possibly related PRs

Merge Risk: Moderate · up to 0c7db · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

This refactor moves pipeline graphs to key-based addressing and adds stricter capture and binding checks. Most paths look intended and well tested. Several edge cases remain open: rebinding a slot and then capturing, staged captures that publish after a bind, recompiling a loaded blueprint, and operator input ordering under legacy projection. These should be fixed or explicitly accepted before merge.

Security architecture risk: Moderate · up to 0c7db

Loading a saved pipeline can silently collapse distinct entries if they resolve to the same identity. That can change which input a step uses. The risk is to the integrity of the restored pipeline; the review did not establish broader access to data or credentials.

Retained concerns

  • Medium · reliability · inferred: The new load-time translation does not require a one-to-one mapping from saved entries to graph keys. If two entries reconstruct to the same identity, the loader can discard one node, merge edge references, and retain only one ordered-input record. The job loader then consumes that rewritten topology. The base kept those lookup entries keyed by their distinct file keys.
Security review details

Security Blast Radius

  • inferred — The identified integrity risk requires a caller to load an affected blueprint or job file. The supported scope is the restored graph and downstream jobs that consume it; the inspected paths do not establish remote reachability, privilege gain, or cross-tenant exposure.

Trust Boundaries and Controls

  • observed — The loader checks the saved format and reconstructs descriptors on file keys before translating topology. The translation changes the graph handed to downstream consumers; it does not select which source descriptors are reconstructed.

Resilience and Maintainability Implications

  • observed — For built-in graph trackers, dispatch stages publications until validation completes for all trackers. Publication then runs sequentially, and custom trackers without staging are invoked inline; this is not a general rollback guarantee.

Hardening Proposals

  • proposed — Validate the complete file-key translation before publishing restored state. Reject ambiguous mappings with a compatibility error unless an explicit legacy rule can preserve node identity and ordered dependencies. Verify that behavior against historical saved files.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "refactor(pipeline): key the graph by node hash (ITL-1559, step 3)" matches the main change. The changeset keys pipeline graph vertices and capture records by stable node/graph keys (OrcaDAG…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "refactor(pipeline): key the graph by node hash (ITL-1559, step 3)" matches the main change. The changeset keys pipeline graph vertices and capture records by stable node/graph keys (OrcaDAG, NodeMap, graph_key, identity chains), and the PR objectives state the same step 3 goal. The title is specific and concise, and it names the ticket and step.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@eywalker

eywalker commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing: this work continues in #695 (ITL-1848, step 3 PR A), which keys compiled graphs by node hash and keeps main's behaviour except for the listed accepted refusals. The rest of step 3 is tracked under ITL-1559 and its children (ITL-1864 for step 4, ITL-1865 for step 6).

Posted by a Claude Code agent on behalf of @eywalker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant