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

This is a prerelease version of ForgeTrust.AppSurface.Evidence.Planner.
dotnet add package ForgeTrust.AppSurface.Evidence.Planner --version 0.2.0-preview.15
                    
NuGet\Install-Package ForgeTrust.AppSurface.Evidence.Planner -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.Planner" 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.Planner" Version="0.2.0-preview.15" />
                    
Directory.Packages.props
<PackageReference Include="ForgeTrust.AppSurface.Evidence.Planner" />
                    
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.Planner --version 0.2.0-preview.15
                    
#r "nuget: ForgeTrust.AppSurface.Evidence.Planner, 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.Planner@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.Planner&version=0.2.0-preview.15&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ForgeTrust.AppSurface.Evidence.Planner&version=0.2.0-preview.15&prerelease
                    
Install as a Cake Tool

ForgeTrust.AppSurface.Evidence.Planner

ForgeTrust.AppSurface.Evidence.Planner turns an explicit diff and a checked-in EvidencePolicy into one deterministic EvidencePlan. It is the boundary that makes a coverage or E2E gate explainable before work begins.

Begin with the EvidenceHost guide. This package owns planning only: it does not invoke Git, start Aspire, run tests, create containers, or decide that missing evidence is acceptable.

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.

Minimal use

using ForgeTrust.AppSurface.Evidence.Contracts;
using ForgeTrust.AppSurface.Evidence.Planner;

var planner = new EvidencePlanner();
var plan = planner.Resolve(policy, [new NormalizedDiffPath("src/Orders/SubmitOrder.cs")]);

Resolve normalizes and sorts paths, applies the most-specific matching rules, and falls back to ConservativeProfileId for a path that has no rule. If equally specific rules choose different profiles, it throws EvidencePlanningException instead of silently taking a lower-risk route. EvidenceUnifiedDiffReader.Read(...) accepts a CI-provided Git-formatted unified diff when callers do not want to depend on a local Git checkout. Hunked diffs must include diff --git file headers; use explicit paths when only a non-Git diff is available.

For the Coverage EvidenceHost producer, use ResolvePatch(policy, patchBytes, additionalPaths) with the exact UTF-8 patch captured for planning (up to 20 MiB). The planner copies the bytes, strictly decodes the entire snapshot before parsing paths or selecting policy, and rejects malformed UTF-8 with ASEVD136. Valid Unicode, including a literal U+FFFD character, remains valid; the patch SHA-256 is computed from the exact copied bytes and recorded separately from the normalized path digest. The Evidence CLI binds the snapshot automatically when you pass --diff-file. A path-only plan still resolves normally but cannot close a patch coverage obligation with this producer.

Strict decoding includes hunk content, not only file headers. A text patch containing legacy-encoded source or fixture bytes fails with ASEVD136 even when its paths are valid UTF-8. Establish the repository's source/fixture encoding policy before generating the planning patch. Do not transcode, truncate or omit bytes after capturing its identity, or mark changed source as binary merely to bypass a coverage obligation.

EvidenceUnifiedDiffReader.Read(string) receives already-decoded text and cannot detect earlier lossy decoding. Callers using it with Resolve must decode their original bytes strictly themselves; prefer ResolvePatch when byte identity and patch coverage matter. A legitimate U+FFFD character must not be rejected as a substitute for validating the original encoding.

Generate the planning patch from the repository root with the same path prefixes and options as the coverage gate. Use the same DIFF_BASE in the acceptance policy:

git --no-pager --no-replace-objects diff --unified=0 --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ --relative "${DIFF_BASE}...HEAD" -- > "$PATCH_FILE"

Choose a patch output path outside the checkout so the source remains clean. Pass the file's exact bytes to ResolvePatch or --diff-file.

Canonical v3 ResolvePatch recipe

Use this recipe only for a v3 report-based patch obligation. The shell example above is the existing planner workflow; it does not implement the stricter appsurface-git-patch-v1 policy. Follow the canonical v3 Git policy, environment, caps and recovery rules. The trusted adapter resolves the requested base once to a full lowercase commit ID, confirms source/head identity and complete local history, and requires merge-base --all to return exactly one base. Git 2.46 or later is required. No fetch, rebase, shell interpolation, alternate diff, or post-capture byte normalization is allowed.

