ForgeTrust.AppSurface.Evidence.Contracts 0.2.0-preview.15

This is a prerelease version of ForgeTrust.AppSurface.Evidence.Contracts.
dotnet add package ForgeTrust.AppSurface.Evidence.Contracts --version 0.2.0-preview.15
                    
NuGet\Install-Package ForgeTrust.AppSurface.Evidence.Contracts -Version 0.2.0-preview.15
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ForgeTrust.AppSurface.Evidence.Contracts" Version="0.2.0-preview.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ForgeTrust.AppSurface.Evidence.Contracts" Version="0.2.0-preview.15" />
                    
Directory.Packages.props
<PackageReference Include="ForgeTrust.AppSurface.Evidence.Contracts" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ForgeTrust.AppSurface.Evidence.Contracts --version 0.2.0-preview.15
                    
#r "nuget: ForgeTrust.AppSurface.Evidence.Contracts, 0.2.0-preview.15"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ForgeTrust.AppSurface.Evidence.Contracts@0.2.0-preview.15
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ForgeTrust.AppSurface.Evidence.Contracts&version=0.2.0-preview.15&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ForgeTrust.AppSurface.Evidence.Contracts&version=0.2.0-preview.15&prerelease
                    
Install as a Cake Tool

ForgeTrust.AppSurface.Evidence.Contracts

ForgeTrust.AppSurface.Evidence.Contracts is the stable vocabulary for a CI run that says what changed, which evidence was required, what actually ran, and whether a downstream gate may consume the result.

Start with the EvidenceHost guide before installing a package. Use this package directly only when you are authoring a consumer-owned producer, policy tool, or gate integration. It starts no process, discovers no test code, provisions no resources, and sends no telemetry.

Release Guidance

AppSurface ships as a coordinated package family. Before installing this package from a prerelease feed, check the package chooser and release hub for current release risk, migration guidance, and readiness.

Contract shape

An EvidencePolicy resolves into an immutable EvidencePlan. A run records declared EvidenceProducerResult values and then uses EvidenceManifestBuilder.Build(...) to produce an EvidenceManifest. Both plan and manifest have canonical JSON and SHA-256 digests, so a gate can verify a result without rerunning the test suite.

EvidencePolicy.CombineProfiles is an opt-in (false by default) policy property. When enabled, the planner unions distinct profiles selected by matched paths, requiring identical canonical declarations for repeated ids and a shared profile scope. Unknown paths continue to use ConservativeProfileId; see the planner reference for merge rules and diagnostics. The default property is omitted from canonical JSON, so existing policies retain their serialized bytes and positional constructor.

Type family Purpose
EvidencePolicy, EvidenceProfile, EvidencePolicyRule Checked-in change-risk policy and explicitly selected profile.
EvidenceResourceDeclaration, EvidenceProducerDeclaration, EvidenceObligation Closed declaration of resource readiness, producer assertions/artifacts, and the risk obligation each assertion may close.
EvidencePlan, NormalizedDiffPath Deterministic resolved input. DiffDigest binds normalized paths; optional PatchSha256 binds the exact unified patch bytes. The plan digest also covers policy identity, the selected profile, and matched rules.
EvidenceProducerResult, EvidenceManifest Terminal producer outcomes and the resulting gate claim.
EvidenceCanonicalJson, EvidenceDigest, EvidenceManifestBuilder Canonical serialization, digesting, claim calculation, and manifest verification.

EvidenceClaimKind.TargetedComplete is eligible for a pull-request gate; ReleaseComplete is eligible only for a release gate and requires ValidatedNotAttested envelope status. ObservationOnly is deliberately informative, never gate-eligible. NoEvidenceRequired is valid only when the selected profile declares no resources, producers, or obligations.

Streaming artifact writes

