Repository navigation
Releases
Releases · rasuvaeff/quality-ledger
v0.2.0
- Badges:
Badge(label, message, colour),BadgeColor(the six-step
shields.io palette, withforPercentage()thresholds),BadgeRenderer
(the output port) andBadgeSvg(a self-contained flat SVG — no external
service, so it renders on an offline runner and inside a private network).
Badge::fromTrend()turns a metric's most recent point into a badge and
answers an empty trend withn/ain red rather than an exception.
v0.1.0
- Initial engine:
Datum,RunReport,StableIdInterface/DefaultStableId,
StoragePort/LocalFileStorage,RetentionPolicy,Ledger(append,
diff,trend),DiffReport/DiffEntry/StillBadEntry,RatchetGate,
Trend/TrendPoint. - Fixed: an id function returning a digit-only string (
(string) crc32(...),
inside whatStableIdInterfacepermits) made the firstappend()fail with
aTypeErrorand left the scope unusable. Ids are now cast back tostring
on the way out ofLedgerState, and the on-diskidsblock is a JSON list
of records rather than an object keyed by id. - Fixed:
DiffReport::$unchangedCountcounted ids observed at neither of the
compared runs — a tombstone still inside its retention window inflated it,
andtotalIdsCompared()with it, by up totombstoneTtlRunsruns' worth of
removed ids. Such an id is now in no bucket at all, as the documentation
already claimed. - Fixed:
metaon an id that was removed betweenbaseandheadnow comes
frombase, as documented, instead of from the empty bookkeeping transition. - The on-disk format is version 2:
idsis a JSON list of{id, transitions}
records rather than an object keyed by id, andkindsits on each transition.
A version-1 file is refused by version. Codec::decode()validates the decoded payload field by field and raises
RuntimeExceptionnaming the offending field, including a strictly ascending
runIndexorder. Previously only the format version was checked: a truncated
file surfaced as aTypeErrorfrom an internal constructor, and an id record
with no transitions re-serialized as"kind":null, corrupting the file
further on every save.DatumandRunReportvalidate their inputs: emptykind,signature,
status,run,scopeor metric name now throwsInvalidArgumentException,
as does anappend()whose id function returns an empty string.Datum
also rejects the ledger's internal absent sentinel as a domain status, and a
metric name PHP would store as an integer array key ('1') is rejected
rather than silently re-typed.Trendenforces the same non-empty contract
on its ownmetric, soLedger::trend($scope, '')throws instead of
answering with an empty trend.LocalFileStorage::write()reports a directory it cannot create instead of
misattributing the failure to the temp file two steps later.Ledger::append()is no longer quadratic in the number of ids: the
duplicate check is a hash lookup, and a run's observations are applied in one
state copy rather than one per datum.benchmarks/LedgerBench.phpmeasures
the scaling.- Documented:
diff()is directional and does not sortbase/head;
append()is a read-modify-write and is not safe to run concurrently against
one scope.