mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(gateway): covers_parent_criteria hint that teaches the shape; CEO pause/resume (#686)
* fix(gateway): teach the delegate remediate + PM prompt the covers_parent_criteria shape; allow CEO through the plain pause route - A child draft rejected for missing covers_parent_criteria now gets a copy-pasteable corrected skeleton with the parent's real criteria inlined, and the PM delegation guidance shows the field as part of every child draft — a PM no longer loops on a rejection that named the field but never showed the shape. - The plain pause route now authorizes the CEO tier like its sibling lifecycle routes; agent-side pause restrictions are unchanged. * fix(gateway): delegate-coverage hint heals and degrades on legacy parents - The coverage-reject path self-heals a criteria-bearing parent whose ids are empty or out of length before rendering the hint, so the skeleton always shows real references; the renderer itself also falls back to quoted criterion texts for any criterion without an id instead of emitting a placeholder or truncating the listing. - The remediate names both legal reference forms (id or exact text) again. - Route comments state the pause/resume check as deliberately CEO-only instead of claiming a precedent whose role set is wider. * test(gateway): real TaskTable rows in the remediation hint round-trips mypy over tests/ rejects a SimpleNamespace where unknown_ac_refs takes a TaskTable; instantiating the ORM row directly needs no session and types cleanly. --------- Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
@@ -2,11 +2,14 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from roboco.db.tables import TaskTable
|
||||
from roboco.services.gateway.remediation import (
|
||||
hint_for_missing_ac_coverage,
|
||||
hint_for_missing_progress,
|
||||
hint_for_missing_reflect,
|
||||
hint_for_unaddressed_acceptance_criteria,
|
||||
)
|
||||
from roboco.services.task import TaskService
|
||||
|
||||
|
||||
def test_missing_progress_hint() -> None:
|
||||
@@ -27,3 +30,61 @@ def test_unaddressed_criteria_hint() -> None:
|
||||
assert "criterion 1" in h
|
||||
assert "criterion 3" in h
|
||||
assert "t-1" in h
|
||||
|
||||
|
||||
def test_missing_ac_coverage_hint_shows_call_shape_and_real_ids() -> None:
|
||||
h = hint_for_missing_ac_coverage(
|
||||
ids=["id-a", "id-b"],
|
||||
texts=["Criterion A", "Criterion B"],
|
||||
title="Orphan slice",
|
||||
)
|
||||
assert "delegate(title='Orphan slice'" in h
|
||||
assert "covers_parent_criteria=['id-a']" in h
|
||||
assert 'id-a="Criterion A"' in h
|
||||
assert 'id-b="Criterion B"' in h
|
||||
|
||||
|
||||
def test_missing_ac_coverage_hint_names_both_legal_reference_forms() -> None:
|
||||
"""The remediate names both legal ``covers_parent_criteria`` forms —
|
||||
a criterion's id or its exact text — not just id."""
|
||||
h = hint_for_missing_ac_coverage(ids=["id-a"], texts=["Criterion A"], title="X")
|
||||
assert "id(s) or exact text(s)" in h
|
||||
|
||||
|
||||
def test_missing_ac_coverage_hint_handles_no_criteria() -> None:
|
||||
h = hint_for_missing_ac_coverage(ids=[], texts=[], title="X")
|
||||
assert "<id>" in h
|
||||
|
||||
|
||||
def test_missing_ac_coverage_hint_empty_ids_uses_quoted_text() -> None:
|
||||
"""A legacy/unhealed parent whose ids are empty must still get a real,
|
||||
copy-pasteable reference for every criterion — never a `'<id>'`
|
||||
placeholder, and never a truncated listing."""
|
||||
texts = ["Criterion A", "Criterion B", "Criterion C"]
|
||||
h = hint_for_missing_ac_coverage(ids=[], texts=texts, title="Orphan slice")
|
||||
|
||||
assert "'<id>'" not in h
|
||||
for text in texts:
|
||||
assert text in h
|
||||
|
||||
parent = TaskTable(acceptance_criteria_ids=[], acceptance_criteria=texts)
|
||||
for text in texts:
|
||||
assert TaskService.unknown_ac_refs(parent, [text]) == []
|
||||
|
||||
|
||||
def test_missing_ac_coverage_hint_drifted_ids_shorter_than_criteria() -> None:
|
||||
"""1 id against 3 criteria: every criterion is listed (id for the
|
||||
first, quoted text for the rest) — zip's `strict=False` used to drop
|
||||
the tail criteria silently."""
|
||||
texts = ["Criterion A", "Criterion B", "Criterion C"]
|
||||
h = hint_for_missing_ac_coverage(ids=["id-a"], texts=texts, title="Orphan slice")
|
||||
|
||||
assert "'<id>'" not in h
|
||||
assert 'id-a="Criterion A"' in h
|
||||
for text in texts[1:]:
|
||||
assert text in h
|
||||
|
||||
parent = TaskTable(acceptance_criteria_ids=["id-a"], acceptance_criteria=texts)
|
||||
assert TaskService.unknown_ac_refs(parent, ["id-a"]) == []
|
||||
for text in texts[1:]:
|
||||
assert TaskService.unknown_ac_refs(parent, [text]) == []
|
||||
|
||||
Reference in New Issue
Block a user