invalidparent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package invalidparent provides the "admin fix invalid-parent-reference" subcommand, which removes dangling parent references from issues whose parent no longer exists in the database. Each repaired issue becomes a top-level issue and receives an audit comment recording the original parent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(f *cmdutil.Factory, runFn ...func(context.Context, RunInput) error) *cli.Command

NewCmd constructs the "admin fix invalid-parent-reference" subcommand. An optional runFn replaces Run for testing; when provided, the Factory is used only to resolve the database store for the Svc field.

func Run

func Run(ctx context.Context, input RunInput) error

Run executes the invalid-parent-reference fix. It calls the service to scan (and optionally repair) dangling parent references, then renders the result as text or JSON according to input.JSON and input.DryRun.

Types

type RunInput

type RunInput struct {
	// Author is the name recorded on audit comments for each repaired issue.
	// The service validates the value; an empty author produces an error.
	Author string

	// DryRun, when true, identifies affected issues without mutating the
	// database. The service receives DryRun=true so no writes occur at any
	// layer.
	DryRun bool

	// JSON enables machine-readable JSON output instead of human-readable text.
	JSON bool

	// Out receives all command output.
	Out io.Writer

	// Svc is the service that performs the repair operation. NewCmd sets this
	// from the factory's store; tests inject a stub.
	Svc service
}

RunInput holds all parameters for the invalid-parent-reference fix logic, decoupled from CLI flag parsing so it can be tested directly.

Jump to

Keyboard shortcuts

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