mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
* feat(gateway): delegation detail-fidelity — details survive hand-off, both directions
Details thinned out at every delegation hop: a PM child task mapped to no
parent criterion was legal (coverage only surfaced at submit_up, after the
whole wave ran — a 12-subtask docs tree grew through 8 review rounds that
way, one child titled 'docs page and route wrapper' shipping only the
page), and QA could pass work on a gestalt read (a 4-scene video brief
shipped 3 scenes past every gate because the features existed only in
prose). Three chokepoint gates:
- delegate (down): every child must declare covers_parent_criteria
resolving against the parent's real acceptance criteria — no mapping or
an unresolvable ref rejects naming every offending child and the valid
criteria; the success envelope carries parent_ac_coverage
{covered, uncovered} so a wave-planning PM sees remaining gaps in the
same turn. Full coverage stays enforced at submit_up (waves stay legal).
- pass_review (up): mandatory criteria_verified — one {criterion,
evidence} entry per task AC, matched by the findings ledger's
id-or-exact-text matcher, evidence soup-checked and capped; rejects
naming the unverified criteria; entries render deterministically into
qa_notes as '[AC] <criterion> — verified: <evidence>' lines. The old
count-only ac_verdicts gate is superseded (arg kept for back-compat).
- video briefs (structured detail at origination): an enumerable feature
list (release highlights, or input_props.highlights carried onto a
reject re-author) becomes its own scene acceptance criterion, bounded to
the AC caps; a re-author without highlights carries the
feedback-addressed criterion instead.
Extracted findings.py's criterion matcher into shared unmatched_criteria /
uncovered_acceptance_criteria instead of duplicating it; criteria_verified
joins the WAF free-text exclusion set like findings/issues.
* fix(gateway): break the block/unblock wedge — four hardening fixes from the live PM loop
A cell task looped fe-pm/main-pm block/unblock for hours (10 cycles, 43
spawns): a transient GitHub API error resolving CI became an unwaivable
blocker finding whose own fix text said no code change was required, the
submit freshness guard then demanded a commit no finding called for,
escalate_up auto-blocked, and main-pm's correct recovery plan 422'd on
the approach length cap, degrading it to a bare unblock. Four fixes:
- pr_pass CI-unresolvable refusal is now explicitly transient-worded:
retry pr_pass shortly, do NOT pr_fail over a CI-status lookup error —
a platform blip is not a code finding
- submit freshness guard grants ONE unchanged-head resubmission per
head sha when the findings ledger has zero open rows (all addressed
without code changes) — stamped via the resubmit_unchanged_head
marker so the same head can never loop a second time
- unblock carries a flip breaker: block_flip_count marker, and at the
third flip a one-shot CEO notification flags the task as structurally
wedged (unblock itself still succeeds — the breaker signals, it does
not wedge recovery)
- i_will_plan's approach cap truncates at 800 chars instead of
rejecting — an over-detailed plan must never cost the PM its turn
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
158 lines
5.4 KiB
Python
158 lines
5.4 KiB
Python
"""Tests for the orchestration-marker accessors."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from types import SimpleNamespace
|
|
|
|
from roboco.foundation.policy.content import markers as m
|
|
|
|
# Named constant — ruff PLR2004 forbids magic-value comparisons.
|
|
_TWO = 2
|
|
|
|
|
|
def _task(om: dict | None = None) -> SimpleNamespace:
|
|
return SimpleNamespace(orchestration_markers=om)
|
|
|
|
|
|
def test_original_developer_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_original_developer(t) is None
|
|
m.set_original_developer(t, "00000000-0000-0000-0001-000000000002")
|
|
assert m.get_original_developer(t) == "00000000-0000-0000-0001-000000000002"
|
|
|
|
|
|
def test_required_cells_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_required_cells(t) == []
|
|
m.set_required_cells(t, ["backend", "frontend"])
|
|
assert m.get_required_cells(t) == ["backend", "frontend"]
|
|
|
|
|
|
def test_dismissed_flag() -> None:
|
|
t = _task()
|
|
assert m.is_dismissed(t) is False
|
|
m.mark_dismissed(t)
|
|
assert m.is_dismissed(t) is True
|
|
|
|
|
|
def test_set_marker_reassigns_dict_for_orm_dirty_tracking() -> None:
|
|
t = _task({"a": 1})
|
|
before = t.orchestration_markers
|
|
m.set_marker(t, "b", 2)
|
|
# A new dict object — SQLAlchemy only flags JSON columns dirty on reassign.
|
|
assert t.orchestration_markers is not before
|
|
assert t.orchestration_markers == {"a": 1, "b": 2}
|
|
|
|
|
|
def test_clear_marker_nulls_when_empty() -> None:
|
|
t = _task({"x": 1})
|
|
m.clear_marker(t, "x")
|
|
assert t.orchestration_markers is None
|
|
# Clearing an absent key is a no-op.
|
|
m.clear_marker(t, "missing")
|
|
assert t.orchestration_markers is None
|
|
|
|
|
|
def test_escalation_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_escalation(t) is None
|
|
m.set_escalation(t, from_slug="be-pm", to_slug="main-pm", reason="re-open please")
|
|
assert m.get_escalation(t) == {
|
|
"from": "be-pm",
|
|
"to": "main-pm",
|
|
"reason": "re-open please",
|
|
}
|
|
|
|
|
|
def test_approve_and_start_notes_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_approve_and_start_notes(t) is None
|
|
m.set_approve_and_start_notes(t, "Board approved; build it.")
|
|
assert m.get_approve_and_start_notes(t) == "Board approved; build it."
|
|
|
|
|
|
def test_transition_note_roundtrip_keyed_by_event() -> None:
|
|
t = _task()
|
|
assert m.get_transition_note(t, "ceo_rejection") is None
|
|
m.set_transition_note(t, "completion", "Reviewed and merged.")
|
|
m.set_transition_note(t, "ceo_rejection", "Needs the migration first.")
|
|
# Each event keeps its own note; setting one doesn't clobber another.
|
|
assert m.get_transition_note(t, "completion") == "Reviewed and merged."
|
|
assert m.get_transition_note(t, "ceo_rejection") == "Needs the migration first."
|
|
assert m.get_transition_note(t, "never_set") is None
|
|
|
|
|
|
def test_video_draft_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_video_draft(t) is None
|
|
m.set_video_draft(
|
|
t,
|
|
{
|
|
"occasion": "release v1.0.0",
|
|
"script": "Here's what shipped...",
|
|
"platforms": ["x", "tiktok"],
|
|
"brief": "Announce the release",
|
|
},
|
|
)
|
|
draft = m.get_video_draft(t)
|
|
assert draft is not None
|
|
assert draft["occasion"] == "release v1.0.0"
|
|
assert draft["platforms"] == ["x", "tiktok"]
|
|
|
|
|
|
def test_video_draft_extended_not_replaced() -> None:
|
|
"""The render pass extends the authoring marker rather than clobbering it —
|
|
the caller is responsible for spreading the existing dict (set_video_draft
|
|
itself just reassigns whatever payload it is given)."""
|
|
t = _task()
|
|
m.set_video_draft(t, {"occasion": "spotlight: org-memory", "script": "x"})
|
|
existing = m.get_video_draft(t) or {}
|
|
m.set_video_draft(
|
|
t, {**existing, "mp4_paths": {"vertical": "a.mp4", "square": "b.mp4"}}
|
|
)
|
|
draft = m.get_video_draft(t)
|
|
assert draft is not None
|
|
assert draft["occasion"] == "spotlight: org-memory"
|
|
assert draft["mp4_paths"] == {"vertical": "a.mp4", "square": "b.mp4"}
|
|
|
|
|
|
def test_documenter_self_heal_head_supersede() -> None:
|
|
t = _task()
|
|
m.set_documenter(t, "doc-uuid")
|
|
m.set_self_heal_fingerprint(t, "deadbeef")
|
|
m.set_external_pr_head(t, "sha123")
|
|
m.set_external_pr_supersede(t, "pr=1 review=2 closed=1")
|
|
assert m.get_documenter(t) == "doc-uuid"
|
|
assert m.get_self_heal_fingerprint(t) == "deadbeef"
|
|
assert m.get_external_pr_head(t) == "sha123"
|
|
assert m.get_external_pr_supersede(t) == "pr=1 review=2 closed=1"
|
|
|
|
|
|
def test_docs_sync_release_version_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_docs_sync_release_version(t) is None
|
|
m.set_docs_sync_release_version(t, "0.23.0")
|
|
assert m.get_docs_sync_release_version(t) == "0.23.0"
|
|
|
|
|
|
def test_resubmit_unchanged_head_roundtrip() -> None:
|
|
t = _task()
|
|
assert m.get_resubmit_unchanged_head(t) is None
|
|
m.set_resubmit_unchanged_head(t, "aaaa1111bbbb2222")
|
|
assert m.get_resubmit_unchanged_head(t) == "aaaa1111bbbb2222"
|
|
|
|
|
|
def test_block_flip_count_bump_and_notify() -> None:
|
|
t = _task()
|
|
assert m.get_block_flip_count(t) == 0
|
|
assert m.is_block_flip_notified(t) is False
|
|
assert m.bump_block_flip_count(t) == 1
|
|
assert m.bump_block_flip_count(t) == _TWO
|
|
assert m.get_block_flip_count(t) == _TWO
|
|
# notified stays False across bumps until explicitly marked.
|
|
assert m.is_block_flip_notified(t) is False
|
|
m.mark_block_flip_notified(t)
|
|
assert m.is_block_flip_notified(t) is True
|
|
# Marking notified must not reset the counter.
|
|
assert m.get_block_flip_count(t) == _TWO
|