Use EvidenceArtifactWriter.WriteAsync with a Stream when a producer has an artifact that may be large or is supplied by a non-seekable process stream. The writer copies in bounded chunks, computes the lower-case SHA-256 digest as bytes arrive, and enforces both the slot's MaximumBytes and the shared 256 MiB producer budget before accepting each chunk. The input stream remains owned by the caller and is read to end; the writer exposes only EvidenceArtifactResult metadata.

The existing ReadOnlyMemory<byte> overload remains useful for already-buffered small values. Use VerifyWrittenArtifactsAsync after producer work or before returning a result when the output directory may have been touched by another process. Verification also streams each file and returns false for missing, inaccessible, truncated, or tampered artifacts. Cancellation and copy errors remove the partial destination and release the logical-name, destination, slot, and aggregate reservations so the producer can retry safely.

Avoid seeking or rewinding the input stream: streaming writes consume it exactly once. Do not close the input stream as part of producer cleanup unless the producer owns it. A failed write cannot be resumed from its partial file; retry by supplying a fresh stream, because the partial destination is deleted before the reservation is released.

Claim rules

A complete claim is deliberately conservative:

  • every selected producer must report Passed;
  • every obligation's required producer and assertion must be present;
  • producer results may not name undeclared producers or assertions;
  • a release profile requires a registered CI-envelope verifier; and
  • the manifest digest and plan digest must verify unchanged.

An unavailable capability, timeout, skipped producer, incomplete test profile, or failed assertion therefore produces None, not a partial success. This is how EvidenceHost distinguishes an observation from evidence that can mediate risk.

Retained artifact check

EvidenceArtifactFileValidation.CheckAsync(artifactRoot, producerId, artifact, cancellationToken) compares one artifact recorded in an EvidenceProducerResult with the file at <artifactRoot>/<producerId>/<artifact.RelativePath> and returns an EvidenceArtifactFileStatus.

Status Meaning
Valid An unlinked regular file with the recorded length and SHA-256.
InvalidPath The producer id is not one path segment, the relative path is absolute, empty or traversing, or the recorded length is negative.
Linked The artifact root, a directory on the way, or the file is a symbolic link or other reparse point.
Missing The file or a directory on the way does not exist or cannot be opened.
LengthMismatch The file length differs from the recorded length. Checked before hashing, and again while reading: a file that shrinks or grows after it is opened gets this status.
DigestMismatch Same length, different SHA-256. At most the recorded length is hashed, and at most one byte past it is read.

Why it exists. EvidenceArtifactValidation.AreValid(...) checks artifact metadata against a declaration, and EvidenceManifestBuilder.Verify(...) checks digests of the plan and manifest. Neither opens the artifact, so without this check a manifest can verify after its artifact is deleted or replaced. appsurface evidence verify and the repository validation tool both call this one method, so there is a single link-rejection rule.

When to use something else. A producer checking its own writes during a run should keep using EvidenceArtifactWriter.VerifyWrittenArtifactsAsync().

Pitfalls. Links are rejected at the artifact root and below it, not above it, so pass a root you trust. The method returns a status and does not throw for a bad file; a caller that forgets to compare with Valid accepts everything.

Test producer declaration (preview)

A producer of kind test declares the test projects it lists, runs and reconciles in an optional test block on EvidenceProducerDeclaration. It claims selection completeness, "every test the declared projects and filters selected ran and passed", and nothing about coverage.

