Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5.5 bf569d6f23 release: 0.1.0-beta.16 - the CHANGELOG section, the accuracy block's release line, README's release lines, LIMITATIONS' version, HANDOFF's section, and owner-only item 12 marked passed
VERSION stays 0.1.0: the tag's numeric core. The owner (2026-10-06), after beta.15's release: item 12 passed on real
hardware ("đã chạy và ok"), do the chip beta.15 left, release, and close the session.

Nothing in the app changed since beta.15, and the section says so; "Updating from 0.1.0-beta.15" is the ordinary path.
HANDOFF: beta.15's START HERE is struck; the beta.16 section records the chip, the beta.15 train's merges (#277 and #278
were opened from the pushed branches, so their squash titles are GitHub's defaults; the content is the gated stack's)
and three traps - a session restart that empties gpg-agent's cache before a tag, a strict linear main that makes every
stacked PR rebase and re-run CI, and a desktop app that wakes the session on a red PR but never on a green one. Item 12
is marked passed in the owner-only list; no item is added.

tools/release-notes.ps1 -Version 0.1.0-beta.16 extracts the section (860 characters); accuracy-check is green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 14:00:20 +07:00
poli0981andClaude Opus 5.5 91c185f71d test(e2e): the suites whose host resolves its target by name consent to a run-unique copy of the harness (beta.16, the beta.15 chip)
#269's first CI run lost AgentEndToEndTests.AConsentedBoundedCaptureLandsAsOneHookedRowInTheScratchLedger: exit 6,
TargetAmbiguous - "hook-harness.exe: 1 process(es) with that name could not be read (pid 3684: Only part of a
ReadProcessMemory or WriteProcessMemory request was completed.)". build.ps1 runs the test projects as parallel processes;
another project's hook-harness.exe was still starting (its module list a partial copy), and TargetResolver must count an
unreadable process of the consented executable's NAME. The refusal is right; the suites sharing one name was not. The
[Collection("agent-harness")] only serialises classes inside Agent.Tests.

- AgentEndToEndTests, PartialRecoveryEndToEndTests and CaptureHostEndToEndTests consent to
  hook-harness-<their scratch directory>.exe, a copy of the staged harness beside their data, as PipeEndToEndTests
  already did: StageTarget copies it once per test and registers the directory with HarnessOverlayLogSweep, so its
  overlay logs leave with the run. TargetResolver, the guard and every product rule are unchanged.
