provenance

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 10 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 DeclaredModeRelPath = ".abcd/config/provenance.json"

DeclaredModeRelPath is the committed file a repository declares its DEFAULT production mode in: how the text of a record it mints was produced, unless the minting verb says otherwise (itd-178). It holds one member, {"production_mode": "<mode>"}.

The default used to ride the committed identity pin (.abcd/config/identity.json). That pin left the repository when each person's commit identity moved to their own machine (itd-2610240918547728, adr-2610241022541063), and the production mode, which is the repository's and not a person's, moved here so it stays committed.

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.

View Source
const LegacyPinRelPath = ".abcd/config/identity.json"

LegacyPinRelPath is the identity pin the production mode used to ride. It is read here ONLY for its production_mode member, and only while the new file is absent, so a repository that has not yet run the migration keeps the mode it declared.

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.

func WriteDeclaredMode added in v0.16.0

func WriteDeclaredMode(root string, m Mode) error

WriteDeclaredMode writes m as the repo's declared default production mode, atomically and inside an os.Root at the repository, so a committed symlink under .abcd cannot aim the write outside the working tree.

Types

type Kind

type Kind string

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

const (
	// KindResearcherAuthored names the ROUTE, not who took it: the record's text
	// was written directly — quoted text handed to a create verb — rather than
	// derived from another record or from a reading item. It is the default for
	// every command that derives nothing, and it asserts nothing about whether a
	// person or an agent session invoked that command.
	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 `capture promote <rdi-N>`, the one
	// command that moves an accepted reading item toward an intent: it reads the
	// item out of the readings store, so it holds both ids already and never asks
	// an operator for them (itd-2609020625400169).
	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 DeclaredMode added in v0.16.0

func DeclaredMode(root string) (Mode, error)

DeclaredMode is the repo's default production mode: the member of DeclaredModeRelPath, else (that file absent) the production_mode member of the legacy identity pin, else DefaultMode. It is the ONE resolution of that question, so no surface re-derives "absent means hand-written" for itself. A present value outside the closed set, or a file that does not parse, is an error, never a silent default.

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.

func ReadDeclaredModeFile added in v0.16.0

func ReadDeclaredModeFile(root string) (Mode, bool, error)

ReadDeclaredModeFile reads DeclaredModeRelPath alone: found is false when the file is absent. A file that is present declares a mode; one whose member is missing or outside the closed set is an error.

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 NewReadingStamp added in v0.8.0

func NewReadingStamp(run, item, mode string) (Stamp, error)

NewReadingStamp is the ONE constructor of a contributed-by-reading stamp. The run and the item are the pointer the value carries; a stamp without them is unrepresentable, which is why NewStamp refuses the kind.

It judges SHAPE and nothing else, because this package is a leaf with no filesystem: no value can be built without a well-formed pair, and whether that pair RESOLVES to a record in the readings store is the promote path's question, answered by the store read it performs before it mints (capture.promoteReadingItem). The two halves are stated here so neither is mistaken for the other (itd-2609020625400169, criterion 4).

func NewStamp

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

NewStamp validates a kind and a possibly-empty production mode, and is the constructor every write path but the reading route uses.

It refuses KindContributedByReading outright, and goes on refusing it. That value carries a pointer to a reading record, and this constructor has no argument for one — so a stamp of that kind built here would be a dangling pointer by construction. The kind has exactly one door, NewReadingStamp below, which takes the pair and refuses it unshaped.

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