Commit Graph
6 Commits
Author SHA1 Message Date
poli0981andClaude Fable 5.2 1342979353 ci: Qodana - JetBrains' code analysis from a workflow of its own, and what its first run reported settled (D93) (#373)
* ci: Qodana - a workflow of its own from JetBrains' template, Qodana Community for .NET over FrameLedger.slnx (D93)

The first run: the linter in its Linux container, EnableWindowsTargeting passed
to it, no quality gate yet - what it builds and what it reports decides the rest.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* ci: Qodana's gate is zero problems, and the inspections this project argues with are off in .editorconfig, each with its reason (D93)

Pushed before the fixes on purpose: the run this starts has the settings and
none of the fixes, so it shows the gate failing on what is left.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: what Qodana's first run reported, settled - about 400 fixes in 181 files, none changing behaviour; the documents (D93)

Redundant qualifiers, casts, using directives, nullable suppressions and unsafe
modifiers removed from the report's own positions; var for built-in types and
one-line block bodies brought to .editorconfig's style by dotnet format; every
XAML item template names its DataType and a binding that reached its page through
DataContext.ViewModel names the page's type; two unread fields, two overwritten
initialisers and an unused parameter removed; SpokenTextAutomationPeer no longer
assumes the base peer's name is a string.

docs/13_CI_CD.md §Qodana, CLAUDE.md, the wiki's workflow table, HANDOFF's
decisions index (D93) and the changelog entry.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 16:13:04 +00:00
poli0981andClaude Opus 5.5 ff949afc6f feat(legal): NOTICE with the GPLv3 section 7 additional terms, the licence header in every source file, and the documents for people who build, contribute or redistribute (D45, beta.12 PR-1) (#253)
- NOTICE: copyright, GPL-3.0-only, and three additional terms of the kinds section 7 permits - (b) preserve the
  notices and the attribution in the program's legal notices, (c) mark a modified version as different and do not
  call it "FrameLedger" alone, (e) no trademark rights in the name. Shipped as licenses\NOTICE.txt; release.yml
  refuses a published tree without it.
- Section 7 wants additional terms named in the source files: every first-party .cs .cpp .h .inl .ps1 .xaml file
  (1,053; src/native/third_party excluded) opens with the SPDX line and a pointer to NOTICE. tools/notice-check.ps1
  is the gate (six self-test cases, both directions; -Fix writes a missing header) and tools/resx-gen.ps1 generates
  the string accessors with the header.
- The native VERSIONINFO LegalCopyright said GPL-3.0-or-later; it now names the real licence.
- CONTRIBUTING.md, FORKING.md, CODE_OF_CONDUCT.md (Contributor Covenant 2.1 by reference), legal/TRADEMARKS.md.
- 12_BUILD gate list, CLAUDE.md layout and conventions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:16:00 +07:00
poli0981andClaude Opus 5.5 7ad1519a4c feat: run the capture agent as administrator - an option off by default, a disclosure, and a UAC prompt at every agent start; games stay standard-user (D34, beta.10) (#244)
* feat: run the capture agent as administrator - an option off by default, a disclosure, and a UAC prompt at every agent start; games stay standard-user (D34, beta.10)

The owner asked for a Settings option, off by default, to let the Agent run with administrator rights. Owner decision D34
(2026-09-27): Windows is asked at EVERY Agent start - by the App, or by the logon task's Agent - with no silent path, and
games started from an elevated Agent must not run elevated.

- Setting capture.run_elevated (registry, Agent-read), read BEFORE the Agent exists by Infrastructure.Startup's
  RunElevatedSetting: one row, PRAGMA query_only, no version gate (the first start after an update meets an older
  schema), anything but "1" is off.
- App: AgentLauncher asks through a UAC prompt owned by the main window (ShellHost.Handle) and starts the Agent with
  --serve --for-user <SID>; declined or failed, it starts the standard user's Agent with --elevation <outcome>; an
  elevated Agent that exits 11 (another account answered) makes it start standard-user Agents until the App restarts.
  With the option off and the App elevated, the Agent gets the desktop shell's token. The connection shows
  AgentConnectionState.Elevating while the prompt waits.
- Agent: --serve takes at most one of --for-user <SID> (refuses to run as another account: exit 11, before anything is
  claimed or written) or --elevation declined|other-account|failed. A plain --serve with the option on and no elevation
  (the logon task's) holds the folder's ElevationMarker, asks Windows once (taskbar prompt), and hands over to the
  elevated Agent once it has claimed the folder - or serves as before and says why. HelloAck.ElevationOutcome carries
  the answer; an elevated Agent logs its enabled privileges.
- Games: ProcessLauncher in an elevated Agent starts the game with the shell's token (UnelevatedProcess: GetShellWindow,
  the token duplicated, CreateProcessWithTokenW, the kill switch's explicit environment) and refuses with error 1400
  rather than start it elevated. LaunchGame is reachable by any process of the user; an elevated launch would be a
  silent elevation.
- Locks: the ledger's migration lock is a SharedMutex with a stated DACL (owner the user; user, Administrators, SYSTEM),
  so an elevated creator no longer locks the unelevated App out; the elevation marker keeps two prompts from racing.
- Privileges: nothing enables one. TokenPrivileges reads them; chokepoint-check forbids AdjustTokenPrivileges,
  RtlAdjustPrivilege, EnterDebugMode and SeDebugPrivilege under src/ (canary checked); PrivilegeFootprintTests asserts on
  the elevated CI runner that the resolver and LibreHardwareMonitor's CPU group enable none.
- Settings: "Run the agent as administrator" with the versioned disclosure (Shared Safety_AdminMode_*, agent-admin-dialog/1;
  ja = the English pending review, vi translated), then a restart over the pipe - never under a running session - and the
  elevation line says why a standard user's Agent is one. Safety_Refused_TargetUnreadable names the mode.
- Updater: the apply also waits for the data folder's instance lock to be let go; an Agent holding it without answering
  is never updated under.
- Tests: setting reader (no ledger, no table, "1"/"0"), marker, account check, SharedMutex SDDL + wait/release,
  environment block, shell-token start (elevated runs only), privilege footprint, CLI surface, Settings toggle
  (declined writes nothing; accepted writes, stops, retries; a running session defers), elevation words, Elevating pill,
  launcher marker, updater held-folder cases.
- Docs: 01_ARCHITECTURE ADR-9, 19_SAFETY elevated targets, 20_OPEN_QUESTIONS G (closed: chosen, not inherited),
  06_DATA_MODEL settings, 02_SPEC FR-10, 12_BUILD flags, 07_IPC (HelloAck, prompts, stated DACLs), 08_UI Settings,
  11_UPDATER, 18_GPU_VENDOR_APIS, 04_CAPTURE launch; CHANGELOG.

No hook-path change: the Overlay is untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: the admin mode's two tests as the hosted runner measured them - a variable keeps the process's own name casing, and the runner's token arrives with SeDebugPrivilege on

CI on #244 (run 36332900944) failed two of the new tests, both on facts of the hosted runner rather than of the code:

- The environment block keeps an existing variable's own casing ("Path" there, "PATH" on the dev box) when the caller
  overrides it - Windows compares names without case, so the value replaces it rather than standing beside it. The
  test now finds the one PATH entry case-insensitively and checks its value.
- The runner's token ARRIVES with SeDebugPrivilege enabled (an administrator's service), so "nothing enabled before
  anything ran" was false there. The footprint test now asserts that nothing it runs NEWLY enables a powerful
  privilege, and names what was already on in its message.

The third failure of that run, TargetResolverTests.OneInstanceResolves (TargetNotRunning), is the hosted-runner flake
the test's own comment records from 2026-09-04; this PR does not touch the resolver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:49:16 +07:00
poli0981andClaude Fable 5.1 0fbaecb05f feat(app,agent): the tray, the Agent's maintenance flags, and the Settings buttons over them (P3 PR-8b) (#163)
The tray (H.NotifyIcon.Wpf; TrayHost over a WPF-free TrayViewModel): four drawn icons -- a
Tier-1 session runs, sessions run and none is measured, the Agent reports paused, a ring
otherwise -- with the game in the tooltip; menu Open / Pause-Resume capture (PauseCapture /
ResumeCapture, the state shown is the PauseAck's) / Agent status / Exit; a left click opens the
window. Minimize-to-tray on close is honoured through WindowClosePolicy while a tray icon exists;
Exit through ShellHost.Quit is a real exit. FR-3.8's balloon "Session saved -- game -- click to
view" is raised only while the window is off screen (the Dashboard's snackbar carries it
otherwise: one event, one channel) and its click opens the summary; a safety event is never a
balloon. Tools > Agent status... and Vulkan layer registration... navigate.

Agent flags: --install-task / --uninstall-task (Infrastructure.Startup.LogonTask: the task
\FrameLedger\FrameLedger.Agent through the Task Scheduler COM API -- schtasks /Create /SC ONLOGON
is "Access is denied" unelevated on the dev box, measured -- this user's logon trigger,
interactive token, lowest run level, --serve) and --register-vklayer / --unregister-vklayer
(Infrastructure.Vulkan.VkLayerRegistration: the HKCU ImplicitLayers DWORD named by the manifest;
register refuses while no game has hooking on; unregister also removes a stale value naming our
manifest elsewhere). HelloAck.vulkanLayerRegistered reads the key at start. --diag stays the one
flag the Agent answers "not this binary's".

Settings: Register / Unregister the layer, Register / Repair / Remove the task -- each runs the
flag as a child process (IAgentTool) and re-reads the machine (IMaintenanceState); Register is
enabled only while the layer is staged, unregistered, and a game has hooking on.

Two gaps stated in 17_HOOK_ENGINE's built note rather than implied: register/unregister on the
consent transition needs the "is Vulkan" fact (P4 capability flags), and a registration buys
nothing until background capture sets the enable variable.

Tests: App 110 (TrayViewModelTests, Settings additions), Infrastructure VkLayerRegistrationTests
(a test's own key) and LogonTaskTests (Integration, a real task under a test's own name), Agent
surface + e2e flags case. 27 App strings en/vi/ja. Docs: 08_UI, 17_HOOK_ENGINE, 12_BUILD,
HANDOFF row 8 struck, CHANGELOG.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 14:25:08 +07:00
poli0981andClaude Opus 5 9b3f5f5fb3 test(agent): kill-and-recover end to end, the FPS-impact runbook, and P2's closing sweep (P2 PR-G) (#151)
PartialRecoveryEndToEndTests is 14_TESTING's long-standing `.partial` line,
built: the shipped FrameLedger.Agent.exe captures hook-harness with the new
`--console ... --partial-flush-seconds <n>`, the test polls until a flush has
actually landed and the session is past the product's 30 s discard threshold,
Process.Kill's the Agent, and `--console recover` turns the valid prefix into
an `interrupted` row whose frame_count IS that prefix, deletes the file, and
finds nothing on a second pass.

Three things the first version got wrong, kept as comments where they bit:
the two Integration classes ran in parallel and started two harnesses of one
image, which TargetResolver correctly refused as ambiguous (they now share an
xUnit collection); PartialSessionFile.Read cannot open a file a live Agent
holds, so the test reads the bytes with FileShare.ReadWrite and calls the same
Parse; and a 2.5 s prefix was DISCARDED by recovery, correctly -- the test
waits the threshold out rather than adding a knob to shrink it.

--partial-flush-seconds is under --console only and pinned by
AgentCommandLineSurfaceTests beside the others: it bounds how often a running
session writes its own crash-recovery file and names nothing about injection.

tools/fps-impact-runbook.ps1 (dev-only, never in build.ps1 check) sequences
14_TESTING item 2's six launches -- consent granted for the ON leg, revoked
for the OFF leg, the same launch path both times so the only difference is
the injection -- reads the Agent's CPU and RSS itself, prompts for the game's
own benchmark average, and prints the spike-notes block. It does not measure
FPS and says so first: FrameLedger's frame times exist only in the hooked leg,
so they cannot be both sides of the comparison. Overlay resident size is left
unmeasured rather than guessed -- reading the target's memory is rule 4.

spike-notes §14 holds three empty slots with the exact commands (the milestone
row against a title's menus, §S1's launcher-fronted election, the FPS table)
and says in its first line that nothing in it has been run. 14_TESTING item 2
now reads "not measured" rather than nothing. HANDOFF's P2 section states what
is left -- two measurements, no code -- and gains a P3 head: the pipe (D10),
and FR-2.1's dialog, which retires ConsentProvenance.AgentConsoleOperator and
must not gain its enum member before the reviewed text exists.

Also carries what merging P2's stack measured about CI itself: THREE failures
in eight gate runs, every one a Category=Integration case, every one green on a
re-run of the identical commit, none caused by the code under review. Two were
guard scans failing -- GuardedInjectAsync(...).IsAllowed false (§S19(b)'s
fragment/signer shape) and ProcessTreeUnavailable, "could not establish the
scan set", which §S19(b) does NOT cover -- and one was ours: CaptureSessionTests
opens a real SQLite ledger, Microsoft.Data.Sqlite pools connections, and the
pooled handle on ledger.db outlived DisposeAsync, so the recursive
Directory.Delete threw IOException and xUnit blamed an unrelated test. That
fixture was the ONLY one in the repository catching just DirectoryNotFoundException
-- every sibling already catches IOException -- and it is the one holding a
database. Fixed here.

13_CI_CD and HANDOFF carry the rest as observations rather than fixes: re-run
first, and if it reproduces read the module list and the scan-set reason rather
than the test. Two traps inside that one, both recorded: ci.yml's signer probe,
the step that would name the refusing module, runs AFTER the gate, so the one
run that needed it printed nothing; and `gh run rerun --failed` rewrites the
original run's conclusion, so the run history shows those three failures as
successes and anyone measuring the flake rate from it measures zero. An earlier
draft of this PR said the refusal fires "one run in the low tens" -- written
after the first failure and wrong by the end of the same evening. Corrected in
place rather than deleted.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 08:53:28 +07:00
poli0981andClaude Opus 5 dad3adbff6 feat(agent): the Agent host -- --serve (watcher -> orchestrator -> recorder), --console verbs, the consent grant (D4) and the kill switch as the gate's fourth input (D7) (P2 PR-F) (#150)
FrameLedger.Agent is a Generic Host now. Composition.AgentServices registers
every Application port to its one shipped Infrastructure adapter;
WatcherHostedService runs PartialRecovery first and then
Application.Watch.CaptureOrchestrator: one process snapshot per second
(ToolhelpProcessSnapshotSource), ProcessWatcher (exact normalised path, or
the file name when exactly one games row carries it -> StalePath, keyed on
the real path), ProcessTree (a child that started before its parent is a
reused pid), DescendantElection (the newest tracked descendant; a launcher's
consent does not extend to what it spawns), ONE session per game at a time
through the new ISessionRecorder port. The orchestrator decides nothing
about hooking: the recorder's loop reaches HookedCaptureGate as a console
verb does.

--console carries consent list|grant|revoke, capture, launch (with the
election after LaunchTargetExited / LaunchNoPresentationRuntime), recover,
sessions, db path, games add, killswitch on|off|status, and --data-dir under
--console only (decision D6). --diag, --install-task, --uninstall-task,
--register-vklayer, --unregister-vklayer answer "not implemented in P2",
exit 2. The surface is pinned by AgentCommandLineSurfaceTests.

D4: Agent --console consent grant shows OperatorDisclosure (moved to
Application.Consent; one text, an OperatorSurface for the first line and the
stamp), refuses redirected stdin, and records the new
ConsentProvenance.AgentConsoleOperator with the Agent's clock.
OperatorAcknowledgement carries its provenance; SqliteGameConsentStore
writes that name and refuses NotRecorded.

D7: FR-2.4 is HookRequest.FromConsent's fourth input --
AntiCheatRefusalReason.KillSwitchEngaged (27, added to the native reason
table so GuardMirrorTests holds), checked before consent is read. IKillSwitch
(Infrastructure.Settings.SettingsKillSwitch over settings.hooking.kill_switch)
is read by CaptureSession before the request and at every guard-scan
boundary, where an engaged switch publishes unhookRequested and ends the
session as KillSwitchEngaged (RefusedKillSwitch when refused up front).
ProcessLauncher(enableVulkanLayer: false) keeps the Vulkan layer off by never
setting FRAMELEDGER_ENABLE_VK_LAYER. A bounded --console capture --seconds N
lowers the discard threshold to N.

Tests: AgentEndToEndTests (Integration, in the gate) runs the shipped
FrameLedger.Agent.exe against hook-harness with a scratch ledger and reads
back ONE hooked sessions row -- the milestone's technical half -- plus the
kill-switch refusal with no ring in the target, consent grant refusing
redirected stdin, the unbuilt flags' exit 2. ProcessWatcherTests,
ProcessTreeAndElectionTests, CaptureOrchestratorTests,
ToolhelpProcessSnapshotSourceTests, SettingsKillSwitchTests, the gate's
kill-switch case, the loop's mid-session case, the store's provenance
round-trip; GameConsentRecordTests pins three provenance names.

Docs: 04_CAPTURE (watcher built, election, threading row), 12_BUILD (the
surface), 07_IPC (pipe is P3), 19_SAFETY (D4/D7 built), 20_OPEN_QUESTIONS
(S27 restated for PR-F, S24 answers, G Agent lifecycle), 01_ARCHITECTURE,
06_DATA_MODEL (third provenance, settings key), 15_ROADMAP (milestone's
technical half), CLAUDE.md, HANDOFF (D4/D7 built, two traps), CHANGELOG.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 08:43:06 +07:00