Skip to content

feat: add optional types and validation for component ports - #306

Open
toby-coleman wants to merge 1 commit into
mainfrom
feature/typed-component-ports
Open

toby-coleman wants to merge 1 commit into
mainfrom
feature/typed-component-ports

Conversation

@toby-coleman

Copy link
Copy Markdown
Contributor

Summary

Allow components to declare input and output types with mappings such as IO(inputs={"samples": list[float]}, outputs={"average": float}). Existing lists of names continue to imply Any, and runtime validation remains off by default.

Changes

  • Preserve type metadata across inheritance and instance construction, including dynamically declared ports, while rejecting conflicting inherited types.
  • Validate declared connection compatibility during process validation, before acquiring external resources. Support Python classes, unions, and built-in containers, with explicit variance rules.
  • Add reusable shallow and deep runtime validators without coercing or copying values. Input checks cover channel data, initial values, and event assignments; optional output checks run once before fan-out.
  • Include contextual validation errors, failure status propagation, serializable type metadata, and documentation examples. Attribute-annotation inference and Pydantic-style schemas are outside this change.

Validation

  • After rebasing onto current main: 93 targeted tests passed, covering typed ports, process validation, construction without external-resource side effects, and Ray task-group execution.
  • Before rebase: broader suite passed with 501 passed, 6 skipped, and 35 service-dependent cases deselected. RabbitMQ, Redis, and Postgres were not configured.
  • Ruff lint and formatting, and ty checking passed after rebase.
  • Documentation build and executable documentation examples passed before rebase.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T21:48:58.458925Z e1251c2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Benchmark comparison for f36c721d (base) vs e1251c26 (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.14-64bit/0001_base)     294.7905 (1.0)      316.6996 (1.03)     301.1578 (1.01)     8.9783 (1.88)     299.1434 (1.01)     8.9394 (1.67)          1;0  3.3205 (0.99)          5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.14-64bit/0001_pr)         295.4773 (1.00)     306.9436 (1.0)      298.7805 (1.0)      4.7658 (1.0)      297.1532 (1.0)      5.3384 (1.0)           1;0  3.3469 (1.0)           5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.40404% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
plugboard/component/port_types.py 86.92% 9 Missing and 8 partials ⚠️
plugboard/process/process.py 90.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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