From ce3daadad65aecf99b1800ca382eee472f46f7a9 Mon Sep 17 00:00:00 2001 From: Nikolay Petrov Date: Thu, 22 Oct 2026 21:58:26 -0700 Subject: [PATCH 1/2] refactor(compare): split per-arm checks out of _provenance_warnings #153 took _provenance_warnings to complexity 11, over the cap of 10, so test_growth_ratchet fails on main. Move the resolved-model and uptake checks into _arm_warnings; the warnings and their order are unchanged. Signed-off-by: Nikolay Petrov --- dokimi/dokimi/repos/compare.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/dokimi/dokimi/repos/compare.py b/dokimi/dokimi/repos/compare.py index 48ed1f61..097fe7e9 100644 --- a/dokimi/dokimi/repos/compare.py +++ b/dokimi/dokimi/repos/compare.py @@ -216,22 +216,29 @@ def _provenance_warnings(cells: list[dict[str, Any]], baseline: str, treatments: if selector_matches(parse_selector(sel), c)} if len(versions) > 1: out.append(f"{text} vs {baseline}: cells ran on different harness versions ({', '.join(sorted(versions))})") - arms = [[c for c in cells if selector_matches(parse_selector(sel), c) and (not models or c["model"] in models)] - for sel in (baseline, text)] - for model in sorted({c["model"] for c in arms[0]} & {c["model"] for c in arms[1]}): - base, treat = ({m for c in arm if c["model"] == model for m in resolved_models(c)} for arm in arms) - if base and treat and not _models_equivalent(base, treat): - out.append(f"{text} vs {baseline}: model {model} was answered by {', '.join(sorted(base))} in " - f"baseline, {', '.join(sorted(treat))} in treatment") - uptake = uptake_counts(arms[1]) - if uptake and uptake["cells"] and not uptake["used"]: - out.append(f"{text}: the agent used none of what the arm added in {uptake['cells']} cell(s); " - "a delta measures the patch's text, not the tool") + out += _arm_warnings(cells, baseline, text, models) compared = [c for c in cells if (not models or c["model"] in models) and any(selector_matches(parse_selector(sel), c) for sel in (baseline, *treatments))] return out + mismatch_warnings(model_mismatch(compared)) +def _arm_warnings(cells: list[dict[str, Any]], baseline: str, text: str, models: list[str] | None) -> list[str]: + """Resolved-model mismatches between ``baseline`` and ``text``, and a treatment whose agent used nothing it added.""" + out = [] + arms = [[c for c in cells if selector_matches(parse_selector(sel), c) and (not models or c["model"] in models)] + for sel in (baseline, text)] + for model in sorted({c["model"] for c in arms[0]} & {c["model"] for c in arms[1]}): + base, treat = ({m for c in arm if c["model"] == model for m in resolved_models(c)} for arm in arms) + if base and treat and not _models_equivalent(base, treat): + out.append(f"{text} vs {baseline}: model {model} was answered by {', '.join(sorted(base))} in " + f"baseline, {', '.join(sorted(treat))} in treatment") + uptake = uptake_counts(arms[1]) + if uptake and uptake["cells"] and not uptake["used"]: + out.append(f"{text}: the agent used none of what the arm added in {uptake['cells']} cell(s); " + "a delta measures the patch's text, not the tool") + return out + + def _built_from_tree(stamp: dict[str, Any]) -> bool: """Whether the stamped image is the one ``repo run`` tags from the tree (``dokimi/:``, or ``:worktree-`` for a working tree), not one ``--image`` named.""" From a16a5d47317a7f51eec8c2d01f1bc0630c7d97ed Mon Sep 17 00:00:00 2001 From: Nikolay Petrov Date: Fri, 23 Oct 2026 12:38:26 -0700 Subject: [PATCH 2/2] chore(growth): drop the _provenance_warnings baseline entry the split made unneeded Signed-off-by: Nikolay Petrov --- dokimi/scripts/growth_baseline.json | 1 - 1 file changed, 1 deletion(-) diff --git a/dokimi/scripts/growth_baseline.json b/dokimi/scripts/growth_baseline.json index 974dd0e6..5511f473 100644 --- a/dokimi/scripts/growth_baseline.json +++ b/dokimi/scripts/growth_baseline.json @@ -78,7 +78,6 @@ "dokimi/report/subject_report.py::render_subject_scorecard": {"complexity": 12}, "dokimi/report/task_runs_report.py::render_task_runs_report": {"complexity": 22}, "dokimi/repos/budget.py::budget": {"complexity": 21, "rationale": "pre-existing when the gate was introduced"}, - "dokimi/repos/compare.py::_provenance_warnings": {"complexity": 11, "rationale": "went over the cap on main in #153 (patch-arm uptake warnings) after #93 seeded this baseline; split it in its own PR"}, "dokimi/repos/environment/__init__.py::inspect_repo": {"complexity": 25, "rationale": "pre-existing when the gate was introduced"}, "dokimi/repos/environment/checks.py::_python": {"complexity": 11, "rationale": "pre-existing when the gate was introduced"}, "dokimi/repos/environment/risks.py::_runs_repository_code": {"complexity": 12, "rationale": "pre-existing when the gate was introduced"},