Documentation
¶
Overview ¶
Package inspect implements post-hoc artifact validation for xray .tar.gz artifacts. It runs five checks in order and returns a Report regardless of whether individual checks pass or fail; the error return is reserved for I/O failures that prevent the inspection from running at all.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SchemaCompat = map[int][]string{
1: {"0.1.0", "0.2.0", "0.2.1", "0.2.2"},
2: {"0.3.0", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.4.10"},
}
SchemaCompat maps schema_version to the slice of binary versions that emit that schema. It is append-only and must stay in lock-step with the compatibility table in README.md#compatibility. The /release script should append a row whenever schema_version changes or a new binary version ships.
This table is the single source of truth used by the schema_version check in Inspect. Do not auto-derive it at build time — it is a hand-vetted contract.
Functions ¶
func IsKnownSchema ¶
IsKnownSchema reports whether schemaVersion appears in SchemaCompat.
func SupportedBinaries ¶
SupportedBinaries returns the binary versions known to emit schemaVersion. Returns nil for an unrecognised version.
Types ¶
type Check ¶
type Check struct {
Name string `json:"name"`
Pass bool `json:"pass"`
// Skipped is true when the check was not run because an earlier check failed.
// A skipped check always has Pass=false; Skipped distinguishes "did not run"
// from "ran and failed" for automated consumers.
Skipped bool `json:"skipped,omitempty"`
// Detail is a human-readable summary; empty is allowed on pass.
Detail string `json:"detail"`
// Mismatches is populated only by the row_counts check.
Mismatches []CountMismatch `json:"mismatches,omitempty"`
}
Check is one of the five validation steps.
type CountMismatch ¶
type CountMismatch struct {
Table string `json:"table"`
Manifest int `json:"manifest"`
DB int `json:"db"`
}
CountMismatch is a single (table, manifest count, db count) divergence row reported by the row_counts check.
type Report ¶
type Report struct {
Artifact string `json:"artifact"`
OK bool `json:"ok"`
Checks []Check `json:"checks"`
}
Report is the top-level result of an Inspect call. The Checks slice always contains exactly five entries in order: tar_integrity, manifest_shape, sqlite_integrity, row_counts, schema_version. Consumers can rely on the index position and the Name field being stable.