Skip to content

Add Plant IoPort for partitioned Ray ingress-pre-process/integration-sub-process/egress-post-process, Invoice Seed, & UnixFS CAR reads - #204

Open
JEJodesty wants to merge 15 commits into
devfrom
w3c
Open

Add Plant IoPort for partitioned Ray ingress-pre-process/integration-sub-process/egress-post-process, Invoice Seed, & UnixFS CAR reads#204
JEJodesty wants to merge 15 commits into
devfrom
w3c

Conversation

@JEJodesty

@JEJodesty JEJodesty commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Goal: Restore distributed pre/post I/O (Bacalhau CoD–style ingress/egress) using Plant [SaaS] Ray, without putting Ray or Kubo into Process source. Align hotF (RayComputePort / integrated_subproc) with the same partition layout so ingress → integration → egress share stable partition identity (minimize shuffle). Default CATS_IO_PARTITIONS=1 keeps today’s TransportPort.migrate demo path.

Follow-on to #202 (signed BOM / AddressStore / LDP / Solid).

flowchart LR
  inv[Invoice input CID]
  ing[ingress IoPort Ray]
  layout[partition dir CID]
  cache[integration_cache TransportPort]
  hotF[hotF RayComputePort]
  egr[egress IoPort Ray]
  out[Invoice data_cid]
  inv --> ing --> layout --> cache --> hotF --> egr --> out
Loading

What landed toward that goal

  • Plant IoPort: Function-owned IoPort protocol; when CATS_IO_PARTITIONS>1, Process ingress/egress use RayIoPort (part-*.car UnixFS directory layout via ContentMesh / AddressStore). Invoice still records one root CID per stage.
  • hotF alignment: ComputePort.num_partitions / RayComputePort consume/produce the same part-* count — no repartition(n) when already n. Naming: Higher-Order Transfer Function (hotF) replaces former tHOF wording for integrated_subproc.
  • Process import hygiene: function_* batch maps typed as Dict[str, Any] — no numpy import in Process callables at import time.
  • Prerequisites: pure-Python UnixFS CID verify + CARv1 / directory extract; gateway-first get / dag_export.

