Skip to content

fix: enforce valid state machine transitions - #227

Open
Ayoubbelguellaoui wants to merge 2 commits into
openecos-projects:mainfrom
Ayoubbelguellaoui:main
Open

fix: enforce valid state machine transitions#227
Ayoubbelguellaoui wants to merge 2 commits into
openecos-projects:mainfrom
Ayoubbelguellaoui:main

Conversation

@Ayoubbelguellaoui

Copy link
Copy Markdown
Contributor

What Changed

  • Added centralized state-transition guards to the ECC flow state machine.
    Defined valid lifecycle transitions for all StateEnum states.
    Reject illegal lifecycle transitions in set_state() with ValueError.
    Prevent invalid shortcuts such as Unstart → Success.
    Updated create_step_workspaces() to record Incomplete through set_state().
    Kept batch reset operations such as clear_states() and _invalidate_suffix() outside lifecycle guards.
    Updated formal state-machine and file-chaining models to match the guarded lifecycle.
    Updated affected tests and execution mocks to follow the real Unstart → Ongoing → Success/Incomplete lifecycle.
    Added regression coverage for valid and invalid transitions, idempotency, persistence, batch resets, and resume/rerun behavior.
    Preserved the previous silent-failure remediation and failure-propagation behavior.

Scope

Select the areas touched by this PR:

  • CLI - command behavior, Typer command surface, output formats, or workspace commands.
  • Flow/runtime - workspace lifecycle, EngineFlow, step execution, logs, metrics, or artifacts.
  • EDA integration - Yosys, ECC-Tools, DreamPlace, KLayout, PDKs, or native/runtime wrappers.
  • Build/package - Nix, PyInstaller, wheels, uv.lock, or release artifacts.
  • CI/release - GitHub Actions, version checks, changelog, or release automation.
  • Tests/docs only

Runtime And Packaging Impact

  • No runtime or packaging impact
  • CLI output or machine-readable contract changed
  • Workspace layout, flow state, or artifact paths changed
  • Native toolchain or wrapper behavior changed
  • ecc-tools or ecc-dreamplace dependency changed
  • PyInstaller, Nix, or release artifact changed

Notes:

  • This PR changes internal flow-state validation only. It does not change CLI behavior, package dependencies, workspace layout, artifact paths, or packaging.

The main behavioral change is that illegal lifecycle transitions are now rejected explicitly instead of being silently accepted. Batch reset operations remain intentionally outside the lifecycle guard mechanism.

Validation

List the commands you ran. Mark checks that are not applicable as N/A.

  • uv run pytest test/
  • uv run ruff check chipcompiler test
  • uv run ruff format --check chipcompiler test
  • PyInstaller smoke: ecc --help, ecc --version, ecc version --json
  • Nix smoke: nix run .#cli -- --help
  • Manual flow smoke:
  • Other: State-machine, file-chaining, flow, rerun, JSON, and regression tests — 152 passed, 5 skipped, 4 xfailed.

Skipped checks and reason:

  • -PyInstaller smoke was not required because this PR does not modify packaging or release artifacts.
    The remaining skipped/xfail tests are documented in the test output and are not caused by the transition-guard implementation.

Checklist

  • I kept the change scoped to ECC.
  • I updated docs or user-facing CLI text where behavior changed.
  • I included lockfile or version metadata updates when dependencies changed.
  • I documented any submodule updates and why they are needed.
  • I did not include local caches, virtual environments, or generated build outputs.
  • I explained skipped validation and remaining risk.

@Ayoubbelguellaoui Ayoubbelguellaoui changed the title enforce valid state machine transitions fix: enforce valid state machine transitions Aug 17, 2026
@Emin017 Emin017 added the enhancement New feature or request label Aug 19, 2026
@Emin017 Emin017 added this to the 0.1.0-alpha.11 milestone Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants