Skill v1.0.3
currentAutomated scan100/1001 files
version: "1.0.3" name: rai-bugfix-close-lean description: "Lean residue de rai-bugfix-close: push + MR + Jira sync. 10 pasos vs 26 enterprise. Asume pipeline-orchestrated." model: haiku
allowed-tools:
- Read
- "Bash(git:*)"
- "Bash(glab:*)"
- "Bash(rai:*)"
license: MIT metadata: raise.adaptable: 'true' raise.fase: '5' raise.frequency: per-bug raise.gate: '' raise.skillset: raise-maintainability raise.version: 1.0.0 raise.visibility: public raise.work_cycle: bugfix-lean raise.inputs: |
- bug_id: string, required, argument
- run_id: string, required, injected by orchestrator in pointer prompt
- dev_branch: string, required, config
raise.outputs: |
- mr_url: string, terminal
Bugfix Close (Lean)
⚠ LEAN VARIANT (ADR-134 v2) — si cambias lógica [R]/[G] en rai-bugfix-close, propaga aquí.Fuente: work/epics/e14770-lean-methodology/skill-audit.md §rai-bugfix-closeLean residue: 10 pasos [R9, G1, I2] de 26 en enterprise (54% ceremonia eliminada).Asume siempre pipeline-orchestrated — requiere run_id en el pointer prompt.
Pipeline Context Check
Verificar que este skill fue invocado vía pipeline engine (RAISE-10715):
- Si
Run ID:aparece en el contexto → continuar silenciosamente. - Si ausente → STOP: "standalone execution detected — prior phases may have been skipped. Options: 1) continue anyway, 2) abort."
- Si eliges continue anyway → ANTES de continuar, emite señal de observabilidad del bypass (RAISE-15391 — el "continue anyway" antes no dejaba rastro queryable):
``bash rai signal emit-work bug "<bug_id>" --event blocked --phase close \ --blocker "standalone-close: prior phases (review/retro) unverified" ``
Objetivo
Push del branch de bug, crear MR, y sincronizar Jira. El lean pipeline siempre provee run_id — no hay check de contexto de pipeline. Sin ceremony.
Inputs: Bug ID, run_id (inyectado por el orquestador), {dev_branch}.
Pasos
1. Verificar artifacts via rai pipeline status [R]
rai pipeline status "{run_id}"
Construir mapa {phase_id → status}. Para cada artifact:
- scope.md (fase: start/diagnose) → si fase skipped: ok; si fase ran + archivo ausente: STOP
- analysis.md (fase: analyse) → si fase skipped: ok
- plan.md (fase: plan) → si fase skipped: ok
- retro.md (fase: review) → si fase skipped: ok
En lean, analyse/plan/review siempre son skipped → solo scope.md es obligatorio.
2. Verificar árbol limpio [R]
git status --short
Si hay cambios uncommitted → commitarlos antes de push.
3. AR gate [R]
rai gate check gate-ar-bugfix
Escape hatch para XS/docs:
RAISE_AR_SKIP_REASON="<razón>" rai gate check gate-ar-bugfix
ℹ El gate emite automáticamente una señalar-skip(WorkLifecycle, queryable víarai signal query bugfix <branch> --event ar-skip) al usar el escape hatch — RAISE-15391. Es un rastro de observabilidad además delgovernance/ar-skip-log.jsonl. No la re-emitas manualmente (doble conteo).
Si falla sin escape hatch → STOP: el AR debe existir antes del close.
4. Alembic single-head gate [R] (si el fix incluye migraciones)
rai gate check gate-alembic-single-head
Si falla → la cadena alembic tiene fork. Linealizar down_revision antes de push — no hacer merge sin esto; alembic upgrade head fallará en deploy.
Si el bug no toca migraciones → este gate pasa automáticamente (skipped).
5-6. Push + Crear MR [G]
Write the title and human-readable description to files without shell interpolation. Invoke /rai-mr-create with these required inputs:
source_branch:currentbug/{issue_key}/{slug}branchtarget_branch:{dev_branch}work_id:{bug_key}quality_review_file:work/bugs/{bug_key}/qr.mdtitle_file:file containing the exact MR/PR titledescription_file:file containing the exact human-readable body
GitLab uses THIN admission. GitHub retains the local full-gate path until equivalent remote enforcement exists. Neither provider permits manual push or MR/PR creation outside /rai-mr-create.
If /rai-mr-create fails (sync conflict, gate failure, push rejection), STOP. Do not assign fixVersion, advance the pipeline, or clean up. There is no remote branch/MR result to finalize: returning a successful close would allow the pipeline to transition Jira despite an unvalidated commit.
7. fixVersion — delegada al engine [R]
No asignar fixVersion manualmente — el engine lo hace automáticamente en el siguiente pipeline_advance: tras la transición a done y antes de after:bug:close, finalize_post_transition escribe el mismo fixVersion que verifica gate-close-jira-sync (assign_close_fix_version, resuelto desde la release line destino del branch — RAISE-18975). Asignar desde el branch name produce un conflicto con gate-close-jira-sync (RAISE-16614).
8. Verificación post-transición delegada (blocking) [R]
No ejecutar gate-close-jira-sync directamente desde el skill: Jira todavía no está en Done. Al devolver control, el siguiente pipeline_advance aplica primero target_status: done y después ejecuta el gate en after:bug:close.
Si el avance devuelve gate_failed para after:bug:close → FAIL el close. No log-and-continue ni escape implícito. Corregir Jira y re-run.
9. Worktree-aware cleanup [R]
if [ "$(git rev-parse --git-common-dir)" != "$(git rev-parse --git-dir)" ]; thenecho "Worktree — cleanup diferido a /rai-worktree-close"elsegit checkout {dev_branch}git branch -D bug/{issue_key}/{slug}fi
10. Bind result [I]
rai session bind RAISE_SESSION_JIRA_KEY "{bug_key}" 2>/dev/null || true
Fin. Devolver: MR URL, gate-close-jira-sync status, cleanup realizado sí/no.
Backlog tracker
Engine behavior (RAISE-16987): The engine checks ExecutionContext to determine mode:
mode: pipeline— engine active;apply_phase_transitionmoves the tracker. No skill call required.mode: standalone— no active run; tracker is not moved automatically.
If standalone (mode == standalone via ExecutionContext):
rai backlog transition {key} --point after:bugfix:close