Skip to content

fix(identity): keep commutative input occurrences and tied Join provenance (ITL-1590) - #661

Closed
eywalker wants to merge 50 commits into
mainfrom
eywalker/itl-1590-step-2b-commutative-pipeline-hash
Closed

eywalker wants to merge 50 commits into
mainfrom
eywalker/itl-1590-step-2b-commutative-pipeline-hash

Conversation

@eywalker

@eywalker eywalker commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Step 2b of the identity series. Step 1 (#633) and step 1b (#652) are on main. This branch also merges main with PR #626.

Fixes ITL-1590

Mentions ITL-1628, ITL-1629, ITL-1631, and ITL-1690.

Changes

  • A commutative pipeline hash sorts the list of input pipeline hashes and keeps every occurrence. The historical group encoding and legacy content hash stay in use. Capture keys, chains, and execution input positions retain repeated operands.
  • Join sorts whole bundles only when every tied operand has a complete, matching library provenance layout. The gate checks source and record column pairs per operand, validates joined or folded paths, and uses the source-ID parser or known fold labels. Values compare as plain strings. Select, drop, and map preserve the relevant system fields, so a certified tie stays certified through those projections.
  • Other ties run main's table or row ordering functions. These include custom tags on either or both inputs, bare raw IDs, and unrecognized column layouts. The same rule applies before and after a projection. Row-channel materialization and source validation use main's strict system-tag validation.
  • The two decided refusals remain. A shared system tag with incompatible normalized Arrow types raises InputValidationError (ITL-1690). Two captures distinguished only by commutative multiplicity raise ValueError before recording until the execution graph adopts node identity in step 3. Step 5 replaces the legacy content preimage.

Not addressed here, present on main

  • ITL-1628: a custom tag can keep its argument position while tied source and record IDs sort.
  • ITL-1629: sparse custom tags can yield different positions on row channels and tables.
  • ITL-1631: tied row paths can infer narrower system-tag declarations than the table. The restored main fingerprints and LOG tests pin that behavior, alongside the custom-tag repros.

Stored identity

The tied diamond Join(Join(0,a,z), Join(0,b,c)) keeps its structural hash, legacy content hash, and storage paths. Main could mix its branches as (0,a,c) and (0,b,z). The corrected bundles are (0,a,z) and (0,b,c).

Main entry ID Corrected entry ID
arrow_v1:000002eab7229380d87d1bcb69a821d8d7298ce753ccb78922901c3aeb2aab4f0a00c3 arrow_v1:0000028a9b6e40369d0350a8b84ec071cd267d2ea581c8055bfa1e0ed55bc914af175d
arrow_v1:000002ef3e66b7d1c3b927427fea45b0c5f4d68d0921b56a56185ae6867aefcf120b19 arrow_v1:000002b6ad095086966d207ea3cef12b1a3cf55f699ab2ad59a19a5d3f2c2bf8bd3019

Replaying the corrected diamond against a store written by main can add the new pipeline records alongside the old ones. The separately intended structural hash change for repeated equal inputs moves their pipeline scope.

Verification against main at 813c5110

  • (a) Byte-identical differential snapshots for all 222 non-tied, aggregate, raw-qualified and constructor cases in the compatibility probe and all 384 cases in the qualified-name probe. In a 329-case matrix of raw and source joins over 2–4 operands, the only differences were the three intentional repeat-hash cases and both input orders of the nested provenance correction. Snapshots include output rows, column order and declarations, tokens, entry IDs, pipeline hashes and legacy content hashes, with sync, row and batch execution. The quoted raw-ID, one-sided custom tag and channel validation repros also matched main. Eight Batch and GroupBy channel snapshots matched exactly for null and non-null tags.
  • (b) All modes and operand orders agree for the certified diamond, three tied nested operands, and their folded forms. Select, drop and map preserve certification with generated pairs. The same projections retain main's ordering when a custom tag is present.
  • (c) Regression tests pin the one-sided custom tag's argument position and entry IDs, the strict null-tag diagnostics through GroupBy and Batch channels, and the lexical ordering and entry IDs of raw identifiers containing quotes.
  • (d) Golden --check passed for semantic, schema, Arrow, datagram, pipeline and Torch. Exactly 36 additions compared with main and the additions are byte-identical to the previous PR head. No existing value changed or was removed.

Source diff against main

The line numbers below identify every hunk in git diff origin/main -- src/ by its starting line in this branch.

  • contexts/data/v1.json

    • 250 — Record the open snapshot hash for the 36 provenance and entry-ID pins.
  • core/base.py

    • 6, 131, 249 — Import, define and invalidate the capture memo generation.
  • core/identity_chains.py

    • 3 — Import symmetry-tree tools.
    • 153 — Transform and validate argument groups by occurrence, encoding each position and retaining the legacy content preimage.
    • 331 — Remove the old refusal for already-collapsed symmetry.
    • 506 — Build chains from explicit occurrences.
    • 542 — Drop the collapse marker that no longer enters the chain.
    • 565, 578, 592 — Read complete source and name chains and combine them with the structural hash.
  • core/nodes/function_node.py

    • 574 — Invalidate memoized capture keys when the upstream changes.
  • core/nodes/operator_node.py

    • 40 — Import argument-group transformations.
    • 303 — Keep the compiled node’s legacy content preimage.
    • 339 — Keep all occurrences in compiled structural identity.
    • 422 — Invalidate capture keys when operator inputs change.
  • core/operators/base.py

    • 14 — Import the positional group type.
    • 409 — Accept the positional group in binary operator annotations.
  • core/operators/join.py

    • 2, 43, 56 — Import provenance grammar, fold labels and positional symmetry primitives.
    • 107 — Certify paired fields per operand, order intact bundles, and check shared Arrow types.
    • 551 — Validate the decided tied-type refusal before graph execution.
    • 567 — Declare all commutative occurrences.
    • 774 — Compare physical Arrow declarations for shared tied tags.
    • 962 — Dispatch table ties to bundle sorting or the historical sorter.
    • 1149 — Rank the full positional list for system-tag suffixes.
    • 1205 — Propagate a tied-type error directly from row tasks.
    • 1252 — Check first-row declarations in the binary row path.
    • 1323 — Find equal-hash groups in the staggered row path.
    • 1343 — Check first rows when every member of a tied group declares its fields.
    • 1405 — Accept the optional first-pair declaration check.
    • 1466 — Run the declaration check before probing for matches.
    • 1603 — Preserve original certified columns beside the main-format row while renaming.
    • 1696 — Validate row declarations and name the restored main row builder.
    • 1999 — Dispatch binary row ordering using the same bundle rule.
    • 2037 — Keep main’s intermediate rows and recover unsorted bundles for the final staggered link.
    • 2147 — Hold original tied columns on internal row datagrams only.
  • core/operators/static_output_pod.py

    • 36 — Import argument-group transforms.
    • 258, 273 — Document occurrence-aware groups.
    • 1757 — Keep the dynamic stream’s legacy content preimage.
    • 1767 — Keep repeats in dynamic stream structural identity.
  • core/operators/streaming_joins.py

    • 95, 120 — Import the Join sorter and positional ordering.
    • 688 — Validate shared types and retain the input suffix list in the batch kernel.
    • 769 — Dispatch batch ordering through the same table rule.
  • core/streams/base.py

    • 27 — Import argument-group transforms.
    • 783 — Describe one upstream occurrence per position and select structural or legacy preimages.
  • hashing/semantic_hashing/semantic_hasher.py

    • 81 — Import the symmetry-group type.
    • 355 — Encode its sorted members with the historical group label and retain duplicates.
    • 544 — Recognize the symmetry group as a nested structure.
  • pipeline/async_orchestrator.py

    • 24 — Import the operator input-position resolver.
    • 227 — Build async readers by downstream node and argument position.
    • 280 — Drain every position when using an existing run.
    • 302 — Read the function node’s positional input channel.
    • 317 — Feed operators every positional reader.
    • 338 — Read the side-effect node’s positional input channel.
  • pipeline/base.py

    • 4, 37 — Import capture memo and identity types.
    • 140 — Keep the keys and memo for multiplicity-aware capture.
    • 332 — Commit stream keys with a successful capture.
    • 362 — Explain the capture key and opt-in memo update.
    • 401 — Resolve full occurrence keys and refuse legacy collisions.
    • 413 — Stage and memoize capture keys and implement the decided refusal.
    • 489 — Index the chosen invocation by both capture and legacy keys.
    • 947 — Restore all recorded positions and reject a legacy collision on the from-graph path.
  • pipeline/edges.py

    • 1 — Resolve compiled dependency edges to the recorded operand positions.
  • pipeline/graph.py

    • 707 — Recover repeated producer positions when compiling a pipeline.
  • pipeline/job.py

    • 473 — Recover compiled job node arguments by their recorded positions.
  • pipeline/pod_invocation.py

    • 1 — Document capture identity and import argument-group tools.
    • 34 — Declare the capture memo entry.
    • 121 — Keep distinct structural and legacy preimages and resolve full capture keys bottom-up.
  • pipeline/restrictions.py

    • 187 — Walk upstream nodes by object identity so legacy-equal graphs cannot hide source use.
  • pipeline/serialization.py

    • 6 — Count occurrences in the commutativity check used for safe reconstruction.
    • 76, 92 — Document, import and accept explicit symmetry groups.
    • 119 — Compare the member positions by identity and multiplicity.
  • pipeline/sync_orchestrator.py

    • 11 — Import the operator input-position resolver.
    • 194 — Supply every recorded operator operand on the sync path.
  • protocols/core_protocols/__init__.py

    • 6, 30 — Expose the symmetry-group type with the pod protocols.
  • protocols/core_protocols/pod.py

    • 7, 71 — Extend the argument grouping type and its examples to explicit symmetric occurrences.
  • protocols/hashing_protocols.py

    • 16, 25, 51, 59 — Remove the obsolete collapsed-symmetry flag and its refusal documentation.
  • types/argument_groups.py

    • 1 — Define positional symmetric groups and stable pipeline-digest ranking.

Local checks

CI

Nine checks passed on b145b92e. GitHub Pages publishing and Spiral integration were skipped by their workflow conditions. Full Python 3.13 job

@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

eywalker and others added 5 commits November 28, 2026 18:06
…t count

Compiled nodes still compare by the legacy content hash, which drops
repeats, so Join()(a, b) beside Join()(a, b, b) (or Join()(a, a) beside
Join()(a, a, a)) became one execution vertex: the sync run read zero rows
and the async run failed. Refuse such a pair at capture until node
identity counts occurrences (ITL-1559 steps 3 and 5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validate tied system tag types from channel declarations, including empty inputs. Remove unrelated changes identified by the seventh review.
@eywalker

eywalker commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing without merging, by the developer's decision (2026-12-03). Superseded by #667 and #694; what remains is tracked on ITL-1751. The branch is kept.

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

@eywalker eywalker closed this Dec 3, 2026
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