livery.extensions.coverage._marks¶
livery.extensions.coverage._marks ¶
The coverage marks: a package's high-water mark, and how it moves.
A package whose contract declares [coverage] floor = "auto-ratchet"
is judged against the mark recorded on the CI state store instead of a
committed number. Enforcement passes at the mark minus the package's
epsilon ([coverage] epsilon, in percentage points, 0.5 when
absent), and the mark ratchets up only when a run clears it by more than
epsilon, so the scheduling wobble of a parallel suite neither fails the
gate nor moves the mark. The first run records the mark and never
judges; a store that cannot be read falls open with its reason and
never writes, since a write from an unread state would erase the marks
it could not see.
Lowering a mark is an explicit act: fm coverage.accept writes a
dated, reasoned row, and the gate judges from it. Every row names the
run or the person that wrote it, so the trail of a package's floor is
readable on the store. Reach for livery.extensions.coverage._marks.marks
to read the current marks and livery.extensions.coverage._marks.judge
to decide a run.
Classes:
| Name | Description |
|---|---|
Mark |
A package's current mark and the row that set it. |
Verdict |
One package's answer under auto-ratchet. |
Functions:
| Name | Description |
|---|---|
marks |
The current mark per package; |
write_mark |
Append one row setting package's mark; |
judge |
Compare the measured packages against their marks; one verdict each. |
render |
One line for verdict: the measured value, the mark, the floor, the move. |
Attributes:
| Name | Type | Description |
|---|---|---|
SERIES |
|
|
AUTO_RATCHET |
|
|
DEFAULT_EPSILON |
|
Mark
dataclass
¶
A package's current mark and the row that set it.
Attributes:
| Name | Type | Description |
|---|---|---|
package |
str
|
The package path ( |
value |
float
|
The mark, in percent. |
kind |
str
|
|
by |
str
|
The run id or the person that wrote the row. |
reason |
str
|
The reason an accept gave; empty otherwise. |
when |
str
|
When the row was written, ISO 8601. |
Verdict
dataclass
¶
One package's answer under auto-ratchet.
Attributes:
| Name | Type | Description |
|---|---|---|
package |
str
|
The package path. |
measured |
float
|
The union's percentage for the package. |
mark |
Mark | None
|
The current mark, or |
epsilon |
float
|
The tolerance, in percentage points. |
raises |
bool
|
Whether the run clears the mark by more than epsilon. |
marks ¶
The current mark per package; (None, reason) when the store could not answer.
An empty store is ({}, ""): the first run writes. A read the
transport could not answer returns its reason, and a caller that
would write refuses on it. A row that does not parse, is of
another schema, or lacks a mark's fields is skipped, so one bad
row disables nothing. The newest row per package is its mark.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_marks.py
write_mark ¶
Append one row setting package's mark; "" or why it was not written.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_marks.py
judge ¶
judge(measured: dict[str, float], current: dict[str, Mark], epsilons: dict[str, float]) -> list[Verdict]
Compare the measured packages against their marks; one verdict each.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_marks.py
render ¶
One line for verdict: the measured value, the mark, the floor, the move.