Documentation
¶
Overview ¶
Package evidence keeps and checks the evidence that one built-in Worker Type operation conforms to one technical capability contract (ADR-0483).
A record binds four things a reviewer chose: a published contract, a Worker Type, one of its operations, and the suite whose cases check that operation against the contract. Everything else in it is derived from the module: the contract's digest, the Worker Type's version and job type, the packages every runtime path of the Worker Type goes through and their dependency digest, the suite's digest, the outcome of every case, and the approval rule in force. A record is current exactly when deriving it again gives the bytes on disk, which is what Verify checks and what Renew restores.
The approval itself is not in the file. A string naming a reviewer proves nothing; a record counts as approved once it reached the protected main branch through a pull request the code owner approved or merged, and the file records only which rule that was. A record with a failed or unexercised case is still a current record: it says what the operation does not do, and it verifies no claim.
Published contracts live under workertype/contracts and records under workertype/evidence/records; both paths belong to the code owner. This is build and review tooling: it runs the go command and the suites' fakes, and the engine never calls it.
Index ¶
- Constants
- func Register(name string, s Suite)
- func Verify(ctx context.Context, moduleDir string, raw []byte) error
- func VerifyAll(ctx context.Context, moduleDir, dir string) error
- type Binding
- type Conformance
- type ContractRef
- type Evidence
- type Implementation
- type OperationRef
- type Result
- type StaleError
- type Suite
Constants ¶
const ( // EvidenceAPIVersion is the first evidence record format. EvidenceAPIVersion = "atlas.io/technical-capability-evidence/v1alpha1" // EvidenceKind identifies an evidence record. EvidenceKind = "TechnicalCapabilityEvidence" // ApprovalRepositoryProvenance is the approval rule of ADR-0483's initial phase: // the record reached protected main through a pull request the single maintainer // approved or merged. Recording it lets a stricter rule tell these records apart. ApprovalRepositoryProvenance = "repository-provenance/single-maintainer" )
const ( OutcomePassed = "passed" OutcomeFailed = "failed" OutcomeNotExercised = "not-exercised" )
The outcomes a case can have. A case the suite could not exercise says so rather than passing or being left out, so a record shows what was not checked.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register adds a suite under the name records use for it. A suite package registers itself from init, and both the gate in workertype/evidence/gate and the evidence command import it, so a record verifies in CI exactly as it renews on a desk. A name registered twice is a programming error.
func Verify ¶
Verify checks one record's bytes against the module. A record that cannot bind what it names is an error; one whose derived values moved is a StaleError.
Types ¶
type Conformance ¶
type Conformance struct {
Suite string `json:"suite"`
Digest string `json:"digest"`
Environment string `json:"environment"`
Results []Result `json:"results"`
}
Conformance is the suite that checked the operation, the digest of its code and fixtures, what it ran against, and every case's outcome.
type ContractRef ¶
type ContractRef struct {
Path string `json:"path"`
ID string `json:"id"`
Version string `json:"version"`
Profile string `json:"profile,omitempty"`
Digest string `json:"digest"`
}
ContractRef names the published contract file and the identity and digest of its bytes. The digest is the one value renewal never changes: a published contract does not change, and new bytes need a new version.
type Evidence ¶
type Evidence struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Contract ContractRef `json:"contract"`
Operation OperationRef `json:"operation"`
Implementation Implementation `json:"implementation"`
Conformance Conformance `json:"conformance"`
Approval string `json:"approval"`
}
Evidence is one record: which contract, which operation, what implements it, what was checked and with which outcome.
func ParseEvidenceJSON ¶
ParseEvidenceJSON decodes one complete record. Unknown fields, a second JSON value and missing or malformed values are refused; parsing does not check the record against the module, which is Verify's work.
type Implementation ¶
Implementation is what runs the operation: the root packages of every path the Worker Type can run on and the dependency digest of their closure.
type OperationRef ¶
type OperationRef struct {
WorkerType string `json:"workerType"`
WorkerTypeVersion string `json:"workerTypeVersion"`
ID string `json:"id"`
JobType string `json:"jobType"`
}
OperationRef names the Worker Type operation the evidence is about.
type Result ¶
type Result struct {
Case string `json:"case"`
Outcome string `json:"outcome"`
Detail string `json:"detail,omitempty"`
}
Result is one case's outcome. Detail says why a case failed or was not exercised.
type StaleError ¶
type StaleError struct {
// Parts names what moved: "operation", "implementation", "conformance", or
// "format" when only the rendering differs.
Parts []string
}
StaleError is a record that no longer matches the module: what it binds is still there, but something derived from it moved. Renewing it in the same change is the remedy ADR-0483 requires.
func (*StaleError) Error ¶
func (e *StaleError) Error() string
type Suite ¶
type Suite struct {
// Package is the import path of the suite's code and fixtures. Its dependency
// digest is the fixture revision a record carries, and it includes the
// schema validator's version through go.sum.
Package string
// Environment states what the cases ran against, for the reviewer.
Environment string
// Run executes every case, in a fixed order, and reports each outcome. It
// fails only when the suite cannot run at all.
Run func(ctx context.Context, contract workertype.TechnicalContract) ([]Result, error)
}
Suite is the executable cases that check one operation against one contract. The cases run in process against a fake of the provider, so a record can be renewed and verified anywhere, without a tenant or a credential; what a fake cannot show is a case the suite reports as not exercised, and Environment says what it ran against.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
evidence
command
Command evidence creates, renews and verifies the conformance evidence records of built-in Worker Types, and prints the dependency digest of any set of packages (ADR-0483).
|
Command evidence creates, renews and verifies the conformance evidence records of built-in Worker Types, and prints the dependency digest of any set of packages (ADR-0483). |
|
Package gate holds the CI check over the evidence records in workertype/evidence/records and nothing else: its test verifies every record against the module, with every registered suite, so a change that moves what a record binds fails until the same change renews the record (ADR-0483).
|
Package gate holds the CI check over the evidence records in workertype/evidence/records and nothing else: its test verifies every record against the module, with every registered suite, so a change that moves what a record binds fails until the same change renews the record (ADR-0483). |