internal/infra/pg/recordassertion.go
internal/infra/pg · 206 lines · 6 declarations · source
Declarations
type RecordAssertion
type RecordAssertion struct {
IdempotencyKey string `json:"idempotency_key"`
DataSubjectID string `json:"data_subject_id,omitempty"`
Subject string `json:"subject"`
Predicate string `json:"predicate"`
Object string `json:"object"`
Statement string `json:"statement"`
ValidFrom time.Time `json:"valid_from,omitempty"`
}
An assertion is application-authored input, not an inference proposal. The closed vocabulary supplies cardinality and object type; a client cannot override either or invent model confidence.
type AssertedRecord
type AssertedRecord struct {
ID string `json:"id"`
Version string `json:"version"`
SourceObservationID string `json:"source_observation_id"`
Replayed bool `json:"replayed"`
}
type AssertionBatch
type AssertionBatch struct {
Records []AssertedRecord `json:"records"`
}
func validAssertionText
func validAssertionText(value string, max int, optional bool) bool
method RecordStore.AssertRecords
func (s *RecordStore) AssertRecords(ctx context.Context, scope, principal string, requests []RecordAssertion) (AssertionBatch, error)
AssertRecords atomically creates 1–20 authored sources or resolves their prior retry receipts. Keys are namespaced within the existing source retry table, whose erasure tombstones prevent queued retries from recreating deleted content. Fingerprints omit the server-assigned event time.
func authorCuratedTx
func authorCuratedTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, principal, owner string, claim domain.Claim, knownAt time.Time) (string, string, error)
Corrections pass their exact withdrawal boundary. Independent assertions let the shared fact writer choose ordered knowledge time; the authored source records that server-assigned event.