AppSurface Search
API Reference

Contracts

Type

NormalizedDiffPath

Source

Describes a normalized changed path used for deterministic policy resolution.

Parameters

  • Path
    A repository-relative path with forward-slash separators.
  • Kind
    The source-control change kind, such as added, modified, deleted, or renamed.
  • PreviousPath
    The previous normalized path for a rename; otherwise null .
Type

EvidenceArtifactSlot

Source

Declares one artifact slot that a producer is allowed to return.

Parameters

  • LogicalName
    Stable logical artifact name.
  • RelativeRoot
    Normalized artifact-root-relative directory permitted for this slot.
  • MediaType
    Expected media type.
  • Required
    Whether a missing artifact invalidates the producer result.
  • MaximumBytes
    Maximum allowed artifact length.
Type

EvidenceArtifactResult

Source

Captures bounded metadata for one declared artifact without serializing its raw content.

Parameters

  • LogicalName
    Declared artifact slot identifier.
  • RelativePath
    Normalized path beneath the evidence artifact root.
  • MediaType
    Declared media type.
  • LengthBytes
    Written artifact length.
  • Sha256
    Lower-case SHA-256 digest of the written bytes.
Type

EvidenceCoverageGateRequirements

Source

Binds a coverage producer's declared assertion to the existing AppSurface coverage gate thresholds.

Parameters

  • MinLinePercent
    Minimum overall line coverage percentage.
  • MinBranchPercent
    Minimum overall branch coverage percentage.
  • MinPatchLinePercent
    Optional minimum changed-line coverage percentage.
  • MinPatchBranchPercent
    Optional minimum changed-branch coverage percentage.
  • PatchLineMode
    Changed-line calculation mode: measurable or codecov .
  • TolerancePercent
    Configured coverage gate tolerance percentage.
Type

EvidenceProducerDeclaration

Source

Declares a producer selected by an evidence profile.

Parameters

  • Id
    Stable producer identifier.
  • Kind
    Registered producer kind, such as coverage or browser-e2e .
  • Version
    Producer implementation semantic version.
  • RequiredResources
    Resource identifiers that must be ready before execution.
  • AssertionIds
    Assertion identifiers that this producer may close.
  • ArtifactSlots
    Closed artifact declarations for this producer.
  • TimeoutSeconds
    Positive producer deadline in seconds.
  • CoverageGate
    Explicit coverage gate requirements when this producer closes a coverage assertion.
Property

CoverageExecution

EvidenceCoverageExecutionOptions? CoverageExecution { get; init; } Source

Gets the optional built-in coverage execution envelope, defaulting to Debug, no managed test results, and serial execution.

Remarks

Only coverage producers interpret this value. It does not change coverage filters, gates, or source scope.

Property

CoverageArtifactRetention

string CoverageArtifactRetention { get; init; } Source

Gets the optional coverage artifact retention mode, managed by default or full to retain raw duplicate XML.

Remarks

Only coverage producers interpret this value. Exactly managed and full are supported; neither changes collection or coverage gates. The existing positional constructor remains unchanged. See the coverageArtifactRetention reference in the coverage storage guide.

Type

EvidenceResourceDeclaration

Source

Declares an evidence resource required by a profile.

Parameters

  • Id
    Stable resource identifier.
  • Readiness
    Declared readiness mode, such as aspire_health or completion .
  • DeadlineSeconds
    Positive readiness deadline in seconds.
  • Requires
    Resource identifiers that must be ready first.
Type

EvidenceResourceResult

Source

Captures bounded terminal readiness metadata for one declared resource.

Parameters

  • ResourceId
    Declared resource identifier.
  • Outcome
    Terminal readiness outcome.
  • ElapsedMilliseconds
    Time spent waiting for the resource.
  • Diagnostic
    Secret-safe readiness diagnostic.
Type

EvidenceObligation

Source

Defines a changed-risk requirement that must be closed before a claim is complete.

Parameters

  • Id
    Stable obligation identifier.
  • RiskClass
    Consumer-defined risk class.
  • Rationale
    Human explanation for why the obligation was selected.
  • RequiredProducerIds
    Every producer that must pass for closure.
  • RequiredAssertionId
    The assertion that confirms closure.
Type

EvidenceProfile

