Skip to content

Commit 00e39c5

Browse files
committed
fix(reviewer-bot): finalize stage 2 replay cleanup
Retire the legacy deferred replay and prose fallback compatibility after the Stage 2 closure gates turn green so reconcile and sweeper follow only the retained router and observer contracts. Replace the legacy locality proof with the final semantic completion gates so after-B6a matrices and current-attempt closure artifacts drive final validation.
1 parent 502298e commit 00e39c5

26 files changed

Lines changed: 1002 additions & 1176 deletions

scripts/reviewer_bot_core/reconcile_replay_policy.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
from dataclasses import dataclass
1010

1111

12-
@dataclass(frozen=True)
13-
class ObserverNoopDecision:
14-
source_event_key: str
15-
reason: str
16-
17-
1812
@dataclass(frozen=True)
1913
class CommentReplayDecision:
2014
record_source_freshness: bool
@@ -38,10 +32,6 @@ class ReviewReplayDecision:
3832
clear_gap: bool
3933

4034

41-
def decide_observer_noop(*, source_event_key: str, reason: str) -> ObserverNoopDecision:
42-
return ObserverNoopDecision(source_event_key=source_event_key, reason=reason)
43-
44-
4535
def decide_comment_replay(
4636
*,
4737
comment_id: int,

scripts/reviewer_bot_lib/overdue.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from .config import TRANSITION_NOTICE_MARKER_PREFIX
66

7-
_TRANSITION_NOTICE_FALLBACK_FIRST_LINE = "🔔 **Transition Period Ended**"
87
_TRANSITION_NOTICE_AUTHORS = {"github-actions[bot]", "guidelines-bot"}
98

109

@@ -133,7 +132,7 @@ def find_existing_transition_notice(bot, issue_number: int, transition_warning_s
133132
continue
134133
lines = body.splitlines()
135134
first_line = lines[0].strip() if lines else ""
136-
if first_line == marker or first_line == _TRANSITION_NOTICE_FALLBACK_FIRST_LINE:
135+
if first_line == marker:
137136
if first_match is None or created_dt < first_match[0]:
138137
first_match = (created_dt, created_at)
139138
if len(response) < 100:

scripts/reviewer_bot_lib/reconcile.py

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
DeferredCommentPayload,
2929
DeferredCommentReplayContext,
3030
DeferredReviewPayload,
31-
ObserverNoopPayload,
32-
_LegacyDeferredIssueCommentPayloadV2,
33-
_LegacyDeferredReviewCommentPayloadV2,
3431
build_deferred_comment_replay_context,
3532
build_deferred_review_replay_context,
3633
parse_deferred_context_payload,
@@ -68,9 +65,7 @@
6865

6966
DeferredArtifactIdentity = _reconcile_payloads.DeferredArtifactIdentity
7067
DeferredReviewReplayContext = _reconcile_payloads.DeferredReviewReplayContext
71-
_artifact_expected_name = _reconcile_payloads.artifact_expected_name
72-
_artifact_expected_payload_name = _reconcile_payloads.artifact_expected_payload_name
73-
ParsedWorkflowRunPayload = DeferredReviewPayload | DeferredCommentPayload | ObserverNoopPayload | _LegacyDeferredIssueCommentPayloadV2 | _LegacyDeferredReviewCommentPayloadV2
68+
ParsedWorkflowRunPayload = DeferredReviewPayload | DeferredCommentPayload
7469

7570

7671
@dataclass(frozen=True)
@@ -268,15 +263,7 @@ def _reconcile_deferred_comment(
268263
pr_number = context.pr_number
269264
_read_live_pr_replay_context(bot, pr_number)
270265
source_freshness_eligible = context.source_freshness_eligible
271-
source_classified = (
272-
_classify_deferred_comment_payload(context.payload)
273-
if isinstance(context.payload, DeferredCommentPayload)
274-
else {
275-
"comment_class": context.payload.comment_class,
276-
"has_non_command_text": context.payload.has_non_command_text,
277-
"command_count": 1,
278-
}
279-
)
266+
source_classified = _classify_deferred_comment_payload(context.payload)
280267

281268
def replay_request(comment_context: LiveCommentReplayContext | None = None, *, comment_body: str = "") -> CommentEventRequest:
282269
return build_replay_comment_event_request(
@@ -405,28 +392,6 @@ def record_artifact_invalid(problem: InvalidEventInput) -> bool:
405392
return changed or reconciled_changed or gap_cleared_changed
406393

407394

408-
def _handle_observer_noop_workflow_run(
409-
bot: ReconcileWorkflowRuntimeContext,
410-
state: dict,
411-
review_data: dict,
412-
parsed_payload: ObserverNoopPayload,
413-
) -> bool:
414-
del state, review_data
415-
_reconcile_payloads.validate_triggering_run_identity(bot, parsed_payload.raw_payload)
416-
decision = reconcile_replay_policy.decide_observer_noop(
417-
source_event_key=parsed_payload.identity.source_event_key,
418-
reason=parsed_payload.reason,
419-
)
420-
_log(
421-
bot,
422-
"info",
423-
f"Observer workflow produced explicit no-op payload for {decision.source_event_key}: {decision.reason}",
424-
source_event_key=decision.source_event_key,
425-
reason=decision.reason,
426-
)
427-
return False
428-
429-
430395
def _handle_issue_comment_workflow_run(
431396
bot: ReconcileWorkflowRuntimeContext,
432397
state: dict,
@@ -550,12 +515,6 @@ def _handle_review_dismissed_workflow_run(
550515

551516

552517
def _workflow_run_handler_for_payload(parsed_payload: ParsedWorkflowRunPayload):
553-
if isinstance(parsed_payload, ObserverNoopPayload):
554-
return _handle_observer_noop_workflow_run
555-
if isinstance(parsed_payload, _LegacyDeferredIssueCommentPayloadV2):
556-
return _handle_issue_comment_workflow_run
557-
if isinstance(parsed_payload, _LegacyDeferredReviewCommentPayloadV2):
558-
return _handle_review_comment_workflow_run
559518
entry = _WORKFLOW_RUN_HANDLER_MATRIX.get(
560519
(
561520
parsed_payload.identity.source_event_name,

0 commit comments

Comments
 (0)