reports.deletion_test

reports.deletion_test(spec, name)

Fowler’s deletion test for one unit: the report and the verdict.

The report lists the blast radius (declared consumers plus every file that references the unit, operational and human dependents included), the intent items with their evaluation and provenance coverage, and a verdict. The verdict is “regenerable” only if every intent item has an evaluation, every dependent is declared and the unit check reports no error.

Parameters

Name Type Description Default
spec RegenSpec The loaded spec. required
name str Dotted module name, or its unique suffix ("forecasting.level"). required

Returns

Name Type Description
DeletionResult DeletionResult The Markdown report, the verdict as a bool and the gaps behind it. deletion_report returns the report alone.

Raises

Name Type Description
KeyError If name matches no unit or more than one.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import deletion_test, load_spec, make_sample_repo

with TemporaryDirectory() as tmp:
    spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
    result = deletion_test(spec, "core.calc")
    print(result.markdown)
    print(result.regenerable, result.gaps)
# Deletion test: samplepkg.core.calc

File `src/samplepkg/core/calc.py`, pace fast, risk low.

## Blast radius

| consumer | kind | declared | note |
|---|---|---|---|
| `docs/guide.qmd` | doc | yes | teaches add |
| `src/samplepkg/app/main.py` | code | yes | sums values with add |
| `tests/test_regen_eval_calc.py` | test | yes | evaluation |

## Knowledge outside the implementation

| intent | evaluations | decisions |
|---|---|---|
| C-1 | 1 | why-add |

Verdict: regenerable. 1 intent items, all evaluated; 3 dependents, all declared.
True ()