Also in this PR (supporting / adjacent)

  • Invoice Seed (Populate Invoice's Seed field #187): Executor mints Process replay dict {seed, rng_seed, num_partitions} into invoice.seed_cid before invoice_cid; flatten_bom resolves invoice.seed; provenance asserts non-null, unique Seeds across CAT0/CAT1. num_partitions on Seed records the observed I/O + hotF alignment n for the run (env-selected today; Seed is the control-plane home going forward).
  • Intra-run PROV: signed ExecutionBom stageLineage (prov:Entity + prov:wasDerivedFrom along Invoice stage CIDs) and #executorRun Activity — envelope stays address-only.
  • TF lock heal: remove orphaned .terraform.tfstate.lock.info when no live holder before destroy/apply heal.
  • Make / deps: deps-uv via pip, deps-uv-sync, Terraform into .venv/bin; content-store-init / ensure / shutdown; committed Structure .terraform.lock.hcl files.
  • Docs: INTEROP / PLANTs / ControlFeedbackLoop (IoPort + hotF), IPFS / STORAGE (UnixFS + partition CAR), BOM / Lineage / W3C (stageLineage + Seed), DEPS / ENV / README.

Design choices

Choice Decision
AQ ownership Process stays Plant-agnostic; Function-owned IoPort; Plant ships RayIoPort under plant_cid (mirrors ComputePort)
n == 1 Keep transport.migrate — iris demo unchanged
n > 1 Plant Ray I/O via IoPort; stable part-00000.car … names as shuffle keys
TransportPort Still used for integration_cache and for ingress/egress when n=1
Seed Replay dictionary on Invoice (seed_cid); stage CIDs remain interim feedback
W3C / CFL Invoice records root stage CIDs only; BOM remains address-only

Non-goals: URI-as-address (2b), cross-CAT Order registry, second Plant adapters beyond Ray IoPort, raw-leaves write pins, Executor reading n from Seed instead of env (follow-up).

Data-plane read path (enables partition CAR I/O)

Control-plane / provenance (address-only envelope)

Test plan

Plant IoPort (primary)

  • uv run pytest tests/test_ray_io_partitions.py -q
    • CATS_IO_PARTITIONS=1 (default): ingress/egress stay on TransportPort.migrate
    • CATS_IO_PARTITIONS>1: ingress/egress use RayIoPort part-*.car layout; Invoice stage fields remain single root CIDs
    • Process callables remain Plant-agnostic (TYPE_CHECKING-only data.* / IoPort imports; no numpy at import)
  • uv run pytest tests/test_compute_plant_ports.py -q
    • ComputePort.num_partitions aligned with IoPort; no shuffle-heavy repartition when already n

AddressStore (UnixFS + CAR prerequisite)

  • uv run pytest tests/test_unixfs_cid_chunked.py -q
    • Pure UnixFS verify for single- and multi-block file layouts; tamper fails
  • uv run pytest tests/test_unixfs_car_extract.py -q
    • Directory get via CAR + UnixFS extract
  • uv run pytest tests/test_address_store_gateway.py -q
    • Exotic layouts fall back to Kubo only-hash
    • Gateway-first get / getCar with RPC fallback
    • ContentMesh.get / getCar wired through AddressStore

stageLineage PROV + Seed

  • uv run pytest tests/test_stage_lineage_prov.py -q
    • Signed bom includes stageLineage; wasDerivedFrom follows Invoice stage CIDs
  • uv run pytest tests/test_network_seams.py -q
    • #executorRun Activity on signed envelope
  • uv run pytest tests/test_provenance.py -q
    • invoice.seed_cid / flattened seed populated; keys {seed, rng_seed, num_partitions}; CAT0/CAT1 Seeds differ
  • Cross-CAT reverse registry remains out of scope

TF state lock heal

  • uv run pytest tests/test_terraform_state_lock_heal.py -q
    • Orphaned lock with no live holder removed; live holder left alone

Docs / review

chore(deps): add py-cid, py-multihash, and cbor2 for pure
 UnixFS CID compute and CARv1 decode
feat(address_store): pure UnixFS file CID verify with Kubo
 only-hash fallback; CARv1 read/write and UnixFS extract;
 gateway-first get/dag_export; wire ContentMesh get/getCar
feat(feedback,runtime): stageLineage Entities with
 wasDerivedFrom along Invoice stage CIDs; #executorRun
 Activity; wire stage CIDs from Runtime.execute
feat(process,plant): IoPort for CATS_IO_PARTITIONS>1;
 RayIoPort part-*.car layout; Processor wires io into
 ingress/egress; align ComputePort num_partitions
fix(infrastructure): remove orphaned
 .terraform.tfstate.lock.info when no live holder
 before destroy/apply heal path
docs(IPFS,STORAGE): pure-Python UnixFS verify; gateway
 CAR directory get and dag_export; partition CAR note
docs(BOM,Lineage,W3C): intra-run wasDerivedFrom
 stageLineage; registry gap remains cross-CAT
docs(INTEROP,PLANTs,ControlFeedbackLoop): IoPort vs
 TransportPort; CATS_IO_PARTITIONS and RayIoPort
@JEJodesty JEJodesty self-assigned this Aug 1, 2026
@JEJodesty JEJodesty added documentation Improvements or additions to documentation enhancement New feature or request story Agile story testing Testing functionality System functionality labels Aug 1, 2026
@JEJodesty JEJodesty added this to the 2. CATs’ Node milestone Aug 1, 2026
@JEJodesty JEJodesty changed the title W3c Add Plant IoPort for partitioned Ray ingress-pre-process/integration-sub-process/egress-post-process Aug 1, 2026
feat(executor,network): mint Seed {seed, rng_seed,
 num_partitions} before invoice_cid; flatten_bom resolves
 seed; provenance asserts non-null unique CAT0/CAT1 Seeds
refactor(process,plant): use Higher-Order Transfer Function
 (hotF) naming for integrated_subproc / ComputePort surface
docs(BOM,ControlFeedbackLoop,W3C): seed_cid replay dict
 shape; tHOF renamed to hotF; Seed closes #187 null gap
docs: replace tHOF with hotF across DESIGN, DEMO,
 INTEROP, PLANTs, STORAGE
chore(make): deps-uv via pip, deps-uv-sync, Terraform into
 .venv/bin; content-store-init/ensure/shutdown; refresh
 DEPS/ENV/README
chore(structure): add plant and infrastructure
 .terraform.lock.hcl for reproducible init
refactor(process): type batch maps as Dict[str, Any] so
 function_* need no numpy at import time
@JEJodesty JEJodesty changed the title Add Plant IoPort for partitioned Ray ingress-pre-process/integration-sub-process/egress-post-process Add Plant IoPort for partitioned Ray ingress-pre-process/integration-sub-process/egress-post-process, Invoice Seed, & UnixFS CAR reads Aug 4, 2026
@JEJodesty JEJodesty linked an issue Aug 4, 2026 that may be closed by this pull request
3 tasks
@JEJodesty JEJodesty removed a link to an issue Aug 4, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request functionality System functionality story Agile story testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant