ForgeTrust.AppSurface.Coverage
0.2.0-preview.15
dotnet add package ForgeTrust.AppSurface.Coverage --version 0.2.0-preview.15
NuGet\Install-Package ForgeTrust.AppSurface.Coverage -Version 0.2.0-preview.15
<PackageReference Include="ForgeTrust.AppSurface.Coverage" Version="0.2.0-preview.15" />
<PackageVersion Include="ForgeTrust.AppSurface.Coverage" Version="0.2.0-preview.15" />
<PackageReference Include="ForgeTrust.AppSurface.Coverage" />
paket add ForgeTrust.AppSurface.Coverage --version 0.2.0-preview.15
#r "nuget: ForgeTrust.AppSurface.Coverage, 0.2.0-preview.15"
#:package ForgeTrust.AppSurface.Coverage@0.2.0-preview.15
#addin nuget:?package=ForgeTrust.AppSurface.Coverage&version=0.2.0-preview.15&prerelease
#tool nuget:?package=ForgeTrust.AppSurface.Coverage&version=0.2.0-preview.15&prerelease
ForgeTrust.AppSurface.Coverage
Portable .NET coverage capture, conservative composition, acceptance, and independent verification. This neutral facade depends on the private coverage engine; it requires neither Aspire nor CLI command workflows. The fan-in guide is the adoption and migration reference, and the dogfood examples show the installed headless proof, generated CLI requests, and Evidence adapter. Use ordinary coverage merge when you only need combined reports; use fan-in when complete inventories, source/run identity and independent acceptance matter.
The packed facade pins ForgeTrust.AppSurface.Evidence.Coverage to the exact same coordinated package version using NuGet's [version] range. Keep the facade and its private engine on the same release; an open lower bound could let a consumer resolve a different engine version than the facade was built against.
The supported CoverageFanIn operations are CollectAndCaptureAsync, CaptureAsync, ComposeAsync, AcceptAsync, and read-only VerifyAsync. Requests explicitly supply CoverageFanInPolicy and a matching clean Git source context. Capture accepts a normalized primary report with successful timings, original collector facts for one or more native projects, or an explicit portable import under the selected versioned contract with its original source-root mapping. Composition requires exactly one primary and the declared supplementary set. Acceptance retains the primary aggregate gate and explicitly selected aggregate-only or aggregate-plus-patch policy. Native measurements come from the original serialized collector class and method facts; normalized Cobertura supplied for native compatibility is not a measurement oracle. Collection uses the existing supervised VSTest Coverlet collector and does not rely on an ambient tool or cache.
A CoverageFanInResult distinguishes operation outcome, original observation, local import, evaluation intent, exact generation and partial effects. Capture and composition success do not mean coverage acceptance. Matching manifests and hashes establish consistency within a trusted-producer boundary, not signatures or proof that arbitrary supplied tests ran. Import preserves producer origin; historical replay never becomes new execution. Only completed acceptance records acceptance, and the Evidence adapter additionally requires successful current-operation delivery.
Callers own progress and diagnostic writers; operations do not dispose or retain them. All operations accept cancellation. Precommit cancellation publishes no complete generation; output may require inspection. Postcommit cancellation reports the actual committed generation. Fresh output is the default. Explicit replacement requires compatible private registration, physical custody and exact unmodified inventory; unknown, modified or linked material is preserved. Verify creates no directories, coordination or diagnostics files. Legacy v1 verification remains available through the original Evidence verifier; schemas cannot mix and historical captures are not relabeled as fresh.
Policy includes exact slash-relative test project identities (including names without a .Tests suffix), exact supplementary IDs/platforms/filters and optional supplementary project inventories, source commit/tree/SDK/configuration, provider-neutral run identity, instrumentation, thresholds, diff intent and operation limits. Collections are frozen and defaults materialized before side effects. Duplicate/aliased project identities are rejected. CoverageGateMode.AggregateOnly explicitly reports PatchNotRequested; AggregateAndPatch requires a diff base and the same frozen diff for both reports. V2 requires measurable changed lines and retains the gate's 0/0 branch convention; v3 reports each dimension as measured or N/A under its report-based applicability contract. Composition cannot reduce either measurable denominator. AppSurface dogfooding keeps its complete inventory, Linux/Windows/macOS evidence, 95% line / 85% branch aggregate and patch gates, 0.5-point tolerance and Codecov patch mode.
CoverageOperationLimits defaults to 512 MiB/XML, 1 MiB/JSON and other text, 4 GiB total admitted/staged bytes, depth 64, 1,000,000 lines/report, 32 bundles, 8,000,000 XML elements/report, 32 attributes/element, 65,536 decoded token characters, 2,000,000 branch records/report and total retained records/operation, five minutes/operation and 30 seconds/identity process. Retained diff.patch uses the Git reader's fixed 20 MiB UTF-8 limit consistently during acceptance, verification and owned replacement, and still counts against the total byte budget. Collection requires its own 1–86,400 second overall deadline. Explicit limits replace defaults as one immutable snapshot; policy limits never lower numeric coverage thresholds. Parsing rejects DTD/entities on v2 wire XML; the controlled normalization boundary strips only the known inert generator declaration while retaining original raw collector bytes.
Source identity subprocesses have a separate fixed 1 MiB limit on each output stream. The complete Git index listing, including its path bytes, must fit that bound for the repository and each pinned submodule; collection also requires its ignored-file listing to fit. Truncated output is rejected with ASCOV302; it never becomes partial source evidence. Raising XML, JSON or total artifact budgets does not raise this subprocess bound. Large checkouts whose listings exceed it are outside the current dogfood preview's supported inputs.
coverage-policy-c14n-1 canonicalizes the typed policy as ordinal properties and set identities, explicit defaults/nulls, valid decoded Unicode without NFC folding, invariant minimal decimal values (0–100, at most six fractional places), UTF-8 without BOM/whitespace. The SHA-256 input is the encoding version plus a newline followed by those bytes. Paths must be normalized slash-relative identities; arbitrary JSON lexical forms do not change policy meaning.
Prerequisites are a supported .NET 10 SDK, Git, consumer-owned test SDK/collector packages, and a supported native filesystem. Single-file, trimming and AOT are not established support claims. The current acceptance target is AppSurface dogfooding; separate downstream consumer validation and onboarding measurements are deferred by user direction.
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.
Request and result reference
Choose CollectAndCaptureAsync when this process should supervise test execution; choose CaptureAsync when a trusted producer already has successful artifacts or when explicitly materializing a portable capture under the selected versioned contract. Use ComposeAsync to produce a conservative combined view, AcceptAsync to run the selected gates and independent checks, and VerifyAsync to recheck an existing generation without changing local state. A caller that needs only a merged report should use coverage merge; a caller that needs EvidenceHost to close an obligation should use the shipped Evidence producer.
CoverageFanInPolicy defaults to contract version 2 with no report profile; this preserves v2 canonical policy bytes/digests and CLI result shape. V3 is an explicit opt-in via ContractVersion = 3 plus ReportProfileId = "coverlet-collector-cobertura-v1". V3 adds CoverageFanInResult.PatchApplicability with primary/composed line and branch outcomes. Pitfall: v3 PatchOutcome == "PatchAccepted" includes valid N/A dimensions. Pin the expected contractVersion: 3 and preserve the complete four primary/composed line/branch outcomes; v3 accepts valid N/A without an additional measured-only switch. The repository build explicitly selects v3 for pull requests requiring native coverage. The standalone Dogfood adapter's --contract-version option defaults to 2 and selects v3 with value 3. See the canonical v3 applicability, trust, diff, artifact, and recovery reference.
Set CoverageFanInPolicy.DiffPolicyId = "appsurface-visual-baseline-png-v1" on a v3 policy to admit replacements for the AppSurface docs screenshot baselines. Omit the property for the default text diff. The selection participates in the policy digest. See screenshot baseline updates for accepted paths, blob checks and replay behavior.
var result = await CoverageFanIn.CollectAndCaptureAsync(
new CoverageCollectRequest(
policy,
repositoryRoot,
freshCaptureDirectory,
freshCollectionDirectory,
ProducerId: "primary",
DeadlineSeconds: 900,
SolutionPath: solutionPath),
cancellationToken,
progress,
diagnostics);
if (result.Outcome != CoverageOperationOutcome.Succeeded)
throw new InvalidOperationException($"Coverage collection ended as {result.Outcome}.");
// Collection success records the observed producer operation. It does not accept coverage.
This example deliberately takes the policy, repository and fresh destinations as caller values. Do not substitute illustrative hashes or host paths; obtain source commit/tree/SDK from the real clean checkout and use a unique run identity. The remaining operation calls, native import, and a packed-fixture command are in the examples.
| Contract | Meaning and constraints |
|---|---|
CoverageSourceIdentity |
Exact lowercase Git commit/tree object IDs (40 or 64 hex characters), selected SDK version and explicit configuration. The local source must match and be clean, including untracked source files. Declared primary and supplementary projects must be tracked regular files in the pinned repository or its pinned submodules. |
CoverageRunIdentity |
Explicit producer system, run scope, run ID and positive attempt. Text fields are bounded to 256 characters, exclude controls/format characters, and must contain no credentials. |
CoverageSupplement |
Unique bounded portable ID, actual platform and explicit test filter (up to 4096 characters); optional nonempty test-project set selects the supplementary collector inventory. Omission uses the complete intended primary inventory. |
CoverageInstrumentation |
Supported collector/cobertura normalization identity. Include defaults to null; exclude defaults to [*.Tests]*,[*.IntegrationTests]*. Filter values are bounded to 4096 characters. These are consumer settings, not authority to change AppSurface's configured scope. |
CoverageGatePolicy |
Explicit mode. Percentage values are lossless decimals in 0–100 with at most six fractional places. Defaults are 95 line/85 branch for aggregate and patch, tolerance 0.5 and codecov. AggregateAndPatch requires a Git base; v3 requires the full lowercase commit ID matching the source object format. AggregateOnly requires null. |
CoverageCollectRequest |
Explicit fresh collection and capture outputs, producer ID and 1–86,400-second deadline. Parallelism defaults to 1. Collection rebuilds the declared projects before testing; NoBuild must be false. It rejects ignored files except standard bin/ and obj/ directories beside outermost tracked .NET projects. Set NoRestore only with trusted restore outputs. SolutionPath does not replace or expand the explicit inventory. See the checkout prerequisites. |
CoverageCaptureRequest |
Select one form exactly: primary requires CoveragePath and successful TimingsPath, with neither raw selector; single-project native requires RawCoveragePath, permits optional bounded-XML CoveragePath, and requires TimingsPath to be absent; indexed native requires RawCoveragePaths and complete TimingsPath, with both CoveragePath and RawCoveragePath absent; import requires ImportDirectory and has no report or timing selectors. Native CoveragePath is compatibility input only and never supplies measurement facts. Collection always uses indexed RawCoveragePaths, even for one project. Fresh is default; ReplaceOwned is explicit. |
CoverageComposeRequest |
Primary, exact supplementary directory list and distinct output; Fresh and CurrentTrustedRun defaults. |
CoverageAcceptRequest |
The same captures, exact composed output and distinct acceptance destination. ExpectedPatchSha256 pins the exact Git patch; v3 aggregate-and-patch requires it, including for an exact empty patch. The EvidenceHost producer supplies the plan hash. Only a successful independent gate sequence creates accepted coverage. |
CoverageVerifyRequest |
Existing captures, composition and acceptance destination. Read-only validity uses explicit CurrentTrustedRun or HistoricalReplay intent. |
CoverageFanInResult |
Requested operation/outcome/operation ID/policy digest, actual effects, bounded diagnostics and retained role/hash references. Accepted, Verified, original Observation, evaluation intent and patch outcome have separate meanings. PatchApplicability is null for v2, capture/compose, aggregate-only acceptance and pre-evaluation failure. For compose, accept and verify, PrimaryImported indicates a primary materialized from transport; Effects.Imported indicates that any input was imported. |
Limit overrides replace their typed field defaults before freezing the policy. XML/JSON byte bounds are positive and at most 2,147,483,647 bytes; total admitted/staging bytes are positive and at most 1 TiB. Depth is 1–256, bundle count 1–1024, noncollection seconds 1–86,400 and identity seconds 1–300. Other count/token bounds are positive 32-bit integers. Primary inventories admit at most 10,000 projects; native inventories admit at most 9,995, reserving five entries in the unchanged 10,000-file storage inventory for coverage, timings, index, manifest and completion marker. Inventories reject case/Unicode-normalization aliases while preserving the original valid scalar spelling in canonical bytes. Relative project components reject traversal, reserved device names, trailing dots/spaces and platform-invalid characters.
Native collection supports the complete supplementary project set, including omission of CoverageSupplement.TestProjects to select the primary set. It always uses the indexed representation for one or more projects, retaining byte-exact originals as collector-0000.cobertura.xml, collector-0001.cobertura.xml, and so on, plus successful timings.json and collector-inventory.json. The index has schemaVersion: 1 and a reports array of { "project": "checks/Example.csproj", "file": "collector-0000.cobertura.xml" } records in ordinal project order. RawCoveragePaths uses that exact project mapping for any indexed native capture and requires complete timings. The single-project RawCoveragePath compatibility form requires exactly one declared project, optional bounded-XML CoveragePath, and no TimingsPath; its established output filenames collector.cobertura.xml, coverage.cobertura.xml, and manifest.json remain unchanged. Indexed capture requires timings and omits both CoveragePath and RawCoveragePath; import omits all report and timing selectors. A supplied single-project CoveragePath never supplies native measurement facts. The capture uses the selected homogeneous contract version, and manifest.json hashes every retained file. Existing v2 capture bytes remain unchanged. Every load, import, composition, acceptance, and verification independently derives the native canonical projection from the original collector reports and compares class, method, line, and occurrence facts plus root totals derived from retained class-line points. Missing, duplicate, reordered, or mismatched project/file mappings, incomplete timings, and unknown files are rejected. A one-report capture cannot satisfy a multi-project declaration. See the portable input contract and API examples.
Original collector root summaries may include compiler branches absent from serialized class records. For native evidence, serialized class and method facts own the canonical projection: root totals are derived from serialized class-line points, while method points remain in patch measurement, and a collector summary cannot fill in omitted points. The composed report retains every primary record and its denominator, then incorporates supplementary raw facts conservatively; its root totals are derived from the complete composed class-line points, while patch metrics also inspect method points. The primary aggregate gate remains separate and uses the exact root counters from the original normalized primary report, including any summary-only compiler points. This distinction is a compatibility boundary: neither the native projection nor composition rewrites the primary aggregate measurement. See the measurement contract.
Supervised native attachment discovery admits at most 10,000 filesystem entries across the complete project set, applies the policy depth limit to each invocation tree and charges timings plus selected original bytes to the operation byte budget. Large diagnostic trees can exhaust this resource limit even when the declared project count is valid. Selection-time hashes for timings and every original report are checked again under retained capture IO before publication; changed evidence is rejected without publishing a complete capture.
ReplaceOwned requires an existing registered generation; a missing destination is rejected before creating its root or coordination lock. Use Fresh for the first publication. V2 accepted and numerically rejected gate evaluations share one replacement purpose, so a failed replacement retains rejection reports and a corrected retry can publish acceptance. V3 requires the exact registered purpose: an acceptance destination cannot be replaced by a rejected evaluation or the reverse. Use a fresh destination for that transition and preserve the prior generation. Capture and composition purposes remain separate. Every replacement still validates the exact prior stage against private registration and its hashed marker, physical identity and inventory. See replacement and recovery.
Expected input/evidence failures return bounded stable reasons. Invalid C# request/policy shapes throw ArgumentException before side effects; malformed CLI envelopes exit 2. Caller cancellation and deadlines produce typed terminal outcomes, with actual partial output effects. Unexpected dependency details and raw logs are not an acceptance oracle and are not copied into safe diagnostics. See diagnostics and recovery.
Supervised fan-in collection emits bounded stage progress to caller writers. Arbitrary test/child-process output and absolute host paths remain in the explicitly selected collection artifacts. Inspect those retained logs locally when collection fails; terminal diagnostics do not copy them. Normalization input and generated-file growth use the declared budgets, and serialized XML is limited before output-buffer growth.
| Product | Versions 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. |
-
net10.0
- CliWrap (>= 3.10.1)
- ForgeTrust.AppSurface.Evidence.Coverage (= 0.2.0-preview.15)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ForgeTrust.AppSurface.Coverage:
| Package | Downloads |
|---|---|
|
ForgeTrust.AppSurface.Evidence.Aspire
Explicit consumer-owned Aspire lifecycle integration for AppSurface EvidenceHost producers and readiness checks. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-preview.15 | 468 | 11/24/2026 |