Skip to main content

Migrating to 0.13

Release 0.13 removes the graphical interface and the Claude driver, folds status into measures, replaces the check IDs by seven families named after Fowler’s primitives, makes the loaders strict and drops three keys. This page takes a repository that works with 0.12 to 0.13 in the order a maintainer does it. The decision behind it is ADR 0003. The page lists what the migration script changes and what stays manual.

The steps

  1. Upgrade to 0.13.0. uv add --dev spotregen (or uv lock --upgrade-package spotregen and uv sync), then uv run spotregen --version.

  2. Look at the edits, then apply them. The script is part of the release and is deleted in 0.14. Without --write it prints the edits and changes nothing:

    uv run python -m spotregen._migrate_0_13 --root .
    uv run python -m spotregen._migrate_0_13 --root . --write

    It deletes the keys that are gone and renames the consumer kinds (see below). It edits the text line by line, so comments, line endings and formatting stay, writes each file through a temporary file and a rename, and never touches regen/runs/. After the edits (in a dry run, on the planned text) it loads every record with the strict loader and lists each file the loader still rejects. It prints “nothing to migrate” and exits 0 only for a tree that loads; otherwise it exits 1.

  3. Do the manual work it lists. It stops and prints file, line and reason for what needs a person (see what stays manual). Rerun it until it is quiet.

  4. Run the check and fix what it reports. uv run spotregen check is stricter than the check of 0.12 in these places:

    • EVAL04: an evaluation file must carry the marker. Add pytestmark = pytest.mark.regen at module level.
    • DELETE03: a consumer uses a name of the unit that is not in public. Add the name to public, or stop using it.
    • DELETE01: re-exports are now followed through any number of packages, so a file that imports a public name through two packages is a consumer too. Declare it, or remove the import.
    • PACE01 to PACE04: a unit needs a pace, [pace] a policy for every declared pace, and a unit may not depend on a unit of a faster pace.
    • PROV03 to PROV05: the checks that 0.12 reported together as PROV02.
    • INTENT02: an intent item that names no evaluation (0.12: EVAL04).
    • PROV08, PROV09: the bundle of every unit changes in 0.13, so the verdict of an archived run is evidence of its day only. Judge the candidates again with spotregen score, or regenerate. The check passes without --strict.
  5. Update scripts and documents that match finding codes or the line format. Use the mapping table. A line is now {path}:{line}: {level} {id} {message}.

  6. Leave the guard hooks as they are. make guard and similar hooks read the exit code of spotregen check only, and that is unchanged.

What the script changes

Table 1: Removed keys and kinds.
where removed or renamed now
unit record unit, path derived: the name is <package>.<stem>, the path follows from it
unit record risk none: no check read it
decision record origin none: no check read it
decision record invariant merged by hand into decision (manual)
architecture.toml kb_dir and the variable REGEN_KB_DIR none: KB: evidence is recorded and never resolved
consumer kind script code
consumer kind book doc
consumer kind operational, human external

The loaders are strict: any other key, at any level, and a value of the wrong type is an error that names the file, the key and its line, and the command exits with code 2. A misspelled key therefore no longer loads silently.

Removed commands and options

A removed command or option is an argparse error and exits with code 2.

Table 2: Removed commands and options.
0.12 0.13
spotregen status spotregen measures (pace, coverage, decisions, consumers and size in one table)
spotregen claude UNIT ... none: local is the only generator. To judge a candidate use spotregen score UNIT FILE [--base REV]
spotregen gui, spotregen-gui none: the graphical interface is removed
spotregen measures --mutation-score, --timeout, --python spotregen mutate UNIT --out FILE
spotregen new-unit --risk none: use --pace P
spotregen local --repair-seed none: the repair of attempt n uses --seed plus n
spotregen gui --root none