Source

Defines a closed profile of resources, producers, and obligations.

Parameters

  • Id
    Stable profile identifier.
  • Scope
    Targeted or release evidence breadth.
  • Resources
    Resources required by the profile.
  • Producers
    Registered producers selected by the profile.
  • Obligations
    Risk obligations selected by the profile.
Type

EvidenceProfileLimits

Source

Defines the shared v1 limits for one EvidenceHost profile declaration.

Type

EvidencePolicyRule

Source

Maps exact paths or segment globs to a single named evidence profile.

Parameters

  • Id
    Stable rule identifier.
  • Pattern
    Exact repository path or segment glob.
  • ProfileId
    Profile selected when the rule matches.
  • Precedence
    Explicit tie breaker for equal-specificity patterns.
Type

EvidencePolicy

Source

Represents a versioned, checked-in evidence policy.

Parameters

  • Id
    Stable policy identifier.
  • Version
    Consumer-controlled policy version.
  • ConservativeProfileId
    Profile selected when a changed path has no direct match.
  • Profiles
    Closed set of selectable profiles.
  • Rules
    Path-selection rules.
Property

CombineProfiles

bool CombineProfiles { get; init; } Source

Combines distinct profiles selected by matched paths into one closed profile.

Remarks

Defaults to false , preserving the conservative fallback for multi-profile selections and omitting the property from canonical JSON.

Type

EvidencePlan

Source

Captures the immutable result of policy resolution before resource or producer execution.

Parameters

  • ContractVersion
    Evidence contract version.
  • PolicyId
    Resolved policy identifier.
  • PolicyDigest
    SHA-256 digest of canonical policy bytes.
  • DiffDigest
    SHA-256 digest of canonical normalized diff bytes.
  • Profile
    Selected closed profile.
  • ChangedPaths
    Normalized paths used during selection.
  • MatchedRuleIds
    Rules that explain selection.
  • PlanDigest
    SHA-256 digest of canonical plan bytes excluding this digest field.
  • PolicySnapshot
    Canonical checked-in policy snapshot used for resolution and later verification.
Type

EvidenceProducerResult

Source

Captures a bounded producer result returned to the EvidenceHost.

Parameters

  • ProducerId
    Producer that emitted the result.
  • Outcome
    Terminal producer outcome.
  • SatisfiedAssertionIds
    Assertion identifiers returned by the producer.
  • Diagnostic
    Secret-safe human diagnostic; never include raw logs or values.
  • Artifacts
    Bounded metadata for artifacts written through the declared artifact writer.
  • ElapsedMilliseconds
    Measured producer execution time.
Type

EvidenceExecutionMetrics

Source

Captures bounded, secret-free lifecycle timing and cleanup status for one evidence execution.

Parameters

  • PlanningMilliseconds
    Time spent resolving the policy and plan.
  • ResourceReadinessMilliseconds
    Cumulative time spent awaiting declared resources.
  • ProducerMilliseconds
    Cumulative producer execution time.
  • CleanupMilliseconds
    Time spent disposing evidence-owned registrations.
  • TotalMilliseconds
    Total measured execution duration.
  • CleanupCompleted
    Whether owned cleanup completed without a terminal failure.
  • CleanupDiagnostic
    Secret-safe cleanup diagnostic when cleanup did not complete.
Type

EvidenceManifest

Source

Captures the immutable claim and execution result of an evidence run.

Parameters

  • ContractVersion
    Evidence contract version.
  • PlanDigest
    Digest of the resolved plan.
  • ExecutionVerdict
    Whether declared execution requirements completed.
  • ClaimKind
    Claim emitted by this run.
  • Eligibility
    Downstream consumers permitted to use the claim.
  • EnvelopeStatus
    Constrained CI-envelope status; it is not an implied runtime sandbox attestation.
  • ResourceResults
    Bounded readiness outcomes for selected resources.
  • SelectedObligationIds
    Obligations selected by the plan.
  • ClosedObligationIds
    Obligations closed by returned assertions.
  • UnmediatedObligationIds
    Selected obligations that remain open.
  • ProducerResults
    Bounded producer terminal results.
  • Metrics
    Secret-free lifecycle timing and cleanup state.
  • ManifestDigest
    SHA-256 digest of canonical manifest bytes excluding this digest field.
