feat: add gds-control — state-space control DSL over GDS#7
feat: add gds-control — state-space control DSL over GDS#7rororowyourboat merged 3 commits intomainfrom
Conversation
…ntics Third independent DSL compiling to GDSSpec/SystemIR, validating GDS as a universal compositional substrate. Maps classical (A,B,C,D) state-space form to canonical (X,U,g,f) decomposition using only Policy for all non-state-updating blocks (no ControlAction). Includes 4 semantic spaces (State, Reference, Measurement, Control), 6 verification checks (CS-001..CS-006), cross-built equivalence tests at Spec/Canonical/SystemIR levels, and parametric canonical invariants across 3 archetypes. 117 tests, zero regressions.
There was a problem hiding this comment.
Pull request overview
This PR adds gds-control, the third independent DSL for the GDS framework (alongside gds-stockflow and gds-games). It provides a declarative state-space control system DSL that compiles to GDSSpec and SystemIR, demonstrating GDS as a universal compositional substrate for control theory.
The package maps classical state-space control theory (A,B,C,D) matrices to the canonical GDS decomposition (X,U,g,f), where states become Mechanisms with Entity state variables, sensors and controllers become Policy blocks, and inputs become BoundaryActions. The design introduces four semantic spaces (State, Reference, Measurement, Control) with six domain-specific verification checks (CS-001 through CS-006).
Changes:
- Adds complete
gds-controlpackage with DSL elements, compilation to GDSSpec/SystemIR, and verification system - Integrates package into workspace via root
pyproject.tomldependencies and ruff configuration - Provides 117 comprehensive tests covering element construction, model validation, compilation, state-space correspondence, and verification checks
Reviewed changes
Copilot reviewed 18 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds gds-control to workspace dependencies and known-first-party imports |
| packages/gds-control/pyproject.toml | Package metadata, dependencies, and build configuration |
| packages/gds-control/README.md | Minimal package description linking to GDS ecosystem |
| packages/gds-control/CLAUDE.md | Comprehensive architecture and convention documentation |
| packages/gds-control/gds_control/init.py | Public API exports for DSL, compilation, and verification |
| packages/gds-control/gds_control/dsl/types.py | ElementType enum for control system categories |
| packages/gds-control/gds_control/dsl/errors.py | Domain-specific exceptions (CSError, CSValidationError, CSCompilationError) |
| packages/gds-control/gds_control/dsl/elements.py | Frozen Pydantic models for State, Input, Sensor, Controller |
| packages/gds-control/gds_control/dsl/model.py | ControlModel with construction-time validation and compilation methods |
| packages/gds-control/gds_control/dsl/compile.py | Compiler mapping ControlModel to GDSSpec and SystemIR with composition tree building |
| packages/gds-control/gds_control/verification/checks.py | Six domain-specific verification checks (CS-001 through CS-006) |
| packages/gds-control/gds_control/verification/engine.py | Verification orchestration running CS checks and optional GDS checks |
| packages/gds-control/tests/test_elements.py | Tests for element construction, defaults, and frozen behavior |
| packages/gds-control/tests/test_model.py | Tests for model validation with valid and invalid configurations |
| packages/gds-control/tests/test_compile.py | Tests for GDSSpec registration and SystemIR compilation |
| packages/gds-control/tests/test_state_space.py | Comprehensive cross-built equivalence tests and canonical invariants |
| packages/gds-control/tests/test_integration.py | End-to-end integration tests for SISO, MIMO, and open-loop systems |
| packages/gds-control/tests/test_verification.py | Tests for all six CS verification checks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not tiers: | ||
| return _parallel_tier(state_blocks) | ||
|
|
There was a problem hiding this comment.
Unreachable code detected. This return statement can never be executed because:
- ControlModel validation requires at least one state
- If state_blocks is non-empty (which it always will be), it gets added to tiers at line 277
- Therefore tiers can never be empty at line 279
This code should be removed.
| if not tiers: | |
| return _parallel_tier(state_blocks) |
…status Add docs/guides/research-boundaries.md documenting two open questions at the structural/dynamical boundary: MIMO semantics (scalar ports vs vector spaces) and timestep semantics across DSLs. Update architecture.md with stockflow and control semantic layer contracts, key file listings, and references to the research note. Update dsl-roadmap.md to reflect validated 3-DSL status and convergent architectural claims. Update root CLAUDE.md with all six packages, commands, and the domain DSL compilation pattern.
The empty-tiers guard was unreachable because ControlModel requires at least one state, so state_blocks is always non-empty. Also removed the redundant conditional on state_blocks — it's guaranteed non-empty by construction-time validation.
Summary
gds-controlpackage: state-space control DSL that compiles to GDSSpec/SystemIR(A,B,C,D)state-space form to canonical(X,U,g,f)decompositionPolicy— noControlAction— preserving clean canonical structureTest plan
uv run --package gds-control pytest packages/gds-control/tests -v— 117 passeduv run --package gds-framework pytest packages/gds-framework/tests -v— 373 passed (regression)uv run --package gds-stockflow pytest packages/gds-stockflow/tests -v— 215 passed (regression)uv run ruff check packages/gds-control/— cleanuv run ruff format --check packages/gds-control/— clean