Four commands behave differently as well:

  • spotregen local requires --model-sha256, --context-length and --protocol (an active decision record), starts from a clean working tree and archives the run under regen/runs/; an aborted run exits with code 2 and has an abort_class. It refuses a model that the endpoint does not list, an endpoint that is not exactly http://localhost|127.0.0.1|[::1] with an optional port, and a scoring environment on which the evaluations fail on the original module; it takes --host LABEL; a repeat of a run gets a directory name with -r2, -r3. [generator] served is gone and [tool] packages_sha256, host, [control], abort_class and report_error are new.
  • spotregen mutate needs a git repository with a commit, because score.toml records the base (spotregen is renamed spotregen_version there). Since 0.13.1 it also records packages_sha256, the hash of the scoring environment, as run.toml does.
  • spotregen compact prints exactly the COMPACT findings of spotregen check. It now lists COMPACT01 to COMPACT03 and no longer the review dates and the stale runs, which are PROV06, PROV08 and PROV09.
  • Every time limit (--timeout, --score-timeout) must be positive and finite.

The Python interface

Table 3: Removed and moved names.
0.12 0.13
status_table, status_rows, UnitStatus measures_table, measure_units, UnitMeasures
deletion_report(spec, unit) deletion_test(spec, unit).markdown
Finding.code, Finding.where Finding.id, Finding.path, Finding.line
measure_cells, total_measures, unrecorded_modules removed
exit_code, summary_line, compaction_summary, load_architecture, load_decision, load_unit, locate no longer exported from spotregen; import them from spotregen.checks, spotregen.compact and spotregen.spec
scan.collect_tests scan.defined_evaluations(root, unit)
spotregen.parser, spotregen.drivers.claude, spotregen.gui removed
spotregen.drivers._common.run_pytest, run_dependents spotregen.judge.run_pytest, run_dependents; they return a Tally, and timeout is required

What stays manual

The script changes nothing it cannot decide. It stops, with the file and the line, for:

  • a decision with invariant: the text is printed; merge it into decision by hand;
  • a unit value that differs from <package>.<stem>: the file name it needs is printed (a package unit of 0.12, unit = "pkg" in pkg.toml, becomes __init__.toml);
  • a path that differs from the derived path: move the record or the module;
  • consumers written as an inline array of tables: the kinds are not renamed in that form;
  • a file that is not UTF-8 or not valid TOML.

After the script, the check findings of step 4 are manual too: the marker of an evaluation file, the names a consumer may use, the paces, the evidence prefixes, and the archived runs that the new bundles have aged. Archived runs of 0.12 stay readable as evidence; the run.toml keys of 0.12 are read as they were written.

The check IDs of 0.12 and 0.13

The IDs of 0.12 (five checkgroups that did not follow the primitives) are gone and are not read or accepted anywhere. INTENT02, COMPILE08, DELETE03, PACE01 to PACE04 and PROV10 are new. One 0.12 code could stand for several conditions, so a row says which.

import re

from IPython.display import Markdown

from spotregen.checks import CHECKS