The patch command is an argument vector run from the validated repository root with the exact isolated environment and common Git prefix in the guide. Its fixed diff arguments are:

diff --no-color --no-ext-diff --no-textconv --no-relative
--no-renames --find-renames=50% --no-rename-empty -l1000
--diff-algorithm=myers --no-indent-heuristic
--ignore-submodules=none --submodule=short
--patch --unified=0 --inter-hunk-context=0 --full-index
--src-prefix=a/ --dst-prefix=b/
--output-indicator-new=+ --output-indicator-old=-
--output-indicator-context=<one literal space>
<merge-base> <head> --

The last option's value is one literal space in one argv item. Retain the exact stdout bytes (including any final newline), enforce the 20 MiB patch cap, and pass that unchanged snapshot to ResolvePatch. Strict UTF-8 decoding and exact-byte SHA-256 binding happen inside the planner:

var plan = planner.ResolvePatch(policy, patchBytes, additionalPaths);
var expectedPatchSha256 = plan.PatchSha256;

Pass plan.PatchSha256 as the v3 Coverage request's ExpectedPatchSha256; the Evidence coverage producer obtains that value from the selected plan. The acceptance request also pins ContractVersion = 3 and ReportProfileId = "coverlet-collector-cobertura-v1". Use fresh homogeneous v3 captures and keep the complete four-metric applicability result with the expected contract version. Valid N/A is accepted by v3 without another flag.

ResolvePatch rejects an empty patch or a patch with no normalized changed path (ASEVD101); the path-only Resolve overload likewise cannot bind patch bytes. Exact-empty v3 diff acceptance is a separate Coverage API case that requires the SHA-256 of the exact empty byte sequence and independently verified empty Git metadata. The Evidence planner does not manufacture an obligation for that case: do not add a synthetic path or edit a digest to make one.

Set EvidencePolicy.CombineProfiles = true to union distinct profiles selected by matched rules. The planner sorts source profile ids, declaration ids, paths, and matched rule ids before producing a stable combined-<digest> profile. Repeated resource, producer, or obligation ids must have identical canonical declarations; a conflict fails closed with ASEVD133. Profiles must share one scope or resolution fails with ASEVD134. An empty profile contributes no declarations. Paths with no matching rule still select the configured conservative profile. With the default false, any multi-profile selection keeps the existing conservative fallback behavior. The option is serialized only when true, preserving the canonical bytes of existing policies.

Policy design

Keep the policy small and explicit:

  • map genuinely non-behavioral files to an empty no-evidence profile;
  • map behavior-sensitive paths to producers that make a real assertion, such as coverage or browser E2E;
  • choose a conservative non-empty fallback profile; and
  • give every obligation one named risk rationale and assertion id.

The planner does not classify C# semantics or infer that a getter, constructor, or generated line is low value. That belongs in a future, separately versioned behavior classifier; v1 refuses to pretend an unimplemented heuristic is trustworthy.

Failure and recovery

