Table of Contents

Class TargetedRegression

Namespace
Valheim.Testing.GameSessions
Assembly
Valheim.Testing.GameSessions.dll

Stages and preflights a targeted native regression from its RegressionInputs on the inventory's client environment, without the game, then hands one arm to the existing strict-pinned ClientRounds.

  1. The fixture root must hold exactly one world with the manifest's UID (FixtureLayout).
  2. Every staged file must be its pinned SHA256; the manifest records every arm's source hash and the chosen arm is staged.
  3. The shared hosted-runtime stage makes a fresh disposable loader profile per arm with BepInEx/plugins, patchers, config and scripts rebuilt from the allowlist only: the default ValheimCLI plugin, the mod plugins, the probe and one arm.
  4. Every hard [BepInDependency] any staged plugin declares must be met by a staged plugin's own [BepInPlugin] (with its minimum version), no [BepInIncompatibility] may be staged, every plugin must load in the client process, and every assembly reference must resolve to the game, BepInEx or a staged DLL. File names count for nothing.
  5. The plan's own Validate(params string[]) and Preflight(IEnumerable<string>) run on the staged install, including the static ValheimCLI capability check against Manifest when set.

Nothing launches. Run(string, string, string, IReadOnlyList<string>, Action<ClientRound>, CancellationToken, Action<ScenarioReport>?) stages a fresh profile for one arm, refuses any file outside the allowlist right before the launch, and keeps ClientRounds' live capability check and strict per-command pins as the second gate.

public sealed class TargetedRegression
Inheritance
object
TargetedRegression

Constructors

TargetedRegression(RegressionInputs, IEnumerable<string>?, EnvironmentInventory?, string?)

A regression of inputs on inventory's client environment: clientEnvironment, or its first client environment. With no inventory, this machine (Read(string?)). The client runs here, so the environment must be on this machine (a local host).

public TargetedRegression(RegressionInputs inputs, IEnumerable<string>? scenarioCapabilities = null, EnvironmentInventory? inventory = null, string? clientEnvironment = null)

Parameters

inputs RegressionInputs
scenarioCapabilities IEnumerable<string>
inventory EnvironmentInventory
clientEnvironment string

Properties

Architecture

The effective client slice selected by the inputs or inventory.

public string Architecture { get; }

Property Value

string

Capabilities

The ValheimCLI capabilities the run uses: HostedRounds and the scenario's own whose owner is ValheimCLI's (valheim. or cli.). They are checked against Manifest before launch, when it is set, and live once the client answers.

public IReadOnlyList<string> Capabilities { get; }

Property Value

IReadOnlyList<string>

ClientEnvironment

The client environment the run uses (Name) and why.

public string ClientEnvironment { get; }

Property Value

string

Detected

What the inventory detected and assumed for this machine (Detected), for a caller to print.

public IReadOnlyList<string> Detected { get; }

Property Value

IReadOnlyList<string>

Game

The prepared Valheim install the disposable profile launches: the client environment's install. Only read.

public string Game { get; }

Property Value

string

Inputs

public RegressionInputs Inputs { get; }

Property Value

RegressionInputs

Install

The disposable loader profile this runner owns in the client environment's runtime.

public string Install { get; }

Property Value

string

LiveOnlyCapabilities

The scenario's capabilities of any other owner (a probe's or the mod's own extension): checked live before the first round.

public IReadOnlyList<string> LiveOnlyCapabilities { get; }

Property Value

IReadOnlyList<string>

LoaderPackage

The client's loader package: the client environment's, else on Windows or Linux the toolkit's pinned BepInExPack (#711), chosen once; null only for a macOS install's own native loader.

public string? LoaderPackage { get; }

Property Value

string

Port

The client's ValheimCLI port: the client environment's.

public int Port { get; }

Property Value

int

SteamUserData

This machine's detected Steam userdata, which a registered character is checked against; null when none was detected.

public string? SteamUserData { get; }

Property Value

string

Methods

Preflight()

Stages and preflights every arm in turn, without the game; returns them in manifest order (the last stays staged). Call Remove() in a finally block to retire that copy and release the host lock.

public IReadOnlyList<StagedArm> Preflight()

Returns

IReadOnlyList<StagedArm>

Read(string, IEnumerable<string>?)

The regression a run's regression.json describes, on the machine it ran on: the environments.json beside it when there is one (written when the run overrode this machine's client), otherwise this machine.

public static TargetedRegression Read(string inputsFile, IEnumerable<string>? scenarioCapabilities = null)

Parameters

inputsFile string
scenarioCapabilities IEnumerable<string>

Returns

TargetedRegression

Remove()

Retires the copy made by this runner through the shared hosted-runtime owner.

public void Remove()

Remove(ScenarioReport, string)

Deletes the disposable install as a Cleanup step of the last arm's report, records what happened to it (disposableInstall) and writes that report again to lastArmOutput, so its result.json says whether cleanup was verified. Rethrows a refusal after recording it.

public void Remove(ScenarioReport lastArm, string lastArmOutput)

Parameters

lastArm ScenarioReport
lastArmOutput string

Run(string, string, string, IReadOnlyList<string>, Action<ClientRound>, CancellationToken, Action<ScenarioReport>?)

Runs one arm: stages and preflights it, writes run-manifest.json, then ClientRounds with rounds and measure, refusing a changed install right before the launch and requiring the scenario's capabilities live before its first round. Scans the client's logs and writes result.json and junit.xml in every outcome. output must not exist yet. Call Remove(ScenarioReport, string) after the last arm to retire the copy and release the host lock. afterPinnedClientOpened runs once the owned client has reached its menu with the selected plugins verified; a caller can record cold-start timing there without treating later world entry as plugin load.

public ScenarioReport Run(string arm, string output, string scenario, IReadOnlyList<string> rounds, Action<ClientRound> measure, CancellationToken cancellation = default, Action<ScenarioReport>? afterPinnedClientOpened = null)

Parameters

arm string
output string
scenario string
rounds IReadOnlyList<string>
measure Action<ClientRound>
cancellation CancellationToken
afterPinnedClientOpened Action<ScenarioReport>

Returns

ScenarioReport

Stage(string)

Stages arm into the disposable install and runs every static check (see the class summary). Refuses with the corrective action at the first problem; nothing is launched.

public StagedArm Stage(string arm)

Parameters

arm string

Returns

StagedArm