Documentation
¶
Overview ¶
Package tcq implements Test Claim Qualification V0 (`tcq/0`) as specified in docs/specs/test-claim-qualification-v0.md.
TCQ is a deterministic, source-body-free matcher over one verified OCM, only its selected claim anchors, their exact target-tree test units, and optionally one command plus one JUnit observation. It emits one result per selected `(obligationId, claimId)` edge.
Every emitted edge carries `authorityClass: CALLER_REPORTED` (TCQ-V0-006). The single positive relation `test-report-matched-v0` is a caller report, never execution attestation: per TCQ-V0-046 no consumer may alias it to harness-observed or mechanically proved execution, and no input can select another authority class.
Per TCQ-V0-045 this package is library and wire conformance only. It adds no CLI, no filesystem path API, no artifact persistence, and no runner: every raw artifact arrives as caller-supplied immutable bytes, and target source is read exclusively through the inherited CEM/OCM repository boundary (TCQ-V0-044).
Index ¶
- Constants
- func MakeTestCommand(argv []string, ...) ([]byte, error)
- func MakeTestObservation(repository Repository, commandRaw, reportRaw []byte, targetRevision string, ...) ([]byte, error)
- type ClaimResult
- type Error
- type Repository
- type Request
- type Resolved
- type Result
- type TreeEntry
- type UpstreamVerifier
Constants ¶
const ( Profile = "tcq/0" CommandSpec = "test-command/0.1-experimental" ObservationSpec = "test-observation/0.1-experimental" ReportFormat = "junit-xml/corvint-v0" AuthorityClass = "CALLER_REPORTED" MatchedRelation = "test-report-matched-v0" OCMSpec = "ocm/0.1-experimental" CEMCanonicalSpec = "cem/0.2" ClaimExtractor = "corvint-test-claim/1" )
Frozen profile and vocabulary constants (TCQ-V0-023, TCQ-V0-031, TCQ-V0-036).
const ( CleanTargetAttested = "CALLER_ATTESTED_CLEAN" CleanTargetNotAttested = "NOT_ATTESTED" )
Clean-target attestations (TCQ-V0-024). Both are unauthenticated caller statements; only CALLER_ATTESTED_CLEAN can participate in the V0 relation, and neither is verifier evidence.
const ( CodeInvalidInput = "invalid-tcq-input" CodeUnsupportedCEMProfile = "unsupported-cem-profile" CodeUnsupportedOCMProfile = "unsupported-ocm-profile" CodeUnsupportedClaimExtractor = "unsupported-claim-extractor" CodeInvalidCommand = "invalid-command" CodeNoncanonicalCommand = "noncanonical-command" CodeCommandTargetMismatch = "command-target-mismatch" CodeInvalidObservation = "invalid-observation" CodeNoncanonicalObservation = "noncanonical-observation" CodeObservationTargetMismatch = "observation-target-mismatch" CodeObservationCommandMismatch = "observation-command-mismatch" CodeReportDigestMismatch = "report-digest-mismatch" CodeInvalidJUnit = "invalid-junit" CodeReportCommandInconsistent = "report-command-inconsistent" CodeInvalidTCQ = "invalid-tcq" CodeNoncanonicalTCQ = "noncanonical-tcq" CodeResourceExhausted = "tcq-resource-exhausted" // Inherited codes TCQ re-raises at its own stages (TCQ-V0-042 step 4/5). CodeExpectedBaseRequired = "expected-base-required" CodeTargetRequired = "target-required" CodeBaseRevisionMismatch = "base-revision-mismatch" CodeTargetMismatch = "target-mismatch" CodeNoncanonicalMap = "noncanonical-map" )
The exact operational vocabulary TCQ adds on top of the inherited CEM/OCM, repository, and Git codes (TCQ-V0-042).
const ( AssociationAssociated = "ASSOCIATED" AssociationAbstained = "ABSTAINED" HygieneEligible = "ELIGIBLE" HygieneIneligible = "INELIGIBLE" HygieneAbstained = "ABSTAINED" ReportNotMatched = "NOT_MATCHED" ReportPassed = "PASSED" ReportFailed = "FAILED" ReportError = "ERROR" ReportSkipped = "SKIPPED" ReportAmbiguous = "AMBIGUOUS" )
Axis values (TCQ-V0-006). No axis rewrites another and none is a confidence, coverage, proof, or generic success score.
Variables ¶
This section is empty.
Functions ¶
func MakeTestCommand ¶
func MakeTestCommand(argv []string, cwd, runnerIdentity, runnerVersion, targetRevision, cleanTarget string) ([]byte, error)
MakeTestCommand builds one canonical `test-command/0.1-experimental` artifact. It is a declaration, never an instruction: TCQ neither executes the command nor claims that retaining it makes execution reproducible (TCQ-V0-025).
func MakeTestObservation ¶
func MakeTestObservation(repository Repository, commandRaw, reportRaw []byte, targetRevision string, exitCode int64) ([]byte, error)
MakeTestObservation projects one caller-supplied JUnit report under one command into a canonical observation. Per TCQ-V0-029 an exit code of zero alongside any failed or errored testcase is `report-command-inconsistent`.
Types ¶
type ClaimResult ¶
type ClaimResult struct {
ObligationID string
ClaimID string
AnchorProfile string
AssociationKind string
AssociationState string
HygieneState string
ReportState string
TestUnitID string
ExecutionKeySha256 string
RowIDs []string
Reasons []string
Relation string
// AuthorityClass is CALLER_REPORTED for every edge, including abstentions
// (TCQ-V0-006). It is carried rather than assumed so no future producer can
// silently upgrade it.
AuthorityClass string
}
ClaimResult is one selected claim edge, in the shape of the reference vector at docs/specs/test-claim-qualification-v0.md:391. Empty string stands for the document's `null` in the nullable fields.
type Error ¶
type Error struct {
Code string
}
Error is one bounded operational failure. Per TCQ-V0-042 an operational error emits no partial artifact and no unverified path, OID, digest, selector, count, command argument, XML value, or derived identity — so the code alone is the payload and Message never carries input-derived text.
type Repository ¶
type Repository interface {
// Blob returns the bytes of one target-tree blob by OID.
Blob(oid string) ([]byte, error)
// TreeEntry resolves one normalized repository-relative path at revision.
// A missing object is (TreeEntry{}, nil), never an error; an error is a
// failed lookup, which TCQ returns as-is (TCQ-V0-028).
TreeEntry(revision, path string) (TreeEntry, error)
}
Repository is that inherited boundary. Both methods read the verified target tree only; sibling repositories, alternates, implicit fetch, and additional-repository discovery are forbidden and must be refused by the implementation, not by TCQ.
type Request ¶
type Request struct {
CEM []byte
OCM []byte
ExpectedBase string
Target string
// The dynamic tuple is all-or-none (TCQ-V0-033). Any other combination is
// `invalid-tcq-input`.
Command []byte
Observation []byte
Report []byte
// Expected optionally verifies a cached result byte-for-byte (TCQ-V0-043).
Expected []byte
}
Request is one TCQ invocation. Every artifact is caller-supplied immutable bytes (TCQ-V0-044); TCQ opens no raw-artifact filesystem path.
type Resolved ¶
Resolved carries the two OIDs the shared CEM/OCM verifier resolved from the independent invocation inputs. TCQ-V0-036 binds these, never values learned from an artifact.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result and ClaimResult are the producer side of the frozen seam declared in internal/frontier/upstream.go. A shim converts Result.ID/Result.Claims into frontier.TCQResult/TCQClaimResult field for field; this package deliberately does not import frontier, which consumes it. Frontier's TCQRequest carries no CEM bytes, so a shim must supply the canonical `cem/0.2` artifact the OCM binds — TCQ-V0-001 requires it and TCQ-V0-002 refuses `cem/0.1`.
Result is one `tcq/0` document. It is a recomputable local cache, never an authority token or execution record (TCQ-V0-043): Raw is the canonical bytes the identity commits to, and every consumer must recompute rather than trust.
func Evaluate ¶
func Evaluate(repository Repository, verifier UpstreamVerifier, request Request) (Result, error)
Evaluate computes one canonical TCQ result. Operational validation stops at the first failing stage of TCQ-V0-042 and emits no partial artifact.
func (Result) Claims ¶
func (result Result) Claims() []ClaimResult
Claims returns one result per selected edge, in TCQ-V0-003 order.
type TreeEntry ¶
TreeEntry is one resolved target-tree object. TCQ never opens a worktree path: TCQ-V0-001 confines every source read to the inherited bounded, sanitized, no-fetch Git boundary.
type UpstreamVerifier ¶
type UpstreamVerifier interface {
VerifyOCM(cemRaw, ocmRaw []byte, expectedBase, target string) (Resolved, error)
}
UpstreamVerifier is the current OCM verifier, which in turn invokes the shared CEM 0.2 canonical verifier. TCQ-V0-001 requires the same bounded raw byte copies and both revision inputs to pass through it, and TCQ-V0-042 forbids reordering any validation internal to it — hence a seam rather than a reimplementation.