Type

EvidenceProducerContext

Source

Supplies the immutable execution context exposed to a registered evidence producer.

Parameters

  • Plan
    Resolved evidence plan.
  • Producer
    The producer declaration being executed.
  • TimeProvider
    Clock seam used for deadlines and deterministic tests.
  • Artifacts
    Bounded writer for declared artifact slots. It exposes no raw host path.
Type

IEvidenceProducer

Source

Represents an explicitly registered typed evidence producer.

Method

ProduceAsync

ValueTask<EvidenceProducerResult> ProduceAsync(EvidenceProducerContext context, CancellationToken cancellationToken)

Produces bounded assertions and diagnostics for one resolved declaration.

Parameters

  • context
    Immutable plan and producer context.
  • cancellationToken
    Cancellation requested by the EvidenceHost lifecycle.

Returns

A terminal producer result.

Property

Id

string Id { get; } Source

Gets the stable declaration identifier handled by this producer.

Type

EvidenceArtifactWriter

Source

Writes only declared producer artifacts beneath a consumer-selected evidence root.

Method

WriteAsync

2 overloads
ValueTask<EvidenceArtifactResult> WriteAsync(string logicalName, string relativePath, ReadOnlyMemory<byte> contents, CancellationToken cancellationToken = default)

Writes one declared artifact and returns only its bounded metadata.

Parameters

  • logicalName
    Declared artifact slot identifier.
  • relativePath
    Normalized artifact-root-relative destination path.
  • contents
    Artifact bytes to write.
  • cancellationToken
    Cancellation requested by the EvidenceHost lifecycle.

Returns

Hash and metadata for the written artifact.

ValueTask<EvidenceArtifactResult> WriteAsync(string logicalName, string relativePath, Stream contents, CancellationToken cancellationToken = default)

Streams one declared artifact to disk while hashing and enforcing its slot and aggregate limits.

Parameters

  • logicalName
    Declared artifact slot identifier.
  • relativePath
    Normalized artifact-root-relative destination path.
  • contents
    Artifact stream. The stream is read until end of stream and is not disposed by this method.
  • cancellationToken
    Cancellation requested by the EvidenceHost lifecycle.

Returns

Hash and metadata for the written artifact.

Method

VerifyWrittenArtifactsAsync

Task<bool> VerifyWrittenArtifactsAsync(CancellationToken cancellationToken = default)

Revalidates the final on-disk bytes for every artifact written through this writer.

Parameters

  • cancellationToken
    Cancellation requested by the EvidenceHost lifecycle.

Returns

true when every artifact still has its declared length and digest.

Property

WrittenArtifacts

IReadOnlyList<EvidenceArtifactResult> WrittenArtifacts { get; } Source

Gets completed artifact metadata emitted through this writer in ordinal logical-name order.

Type

EvidenceArtifactValidation

Source

Validates declared evidence artifact metadata and containment without reading raw artifact contents into manifests.

Method

AreValid

bool AreValid(EvidenceProducerDeclaration producer, IReadOnlyList<EvidenceArtifactResult>? artifacts)

Validates producer artifact metadata against its closed declaration set.

Parameters

  • producer
    Producer declaration that owns the slots.
  • artifacts
    Producer-returned artifact metadata.

Returns

true when every artifact is declared, bounded, and valid.

Method

NormalizeRelativePath

string NormalizeRelativePath(string relativePath)

Normalizes an artifact-root-relative path or throws when it escapes the artifact boundary.

Parameters

  • relativePath
    Artifact-root-relative candidate path.

Returns

Normalized forward-slash path.

Method

ValidatePathForSlot

void ValidatePathForSlot(EvidenceArtifactSlot slot, string relativePath)

Validates that an artifact path remains beneath the declared slot root.

Parameters

  • slot
    Declared artifact slot.
  • relativePath
    Artifact-root-relative candidate path.
Method

GetContainedPath

string GetContainedPath(string rootPath, string relativePath)

Returns an absolute path contained beneath a controlled artifact root.

Parameters

  • rootPath
    Controlled artifact root.
  • relativePath
    Validated root-relative artifact path.

Returns

Contained absolute destination path.

Type

EvidenceCanonicalJson

Source