- The self-constraint tests pin the copy to the staged hook-harness.exe byte for byte (and the staged one to the test
  binary's directory), so the suites still inject into nothing but our own harness.
- AnotherHookHarnessRunningBesideTheSuiteDoesNotMakeTheTargetAmbiguous runs a second harness beside the capture. Measured
  against the old shared name: "session: TargetAmbiguous", red; green now.
- Suites that attach by pid (ShmDrainIntegrationTests, the native fl_guard_test) were never exposed and keep the name.

Docs: 14_TESTING (test isolation), HANDOFF (the beta.15 trap marked fixed), CHANGELOG (development note).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:59:57 +07:00
10 changed files with 205 additions and 33 deletions

No files matched your search

+15
View File
@@ -28,6 +28,21 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
## [0.1.0-beta.16] - 2026-10-06
**The sixteenth pre-release: nothing changes in the app.** It is 0.1.0-beta.15 as the owner verified it on real hardware
the same day, with the developers' end-to-end tests made reliable. The same unsigned installer: verify its hash against
`SHA256SUMS.txt`, then *More info → Run anyway*.
**Updating from `0.1.0-beta.15`:** Help ▸ Check for updates, then *Restart to update* with no game running. Nothing in
the database changes and nothing is shown again for you to accept; sessions already stored keep their status.
### Fixed
- **Development: the Agent's and the capture host's end-to-end tests no longer fail when another test project starts
the test harness at the same moment.** Each such suite now records into a copy of the harness under a name of its
own, so the target it asks for is never ambiguous (`14_TESTING`). Nothing in the app changes.
## [0.1.0-beta.15] - 2026-10-06
**The fifteenth pre-release: a quick restart recorded, an anti-cheat check that stays on the game's own programs, a
+1 -1
View File
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
page lists them in plain words; each item links to the document that has the details.
*Beta software: this page describes version 0.1.0-beta.15.*
*Beta software: this page describes version 0.1.0-beta.16.*
## Games it will not measure
+3 -3
View File
@@ -10,7 +10,7 @@ anti-cheat, and look after your data, a page each. What FrameLedger cannot do is
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-10-06.** The software is a beta; its latest
> **pre-release is `0.1.0-beta.15`** (2026-10-06), an unsigned installer built from that tag with its
> **pre-release is `0.1.0-beta.16`** (2026-10-06), an unsigned installer built from that tag with its
> checksums published beside it. The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
@@ -161,7 +161,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
## Install
> **The latest pre-release is `v0.1.0-beta.15` (2026-10-06); before it `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read `CHANGELOG.md`'s section for the one you install — what it measures, what it does not yet, and how to update — before installing. A source build is `docs/12_BUILD.md`.
> **The latest pre-release is `v0.1.0-beta.16` (2026-10-06); before it `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read `CHANGELOG.md`'s section for the one you install — what it measures, what it does not yet, and how to update — before installing. A source build is `docs/12_BUILD.md`.
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
@@ -208,4 +208,4 @@ GPU telemetry is layered so the project never depends on a proprietary vendor li
---
**Status:** pre-release (beta). Fifteen tagged pre-releases so far; see `CHANGELOG.md` for what each one changed and the accuracy block at the top of this file for what is and is not measured. It is not feature-complete, it certainly still has bugs, and `legal/DISCLAIMER.md` §0 says what that means for you.
**Status:** pre-release (beta). Sixteen tagged pre-releases so far; see `CHANGELOG.md` for what each one changed and the accuracy block at the top of this file for what is and is not measured. It is not feature-complete, it certainly still has bugs, and `legal/DISCLAIMER.md` §0 says what that means for you.
+10
View File
@@ -87,6 +87,16 @@ own work item on the STA thread and puts back — and with the keys a parameter,
caused when its run ends, and `tools/test-artifacts-check.ps1` fails the gate for one left behind
(`17_HOOK_ENGINE` §Native logging, 2026-09-15). A new native test binary that starts the harness needs the listener;
a managed test project that stages it gets the sweep from `FrameLedger.DrainFixtures.targets`.
- **Test isolation: a suite whose host resolves its target BY NAME consents to a run-unique copy of the harness**
(beta.16). `build.ps1` runs the test projects as parallel processes, and `TargetResolver` counts every process of the
consented executable's name — an unreadable one too, which is what a `hook-harness.exe` another project is still
starting is (its module list a partial copy). #269's first CI run lost `AgentEndToEndTests` that way:
`TargetAmbiguous`, exit 6. `AgentEndToEndTests`, `PartialRecoveryEndToEndTests` and `CaptureHostEndToEndTests` now copy
the staged harness to `hook-harness-<their scratch directory>.exe` beside their data, as `PipeEndToEndTests` already
did, register that directory with the sweep, and pin the copy to the staged harness byte for byte;
`AnotherHookHarnessRunningBesideTheSuiteDoesNotMakeTheTargetAmbiguous` runs a second harness beside the capture (red
against the shared name: `TargetAmbiguous`). A suite that attaches by pid (`ShmDrainIntegrationTests`, the native
`fl_guard_test`) is not exposed and keeps the staged name.
- Guard integration: harness loads a **dummy DLL named like an anti-cheat module** → injection refused pre-launch; loaded late → safety unhook. (A renamed harmless DLL, not real anti-cheat software.)
## Hook overhead measurement (NFR-1, per release)
+33 -3
View File
@@ -1970,7 +1970,7 @@ PR-7 the metrics' Agent half (schema 0019), PR-8 their App half, PR-9 the releas
**Owner-only, added to the list below:** item 11.
## **START HERE** — 2026-10-06, the beta.15 train: the five chips beta.14 left
## ~~**START HERE**~~ — 2026-10-06, the beta.15 train: the five chips beta.14 left *(struck the same day: the head is §beta.16 below)*
*Status is `CHANGELOG.md` `[0.1.0-beta.15]`; this is what no other file carries. The owner's request (2026-10-06): "Xong
beta14, tổng hợp 5 chip thành 1 bản beta15" — the five findings the beta.14 train spawned as tasks instead of fixing in
@@ -2006,10 +2006,39 @@ during finalize, PR-4 the scan set's creation times (D51), PR-5 the App's viewer
- **An Agent end-to-end test can lose to another project's harness**: `build.ps1` runs the test projects as parallel
processes, and a `hook-harness.exe` another project was still starting made `TargetResolver` refuse with
`TargetAmbiguous` (#269's first CI run; the re-run passed). The refusal is right and the test isolation is not — left
as a task, not fixed in this train.
as a task, not fixed in this train. *(Fixed in beta.16: the by-name suites consent to a run-unique copy of the
harness — `14_TESTING` §hook-harness, test isolation.)*
**Owner-only, added to the list below:** item 12.
## **START HERE** — 2026-10-06, 0.1.0-beta.16: beta.15 verified, and the chip it left
*Status is `CHANGELOG.md` `[0.1.0-beta.16]`; this is what no other file carries. The owner, after beta.15's release
(2026-10-06): owner-only item 12 passed on real hardware ("đã chạy và ok"), do the chip beta.15 left, release, and close
the session. One PR carries the test isolation and the release. Nothing in the app changed, so no owner-only item is
added.*
- **The chip:** a suite whose host resolves its target BY NAME (`TargetResolver`) — the Agent's end-to-end and
partial-recovery suites, the capture host's — consents to a run-unique copy of the harness, as the pipe suite already
did, so another project's `hook-harness.exe` starting at the same moment can no longer make the target ambiguous
(`14_TESTING` §hook-harness). `AnotherHookHarnessRunningBesideTheSuiteDoesNotMakeTheTargetAmbiguous` runs a second
harness beside the capture and was red against the shared name (`TargetAmbiguous`), measured before the fix.
- **The beta.15 train's merges, for the record:** #274–#276 and #279 carry the PRs' own titles; #277 (PR-4, the scan
set, D51) and #278 (PR-5, the viewer, D52) were opened by the owner from the pushed branches, so their squash commits
are titled "Beta15/pr4 guard" and "Beta15/pr5 viewer" and list every commit of the branch. Their content is the gated
stack's: main's tree matched it after each merge.
**Traps met on the way:**
- **A session restart restarts gpg-agent**, so the first signature after it asks for the passphrase again, whatever the
cache said a minute before; pinentry-qt gives up in about half a minute with nobody at the desk (`git tag -s` failed
with "signing failed: Timeout"). Ask the owner for `echo x | gpg --clearsign` right before a tag.
- **main is strict and linear**: each PR of a stack must be rebased onto the squash of the one before and run CI again.
`git rebase --update-refs --onto origin/main <merged branch> <tip>` moves every branch of the stack at once and drops
a commit main already carries (it dropped PR-4 and PR-5 when the owner had merged them from the branches).
- **The desktop app forbids polling CI** (no `gh` loop, Monitor or ScheduleWakeup): it wakes the session on a failure, a
conflict or a review comment, never on green, so a green PR waits for the owner's word or the owner's auto-merge.
## Owner-only — no PR can close these
1. **§S23-2 — branch protection.** `Rules / validate` is not a required status check on
@@ -2086,7 +2115,8 @@ during finalize, PR-4 the scan set's creation times (D51), PR-5 the App's viewer
against the DLSS mode, the clocks, fan and limits. (h) The `ja` strings marked `review`. (i) **The Privacy Policy 2.7
wording — before PR-5 and PR-7 merge.**
12. **beta.15 on real hardware.** (a) **The update from beta.14:** Help ▸ Check for updates, then *Restart to update*
12. ~~**beta.15 on real hardware.**~~ **Passed 2026-10-06** — the owner ran it on real hardware and reported it OK ("đã
chạy và ok"). *(The item as written:)* (a) **The update from beta.14:** Help ▸ Check for updates, then *Restart to update*
with no game running — the first update in which beta.14's own step stops the Agent before Velopack applies; the
`velopack:` lines in `ui-*.log` say what was downloaded. (b) **A quick restart:** close a hooked game and start it again
within a few seconds; both sessions are recorded. (c) **A change of language:** English ↔ Tiếng Việt in Settings; the
+1 -1
View File
@@ -12,7 +12,7 @@
HTML comments are not part of the block.
-->
> ⚠ **What FrameLedger actually measures today — 2026-10-06.** The software is a beta; its latest
> **pre-release is `0.1.0-beta.15`** (2026-10-06), an unsigned installer built from that tag with its
> **pre-release is `0.1.0-beta.16`** (2026-10-06), an unsigned installer built from that tag with its
> checksums published beside it. The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
+1 -1
View File
@@ -114,7 +114,7 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-10-06.** The software is a beta; its latest
> **pre-release is `0.1.0-beta.15`** (2026-10-06), an unsigned installer built from that tag with its
> **pre-release is `0.1.0-beta.16`** (2026-10-06), an unsigned installer built from that tag with its
> checksums published beside it. The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
@@ -11,6 +11,7 @@ using FrameLedger.Domain.Consent;
using FrameLedger.Domain.Sessions;
using FrameLedger.Infrastructure.Persistence;
using FrameLedger.Infrastructure.Settings;
using FrameLedger.Testing;
namespace FrameLedger.Agent.Tests;
@@ -45,11 +46,17 @@ public sealed class AgentEndToEndTests : IDisposable
private static string Agent => Path.Combine(AppContext.BaseDirectory, "FrameLedger.Agent.exe");
/// <summary>The ONE executable this suite may write a consent record for.</summary>
private static string ConsentedExecutable => Harness;
private readonly string _dataDir = Path.Combine(Path.GetTempPath(), "fl-agent-e2e-" + Guid.NewGuid().ToString("N"));
/// <summary>
/// The ONE executable this suite may write a consent record for: our harness, copied under a run-unique name
/// (beta.16). The Agent resolves its target BY NAME (<c>TargetResolver</c>), and <c>build.ps1</c> runs the test projects as
/// parallel processes: a <c>hook-harness.exe</c> another project was still starting - its module list a partial copy -
/// is an unreadable process of the same name, which the resolver must count, and it refused <c>TargetAmbiguous</c>
/// (#269's first CI run). No other test starts a process of this name.
/// </summary>
private string ConsentedExecutable => Path.Combine(_dataDir, "hook-harness-" + Path.GetFileName(_dataDir) + ".exe");
private string Ledger => Path.Combine(_dataDir, LedgerPaths.DatabaseFileName);
public void Dispose()
@@ -66,13 +73,35 @@ public sealed class AgentEndToEndTests : IDisposable
[Fact]
public void TheTargetAndTheConsentRecordAreBothOurOwnHarness()
{
Path.GetFileName(ConsentedExecutable).Should().Be("hook-harness.exe");
Path.GetDirectoryName(ConsentedExecutable).Should().Be(AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar));
StageTarget();
Path.GetFileName(Harness).Should().Be("hook-harness.exe");
Path.GetDirectoryName(Harness).Should().Be(AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar));
Path.GetFileName(ConsentedExecutable).Should().StartWith("hook-harness-");
Path.GetDirectoryName(ConsentedExecutable).Should().Be(_dataDir, "the copy lives in this run's scratch directory and nowhere else");
File.ReadAllBytes(ConsentedExecutable).Should().Equal(File.ReadAllBytes(Harness), "the target IS hook-harness, byte for byte, under another name");
Path.GetFileName(Agent).Should().Be("FrameLedger.Agent.exe");
}
/// <summary>This run's copy of hook-harness, once per test; its overlay logs are this assembly's to remove (<c>17_HOOK_ENGINE</c> §Native logging).</summary>
private void StageTarget()
{
if (File.Exists(ConsentedExecutable))
{
return;
}
File.Exists(Harness).Should().BeTrue(
"hook-harness.exe must be staged beside the test binary (FrameLedger.DrainFixtures.targets). "
+ "This FAILS rather than skipping: an integration test that quietly does nothing when its fixture "
+ "is absent is a gate that cannot fail.");
Directory.CreateDirectory(_dataDir);
HarnessOverlayLogSweep.Own(_dataDir);
File.Copy(Harness, ConsentedExecutable);
}
private async Task<ConsentWriteOutcome> GrantConsentAsync()
{
StageTarget();
ExecutableFingerprint fingerprint = FrameLedger.Infrastructure.Io.ExecutableIdentity.Read(ConsentedExecutable)!.Value;
Directory.CreateDirectory(_dataDir);
LedgerDatabase db = await LedgerDatabase.OpenAsync(Ledger, ct: TestContext.Current.CancellationToken).ConfigureAwait(false);
@@ -98,11 +127,11 @@ public sealed class AgentEndToEndTests : IDisposable
}
}
private static Process StartHarness(string arguments)
private Process StartHarness(string arguments)
{
File.Exists(Harness).Should().BeTrue("hook-harness.exe must be staged beside the test binary (FrameLedger.DrainFixtures.targets); this FAILS rather than skipping");
StageTarget();
File.Exists(Agent).Should().BeTrue("the Agent must be built and copied beside this test");
var p = Process.Start(new ProcessStartInfo(Harness, arguments) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true })!;
var p = Process.Start(new ProcessStartInfo(ConsentedExecutable, arguments) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true })!;
Thread.Sleep(800);
p.HasExited.Should().BeFalse("the harness must be running before the Agent looks for it");
return p;
@@ -215,9 +244,38 @@ public sealed class AgentEndToEndTests : IDisposable
}
}
/// <summary>
/// beta.16: the collision #269's first CI run hit. Another hook-harness.exe running beside this suite's run - another
/// test project's, or one left over - shares neither the copy's name nor its path, so the Agent's resolver never counts
/// it. Until beta.16 this suite consented to the staged hook-harness.exe itself, and a second one was a second match:
/// TargetAmbiguous, exit 6.
/// </summary>
[Fact]
public async Task AnotherHookHarnessRunningBesideTheSuiteDoesNotMakeTheTargetAmbiguous()
{
(await GrantConsentAsync()).Should().Be(ConsentWriteOutcome.Written);
Process stranger = Process.Start(new ProcessStartInfo(Harness, "--real --hold-presenting 30") { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true })!;
Process harness = StartHarness("--real --hold-presenting 30");
try
{
using Process agent = StartAgent("capture", "--exe", ConsentedExecutable, "--seconds", "3");
(string output, int exit) = await FinishAsync(agent);
exit.Should().Be(0, output);
output.Should().Contain("SAVED as sessions.id=", output);
output.Should().NotContain("TargetAmbiguous", output);
}
finally
{
Kill(harness);
Kill(stranger);
}
}
[Fact]
public async Task ConsentGrantRefusesRedirectedStdinAndWritesNothing()
{
StageTarget();
using Process agent = StartAgent("consent", "grant", "--exe", ConsentedExecutable);
(string output, int exit) = await FinishAsync(agent);
@@ -10,6 +10,7 @@ using FrameLedger.Domain.Consent;
using FrameLedger.Domain.Sessions;
using FrameLedger.Infrastructure.Persistence;
using FrameLedger.Infrastructure.Recording;
using FrameLedger.Testing;
namespace FrameLedger.Agent.Tests;
@@ -48,11 +49,17 @@ public sealed class PartialRecoveryEndToEndTests : IDisposable
private static string Agent => Path.Combine(AppContext.BaseDirectory, "FrameLedger.Agent.exe");
/// <summary>The ONE executable this suite may write a consent record for.</summary>
private static string ConsentedExecutable => Harness;
private readonly string _dataDir = Path.Combine(Path.GetTempPath(), "fl-agent-recover-" + Guid.NewGuid().ToString("N"));
/// <summary>
/// The ONE executable this suite may write a consent record for: our harness, copied under a run-unique name
/// (beta.16). The Agent resolves its target BY NAME (<c>TargetResolver</c>), and <c>build.ps1</c> runs the test projects as
/// parallel processes: a <c>hook-harness.exe</c> another project was still starting - its module list a partial copy -
/// is an unreadable process of the same name, which the resolver must count, and it refused <c>TargetAmbiguous</c>
/// (#269's first CI run). No other test starts a process of this name.
/// </summary>
private string ConsentedExecutable => Path.Combine(_dataDir, "hook-harness-" + Path.GetFileName(_dataDir) + ".exe");
private string Ledger => Path.Combine(_dataDir, LedgerPaths.DatabaseFileName);
private string PartialDirectory => Path.Combine(_dataDir, "tmp");
@@ -70,7 +77,10 @@ public sealed class PartialRecoveryEndToEndTests : IDisposable
private async Task GrantConsentAsync()
{
Path.GetFileName(ConsentedExecutable).Should().Be("hook-harness.exe", "this suite injects into nothing else");
StageTarget();
byte[] target = await File.ReadAllBytesAsync(ConsentedExecutable, TestContext.Current.CancellationToken).ConfigureAwait(false);
byte[] harness = await File.ReadAllBytesAsync(Harness, TestContext.Current.CancellationToken).ConfigureAwait(false);
target.Should().Equal(harness, "this suite injects into nothing but hook-harness, under a run-unique name");
ExecutableFingerprint fingerprint = FrameLedger.Infrastructure.Io.ExecutableIdentity.Read(ConsentedExecutable)!.Value;
Directory.CreateDirectory(_dataDir);
LedgerDatabase db = await LedgerDatabase.OpenAsync(Ledger, ct: TestContext.Current.CancellationToken).ConfigureAwait(false);
@@ -102,13 +112,27 @@ public sealed class PartialRecoveryEndToEndTests : IDisposable
return Process.Start(psi)!;
}
private static Process StartHarness(string arguments)
/// <summary>This run's copy of hook-harness, once per test; its overlay logs are this assembly's to remove (<c>17_HOOK_ENGINE</c> §Native logging).</summary>
private void StageTarget()
{
if (File.Exists(ConsentedExecutable))
{
return;
}
File.Exists(Harness).Should().BeTrue(
"hook-harness.exe must be staged beside the test binary (FrameLedger.DrainFixtures.targets). "
+ "This FAILS rather than skipping: an integration test that quietly does nothing when its fixture "
+ "is absent is a gate that cannot fail.");
var p = Process.Start(new ProcessStartInfo(Harness, arguments) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true })!;
Directory.CreateDirectory(_dataDir);
HarnessOverlayLogSweep.Own(_dataDir);
File.Copy(Harness, ConsentedExecutable);
}
private Process StartHarness(string arguments)
{
StageTarget();
var p = Process.Start(new ProcessStartInfo(ConsentedExecutable, arguments) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true })!;
Thread.Sleep(800);
p.HasExited.Should().BeFalse("the harness must be running before the Agent looks for it");
return p;
@@ -13,6 +13,7 @@ using FrameLedger.Domain.Sessions;
using FrameLedger.Infrastructure.Persistence;
using FrameLedger.Infrastructure.Recording;
using FrameLedger.Shared;
using FrameLedger.Testing;
namespace FrameLedger.CaptureHost.Tests;
@@ -52,22 +53,30 @@ public sealed class CaptureHostEndToEndTests : IDisposable
private static string Host => Path.Combine(AppContext.BaseDirectory, "FrameLedger.CaptureHost.exe");
/// <summary>This test's scratch directory: the harness copy it consents to, and nothing else.</summary>
private readonly string _scratch = Path.Combine(Path.GetTempPath(), "fl-capturehost-e2e-" + Guid.NewGuid().ToString("N"));
/// <summary>
/// The ONE executable this suite may write a consent record for.
/// The ONE executable this suite may write a consent record for: our harness, copied under a run-unique name
/// (beta.16). The host resolves its target BY NAME (<c>TargetResolver</c>), and <c>build.ps1</c> runs the test projects as
/// parallel processes: a <c>hook-harness.exe</c> another project was still starting - its module list a partial copy -
/// is an unreadable process of the same name, which the resolver must count, and it refused <c>TargetAmbiguous</c>
/// (#269's first CI run). No other test starts a process of this name.
/// </summary>
/// <remarks>
/// Every write goes through here, so "which binary did the suite consent to?" has
/// one answer and one place to change it — and changing it is what the assertion
/// below turns red.
/// </remarks>
private static string ConsentedExecutable => Harness;
private string ConsentedExecutable => Path.Combine(_scratch, "hook-harness-" + Path.GetFileName(_scratch) + ".exe");
/// <summary>The host's own ledger, beside its binary (P2 PR-B): the same SQLite adapter the Agent will use.</summary>
private static string HostLedger => Path.Combine(Path.GetDirectoryName(Host)!, LedgerPaths.DatabaseFileName);
/// <summary>Writes the ONE consent record this suite may write, through the real store, and closes the ledger again.</summary>
private static async Task<ConsentWriteOutcome> GrantConsentAsync()
private async Task<ConsentWriteOutcome> GrantConsentAsync()
{
StageTarget();
ExecutableFingerprint fingerprint = FrameLedger.Infrastructure.Io.ExecutableIdentity.Read(ConsentedExecutable)!.Value;
LedgerDatabase db = await LedgerDatabase.OpenAsync(HostLedger, ct: TestContext.Current.CancellationToken).ConfigureAwait(false);
await using (db.ConfigureAwait(false))
@@ -81,7 +90,7 @@ public sealed class CaptureHostEndToEndTests : IDisposable
}
}
private static async Task<GameConsentRecord> FindConsentAsync()
private async Task<GameConsentRecord> FindConsentAsync()
{
LedgerDatabase db = await LedgerDatabase.OpenAsync(HostLedger, ct: TestContext.Current.CancellationToken).ConfigureAwait(false);
await using (db.ConfigureAwait(false))
@@ -122,26 +131,52 @@ public sealed class CaptureHostEndToEndTests : IDisposable
// output directory. Leaving a consent record there would make the NEXT run of the refusal case
// pass for the wrong reason.
DeleteHostLedger();
try
{
Directory.Delete(_scratch, recursive: true);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
// A harness this test killed may still hold its image for a moment; the directory is the temp folder's.
}
}
[Fact]
public void TheTargetAndTheConsentRecordAreBothOurOwnHarness()
{
Path.GetFileName(ConsentedExecutable).Should().Be("hook-harness.exe");
Path.GetDirectoryName(ConsentedExecutable).Should().Be(
StageTarget();
Path.GetFileName(Harness).Should().Be("hook-harness.exe");
Path.GetDirectoryName(Harness).Should().Be(
AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar));
Path.GetFileName(ConsentedExecutable).Should().StartWith("hook-harness-");
Path.GetDirectoryName(ConsentedExecutable).Should().Be(_scratch, "the copy lives in this test's scratch directory and nowhere else");
File.ReadAllBytes(ConsentedExecutable).Should().Equal(File.ReadAllBytes(Harness), "the target IS hook-harness, byte for byte, under another name");
Path.GetFileName(Host).Should().Be("FrameLedger.CaptureHost.exe");
}
private static Process StartHarness(string arguments)
/// <summary>This run's copy of hook-harness, once per test; its overlay logs are this assembly's to remove (<c>17_HOOK_ENGINE</c> §Native logging).</summary>
private void StageTarget()
{
if (File.Exists(ConsentedExecutable))
{
return;
}
File.Exists(Harness).Should().BeTrue(
"hook-harness.exe must be staged beside the test binary (FrameLedger.DrainFixtures.targets). "
+ "This FAILS rather than skipping: an integration test that quietly does nothing when its "
+ "fixture is absent is a gate that cannot fail.");
+ "This FAILS rather than skipping: an integration test that quietly does nothing when its fixture "
+ "is absent is a gate that cannot fail.");
Directory.CreateDirectory(_scratch);
HarnessOverlayLogSweep.Own(_scratch);
File.Copy(Harness, ConsentedExecutable);
}
private Process StartHarness(string arguments)
{
StageTarget();
File.Exists(Host).Should().BeTrue("the host must be built and copied beside this test");
var p = Process.Start(new ProcessStartInfo(Harness, arguments)
var p = Process.Start(new ProcessStartInfo(ConsentedExecutable, arguments)
{
UseShellExecute = false,
CreateNoWindow = true,