package thin import ( "context" "errors" "fmt" "amadan.net/oficina/equipo/internal/runner/workspace" ) const ( copyMergeSandboxMask = "Merge refused: %s is a new empty file at a sandbox placeholder path. Remove it or add the intended contents before merging." // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) copyMergeSandboxCheck = "Could not check the branch for sandbox placeholder files: %v" // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) ) // Every actual merge request checks the judged commit against the current // default branch. Reconciliation of an already landed merge needs no check. func (e *Engineer) mergeSandboxDetail(ctx context.Context, r stepRow) string { ctx, cancel := context.WithTimeout(ctx, fetchTimeout) defer cancel() _, base, _, err := e.Clones.Heads(ctx, r.Repo, nil) if err != nil && !errors.Is(err, ErrEmptyRepo) { return fmt.Sprintf(copyMergeSandboxCheck, err) } if err := e.fetch(ctx, r.Repo); err != nil { return fmt.Sprintf(copyMergeSandboxCheck, err) } tree := workspace.TaskTree{Git: e.O.Runner.GitPath, GitDir: e.Clones.Path(r.Repo), Dir: e.Clones.Path(r.Repo)} paths, err := tree.AddedSandboxMasks(ctx, base, r.CandidateSHA) if err != nil { return fmt.Sprintf(copyMergeSandboxCheck, err) } if len(paths) > 0 { return fmt.Sprintf(copyMergeSandboxMask, fmt.Sprintf("%q", paths[0])) } return "" }