MAPPING = [
    ("ARCH00", "package file does not parse", "COMPILE01"),
    ("ARCH01", "forbidden import", "COMPILE02"),
    ("ARCH02", "subpackage not in `[allowed]`", "COMPILE03"),
    ("ARCH03", "listed subpackage not found", "COMPACT01"),
    ("ARCH03", "allowed edge unused", "COMPACT02"),
    ("ARCH04", "new import cycle", "COMPILE04"),
    ("ARCH05", "known cycle gone", "COMPACT03"),
    ("UNIT01", "implementation does not exist", "COMPILE05"),
    ("UNIT01", "implementation does not parse", "`COMPILE01` (also from the unit check)"),
    ("UNIT02", "`path` is not the module", "removed: the path is derived"),
    ("UNIT03", "public name not defined", "COMPILE06"),
    ("UNIT04", "import not in `depends_on`", "COMPILE07"),
    ("UNIT05", "`depends_on` entry not imported", "COMPACT04"),
    ("UNIT06", "no intent item", "INTENT01"),
    ("EVAL01", "evaluation file does not exist", "EVAL01"),
    ("EVAL01", "evaluation file does not parse", "EVAL02"),
    ("EVAL01", "named evaluation not found", "EVAL03"),
    ("EVAL02", "file not marked `regen`", "EVAL04"),
    ("EVAL03", "evaluation imports a non-public name", "EVAL05"),
    ("EVAL04", "intent item names no evaluation", "INTENT02"),
    ("EVAL05", "evaluation not linked to intent", "COMPACT05"),
    ("PROV01", "intent item cites an unknown decision", "PROV01"),
    ("PROV01", "architecture cites an unknown decision", "PROV02"),
    ("PROV02", "`file:` evidence missing", "PROV03"),
    ("PROV02", "`commit:` evidence missing", "PROV04"),
    ("PROV02", "unknown evidence prefix", "PROV05"),
    ("PROV03", "review due", "PROV06"),
    ("PROV04", "rests on a non-active decision", "PROV07"),
    ("PROV05", "decision cited by nothing", "COMPACT06 (active decisions only)"),
    ("PROV06", "stale run: bundle", "PROV08"),
    ("PROV06", "stale run: module", "PROV09"),
    ("PROV06", "unparsable `run.toml` (reported per unit)", "PROV10 (once, at its own path)"),
    ("DEL01", "undeclared dependent", "DELETE01"),
    ("DEL02", "declared consumer missing", "DELETE02"),
    ("DEL03", "consumer no longer references the unit", "COMPACT07"),
]
known = {i for i, _, _ in CHECKS}
assert {i for _, _, new in MAPPING for i in re.findall(r"[A-Z]+\d\d", new)} <= known
rows = ["| 0.12 | condition | now |", "|:--|:--|:--|"]
rows += [f"| {old} | {what} | {new} |" for old, what, new in MAPPING]
Markdown("\n".join(rows))
Table 4: The 0.12 codes and the IDs that replace them. Every ID in the last column is checked against the table of checks.
0.12 condition now
ARCH00 package file does not parse COMPILE01
ARCH01 forbidden import COMPILE02
ARCH02 subpackage not in [allowed] COMPILE03
ARCH03 listed subpackage not found COMPACT01
ARCH03 allowed edge unused COMPACT02
ARCH04 new import cycle COMPILE04
ARCH05 known cycle gone COMPACT03
UNIT01 implementation does not exist COMPILE05
UNIT01 implementation does not parse COMPILE01 (also from the unit check)
UNIT02 path is not the module removed: the path is derived
UNIT03 public name not defined COMPILE06
UNIT04 import not in depends_on COMPILE07
UNIT05 depends_on entry not imported COMPACT04
UNIT06 no intent item INTENT01
EVAL01 evaluation file does not exist EVAL01
EVAL01 evaluation file does not parse EVAL02
EVAL01 named evaluation not found EVAL03
EVAL02 file not marked regen EVAL04
EVAL03 evaluation imports a non-public name EVAL05
EVAL04 intent item names no evaluation INTENT02
EVAL05 evaluation not linked to intent COMPACT05
PROV01 intent item cites an unknown decision PROV01
PROV01 architecture cites an unknown decision PROV02
PROV02 file: evidence missing PROV03
PROV02 commit: evidence missing PROV04
PROV02 unknown evidence prefix PROV05
PROV03 review due PROV06
PROV04 rests on a non-active decision PROV07
PROV05 decision cited by nothing COMPACT06 (active decisions only)
PROV06 stale run: bundle PROV08
PROV06 stale run: module PROV09
PROV06 unparsable run.toml (reported per unit) PROV10 (once, at its own path)
DEL01 undeclared dependent DELETE01
DEL02 declared consumer missing DELETE02
DEL03 consumer no longer references the unit COMPACT07

Pace had no IDs in 0.12: a missing or invalid pace stopped the tool with exit code 2. It now loads and check reports it (PACE01, PACE02). The rule that a unit may not depend on a unit of a faster pace (PACE04) and the check that a consumer uses only public names (DELETE03) are new, and so is the check that a depends_on entry names a module and a name that exist (COMPILE08), which context needs to build its bundle. The schema page lists every current ID with its level and its condition.