fixture

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fixture implements the labeled synthetic dataset (SPEC-04 §9) and the banner constant shared by CLI/API/Dashboard.

Every row is `provenance=fixture`; every surface marks fixture rows with the banner. Fixture data can never be promoted to real (AC-9.7.x).

M4: this package now carries the full fixture machinery — the embedded SPEC-04 §9 corpus (testdata/fixture/corpus.json), the Banner constant, and the Facts/Load loader that ingests it through the M4 store (idempotent via L1/L2). The QS-6 --load-fixtures / --purge-fixtures confirmation gate lives in the CLI layer; the provenance=fixture tag is stamped here and can never be promoted to real.

Index

Constants

View Source

Banner is the shared fixture-surface constant (SPEC-01 §45). CLI, REST and Dashboard print it wherever fixture rows appear so no consumer mistakes the synthetic dataset for real internet data. The em-dash is a deliberate, contract-pinned character (U+2014): tests assert the exact byte sequence.

Variables

This section is empty.

Functions

func Facts

func Facts() ([]postgres.Fact, error)

Facts returns the SPEC-04 §9 corpus as ingestion-ready facts.

Determinism guarantees (asserted by corpus_test.go): the returned slice is in corpus observation order; each Observation.PayloadHash is hex(sha256(canonical JSON of evidence)) — encoding/json sorts map keys, so the marshal of the decoded map is byte-stable; each Observation.ID is fnv1a-64 over "fixture:"+cursor, a stable bookkeeping id only (the L1 delivery identity (source_id, source_cursor) — not this id — is the ingestion idempotency key). AssetID/ServiceID/SourceID are left zero: the store resolves them during IngestFact, and Load stamps SourceID after EnsureFixtureSource.

Types

type LoadStats

type LoadStats struct {
	SourceID int64
	postgres.IngestStats
}

LoadStats reports what Load did: the fixture source registry id the facts were stamped with, plus the store's ingest counters.

func Load

func Load(ctx context.Context, store *postgres.Store) (LoadStats, error)

Load ensures the fixture data_source row exists, then ingests the corpus through store — idempotent via L1/L2 (safe to re-run).

The SourceID stamp happens per fact right before ingest because the observation insert requires a caller-supplied source_id (FK to data_sources) and EnsureFixtureSource is what makes that id real. Re-running Load is safe by construction: EnsureFixtureSource is an upsert, and IngestFacts dedupes observations on the L1 delivery identity (source_id, source_cursor) — a second run reports the same rows as updated/deduped instead of duplicating anything.

Jump to

Keyboard shortcuts

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