fix(sre): sop-checklist section_marker_present backward checkbox search
All checks were successful
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 27s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 41s
CI / Detect changes (pull_request) Successful in 1m36s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m54s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m24s
CI / Python Lint & Test (pull_request) Successful in 7m57s
sop-tier-check / tier-check (pull_request) Successful in 34s
gate-check-v3 / gate-check (pull_request) Successful in 1m4s
lint-mask-pr-atomicity / lint-mask-pr-atomicity (pull_request) Successful in 3m14s
CI / Platform (Go) (pull_request) Successful in 18m17s
CI / Canvas (Next.js) (pull_request) Successful in 18m53s
CI / all-required (pull_request) Successful in 18m48s
CI / Canvas Deploy Reminder (pull_request) Successful in 5s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4

The checkbox-detection window (500 chars forward from marker) failed
for memory-consulted because the author placed the marker mid-sentence
and the checkbox was 600+ chars before the marker. Add a backward
fallback search (2000 chars) to handle inline markers.

mc#1099 follow-up.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · infra-sre 2026-05-16 04:40:34 +00:00
parent e4bdcf0b76
commit 6a86b84c92

View File

@ -206,7 +206,17 @@ def section_marker_present(body: str, marker: str) -> bool:
next_line_end = len(body)
next_line = body[line_end + 1:next_line_end]
stripped_next = re.sub(r"[\s\*:\-\[\]]+", "", next_line)
return bool(stripped_next)
if stripped_next:
return True
# Last resort: the marker may appear mid-sentence (e.g.
# **Memory/saved-feedback consulted**: No applicable...).
# The checkbox is on the PRECEDING line. Search backward from
# the marker for the checkbox pattern.
# mc#1099 follow-up: memory-consulted detection was failing because
# the checkbox was 600+ chars before the inline marker text.
_CHECKBOX_RE = re.compile(r"- \[[ x\]]|<input", re.IGNORECASE)
before = body[max(0, idx - 2000):idx]
return bool(_CHECKBOX_RE.search(before))
# ---------------------------------------------------------------------------