{
  "id": "tooling-tests",
  "kind": "test",
  "version": "1.0.0",
  "requiredResources": [],
  "assertionIds": ["appsurface/test/discovery-complete@1"],
  "artifactSlots": [
    { "logicalName": "test-receipt", "relativeRoot": "test", "mediaType": "application/json", "required": true, "maximumBytes": 65536 }
  ],
  "timeoutSeconds": 900,
  "test": {
    "projects": [
      { "path": "tests/Tooling.Tests/Tooling.Tests.csproj", "filter": "FullyQualifiedName~Tooling.Release", "minimumTests": 10 }
    ]
  }
}
Member Shape and default Constraint
EvidenceProducerDeclaration.Test EvidenceTestDeclaration?, null Required for kind test, rejected on every other kind. Omitted from canonical JSON when null.
EvidenceTestDeclaration.Projects list of EvidenceTestProject 1 to 32 entries, unique paths.
EvidenceTestProject.Path string Repository-relative, forward slashes, at most 512 characters, ends in .csproj, .fsproj or .vbproj.
EvidenceTestProject.Filter string?, null VSTest filter, at most 1024 characters, one line. Omitted when null.
EvidenceTestProject.MinimumTests int?, null meaning 1 1 or greater. Omitted when null.
EvidenceTestProducerContract constants The kind, the single assertion id, the receipt slot name, media type and required relativeRoot (test), the limits above, the 30-second minimum timeout, and GetMinimumReceiptBytes(projects): 4096 bytes plus, per project, 512 bytes and six bytes per character of its path.

The planner enforces every constraint with its own diagnostic, ASEVD137 through ASEVD149.

When to use it. Use kind test for paths with no production code to cover, such as workflows, scripts and release tooling, where the truthful evidence is that the tests exercising them ran. Use kind coverage when a coverage threshold is the evidence; a test producer cannot carry a coverage gate or close a coverage assertion.

Digests. The whole declaration is hashed, so changing a project, a filter or a minimum changes PolicyDigest and PlanDigest. A policy with no test block keeps its existing canonical bytes.

Pitfalls.

  • Preview: the kind, the assertion id and this shape may change without a compatibility step until a real route has closed with them.
  • The filter is public plan data. Do not put anything confidential in it.
  • A filter that starts matching fewer tests can still pass if it matches at least minimumTests tests, or one when no minimum is set, and every selected test runs and passes. A filter that matches no test always fails.
  • A reader that does not know the test property drops it and computes a different PolicyDigest. Upgrade every CLI that runs or verifies evidence before adding a test block to a shared policy, and remove the block before downgrading.

Pitfalls

  • Do not construct a NoEvidenceRequired result merely because a local run omitted tests. It is a policy outcome, not a convenience override.
  • Do not treat a coverage collection artifact as a gate pass unless its producer has closed the assertion declared by the selected policy.
  • Do not claim independent attestation in v1. An accepted envelope is represented as ValidatedNotAttested.
  • Do not edit generated plan or manifest JSON. EvidenceManifestBuilder.Verify(...) and appsurface evidence verify detect inconsistent or edited claim fields by recomputing internal digests; they do not authenticate their inputs. Gates must obtain the plan and manifest through a trusted CI channel.

Read next: the planner README, the Aspire lifecycle README, and the EvidenceHost cookbook.

Coverage declarations optionally include coverageExecution: configuration (default Debug, a simple identifier up to 32 characters), parallelism (1 through 32, default 1), and testResults (none or junit, default none). These settings control execution and report production; they do not alter coverage gates or source filters. Omitting the property preserves the previous canonical declaration bytes and legacy behavior. An explicitly supplied value participates in the policy and plan digests. See the built-in coverage workflow and native consumer acceptance recipe.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on ForgeTrust.AppSurface.Evidence.Contracts:

Package Downloads
ForgeTrust.AppSurface.Evidence.Planner

Deterministic diff-to-policy planning and manifest claim evaluation for AppSurface evidence.

ForgeTrust.AppSurface.Evidence.Aspire

Explicit consumer-owned Aspire lifecycle integration for AppSurface EvidenceHost producers and readiness checks.

ForgeTrust.AppSurface.Evidence.Cli

First-party AppSurface evidence command workflow for safe initialization, planning, diagnostics, execution summaries, and manifest verification.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-preview.15 417 11/24/2026
0.2.0-preview.14 1,318 10/16/2026
0.2.0-preview.13 319 10/4/2026
0.2.0-preview.11 105 9/30/2026
0.2.0-preview.8 2,084 8/23/2026