Coordination hardening: reconciler TOCTOU, janitor :throw, Events.Tap seq

Abierto
#45 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
elixir, git
Área
cli, devtools

Línea de trabajo

Lee primero lib/loopyard/git.ex:65 y lib/loopyard/source/local/worktree.ex:43; después, sigue el fallback de la ruta del worktree en lib/loopyard/source/local.ex:149 y :302. Verifica que la eliminación y recreación del workspace de la misma rama se realicen correctamente y que current_revision/1 y dirty?/1 devuelvan valores reales para el workspace principal.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug reliability

Problem

git worktree remove runs in the wrong repo — so branch workspaces can never be re-created.

  • lib/loopyard/git.ex:65 — worktree_remove/1 runs git worktree remove --force <abs-path> without cd:, i.e. in the BEAM's cwd (the Loopyard repo under mix loopyard.server). Git resolves worktrees against the cwd's repo, so removal always fails (exit 128, "is not a working tree") for any project repo.
  • lib/loopyard/source/local/worktree.ex:43 — remove/1 ignores that error and File.rm_rfs the directory, leaving stale registration in the project repo's .git/worktrees/.
  • Any later create at the same deterministic path (workspace re-add of the same branch, or do_create_worktree's remove-then-create retry, source/local.ex:149) then fails: "missing but already registered worktree; use add -f, or prune".

Empirically reproduced (git 2.41).

Also here (small, same file area):

  • Source.Local.current_revision/1 and dirty?/1 (local.ex:302) route through Worktree.path_for(id), which doesn't exist for the main workspace (checkout is the project root) → always {:error, :worktree_missing} / false for main, while the git_* callbacks correctly fall back to workspace.path.

Fix

  • Run git worktree remove with cd: set to the project repo (or the worktree path), and/or git worktree prune in the repo after any rm_rf fallback. Worktree.remove/1 needs the repo path passed in.
  • Make current_revision/1 / dirty?/1 use the same worktree-path-with-fallback the git_* callbacks use.

Acceptance

  • Remove a branch workspace, then re-create the same branch — succeeds (no "already registered worktree").
  • current_revision/dirty? return real values for the main workspace.
Lenguaje dominante
Elixir
Estrellas
85
Forks
11
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de loopyard/loopyard

Todos los issues de loopyard/loopyard

Issues similares

Más issues de Elixir

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.