Diagnostic Meaning Recovery
ASEVD105 Conservative fallback points at an empty profile. Choose a non-empty profile that genuinely mediates unknown changes.
ASEVD117 Same-precedence rules selected different profiles. Add an explicit precedence or remove the overlap.
ASEVD133 Selected profiles declare conflicting values for one resource, producer, or obligation id. Make same-id declarations identical or keep the profiles separate.
ASEVD134 Selected profiles have different scopes. Select profiles with a shared scope or disable profile combination.
ASEVD118 A supplied changed path is not normalized. Use a repository-relative forward-slash path without . or .. segments.
ASEVD121 An identifier is empty or exceeds 128 characters. Use a stable identifier up to 128 characters.
ASEVD111, ASEVD124 A producer or resource requires an undeclared resource. Declare every required resource in the same profile.
ASEVD128 A hunked unified diff does not include Git file headers. Supply a Git-formatted diff or explicit changed paths.
ASEVD129 A coverage execution configuration is empty, longer than 32 characters, or contains unsupported characters. Use letters, digits, ., -, or _ in a simple configuration name.
ASEVD130 Coverage execution parallelism is outside 1 through 32. Choose a bounded project concurrency from 1 through 32.
ASEVD131 A coverage execution test-result format is unsupported. Select none or junit in the coverage declaration.
ASEVD132 A coverage producer has an unsupported coverageArtifactRetention value. Use managed (the default) or full; this setting does not change coverage gate requirements.
ASEVD135 A Git patch path header is empty or contains invalid quoting or Git path escapes. Supply an unmodified Git unified patch with UTF-8 paths.
ASEVD136 The exact patch snapshot contains malformed UTF-8 anywhere in its bytes. Supply a valid UTF-8 unified patch; the planner rejects it before policy selection.
ASEVD137 A test producer has no test block or an empty test.projects. Declare 1 to 32 projects in the test declaration.
ASEVD138 A test producer declares more than 32 projects. Split the projects across more than one test producer.
ASEVD139 A test.projects path is not a repository-relative forward-slash path of at most 512 characters ending in .csproj, .fsproj or .vbproj, or it has a ./.. segment, a segment starting with -, a : or a control character. Correct the path; it is passed to dotnet as an argument, so a leading - is refused.
ASEVD140 A test producer declares the same project path twice, compared without regard to case. Declare each project once and combine filters with \| in one entry.
ASEVD141 A filter is blank, longer than 1024 characters, or holds a control character or line break. Use a one-line VSTest filter, or omit filter to select every test.
ASEVD142 minimumTests is below 1. Use 1 or greater, or omit it for the default of 1.
ASEVD143 A producer of another kind declares a test block. Remove the block or set kind to test.
ASEVD144 A test producer declares coverageGate, coverageExecution or a non-default coverageArtifactRetention. Remove the coverage fields; a test producer makes no coverage claim. Use kind coverage for coverage evidence.
ASEVD145 A test producer's assertionIds is not exactly ["appsurface/test/discovery-complete@1"]. Paste the array printed in the message.
ASEVD146 A test producer does not declare exactly one required test-receipt slot with media type application/json and relativeRoot test. Paste the artifactSlots value printed in the message.
ASEVD147 The test-receipt slot's maximumBytes is below 4096 plus, per project, 512 plus six bytes per character of its path (the worst case of the receipt's JSON escaping). Set maximumBytes to at least the minimum printed in the message.
ASEVD148 A test producer's timeoutSeconds is below 30. Use 30 or more so the producer keeps time to write its receipt.
ASEVD149 A test producer id is not one safe path segment (A-Z a-z 0-9 . _ -, and not . or ..). Rename the producer; its id names the artifact directory. Other kinds keep the general identifier rule (ASEVD121).

Test producer rules (preview)

ASEVD137 through ASEVD149 apply only to producers of kind test, except ASEVD143, which keeps a test block off every other kind. The planner checks them in this order and reports the first failure: ASEVD143, ASEVD149, ASEVD137, ASEVD138, then per project ASEVD139 to ASEVD142, then ASEVD144 to ASEVD148. The general producer rules (ASEVD110, ASEVD121, ASEVD125, ASEVD126) run first.

Why these rules exist: a test producer claims only that the tests it selected all ran and passed. ASEVD144 and ASEVD145 stop that claim from standing in for a coverage assertion, and ASEVD146 and ASEVD147 guarantee the producer can always write the receipt a gate reads. The kind, its assertion id and these codes are preview and may change without a compatibility step. Pitfall: an older planner ignores an unknown test block instead of rejecting it, so upgrade every CLI that plans or verifies before adding one to a shared policy.

Read next: contracts, CLI workflow, and the policy cookbook.

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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ForgeTrust.AppSurface.Evidence.Planner:

Package Downloads
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 404 11/24/2026
0.2.0-preview.14 1,307 10/16/2026
0.2.0-preview.13 302 10/4/2026
0.2.0-preview.11 99 9/30/2026
0.2.0-preview.8 2,058 8/23/2026