# What Determines if a Finding is Auto‑Fixable vs Ask‑User in No‑Mistakes

> Understand what determines auto-fixable vs ask-user findings in No-Mistakes. Learn how the Action field setting drives automated fixes and user intervention for code quality.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: internals
- Published: 2026-07-17

---

**A finding is auto‑fixable only when its `Action` field is explicitly set to `"auto‑fix"` in the source code; otherwise, it defaults to `"ask‑user"` and requires human review.**

The `no‑mistakes` pipeline processes code quality findings through a deterministic decision engine that categorizes each issue as either safe to resolve automatically or requiring developer oversight. According to the `kunchenguid/no‑mistakes` source code, this determination hinges on a single enumerated field within the `Finding` struct that explicitly declares the intended remediation strategy.

## The Action Field: Three Possible Values

In [`internal/types/findings.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/types/findings.go), the `Finding` struct carries an **Action** field that controls remediation behavior. Three constants define the available actions:

- **`ActionNoOp`** (`"no‑op"`): The finding requires no remediation.
- **`ActionAutoFix`** (`"auto‑fix"`): The pipeline may resolve the issue automatically without human intervention.
- **`ActionAskUser`** (`"ask‑user"`): The finding must be presented to the user for manual review and approval.

## How the Pipeline Filters Auto‑Fixable Findings

The `AutoFixableFindings()` function in [`internal/types/findings.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/types/findings.go) (lines 68‑78) filters the findings list by checking the action value:

```go
func AutoFixableFindings(findings Findings) Findings {
    result := Findings{…}
    for _, item := range findings.Items {
        if item.actionOrDefault() == ActionAutoFix {   // ← decision point
            result.Items = append(result.Items, item)
        }
    }
    return result
}

```

The `actionOrDefault()` method returns the explicit `Action` value if set; otherwise, it defaults to `ActionAskUser`. This means:

- **Auto‑fixable**: Explicitly tagged with `ActionAutoFix`.
- **Ask‑user**: Either explicitly tagged with `ActionAskUser` or missing/empty (causing the default fallback).

## What Qualifies as Auto‑Fixable

According to the authoritative comment in [`internal/pipeline/steps/review.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/review.go) (line 208), the `"auto‑fix"` action applies exclusively to *“non‑functional, non‑user‑visible issues (correctness, error handling, security, performance, mechanical code quality) that can be safely fixed without any discussion about the author’s intent.”*

This classification ensures that purely mechanical transformations—such as removing unused variables or applying formatting fixes—proceed automatically, while design decisions or ambiguous refactorings route to human reviewers.

## Practical Examples: Configuring Finding Actions

The following examples demonstrate how different finding types trigger distinct pipeline behaviors:

```go
// Example: a lint finding that can be auto‑fixed
f := types.Finding{
    Severity:    "error",
    Description: "unused variable",
    Action:      types.ActionAutoFix,   // ← auto‑fixable
}

// Example: a design‑choice finding that must be reviewed
g := types.Finding{
    Severity:    "warning",
    Description: "consider refactoring for readability",
    // Action omitted → defaults to ask‑user
}

```

When processed, `f` triggers automatic removal of the unused variable, while `g` appears in the review queue for developer approval.

## Pipeline Integration Points

The action classification system extends across multiple pipeline stages:

- **[`internal/pipeline/steps/lint.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/lint.go)**: Classifies lint findings based on rule severity and safety.
- **[`internal/pipeline/steps/test.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/test.go)**: Determines whether test failures can be automatically corrected or require investigation.
- **[`internal/pipeline/steps/review.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/review.go)**: Implements the final review gate that respects the `"ask‑user"` designation.

## Summary

- A finding is **auto‑fixable** only when explicitly assigned `Action: "auto‑fix"` in the source code.
- The `AutoFixableFindings()` function in [`internal/types/findings.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/types/findings.go) filters findings using the `actionOrDefault()` method, which falls back to `"ask‑user"` when no action is specified.
- **Ask‑user** is the default state for safety, ensuring human oversight unless the issue is purely mechanical and non‑functional.
- Auto‑fixable issues include correctness fixes, error handling improvements, and mechanical code quality changes that do not alter author intent.

## Frequently Asked Questions

### What happens if the Action field is left empty?

When the `Action` field is omitted or empty, the `actionOrDefault()` method automatically returns `ActionAskUser`, routing the finding to manual review. This safety‑first default ensures no potentially ambiguous fixes are applied automatically.

### Can users override the auto‑fix decision for specific findings?

The source code indicates that the action is determined at the point of finding creation (typically in lint or test steps). While the pipeline respects the predefined action, the architecture suggests that classification logic in files like [`internal/pipeline/steps/lint.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/lint.go) could be extended to support user‑defined overrides through configuration.

### Why are some mechanical fixes still marked as ask‑user?

Findings default to `ActionAskUser` unless the code generating them explicitly sets `ActionAutoFix`. This conservative approach prevents unintended side effects where a seemingly mechanical change might impact business logic or author intent that automated tools cannot infer.

### Where is the auto‑fix criteria documented in the codebase?

The definitive description of what constitutes an auto‑fixable finding appears in the inline documentation within [`internal/pipeline/steps/review.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/review.go) at line 208, which specifies that such issues must be non‑functional, non‑user‑visible, and safe to resolve without discussing author intent.