Skip to content

feat(smartlog): Phase 3 #310 — branch-tip CI overlay for PR-less nodes - #420

Merged
erishforG merged 1 commit into
release/1.0from
feat/auto-310-ci-overlay-phase3
Sep 4, 2026
Merged

feat(smartlog): Phase 3 #310 — branch-tip CI overlay for PR-less nodes#420
erishforG merged 1 commit into
release/1.0from
feat/auto-310-ci-overlay-phase3

Conversation

@erishforG

Copy link
Copy Markdown
Owner

무엇

attach_ci_overlay 가 PR이 없는 SmartlogNode를 조용히 건너뛰던 문제를 수정합니다. 이 Phase는 issue #310 의 원래 요구사항을 완성합니다:

각 worktree branch tip 에 대해 GitHub check runs aggregate

왜 (Epic: Refs #310, Milestone: v1.0)

PR 없이 작업 중인 worktree(초기 branch, 실험적 spike 등)도 CI 상태를 한눈에 볼 수 있어야 합니다.

변경

src/github/mod.rs

  • GitHubClient::get_check_runs_by_sha(sha: &str) -> Result<CiStatus> 추가
    • PR 조회 없이 /commits/{sha}/check-runs 직접 호출
    • pr_number: 0 sentinel (호출자는 집계 필드만 사용)
    • get_check_runs와 동일한 집계 로직 공유

src/cli/commands/smartlog.rs

  • attach_ci_overlay: 노드별 분기
    • PR 있는 노드 → 기존 get_check_runs(pr.number) 경로
    • PR 없는 노드 → git rev-parse <branch> 로 SHA 해결 후 get_check_runs_by_sha 호출
    • git 실패 시 해당 노드 CI 배지 생략 (graceful degradation)
  • resolve_branch_tip_sha(repo, branch) -> Option<String> 추가
  • Phase 3 모듈 doc comment
  • 테스트 3개 추가

다음 Phase 힌트

Phase 4 후보:

리스크

  • low: 기존 PR-linked 노드 동작 변경 없음. PR-less 노드는 git rev-parse 실패 시 CI 배지 생략 (이전과 동일). 새 GitHub API 호출은 기존 get_check_runs와 같은 엔드포인트.

롤백

git revert e0033c3 — 두 파일만 변경, 메인 로직 불변.

Test plan

  • cargo build --quiet
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --quiet: 325 tests pass ✅
  • 신규 테스트: ci_badge_renders_same_for_pr_less_node, ci_badge_none_renders_for_pr_less_node, resolve_branch_tip_sha_rejects_empty

@erishforG

Previously attach_ci_overlay skipped any SmartlogNode that had no PR
overlay, leaving worktrees without an open PR with no CI information.

This phase completes the original #310 acceptance criterion:
  > 각 worktree branch tip 에 대해 GitHub check runs aggregate

Changes
- src/github/mod.rs: add GitHubClient::get_check_runs_by_sha(sha)
  Fetches /commits/{sha}/check-runs directly, without a PR round-trip.
  Returns CiStatus with pr_number=0 as sentinel (callers use aggregate
  fields, not pr_number). Identical aggregation logic to get_check_runs.
- src/cli/commands/smartlog.rs:
  - attach_ci_overlay: remove early-exit when all nodes lack a PR;
    instead branch per node — PR nodes use get_check_runs (existing),
    PR-less nodes resolve their branch-tip SHA via git rev-parse and
    call get_check_runs_by_sha (new). Skip gracefully on git failure.
  - resolve_branch_tip_sha(repo, branch) -> Option<String>: thin helper
    calling git rev-parse, returns None for orphan/unresolvable branches.
  - Phase 3 doc comment at module top.
  - 3 new unit tests: ci badge renders for PR-less node, none badge for
    PR-less node, resolve_branch_tip_sha returns None for invalid path.

Backward-compat: behaviour for PR-linked nodes is unchanged; nodes that
fail the git rev-parse (orphan/unborn) degrade to no CI badge, same as
before.

Refs #310

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@erishforG erishforG added the auto-improvement Daily auto-generated improvement PR/issue label Sep 4, 2026
@erishforG
erishforG merged commit efada26 into release/1.0 Sep 4, 2026
12 checks passed
@erishforG
erishforG deleted the feat/auto-310-ci-overlay-phase3 branch September 4, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-improvement Daily auto-generated improvement PR/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant