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 ¶
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).
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.
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.
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 MalformedModeFile ¶
MalformedModeFile is the refusal of a production mode read from the repository file at rel: it names the file and the closed set and leaves the value out, since a file in the repository chose it and the refusal reaches the person and the agent as written (iss-2611170005148886). ParseMode's own error, which quotes the value, stays for a value the person typed.
func ModeNames ¶ added in v0.17.0
func ModeNames() []string
ModeNames returns the set's wire values in the order modeList names them: the closed set a --production-mode flag declares, read from the one list ParseMode checks against.
func OriginList ¶
func OriginList() string
OriginList names the origin vocabulary in words, for a refusal that leaves the value it refused out.
func WriteDeclaredMode ¶ added in v0.16.0
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
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 ¶
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
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 ¶
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 ¶
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.
type Stamp ¶
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
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 ¶
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) OriginValue ¶
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.