Skip to content

fix(external-wait): normalize short head SHAs at registration, heal legacy records (#961) - #975

Merged
jinon86 merged 2 commits into
mainfrom
fix/external-wait-short-sha
Aug 6, 2026
Merged

fix(external-wait): normalize short head SHAs at registration, heal legacy records (#961)#975
jinon86 merged 2 commits into
mainfrom
fix/external-wait-short-sha

Conversation

@jinon86

@jinon86 jinon86 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

문제 (#961 / #949 실측)

external_wait_cli register에 7~39자 축약 SHA를 주면 검증 통과 + ok:true 반환하지만, 모니터의 비교는 GitHub headRefOid(항상 40자)와의 정확 일치라 첫 폴에서 즉시 superseded — "CI 끝나면 자동 재개" 약속이 조용히 유실됐다.

수정

  • register: 축약 SHA를 gh api repos/{repo}/commits/{sha}로 40자 전체 SHA로 정규화. 해소 실패 시 등록 거부(ok:false, exit 2) — 지킬 수 없는 약속을 만들지 않음
  • monitor: 기록된 축약 SHA가 라이브 head의 접두사면 supersede 대신 레코드를 전체 SHA로 치유(heal). 실제로 head가 바뀐 경우는 기존처럼 superseded
  • registry: correct_head_sha() — monitoring 상태 + 엄격 접두사 일치 + 40자 검증일 때만 치유

기존 레코드(머지 전 등록된 축약 SHA)도 모니터 치유 경로로 회복됨.

검증

  • 회귀 테스트 5건 추가: 등록 시 40자 저장 / 미해소 시 fail-closed·레코드 없음 / 40자는 gh 미호출 패스스루 / 모니터 치유 후 success 도달 / 동일 길이 다른 head는 여전히 supersede
  • test_external_wait*.py 43 passed, ruff·mypy clean
  • 라이브 스모크: ca993cc1ca993cc1c738... 실제 gh 해소 확인

Closes #961

…egacy records (#961)

A 7-39 char head SHA passed format validation but could never equal
GitHub's 40-char headRefOid, so the wait superseded on the first poll
while register returned ok — the #949 silent promise loss.

- register: resolve short SHAs to the full head via gh api; refuse
  registration (ok:false, exit 2) when the SHA does not resolve
- monitor: a recorded short SHA that prefixes the live head is healed
  to the full SHA instead of superseded; a genuinely moved head still
  supersedes
- registry: correct_head_sha() heals only monitoring records with a
  strict prefix match

Closes #961
@jinon86
jinon86 requested a review from seoseo-ai as a code owner August 6, 2026 01:37

@seoseo-ai seoseo-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after explicit operator authorization using the local seoseo-ai credential.

@jinon86
jinon86 merged commit 03d4e30 into main Aug 6, 2026
8 checks passed
@jinon86
jinon86 deleted the fix/external-wait-short-sha branch August 6, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

external-wait: 축약 SHA를 받아들이고 2초 만에 superseded로 죽는다 — 등록은 ok를 반환(약속 유실)

2 participants