scope

package
v0.4.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MatchPrefixMigrationSchema  = "gonimbus.scope.match_prefix_migration.v1"
	MatchPrefixMigrationVersion = 1
)

Migration plan schema identity for prefix-equivalent match→scope conversion.

View Source
const (
	ClassificationConvertible       = "convertible"
	ClassificationAlreadyCompatible = "already_compatible"
	ClassificationAlreadyMigrated   = "already_migrated"
	ClassificationRefused           = "refused"
)

Classification outcomes for a match→scope migration audit.

View Source
const (
	ReasonConvertible           = "prefix_includes_convertible"
	ReasonAlreadyCompatible     = "default_match_no_scope"
	ReasonAlreadyMigrated       = "proposed_form_present"
	ReasonExistingScope         = "existing_scope"
	ReasonNonPrefixInclude      = "non_prefix_include"
	ReasonHasExcludes           = "has_excludes"
	ReasonHasFilters            = "has_filters"
	ReasonIncludeHidden         = "include_hidden"
	ReasonEmptyOrRootPrefix     = "empty_or_root_prefix"
	ReasonBaseAnchorMismatch    = "base_anchor_mismatch"
	ReasonEmptyLegacyPlan       = "empty_legacy_plan"
	ReasonPlanInequality        = "plan_inequality"
	ReasonInvalidBaseURI        = "invalid_base_uri"
	ReasonInvalidManifest       = "invalid_manifest"
	ReasonEmitValidateFailed    = "emit_validate_failed"
	ReasonUnsupportedScopeType  = "unsupported_scope_type"
	ReasonIdentityComputeFailed = "identity_compute_failed"
	ReasonNoIncludes            = "no_includes"
	ReasonMixedDefaultAndPrefix = "mixed_default_and_prefix"
)

Stable reason codes for classification (allowlist + refuse matrix).

Variables

This section is empty.

Functions

func HashConfig

func HashConfig(cfg *manifest.IndexScopeConfig) (string, error)

HashConfig computes a canonical scope hash for identity purposes.

func RequiresPrefixLister

func RequiresPrefixLister(cfg *manifest.IndexScopeConfig) bool

Types

type ComputedIdentityEvidence

type ComputedIdentityEvidence struct {
	Kind            string   `json:"kind"` // always "computed"
	IndexSetID      string   `json:"index_set_id"`
	CanonicalSHA256 string   `json:"canonical_sha256"`
	ScopeHash       string   `json:"scope_hash,omitempty"`
	Includes        []string `json:"includes,omitempty"`
	GonimbusVersion string   `json:"gonimbus_version,omitempty"`
}

ComputedIdentityEvidence is an identity calculation under the current binary. It is not authoritative for a live on-disk set unless bound to a marker/receipt.

type IdentityComputer

type IdentityComputer func(m *manifest.IndexManifest, gonimbusVersion string) (*ComputedIdentityEvidence, error)

IdentityComputer optionally computes index-set identity evidence from a fully defaulted/reparsed manifest. Callers that need identity evidence must inject an implementation; pkg/scope remains storage-free (ADR-0006).

type MigrationPlan

type MigrationPlan struct {
	Schema  string `json:"schema"`
	Version int    `json:"version"`

	Classification string `json:"classification"`
	ReasonCode     string `json:"reason_code"`
	Detail         string `json:"detail,omitempty"`

	SourceManifestDigest string `json:"source_manifest_digest"`

	CanonicalLegacyIncludes []string `json:"canonical_legacy_includes,omitempty"`

	LegacyProviderPrefixes []string `json:"legacy_provider_prefixes,omitempty"`
	LegacyPlanDigest       string   `json:"legacy_plan_digest,omitempty"`
	LegacyPlanCount        int      `json:"legacy_plan_count,omitempty"`

	ProposedScope            *manifest.IndexScopeConfig `json:"proposed_scope,omitempty"`
	ProposedManifestYAML     string                     `json:"proposed_manifest_yaml,omitempty"`
	ProposedManifestDigest   string                     `json:"proposed_manifest_digest,omitempty"`
	ProposedProviderPrefixes []string                   `json:"proposed_provider_prefixes,omitempty"`
	ProposedPlanDigest       string                     `json:"proposed_plan_digest,omitempty"`
	ProposedPlanCount        int                        `json:"proposed_plan_count,omitempty"`
	ProposedScopeHash        string                     `json:"proposed_scope_hash,omitempty"`
	LegacyConfigIdentity     *ComputedIdentityEvidence  `json:"legacy_config_identity_under_current_binary,omitempty"`
	ProposedConfigIdentity   *ComputedIdentityEvidence  `json:"proposed_config_identity_under_current_binary,omitempty"`
}

MigrationPlan is the immutable audit record for one match→scope classification.

Experimental prefix-equivalent match→scope migration. Pure classification and conversion; no provider calls, authority, or filesystem side effects.

func PlanMatchPrefixMigration

func PlanMatchPrefixMigration(raw []byte, opts PlanOptions) (*MigrationPlan, error)

PlanMatchPrefixMigration classifies and, when convertible, converts prefix-shaped match.includes into an explicit build.scope prefix_list. It never mutates disk or contacts a provider.

type Plan

type Plan struct {
	Prefixes []string
}

func Compile

func Compile(ctx context.Context, cfg *manifest.IndexScopeConfig, basePrefix string, lister provider.PrefixLister) (*Plan, error)

Compile compiles a build.scope configuration into an explicit prefix plan.

type PlanOptions

type PlanOptions struct {
	// GonimbusVersion is injected into identity evidence so tests can hold version constant.
	// When empty and ComputeIdentity is nil, identity evidence fields are omitted.
	GonimbusVersion string
	// ComputeIdentity is optional. When set (and GonimbusVersion is non-empty), identity
	// evidence is attached. Implementations may live in storageful packages (CLI adapter).
	ComputeIdentity IdentityComputer
}

PlanOptions configures PlanMatchPrefixMigration.

Jump to

Keyboard shortcuts

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