internal/infra/pg/extractionpin.go
internal/infra/pg · 64 lines · 6 declarations · source
Declarations
var ErrExtractionChanged
var ErrExtractionChanged = errors.New("source extraction configuration changed; use its original configuration or an explicit rebuild")
var ErrInvalidExtractionVersion
var ErrInvalidExtractionVersion = errors.New("invalid extraction identity")
var extractionVersionPattern
var extractionVersionPattern = regexp.MustCompile(`^extract/v2:[a-f0-9]{64}$`)
method FactStore.PinExtraction
func (s *FactStore) PinExtraction(ctx context.Context, schema Schema, scope, source, version string) error
PinExtraction prevents a restart with another model from silently mixing partial outcomes. It commits before inference so even a crash before the first fact retains the accepted identity.
func pinExtractionTx
func pinExtractionTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, source, version string) error
func pinLockedExtractionTx
func pinLockedExtractionTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, source, version string) error
Fact assertion already holds the source lock while validating attribution. Share its lock so the established role refusal stays ahead of provenance writes without another advisory-lock query.