provenance

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package provenance is the record's disclosure vocabulary as DATA: where an item came from (`origin`) and how its text was produced (`production_mode`), plus the one parser that reads and renders them.

It is a leaf for the same reason core/issueschema and core/changelog are: the WRITERS that stamp the pair (core/intent, core/spec, core/capture) and the GATE that judges it (core/lint) must agree about what a legal value is, and two hand-kept copies of a closed set drift the moment one side gains a member. It imports no filesystem and no transport — only core/issueschema, for the reading families' own spelling of their id prefixes, which is not restated here.

Neither key touches authorship. They are disclosure at field granularity, on the same footing as the `Assisted-by:` trailer at commit granularity (itd-178).

Index

Constants

View Source
const (
	KeyOrigin         = "origin"
	KeyProductionMode = "production_mode"
)

The two frontmatter keys, spelled once. Both are single-line SCALARS, which is a constraint on the encoding rather than an accident: a nested mapping is readable by capture's YAML subset but invisible to frontmatter.Fields, the same-line scanner every intent and spec reader uses, so a nested value would need a second record parser (spc-56).

View Source
const DefaultMode = ModeHandWritten

DefaultMode is what an unset production mode means: a repository that declares none, and a verb invoked with no `--production-mode`, both stamp this.

Variables

This section is empty.

Functions

func ModeList

func ModeList() string

ModeList renders the legal set for an error message or a flag's help text.

Types

type Kind

type Kind string

Kind is the arrival path an `origin` value names.

const (
	// KindResearcherAuthored is the default for a verb a person invoked.
	KindResearcherAuthored Kind = "researcher-authored"
	// KindExtractedFromRecord is stamped by capture.Promote, the one shipped path
	// that derives a record from another record.
	KindExtractedFromRecord Kind = "extracted-from-record"
	// KindContributedByReading carries the run and item identifiers that resolve
	// to a reading record. It is minted only by the reading-ingest verb, which
	// carries both ids already and never asks an operator for them.
	KindContributedByReading Kind = "contributed-by-reading"
)

The three members of the closed set. The string values are the wire format — what the frontmatter carries — so renaming a constant is safe and changing a value is a record migration.

type Mode

type Mode string

Mode is how a record's text was produced.

const (
	ModeHandWritten          Mode = "hand-written"
	ModeDictatedAndFormatted Mode = "dictated-and-formatted"
	ModeScribeTranscribed    Mode = "scribe-transcribed"
)

The three members of the closed set (the ruled authorship account's vocabulary; spc-56 ships the mechanism that stamps it, not the vocabulary decision).

func ModeOrDefault

func ModeOrDefault(v string) (Mode, error)

ModeOrDefault is the ONE defaulting door: an absent value means DefaultMode, and anything else goes through ParseMode. Every write path normalises here, so the "absent means hand-written" rule is stated once rather than at each writer.

func ParseMode

func ParseMode(v string) (Mode, error)

ParseMode is the boundary validator for a PRESENT production mode. An empty value is an error here, never a default: the defaulting rule has exactly one door (ModeOrDefault), so a caller cannot absorb an unset value by accident and a config member that is present but blank is a fault rather than a shrug.

type Origin

type Origin struct {
	Kind Kind
	Run  string
	Item string
}

Origin is a parsed `origin` value: the arrival path, plus the reading pointer when the path is a reading contribution. Run and Item are empty for every other kind, so a zero pointer beside a reading kind is unrepresentable after a successful parse.

func ParseOrigin

func ParseOrigin(v string) (Origin, error)

ParseOrigin is the ONE predicate that reads an `origin` value, and the one the lint calls.

Matching is exact: no case folding and no trimming, matching how the shared impact parser reads its enum. The frontmatter scanner already trims the value it hands over, so whitespace still present here came from inside the value and is an authoring defect worth naming rather than absorbing.

func (Origin) String

func (o Origin) String() string

String renders the value exactly as a record carries it, so a parse and a render round-trip byte-for-byte. The rendered value contains no ": " sequence, which is what keeps it a plain YAML scalar to every reader in the corpus.

type Stamp

type Stamp struct {
	Origin Origin
	Mode   Mode
}

Stamp is the pair a write path stamps: both keys together, never one of them. Every mint writes both, which is what makes a lone key a state no command could have produced.

func NewStamp

func NewStamp(kind Kind, mode string) (Stamp, error)

NewStamp validates a kind and a possibly-empty production mode, and is the only constructor a write path uses.

It refuses KindContributedByReading outright. That value carries a pointer to a reading record, and the reading-ingest verb that holds those identifiers does not exist in this repository yet — so nothing here can supply them, and a constructor that accepted the kind would let a caller mint a dangling pointer. The lint's resolution check for the value is exercised by fixture until the verb ships (spc-56, stated rather than discovered later).

func (Stamp) ModeValue

func (s Stamp) ModeValue() string

ModeValue renders the production-mode value.

func (Stamp) OriginValue

func (s Stamp) OriginValue() string

OriginValue and ModeValue render the two frontmatter values. Writers ask the stamp for them rather than reaching into it, so the rendering of the pair has one home.

Jump to

Keyboard shortcuts

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