fix

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fix is the tier-1 fix engine (DESIGN.md section 7, SPEC.md section 7): a whitelist of hand-proven transforms plus mechanical re-verification. A transform declares its relation delta; after applying the edits, the workspace is re-extracted and the actual post-fix relation must equal the expected one (canonical-form comparison, span attributes masked for rows at or after the edit point in edited files). A mismatch rolls the file back and reports a tool bug — it is never silently accepted.

The whitelist has one transform: unreachable-statement removal (the flagship, offered by the unreachable-code rule).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Planned

type Planned struct {
	Rule        string
	Description string
	// File is the workspace-root-relative path.
	File string
	// Start/End is the removal range over the file's LF-normalized bytes,
	// snapped to whole lines at apply time.
	Start uint32
	End   uint32
}

Planned is one planned tier-1 fix: a byte-range removal in one file.

func PlanUnreachableRemovals

func PlanUnreachableRemovals(res *extract.Result, cfg *config.Effective) []Planned

PlanUnreachableRemovals plans the whitelisted removal transform for every unreachable region the configuration leaves active. Regions contained within a larger dead region of the same file collapse into the outer removal.

type Report

type Report struct {
	Applied []Planned
	// FilesEdited is the number of distinct files rewritten.
	FilesEdited int
}

Report is the outcome of Apply.

func Apply

func Apply(ws *workspace.Workspace, pre *extract.Result, plans []Planned) (*Report, error)

Apply performs the planned fixes and runs the SPEC section 7 verification. On a verification mismatch every edited file is restored and an error describing the tool bug is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL