Documentation
¶
Overview ¶
Package identity checks that the git author identity a commit would use in a managed repo matches the identity pinned in .abcd/config/identity.json.
It is the single source of truth for the iss-62 managed-repo identity gate: `ahoy doctor` surfaces a divergence as a detection gap, and the installed pre-commit hook calls Check to fail closed before a mis-attributed commit can land — so a stray repo-local override (e.g. a sandbox "Test User") is caught up front rather than discovered later.
Index ¶
Constants ¶
const PinRelPath = ".abcd/config/identity.json"
PinRelPath is the committed identity pin, relative to the repo root.
Variables ¶
This section is empty.
Functions ¶
func DeclaredProductionMode ¶ added in v0.7.0
func DeclaredProductionMode(root string) (provenance.Mode, error)
DeclaredProductionMode is the repo's default production mode: the pin's optional member, or provenance.DefaultMode when the repo has no pin or the pin declares none. It is the ONE resolution of that question, so no surface re-derives "absent means hand-written" for itself.
Types ¶
type Effective ¶
Effective is the identity git would actually stamp on a commit in the repo, resolved as git resolves the author: the GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL environment overrides first, then git config's local > global > system layering.
func EffectiveIdentity ¶
EffectiveIdentity returns the author identity git would stamp on a commit in root. Git gives the GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL environment variables HIGHER precedence than user.name/user.email config, so an agent/CI sandbox that exports them lands a mis-attributed commit that a config-only check would wave through. Each field is therefore resolved from its GIT_AUTHOR_* override first, falling back to `git config` (local > global > system) when the override is unset or blank. Unset name or email yields an empty field, not an error.
type Pin ¶
type Pin struct {
Name string `json:"name"`
Email string `json:"email"`
// ProductionMode is the repo's DEFAULT production mode: how the text of a
// record this repository mints was produced, unless the minting verb says
// otherwise (itd-178). It rides the pin rather than a second config file
// because this is already the repo's attribution seam and already has a
// reader; a second file would be a second reader of the same question.
//
// Optional and omitted when empty, so a pin written before the member existed
// round-trips byte-identically. An absent member means provenance.DefaultMode.
// The self-contained pre-commit identity guard seds `name` and `email` out of
// this file by name, so an added member is invisible to it.
ProductionMode string `json:"production_mode,omitempty"`
}
Pin is the expected commit identity, committed so every checkout enforces the same value regardless of local git config.
type Result ¶
Result carries the comparison outcome and both identities for reporting.
type Status ¶
type Status int
Status is the outcome of comparing the effective identity to the pin.
const ( // StatusOK: a pin exists and the effective identity matches it. StatusOK Status = iota // StatusNoPin: no identity.json — the repo has not opted into the gate. StatusNoPin // StatusMismatch: a pin exists and the effective identity differs. StatusMismatch // StatusUnset: a pin exists but git has no author identity configured. StatusUnset )