pwm/s-flow
69.2
Adequate · 22 September 2026
348
lines of production code
PHP
primary language
7
measurements over time
What this system is
This system is a PHP library for building finite state machines, specifically implementing the SFlow framework. It manages state transitions by validating events against a graph model and returning detailed operation results. The codebase includes comprehensive test coverage for core components like state graphs and transition operations.
Behavioural changes
Refactor FSM to use a dedicated Graph model and explicit type system
The internal state machine implementation has been refactored to separate the graph model from the machine logic. The previous \FSM\ class, which managed the transition graph directly, now delegates to a new \Graph\ class that handles state and event validation. The \Transition\ class has been replaced with a \Transition\ interface and a \TransitionOp\ value object that encapsulates the result of a state transition, including success/failure status, the resulting state, and the sequence of events. Additionally, the codebase has been moved from the \Pwm\\Fsm\ namespace to \Pwm\\SFlow\, and the \deriveState\ method has been replaced by the \run\ method which returns a \TransitionOp\.
src · high confidence
S-Flow v4.0.0: States and events promoted to real types; TransitionOp replaces StateOp
The library has been updated to v4.0.0, where \State\ and \Event\ are now real types rather than Enums, and \StateOp\ has been renamed to \TransitionOp\. The \Transition\ interface now represents functions of type \S -\> E -\> S\ instead of predicates, and the underlying \Graph\ has been factored out of the \FSM\. Additionally, \TransitionOp\ now tracks applied events. The README has been expanded with a full working example, and static analysis tools (Psalm, Infection) have been configured.
(repo-wide) · high confidence
Test coverage
Added unit tests for the SFlow state machine library
Added comprehensive unit tests for the SFlow library, covering the core state machine components including Graph, Arrow, DrawnArrow, Events, and TransitionOp. The test suite also includes a detailed simulation of a shopping cart workflow, verifying state transitions, event handling, and error conditions such as missing states or duplicate events.
tests · high confidence
Dependencies
Updated PHP and tooling dependencies in composer.json
The project's PHP requirement has been raised from 7.1.0 to 7.2.0. Several development dependencies have been updated or added: phpstan has been upgraded to version 0.10, and new tools infection (v0.10) and vimeo/psalm (v3.0) have been introduced, with corresponding scripts added to the build process.
(dependencies) · medium confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 68 → 69 (+1.2)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 100 (+0.0)
- Architecture 69 → 69 (+0.0)
- Maturity 61 → 64 (+2.5)
- Readiness 64 → 64 (+0.0)
- Security 100 → 100 (+0.0)
Resolved (8)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- No exposed public API
- Test reliability not included
- early-stage repository — too little history to judge knowledge freshness
- git history depth insufficient
- git history depth insufficient
- single-maintainer — knowledge-concentration (bus factor) risk
New (5)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Inconsistent naming convention for singular vs plural operations. 'drawArrow' is singular, but 'drawArrows' is plural. Typically, if the method accepts a single item, it is named singular; if it accepts a collection, it is named plural. However, the parameter type for 'drawArrows' is 'Arrow' (singular type hint), suggesting it might accept a single item or the type hint is misleading. If it accepts a collection, the parameter name 'arrows' and method name 'drawArrows' are consistent, but the presence of 'drawArrow' for a single item creates a redundant pair. More critically, if 'drawArrows' is intended for collections, the parameter type should likely be an array/collection of Arrow, not just 'Arrow'.
- No dependency advisory monitoring
- The constructor 'Events.__construct' accepts a single 'Event', but the class is named 'Events' (plural) and has methods like 'toList()', 'count()', 'getIterator()'. This suggests it is a collection. Accepting a single Event in the constructor is inconsistent with the plural name and collection-like API. It should likely accept an array/collection of Events.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
pwm/s-flow was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 22 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 4b37ea7275fc4cfeb49cce12e866b143c23ce21c — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-821afab8930d.