feat(config): add core component config engine#202
Open
maxxgx wants to merge 2 commits into
Open
Conversation
Introduce physicalai.config with export_config, to_config, instantiate, normalization, envelope validation, and consolidated dotted-path importing. Refactor inference and robot transport importers to delegate to the shared module. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new physicalai.config module that defines a strict, JSON-shaped component configuration format (class_path + init_args) along with utilities to export live components to config, validate/normalize configs, and instantiate trusted config trees. This centralizes dotted-path importing and updates documentation/tests to align Runtime configuration with the new core config engine.
Changes:
- Introduces
physicalai.configpublic API (@export_config,to_config,instantiate, validation/normalization, YAML helpers, envelope validation). - Consolidates dotted-path importing into
physicalai.config.importingand re-exports it from inference and robot transport for backward compatibility. - Updates the config schema reference docs and adds substantial unit test coverage for export/normalize/instantiate/YAML round-trips.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/config/init.py | Marks the new config unit test package and sets ruff ignores. |
| tests/unit/config/test_component_config.py | Comprehensive tests for export/normalize/instantiate behavior, including error paths and depth/cycle guards. |
| tests/unit/config/test_yaml.py | Tests YAML serialization/deserialization round-trips for exported components/config mappings. |
| src/physicalai/config/init.py | Defines the public physicalai.config API surface and re-exports key functions/types. |
| src/physicalai/config/_envelope.py | Adds schema-positive envelope validation and component-config normalization for transports. |
| src/physicalai/config/_errors.py | Introduces config-specific error types (ComponentConfigError, ComponentImportError). |
| src/physicalai/config/_export.py | Implements @export_config, captured init-arg export via to_config, and class_path resolution. |
| src/physicalai/config/_instantiate.py | Implements trusted config preflight validation and recursive instantiation. |
| src/physicalai/config/_normalize.py | Implements recursive normalization, cycle/depth detection, and config-shape validation. |
| src/physicalai/config/_path.py | Adds shared path formatting helper for consistent error messages. |
| src/physicalai/config/_types.py | Defines core JSON/config TypedDicts and internal constants (depth limit, private attrs). |
| src/physicalai/config/_yaml.py | Adds YAML serialization/loading helpers for component configs. |
| src/physicalai/config/importing.py | New canonical dotted-path import helper used across config/inference/robot. |
| src/physicalai/inference/_importing.py | Re-exports canonical import_dotted_path for backward compatibility. |
| src/physicalai/robot/transport/_importing.py | Re-exports canonical import_dotted_path for backward compatibility. |
| docs/reference/config-schema.md | Updates documentation to describe the strict ComponentConfig schema and Runtime document shapes. |
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
physicalai.config(@export_config,to_config,instantiate, normalization, envelope validation, cycle detection).physicalai.config.importing; inference and robot transport re-export from there.docs/reference/config-schema.mdand adds unit tests undertests/unit/config/.Test plan
uv run pytest tests/unit/config/Review & merge order
PR #202 — Core config engine (this PR) →
mainCore
physicalai.config(export, instantiate, validation)PR #204 — Robot drivers & SharedRobot transport
Robot config export and SharedRobot owner process startup
PR #205 — Camera drivers & SharedCamera transport
Camera config export and SharedCamera publisher startup
PR #206 — Runtime, InferenceModel & CLI
End-to-end YAML,
physicalai run --config, examples, and user docsIn parallel: PR #203 — Component config design doc →
docs/designDetailed design doc; not blocking the code PRs