Skip to content

perf(ci): scope remote audit to changed skills via revision diff#13

Merged
bluejayA merged 2 commits into
mainfrom
feat/remote-audit-scope-by-diff
Apr 14, 2026
Merged

perf(ci): scope remote audit to changed skills via revision diff#13
bluejayA merged 2 commits into
mainfrom
feat/remote-audit-scope-by-diff

Conversation

@bluejayA
Copy link
Copy Markdown
Owner

Summary

  • skill-audit-remote.yml이 플러그인의 모든 SKILL.md를 감사해 대규모 업데이트 시 타임아웃이 발생하던 문제 해소
  • marketplace.json의 old/new revision 쌍으로 git diff를 돌려 실제 바뀐 스킬만 감사
  • skills/_*/ 공유 경로 변경 시 해당 플러그인 전수 감사로 fallback (정합성 유지)
  • 스킬당 timeout 300 상한으로 한 스킬이 먹통이어도 job 전체가 멈추지 않음

동작 매트릭스

상황 동작
기존 플러그인 + 일부 스킬만 변경 diff 범위만 감사 (핵심 절감)
skills/_*/ 공유 경로 변경 전수 감사로 fallback
신규 플러그인 (old_revision 없음) 전수 감사
old revision fetch 실패 전수 감사 + warning
스킬당 300초 초과 해당 스킬 BLOCKED, 다음 스킬 진행
skills/ 하위 변경 없음 (docs-only) audit skip

Security / Fail-Closed

  • revision / old_revision 필드를 ^[a-f0-9]{7,40}$ 로 형식 검증한 뒤 shell에 전달
  • git fetch 실패 → 전수 감사 (fail-open 아님)
  • claude --print 실패/타임아웃 → BLOCKED
  • submodule-from-base 방어, URL/name allowlist, 120s clone 타임아웃 그대로 유지
  • SCOPE_KIND enum(diff/full_shared/full_fetch_failed/full_new_plugin) + SCOPE_DESC 라벨 분리 — 제어 흐름과 표시 문자열 이중 용도 해소

Review 반영 이력

병렬 서브에이전트 3명 리뷰 후:

  • awk 필터 NF>=2NF>=3 (skills/ 직하 파일 오탐 제거)
  • SCOPE_MODE 문자열 이중 용도 → SCOPE_KIND/DESC 분리
  • revision SHA 형식 검증 추가
  • cmd && A \|\| Bif/then/else (가독성)
  • skill count wc -lgrep -c . (trailing newline 케이스)

후속 논의 (별도 이슈)

  • 룰셋 버전 업그레이드 시 기존 플러그인 재감사 정책 (v1.5→v2.0 같은 전환)
  • marketplace spec에 "shared code는 skills/_*/ 하위에만 둘 것" 명시

Test plan

  • 동일 플러그인의 일부 스킬만 변경한 테스트 PR로 diff 범위가 좁혀지는지 확인
  • skills/_shared/ 파일만 변경한 PR로 전수 감사 fallback 동작 확인
  • 신규 플러그인 등록 PR로 전수 감사 경로 확인
  • 잘못된 revision SHA (e.g., branch name) 입력 시 Validate 단계에서 차단되는지 확인
  • 단일 스킬이 300초 초과 시 해당 스킬만 BLOCKED 처리되고 다음 스킬이 진행되는지 확인

🤖 Generated with Claude Code

bluejayA and others added 2 commits April 14, 2026 10:42
Large plugin updates were timing out because every skill in the plugin
was re-audited even when only a few actually changed. Use the old/new
revision pair from marketplace.json to `git diff` the plugin repo and
audit only the skills whose files changed. Shared-path (`skills/_*`)
changes fall back to a full audit to preserve correctness. Also add a
300s per-skill timeout so a single hung audit cannot stall the job.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…COPE_KIND enum

Applying reviewer feedback on the diff-scoping patch:

- Validate `revision` / `old_revision` fields as `^[a-f0-9]{7,40}$`
  before they reach `git fetch` / `git diff` (defense-in-depth).
- Tighten awk path filter from `NF>=2` to `NF>=3` so that files sitting
  directly under `skills/` (e.g. `skills/README.md`) no longer pollute
  `CHANGED_DIRS` or `SHARED_CHANGED` detection.
- Split `SCOPE_MODE` into `SCOPE_KIND` (enum for control flow) and
  `SCOPE_DESC` (human-readable label). The old string was used for both,
  so any future label tweak would silently break the full-fallback
  branch. Comparisons now use the enum only.
- Convert `cmd && A || B` DIFF_OK assignment to `if/then/else` for
  readability.
- Replace `wc -l | tr -d ' '` skill count with `grep -c .` for correct
  handling of trailing-newline-less input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bluejayA bluejayA merged commit ca1d9e5 into main Apr 14, 2026
2 checks passed
@bluejayA bluejayA deleted the feat/remote-audit-scope-by-diff branch April 14, 2026 01:59
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.

1 participant