indexcompare

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CompareResultType is the JSONL record type for index comparison reports.
	CompareResultType    = "gonimbus.index.compare_result.v1"
	ProjectionVersion    = "gonimbus.index.compare_projection.v1"
	ComparatorVersion    = "gonimbus.index.comparator.v1"
	DefaultMaxMismatches = 20
)
View Source
const DurableDeltaComparatorVersion = "gonimbus.index.durable_delta.v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	ID   string `json:"id,omitempty"`
	Path string `json:"path,omitempty"`
}

type ContentIdentityCheck

type ContentIdentityCheck struct {
	Semantics  string `json:"semantics"`
	Checked    bool   `json:"checked"`
	Mismatches int64  `json:"mismatches"`
}

type CoverageAttribution

type CoverageAttribution struct {
	Attributed bool   `json:"attributed"`
	Basis      string `json:"basis,omitempty"`
	Scope      string `json:"scope,omitempty"`
}

type DeltaChange

type DeltaChange struct {
	Kind       string              `json:"kind"`
	RelKey     string              `json:"rel_key"`
	Fields     []FieldDelta        `json:"fields,omitempty"`
	Coverage   CoverageAttribution `json:"coverage"`
	BeforeETag string              `json:"before_etag,omitempty"`
	AfterETag  string              `json:"after_etag,omitempty"`
}

type DeltaCoverageSummary

type DeltaCoverageSummary struct {
	Semantics        string `json:"semantics"`
	BeforeScopes     int    `json:"before_scopes"`
	AfterScopes      int    `json:"after_scopes"`
	AttributedRows   int64  `json:"attributed_rows"`
	UnattributedRows int64  `json:"unattributed_rows"`
}

type DurableDeltaInput

type DurableDeltaInput struct {
	Before        DurableSnapshotInput
	After         DurableSnapshotInput
	MaxChanges    int
	RequireParent bool
}

type DurableDeltaReport

type DurableDeltaReport struct {
	Type              string               `json:"type"`
	ComparatorVersion string               `json:"comparator_version"`
	IndexSetID        string               `json:"index_set_id"`
	BeforeRunID       string               `json:"before_run_id"`
	AfterRunID        string               `json:"after_run_id"`
	BeforeArtifact    Artifact             `json:"before_artifact"`
	AfterArtifact     Artifact             `json:"after_artifact"`
	BeforeRows        int64                `json:"before_rows"`
	AfterRows         int64                `json:"after_rows"`
	Added             int64                `json:"added"`
	Changed           int64                `json:"changed"`
	Tombstoned        int64                `json:"tombstoned"`
	Unchanged         int64                `json:"unchanged"`
	BeforeSHA256      string               `json:"before_projection_sha256,omitempty"`
	AfterSHA256       string               `json:"after_projection_sha256,omitempty"`
	Coverage          DeltaCoverageSummary `json:"coverage"`
	Changes           []DeltaChange        `json:"changes,omitempty"`
}

func CompareDurableDelta

func CompareDurableDelta(ctx context.Context, input DurableDeltaInput) (DurableDeltaReport, error)

type DurableSnapshotInput

type DurableSnapshotInput struct {
	Manifest   indexsubstrate.InternalManifest
	SegmentDir string
	Artifact   Artifact
}

type ExcludedFieldSemantics

type ExcludedFieldSemantics struct {
	FieldClass string `json:"field_class"`
	Reason     string `json:"reason"`
	OwningGate string `json:"owning_gate"`
}

ExcludedFieldSemantics describes one field class intentionally outside the projection and names the gate that owns it.

type FieldDelta

type FieldDelta struct {
	Field  string `json:"field"`
	Before string `json:"before,omitempty"`
	After  string `json:"after,omitempty"`
}

type Input

type Input struct {
	SQLiteDB             *sql.DB
	SQLiteIndexSetID     string
	SQLiteArtifact       Artifact
	DurableManifest      indexsubstrate.InternalManifest
	DurableSegmentDir    string
	DurableArtifact      Artifact
	ObservationRunID     string
	ObservationStartedAt time.Time
	Options              Options
}

type Mismatch

type Mismatch struct {
	Kind    string `json:"kind"`
	RelKey  string `json:"rel_key,omitempty"`
	Side    string `json:"side,omitempty"`
	Field   string `json:"field,omitempty"`
	SQLite  string `json:"sqlite,omitempty"`
	Durable string `json:"durable,omitempty"`
}

type Options

type Options struct {
	ProjectionVersion string
	MaxMismatches     int
}

type ProjectionSemantics

type ProjectionSemantics struct {
	Certifies       string                   `json:"certifies"`
	DoesNotCertify  string                   `json:"does_not_certify"`
	IncludedFields  []string                 `json:"included_fields"`
	ContentIdentity string                   `json:"content_identity"`
	ExcludedFields  []ExcludedFieldSemantics `json:"excluded_fields"`
}

ProjectionSemantics is the machine-carried contract for ProjectionVersion. It keeps compare_result.v1 consumers from treating LIST-projection parity as a broader reflow-readiness or enrichment-parity claim.

func DefaultProjectionSemantics

func DefaultProjectionSemantics() ProjectionSemantics

DefaultProjectionSemantics returns the static contract for projection v1.

type Report

type Report struct {
	Type                 string              `json:"type"`
	ProjectionVersion    string              `json:"projection_version"`
	ProjectionSemantics  ProjectionSemantics `json:"projection_semantics"`
	ComparatorVersion    string              `json:"comparator_version"`
	ObservationRunID     string              `json:"observation_run_id,omitempty"`
	ObservationStartedAt string              `json:"observation_started_at,omitempty"`
	SQLiteMaterialized   bool                `json:"sqlite_materialized"`
	DurablePublished     bool                `json:"durable_published"`
	ComparisonRan        bool                `json:"comparison_ran"`
	// ParityPassed means LIST-projection fidelity for one crawl; it does not
	// certify reflow-input readiness or HEAD-enrichment parity.
	ParityPassed            bool                 `json:"parity_passed"`
	SQLiteArtifact          Artifact             `json:"sqlite_artifact"`
	DurableArtifact         Artifact             `json:"durable_artifact"`
	SQLiteRows              int64                `json:"sqlite_rows"`
	DurableRows             int64                `json:"durable_rows"`
	SQLiteProjectionSHA256  string               `json:"sqlite_projection_sha256,omitempty"`
	DurableProjectionSHA256 string               `json:"durable_projection_sha256,omitempty"`
	ProjectionMismatches    int64                `json:"projection_mismatches"`
	ContentIdentityCheck    ContentIdentityCheck `json:"content_identity_check"`
	Mismatches              []Mismatch           `json:"mismatches,omitempty"`
}

Report describes a compare_result.v1 parity check. ParityPassed certifies only the ProjectionSemantics contract carried on the same result.

func Compare

func Compare(ctx context.Context, input Input) (Report, error)

Jump to

Keyboard shortcuts

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