Serializes contract objects deterministically for evidence identity and verification.

Method

Serialize

byte[] Serialize<TValue>(TValue value)

Serializes a value as canonical UTF-8 JSON with ordinal object-property order.

Type parameters

  • TValue
    Value type to serialize.

Parameters

  • value
    Value to serialize.

Returns

Canonical UTF-8 JSON bytes.

Method

Deserialize

TValue Deserialize<TValue>(ReadOnlySpan<byte> utf8Json)

Deserializes a JSON document using the contract serializer options.

Type parameters

  • TValue
    Value type to deserialize.

Parameters

  • utf8Json
    JSON bytes.

Returns

The deserialized value.

Type

EvidenceManifestBuilder

Source

Builds and verifies manifest claims from a resolved plan and bounded producer results.

Method

Build

EvidenceManifest Build(EvidencePlan plan, IReadOnlyList<EvidenceProducerResult> producerResults, bool observationOnly = false, EvidenceEnvelopeStatus envelopeStatus = EvidenceEnvelopeStatus.NotRequired, IReadOnlyList<EvidenceResourceResult>? resourceResults = null, EvidenceExecutionMetrics? metrics = null)

Produces a manifest and closes obligations only when every declared producer and assertion requirement passed.

Parameters

  • plan
    Resolved plan.
  • producerResults
    Terminal results returned by selected producers.
  • observationOnly
    Whether the caller intentionally requested a non-gate observation.
  • envelopeStatus
    Constrained CI-envelope status bound to the manifest.
  • resourceResults
    Terminal readiness results for selected resources.
  • metrics
    Secret-free lifecycle timing and cleanup state.

Returns

A digest-bound manifest.

Method

Verify

bool Verify(EvidencePlan plan, EvidenceManifest manifest)

Validates that a manifest still binds to a supplied plan and canonical manifest content. This detects inconsistent or edited claim fields, but does not authenticate the origin of a plan or manifest. Gates must obtain both values through a trusted CI channel.

Parameters

  • plan
    Plan expected by the verifier.
  • manifest
    Manifest to verify.

Returns

true when the binding and digest are valid.

Type

EvidenceDigest

Source

Computes SHA-256 evidence identities from canonical bytes.

Method

Sha256

string Sha256(ReadOnlySpan<byte> bytes)

Computes a lower-case hexadecimal SHA-256 digest.

Parameters

  • bytes
    Bytes to digest.

Returns

The digest.

Method

CanonicalSha256

string CanonicalSha256<TValue>(TValue value)

Computes a canonical-object digest.

Type parameters

  • TValue
    Value type to digest.

Parameters

  • value
    Value to serialize and digest.

Returns

The canonical SHA-256 digest.

Type

EvidenceCoverageExecutionOptions

Source

Configures the bounded execution envelope for a built-in Evidence coverage producer.

Parameters

  • Configuration
    A simple build and test configuration identifier, defaulting to Debug .
  • TestResults
    The managed test-result artifact format, defaulting to EvidenceCoverageTestResultFormat.None .
  • Parallelism
    The maximum number of non-exclusive test projects to run concurrently, defaulting to 1 .

Remarks

This configuration selects an execution envelope; it does not change the producer's coverage filters, coverage gate thresholds, or source scope. The planner accepts simple identifiers only so a configuration value cannot inject command-line arguments. Validated values are forwarded exactly to the coverage engine.

Enum

EvidenceProfileScope

Source

Defines the scope selected by a versioned evidence policy.

Enum

EvidenceExecutionVerdict

Source

Describes whether a resolved evidence execution satisfied its declared contract.

Enum

EvidenceClaimKind

Source

Defines the machine-readable claim that a manifest may make.

Enum

EvidenceClaimEligibility

Source

Defines the allowed downstream consumers of an evidence claim.

Enum

EvidenceEnvelopeStatus

Source

Describes the constrained status of the CI execution envelope bound to an evidence run.

Enum

EvidenceProducerOutcome

Source

Defines a terminal producer outcome.

Enum

EvidenceResourceOutcome

Source

Defines the terminal readiness outcome for one declared evidence resource.

Enum

EvidenceCoverageTestResultFormat

Source

Defines the managed test-result artifact formats available to the built-in coverage producer.