code: func (client *clientImpl) makeRepairChecker(ctx context.Context, paranoia ParanoidMode) repairCB {
  	if paranoia == NotParanoid {
  		return func(string, common.Pin) *RepairPlan { return nil }
  	}
  
  	return func(subdir string, pin common.Pin) *RepairPlan {
  		switch state, err := client.deployer.CheckDeployed(ctx, subdir, pin.PackageName, paranoia, WithoutManifest); {
  		case err != nil:
  			// This error is probably non-recoverable, but we'll try anyway and
  			// properly fail later.
  			return &RepairPlan{
  				NeedsReinstall:  true,
  				ReinstallReason: fmt.Sprintf("failed to check the package state - %s", err),
  			}
  		case !state.Deployed:
  			// This should generally not happen. Can probably happen if two clients
  			// are messing with same .cipd/* directory concurrently.
  			return &RepairPlan{
  				NeedsReinstall:  true,
  				ReinstallReason: "the package is not deployed at all",
  			}
  		case state.Pin.InstanceID != pin.InstanceID:
  			// Same here.
  			return &RepairPlan{
  				NeedsReinstall:  true,
  				ReinstallReason: fmt.Sprintf("expected to see instance %q, but saw %q", pin.InstanceID, state.Pin.InstanceID),
  			}
  		case len(state.ToRedeploy) != 0 || len(state.ToRelink) != 0:
  			// Have some corrupted files that need to be repaired.
  			return &RepairPlan{
  				ToRedeploy: state.ToRedeploy,
  				ToRelink:   state.ToRelink,
  			}
  		default:
  			return nil // the package needs no repairs
  		}
  	}
  }
docs: // makeRepairChecker returns a function that decided whether we should attempt
  // to repair an already installed package.
  //
  // The implementation depends on selected paranoia mode.