spec.IntentItem

spec.IntentItem(id, scope, invariant, reason, evaluations=(), decisions=())

One intent item of a unit, in the three parts of Fowler, Regenerative Software, ch. 3.

Attributes

Name Type Description
id str Stable identifier, for example "LVL-1".
scope str Where the requirement applies.
invariant str What must remain true, independent of any implementation.
reason str Why the invariant matters. Mandatory, because intent without a reason cannot be revisited honestly.
evaluations tuple[str, …] Names of test functions in the unit’s evaluation files that check the invariant.
decisions tuple[str, …] Ids of decision records in regen/decisions/ behind the invariant.

Examples

from spotregen import IntentItem

item = IntentItem(
    id="C-1",
    scope="add",
    invariant="add(a, b) == a + b",
    reason="Callers rely on plain arithmetic.",
    evaluations=("test_add",),
)
print(item.id, item.invariant, item.evaluations)
C-1 add(a, b) == a + b ('test_add',)