stableidmigration

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package stableidmigration builds deterministic old-to-new finding-ID reports from canonical goplint finding streams.

Index

Constants

View Source
const SchemaVersion = 2

Variables

This section is empty.

Functions

func Marshal

func Marshal(report Report) ([]byte, error)

Types

type Collision

type Collision struct {
	Scan     string            `json:"scan"`
	ID       string            `json:"id"`
	Findings []semanticFinding `json:"findings"`
}

type Counts

type Counts struct {
	Retained int `json:"retained"`
	Changed  int `json:"changed"`
	Added    int `json:"added"`
	Removed  int `json:"removed"`
}

type Duplicate

type Duplicate struct {
	Scan            string          `json:"scan"`
	SemanticFinding semanticFinding `json:"semantic_finding"`
	ID              string          `json:"id"`
	Count           int             `json:"count"`
}

type Migration

type Migration struct {
	SemanticFinding semanticFinding `json:"semantic_finding"`
	OldID           string          `json:"old_id,omitempty"`
	NewID           string          `json:"new_id,omitempty"`
	Status          string          `json:"status"`
}

type PopulationChange

type PopulationChange struct {
	Status          string `json:"status"`
	Category        string `json:"category"`
	Population      int    `json:"population"`
	CanonicalSHA256 string `json:"canonical_sha256"`
	Reviewed        bool   `json:"reviewed"`
	Reason          string `json:"reason,omitempty"`
	Evidence        string `json:"evidence,omitempty"`
}

type PopulationChangeReview

type PopulationChangeReview struct {
	Status          string `json:"status"`
	Category        string `json:"category"`
	Population      int    `json:"population"`
	CanonicalSHA256 string `json:"canonical_sha256"`
	Reason          string `json:"reason"`
	Evidence        string `json:"evidence"`
}

PopulationChangeReview binds an intentionally changed scan population to its exact semantic-finding set. Counts alone are insufficient: the digest prevents a same-sized but different addition/removal set from inheriting a prior review.

type Report

type Report struct {
	SchemaVersion     int                `json:"schema_version"`
	Deterministic     bool               `json:"deterministic"`
	Accepted          bool               `json:"accepted"`
	OldScan           ScanSummary        `json:"old_scan"`
	NewScan           ScanSummary        `json:"new_scan"`
	RepeatScan        ScanSummary        `json:"repeat_scan"`
	Counts            Counts             `json:"counts"`
	Migrations        []Migration        `json:"migrations"`
	PopulationChanges []PopulationChange `json:"population_changes"`
	Collisions        []Collision        `json:"collisions"`
	Duplicates        []Duplicate        `json:"duplicates"`
	Failures          []string           `json:"failures"`
}

func Build

func Build(oldData, newData, repeatData []byte) (Report, error)

Build parses an old scan and two independently executed new scans. It accepts a migration only when the repeated new scans are byte-identical after canonical sorting, every shared semantic finding maps one-to-one, no ID collision or duplicate report remains, and every added/removed population is bound to an exact reviewed digest.

func BuildReviewed

func BuildReviewed(
	oldData,
	newData,
	repeatData []byte,
	reviews []PopulationChangeReview,
) (Report, error)

BuildReviewed is Build with exact reviewed population changes. Reviews do not weaken collision, duplicate, determinism, or ambiguous-mapping checks.

type ScanSummary

type ScanSummary struct {
	Population      int    `json:"population"`
	CanonicalSHA256 string `json:"canonical_sha256"`
}

Jump to

Keyboard shortcuts

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