Documentation
¶
Overview ¶
Package testvalidity defines one shared test-validity projection consumed by both the Go CLI/MCP surface and the VS Code extension's TypeScript mirror (extensions/vscode/src/testvalidity.ts). A projection composes facts already produced by internal/tcq (association, hygiene, reported execution) and internal/liveverify/mutate (measured strength), plus one execution/freshness report shaped by the frozen LPCV "Result axes" vocabulary (docs/specs/live-proof-carrying-verification-v0.md) and the GLTP INCOMPLETE-cause vocabulary (docs/specs/go-live-test-provider-v0.md).
Five axes stay independent: association (which source the test covers), hygiene (empty/always-skipped/wrong target), freshness (stale execution vs current source), execution (pass/fail/skipped/infrastructure/cancelled), and measured strength (mutation witness: a killed mutation establishes only the witnessed distinction, never general adequacy). No axis rewrites another. Passing never implies adequacy, and an unsupported case never collapses into a universal "valid" boolean: Project always returns every axis, stated UNSUPPORTED with a reason when its producer supplied nothing, rather than a derived pass/fail summary field.
Index ¶
Constants ¶
const ( AssociationAssociated = tcq.AssociationAssociated AssociationAbstained = tcq.AssociationAbstained AssociationUnsupported = StateUnsupported )
Association axis states, reused verbatim from TCQ-V0-006.
const ( HygieneEligible = tcq.HygieneEligible HygieneIneligible = tcq.HygieneIneligible HygieneAbstained = tcq.HygieneAbstained HygieneUnsupported = StateUnsupported )
Hygiene axis states, reused verbatim from TCQ-V0-006.
const ( FreshnessCurrent = "CURRENT" FreshnessStale = "STALE" FreshnessUnknown = "UNKNOWN" FreshnessUnsupported = StateUnsupported )
Freshness axis states: stale execution vs current source (LPCV "Result axes" currency term).
const ( ExecutionPassed = "PASSED" ExecutionFailed = "FAILED" ExecutionSkipped = "SKIPPED" ExecutionError = "ERROR" ExecutionNotMatched = "NOT_MATCHED" ExecutionInfrastructure = "INFRASTRUCTURE" ExecutionCancelled = "CANCELLED" ExecutionUnsupported = StateUnsupported )
Execution axis states: pass/fail/skipped/infrastructure/cancelled, plus not-matched for a report with no corresponding row and error for a caller-reported harness error.
const ( StrengthKilled = string(mutate.Killed) StrengthSurvived = string(mutate.Survived) StrengthNotMeasured = "NOT_MEASURED" StrengthUnsupported = StateUnsupported )
Strength axis states: a mutation witness. NotMeasured means no mutation run was attempted; it is not evidence of adequacy either way.
const HygieneReasonWrongTarget = "wrong-target"
HygieneReasonWrongTarget is a testvalidity-level hygiene reason beyond TCQ's frozen empty-body/unconditional-skip pair: the associated unit does not target what its claim declares. TCQ's claim-only boundary does not classify this; it is contributed by whatever caller populates ClaimFacts.
const StateUnsupported = "UNSUPPORTED"
StateUnsupported is the shared sentinel every axis uses when its own input was not supplied at all. It is not TCQ's or LPCV's frozen enum value; it is this projection's explicit "no fact to project" state, always carrying a reason so it cannot be mistaken for a positive result.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Axis ¶
type Axis struct {
State string `json:"state"`
Reason string `json:"reason"`
Anchors []string `json:"anchors"`
}
Axis is one independent facet of a test-validity projection: a state, the reason it holds, and the content anchors that ground it. No axis is a confidence, coverage, proof, or generic pass/fail score (TCQ-V0-006, extended here to freshness/execution/strength).
type ClaimFacts ¶
type ClaimFacts struct {
AssociationState string
HygieneState string
ReportState string
Reasons []string
Anchors []string
}
ClaimFacts is the subset of a TCQ claim result a projection draws from: association, hygiene, and reported-execution state plus their reasons and anchors. FromClaimResult adapts the real TCQ producer type unchanged; a caller may also build one directly, since ClaimFacts.Reasons is an open vocabulary a superset of TCQ's own frozen reason list (see HygieneReasonWrongTarget).
func FromClaimResult ¶
func FromClaimResult(claim tcq.ClaimResult) ClaimFacts
FromClaimResult projects the three TCQ-V0-006 axes out of one real TCQ claim result. TCQ's own frozen reason vocabulary is carried through verbatim; this adapter adds no reason of its own.
type ExecutionFacts ¶
type ExecutionFacts struct {
// Outcome is PASSED, FAILED, SKIPPED, INCOMPLETE, or "" when no report
// exists. SKIPPED is a test the runner reported as skipped: it projects
// the execution state SKIPPED, never PASSED (LPCV-V0-052).
Outcome string
// Cause qualifies a FAILED or INCOMPLETE outcome: BUILD,
// ASSERTION_OR_TEST, STALE, TIMEOUT, INFRASTRUCTURE, CANCELLATION, or "".
Cause string
// Currency is CURRENT, STALE, UNKNOWN, or "" (LPCV "Result axes").
Currency string
Anchors []string
}
ExecutionFacts is the caller-normalized shape of one LPCV/GLTP execution result: LPCV's frozen "Result axes" currency term plus GLTP's executionOutcome cause vocabulary. A projector consumes this decoded shape rather than re-parsing receipt wire bytes.
type Input ¶
type Input struct {
Claim *ClaimFacts
Execution *ExecutionFacts
Mutation *MutationFacts
}
Input is every fact a projection may draw from. A nil member means that producer supplied nothing at all; Project states UNSUPPORTED for the axes with no input rather than inventing a state.
type MutationFacts ¶
MutationFacts adapts one real mutate.Report into the strength axis.
func FromMutationReport ¶
func FromMutationReport(report mutate.Report) MutationFacts
FromMutationReport adapts a real mutate.Report unchanged.
type Projection ¶
type Projection struct {
Association Axis `json:"association"`
Hygiene Axis `json:"hygiene"`
Freshness Axis `json:"freshness"`
Execution Axis `json:"execution"`
Strength Axis `json:"strength"`
}
Projection is the one shared native test-validity shape. It has no boolean summary field by design.
func Project ¶
func Project(input Input) Projection
Project composes one Projection from whatever facts Input carries. It never errors and never collapses to a boolean: a completely empty Input yields every axis UNSUPPORTED with reason "no-input-supplied", the unsupported-input case a caller must not read as a universal "valid".
func ProjectGoSession ¶
func ProjectGoSession(state, identity string) Projection
ProjectGoSession recomputes the shared projection for one Go live-session state. Identity is the observation's current-input binding; without it the freshness axis stays UNKNOWN and no anchor is invented.
func ProjectGoTest ¶
func ProjectGoTest(action, identity string, stale bool, anchor string) Projection
ProjectGoTest recomputes one Go test observation. Action is the retained last terminal go test -json action (pass, fail, skip), or another/empty value when no terminal action was observed. An absent action therefore abstains on execution rather than trusting a carried projection.