Motivation
Lifecycle bugs are hard to debug because the system currently does not validate or explain lifecycle state violations.
What this PR adds
- A lifecycle contract defining valid state transitions
- A validator that detects contract violations at runtime
- An optional diagnostics mode that explains why lifecycle failures occur
- Integration tests using the dummy client to validate detection
Why this matter:
This does not just fix a single bug it prevents an entire class of lifecycle issues and makes failures observable and actionable for maintainers and users.
Backward compatibility
Diagnostics are opt in and have no runtime impact unless explicitly enabled.