pwm/s-flow
70.9
Strong · 9 November 2026
348
lines of production code
PHP
primary language
10
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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 71 → 71 (+0.0)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 100 → 100 (+0.0)
- Architecture 69 → 69 (+0.0)
- Maturity 65 → 65 (+0.0)
- Readiness 69 → 69 (+0.0)
- Security 100 → 100 (+0.0)
Resolved (3)
- Confusing naming convention and type mismatch between 'draw' and 'add' methods. 'draw' methods accept raw Arrow objects, while 'add' methods accept DrawnArrow objects. The distinction between 'drawing' (visualizing) and 'adding' (registering in the graph) is unclear, especially since both modify the graph state. Furthermore, the plural/singular naming convention is inconsistent with the parameter types (e.g., drawArrows takes a single Arrow, not an array).
- Inconsistent construction patterns. Arrow uses a fluent builder pattern (from/via) but requires an EventName in the constructor. DrawnArrow requires all three components in the constructor. This creates two different ways to create arrow-like objects with different requirements and interfaces.
- Redundant interface/method signatures across different types. Both Event and NamedEvent have a name() method returning EventName, and similarly for State/NamedState. It is unclear if NamedEvent/NamedState are distinct types or if Event/State are abstract interfaces. If they are distinct, the identical method signatures suggest a lack of clear inheritance or interface segregation.
Written by cca.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 9 November 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.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.4+preprod-464a0040a931.