fix: resolve conflicts for PR #372 against current master
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -1242,6 +1242,121 @@ def assess_workspace_mutation_consistency(report_text, observed_commands=None):
|
||||
}
|
||||
|
||||
|
||||
# ── Reconciliation controller-handoff schema (Issue #303) ────────────────────
|
||||
#
|
||||
# Already-landed PR reconciliation is neither author issue work nor
|
||||
# reviewer merge work; its handoff needs its own schema. Stale
|
||||
# author/reviewer fields fail validation, and observed git ref
|
||||
# mutations (fetch) must be reported under the precise category.
|
||||
|
||||
RECONCILIATION_ELIGIBILITY_CLASS = "ALREADY_LANDED_RECONCILE_REQUIRED"
|
||||
|
||||
RECONCILIATION_HANDOFF_FIELDS = (
|
||||
("Task", ("task",)),
|
||||
("Repo", ("repo",)),
|
||||
("Role/profile", ("role/profile", "role", "profile")),
|
||||
("Identity", ("identity",)),
|
||||
("Selected PR", ("selected pr",)),
|
||||
("PR live state", ("pr live state",)),
|
||||
("Candidate head SHA", ("candidate head sha",)),
|
||||
("Target branch", ("target branch",)),
|
||||
("Target branch SHA", ("target branch sha",)),
|
||||
("Ancestor proof", ("ancestor proof",)),
|
||||
("Linked issue", ("linked issue",)),
|
||||
("Linked issue live status", ("linked issue live status",)),
|
||||
("Eligibility class", ("eligibility class",)),
|
||||
("Capabilities proven", ("capabilities proven",)),
|
||||
("Missing capabilities", ("missing capabilities",)),
|
||||
("PR comments posted", ("pr comments posted",)),
|
||||
("Issue comments posted", ("issue comments posted",)),
|
||||
("PRs closed", ("prs closed",)),
|
||||
("Issues closed", ("issues closed",)),
|
||||
("Git ref mutations", ("git ref mutations",)),
|
||||
("Worktree mutations", ("worktree mutations",)),
|
||||
("MCP/Gitea mutations", ("mcp/gitea mutations",)),
|
||||
("External-state mutations", ("external-state mutations",)),
|
||||
("Read-only diagnostics", ("read-only diagnostics",)),
|
||||
("Blocker", ("blocker",)),
|
||||
("Safe next action", ("safe next action",)),
|
||||
("No review/merge confirmation", ("no review/merge",)),
|
||||
)
|
||||
|
||||
RECONCILIATION_FORBIDDEN_FIELDS = (
|
||||
"pr number opened",
|
||||
"pinned reviewed head",
|
||||
"scratch worktree used",
|
||||
"workspace mutations",
|
||||
"issue lock proof",
|
||||
"claim/comment status",
|
||||
)
|
||||
|
||||
|
||||
def assess_reconciliation_handoff(report_text, observed_commands=None):
|
||||
"""#303: validate the dedicated reconciliation handoff schema.
|
||||
|
||||
Requires a Controller Handoff section carrying every reconciliation
|
||||
field, ``Eligibility class: ALREADY_LANDED_RECONCILE_REQUIRED``, and
|
||||
no stale author/reviewer fields. *observed_commands* is the git
|
||||
command log; an observed fetch/pull must be reported under ``Git ref
|
||||
mutations`` (never claimed none).
|
||||
|
||||
Returns {'complete', 'downgraded', 'reasons'}; fails closed.
|
||||
"""
|
||||
section = _handoff_section_lines(report_text)
|
||||
if section is None:
|
||||
return {
|
||||
"complete": False,
|
||||
"downgraded": True,
|
||||
"reasons": [
|
||||
"reconciliation report has no section titled exactly "
|
||||
f"'{HANDOFF_HEADING}'"
|
||||
],
|
||||
}
|
||||
|
||||
fields = {}
|
||||
for line in section:
|
||||
stripped = line.strip().lstrip("-*").strip()
|
||||
if ":" in stripped:
|
||||
k, v = stripped.split(":", 1)
|
||||
fields[k.strip().lower()] = v.strip()
|
||||
|
||||
reasons = []
|
||||
|
||||
for name, aliases in RECONCILIATION_HANDOFF_FIELDS:
|
||||
if not any(label.startswith(alias)
|
||||
for label in fields for alias in aliases):
|
||||
reasons.append(
|
||||
f"reconciliation handoff missing required field: {name}"
|
||||
)
|
||||
|
||||
for stale in RECONCILIATION_FORBIDDEN_FIELDS:
|
||||
if any(label.startswith(stale) for label in fields):
|
||||
reasons.append(
|
||||
f"reconciliation handoff must not include stale field "
|
||||
f"'{stale}'"
|
||||
)
|
||||
|
||||
eligibility = fields.get("eligibility class", "")
|
||||
if eligibility and RECONCILIATION_ELIGIBILITY_CLASS not in eligibility.upper():
|
||||
reasons.append(
|
||||
"reconciliation handoff eligibility class must be "
|
||||
f"'{RECONCILIATION_ELIGIBILITY_CLASS}' (got '{eligibility}')"
|
||||
)
|
||||
|
||||
_, ref_cmds = _classify_git_commands(observed_commands)
|
||||
if ref_cmds and _field_claims_none(fields, "git ref mutations"):
|
||||
reasons.append(
|
||||
"observed git ref mutation not reported under 'Git ref "
|
||||
f"mutations': {ref_cmds[0]}"
|
||||
)
|
||||
|
||||
return {
|
||||
"complete": not reasons,
|
||||
"downgraded": bool(reasons),
|
||||
"reasons": reasons,
|
||||
}
|
||||
|
||||
|
||||
# ── Already-landed report wording (Issue #298) ───────────────────────────────
|
||||
#
|
||||
# An already-landed PR is reconciliation-only: it must never be called
|
||||
@@ -4778,6 +4893,13 @@ def assess_reconcile_linked_issue_report(report_text, **kwargs):
|
||||
return _assess(report_text, **kwargs)
|
||||
|
||||
|
||||
def assess_infra_stop_handoff_report(report_text, **kwargs):
|
||||
"""#289: repair handoff purity when infra_stop blocks reviewer capability."""
|
||||
from reviewer_infra_stop_handoff import assess_infra_stop_handoff_report as _assess
|
||||
|
||||
return _assess(report_text, **kwargs)
|
||||
|
||||
|
||||
def assess_mutation_categories_report(report_text, **kwargs):
|
||||
"""#319: require precise mutation categories in reviewer controller handoffs."""
|
||||
from reviewer_mutation_categories import assess_mutation_categories_report as _assess
|
||||
|
||||
Reference in New Issue
Block a user