conformance

package
v11.3.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package conformance provides small Windmill readiness probes and report aggregation for chassis services.

It intentionally checks L0-L2 runtime evidence plus L3 declaration evidence only. Durable outbox and domain-event behavior remain service/addon concerns.

Index

Constants

View Source
const (
	ReqAcceptsXTraceID                     = "accepts_x_trace_id"
	ReqEmitsProblemJSONErrors              = "emits_problem_json_errors"
	ReqScopedBearerAuthOnMutatingRoutes    = "scoped_bearer_auth_on_mutating_routes"
	ReqErrorProblemJSONRetryClass          = "error_problem_json_retry_class"
	ReqCapabilityManifest                  = "capability_manifest"
	ReqIdempotencyKeyReplayForMutating     = "idempotency_key_replay_for_mutating_routes"
	ReqIdempotencyStoreDeclared            = "idempotency_store_declared"
	ReqIdempotencyKeyTenantScoped          = "idempotency_key_tenant_scoped"
	ReqOutboxOrEquivalentDeclared          = "chassis_outbox_or_equivalent_declared"
	ReqDomainEventsTraceAndEntityRefs      = "domain_events_preserve_trace_and_entity_refs"
	ReqDurableStoreRequiredForL2Production = "durable_store_required_for_l2_prod"
)

Requirement names mirror testdata/windmill/contracts/conformance.yaml.

View Source
const (
	ContractVersion = orchestration.DefaultContractVersion
)

Variables

This section is empty.

Functions

func AcceptsTraceID

func AcceptsTraceID(traceID string) bool

AcceptsTraceID reports whether traceID is acceptable at ingress. It allows the bounded legacy tr_[0-9a-f]{12} migration form but new IDs must be canonical.

func RequirementsFor

func RequirementsFor(level Level) []string

RequirementsFor returns cumulative requirement names for the target level.

func ValidCanonicalTraceID

func ValidCanonicalTraceID(traceID string) bool

ValidCanonicalTraceID reports whether traceID matches the generated canonical X-Trace-ID format tr_[0-9a-f]{32}.

Types

type Evidence

type Evidence struct {
	AcceptsXTraceID                  bool
	EmitsProblemJSONErrors           bool
	ErrorProblemJSONRetryClass       bool
	ScopedBearerAuthOnMutatingRoutes bool
	CapabilityManifest               bool
	Manifest                         *orchestration.Manifest
	IdempotencyKeyReplayForMutating  bool
	IdempotencyStoreDeclared         bool
	IdempotencyKeyTenantScoped       bool
	OutboxOrEquivalentDeclared       bool
	DomainEventsTraceAndEntityRefs   bool
}

Evidence is caller-supplied proof collected from runtime probes, fixtures, or service metadata. Check interprets Manifest when present, so callers do not need to set CapabilityManifest or IdempotencyStoreDeclared separately.

type IdempotencyReplayObservation

type IdempotencyReplayObservation struct {
	FirstStatus  int
	ReplayStatus int
	FirstBody    []byte
	ReplayBody   []byte
	ReplayHeader http.Header
}

IdempotencyReplayObservation captures first/replay responses for the same tenant and idempotency key.

type Level

type Level string

Level is a cumulative Windmill readiness target.

const (
	LevelL0 Level = "L0"
	LevelL1 Level = "L1"
	LevelL2 Level = "L2"
	LevelL3 Level = "L3"
)

func LevelForProfile

func LevelForProfile(profile orchestration.Profile) Level

LevelForProfile maps an orchestration manifest profile to the closest cumulative conformance level. CLI/daemon profiles are not HTTP readiness levels and therefore return an empty Level.

type ProbeResult

type ProbeResult struct {
	Passed  bool           `json:"passed"`
	Reason  string         `json:"reason,omitempty"`
	Details map[string]any `json:"details,omitempty"`
}

ProbeResult is returned by individual probe helpers.

func ProbeIdempotencyReplay

func ProbeIdempotencyReplay(obs IdempotencyReplayObservation) ProbeResult

ProbeIdempotencyReplay validates same-tenant idempotency replay behavior.

func ProbeManifest

func ProbeManifest(body []byte) (orchestration.Manifest, ProbeResult)

ProbeManifest validates a capability manifest response body.

func ProbeProblemJSON

func ProbeProblemJSON(obs ProblemObservation) ProbeResult

ProbeProblemJSON validates the Windmill problem+json shape used for L0/L1.

func ProbeTenantIsolation

func ProbeTenantIsolation(obs TenantIsolationObservation) ProbeResult

ProbeTenantIsolation validates that a same idempotency key in tenant B is not replayed from tenant A.

type ProblemObservation

type ProblemObservation struct {
	StatusCode int
	Header     http.Header
	Body       []byte
}

ProblemObservation captures an HTTP problem response for validation.

type Report

type Report struct {
	Level                   Level    `json:"level"`
	Passed                  bool     `json:"passed"`
	Checked                 []string `json:"checked"`
	Missing                 []string `json:"missing,omitempty"`
	Warnings                []string `json:"warnings,omitempty"`
	L3DeclarationOnly       bool     `json:"l3_declaration_only,omitempty"`
	ManifestContractVersion string   `json:"manifest_contract_version,omitempty"`
	ManifestProfile         string   `json:"manifest_profile,omitempty"`
}

Report is the result of evaluating evidence against a target level.

func Check

func Check(level Level, evidence Evidence) Report

Check evaluates evidence against a cumulative level.

func Require

func Require(t TestingT, level Level, evidence Evidence) Report

Require fails t when Check does not pass.

func (Report) SortedMissing

func (r Report) SortedMissing() []string

SortedMissing returns a copy of the missing requirements in stable order.

type TenantIsolationObservation

type TenantIsolationObservation struct {
	TenantAStatus          int
	TenantBStatus          int
	TenantABody            []byte
	TenantBBody            []byte
	TenantBReplayHeader    http.Header
	TenantBHandlerExecuted bool
}

TenantIsolationObservation captures same-key responses across two tenants.

type TestingT

type TestingT interface {
	Helper()
	Fatalf(format string, args ...any)
}

TestingT is the minimal testing.TB surface used by Require.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL