Skip to content

Active page files: list the kernel's live page files in the commit status line - #174

Merged
jamesabel merged 2 commits into
masterfrom
active-pagefiles
Sep 29, 2026
Merged

jamesabel merged 2 commits into
masterfrom
active-pagefiles

Conversation

@jamesabel

Copy link
Copy Markdown
Owner

Summary

  • New reader commit_memory.active_pagefiles() -> list[PageFileUsage] (path, total/in-use/peak bytes, percent), read from NtQuerySystemInformation(SystemPageFileInformation) (what Task Manager and Win32_PageFileUsage use, ~50 µs, no privilege/dependency/subprocess). Same fail-open contract as the two existing readers: [] off Windows and on any error, logged once.
  • Buffer parsing lives in parse_pagefile_information(buffer, page_size) with fixed-width ctypes structs, so it is unit-tested on every platform without touching the kernel.
  • System metrics window: the commit status line now lists every active page file with live size and use, e.g. Pagefile: C:\pagefile.sys 0.6/26.6 GB (2%) system-managed · V:\pagefile.sys 0.1/128.0 GB (0%) (total 154.6 GB). Refreshed every tick. The system-managed suffix comes from the registry breakdown (a ?: entry matches the system drive). When the kernel read returns [] the line is exactly the previous registry-based text.
  • Why: the registry PagingFiles value is the boot-time configuration only. It misses a page file activated after boot with NtCreatePagingFile and records system-managed files as ?:\pagefile.sys 0 0, so the old line could omit a file and show no size. On this machine the old line showed one file; the kernel reports two.
  • Spec checked in as docs/pytest-fly-active-pagefiles-spec.md. pagefile_breakdown() and its callers/tests are untouched. Admission gate and resource guard unchanged.
  • Version 0.10.5 -> 0.10.6.

Tests

  • tests/test_commit_memory.py: parser on a two-entry and a one-entry buffer built with the ctypes structs (chain walk, \??\ stripped, pages -> bytes), percent with a zero total, non-Windows returns [] with no warning, Windows fail-open (invalid information class -> [] twice, one warning), and a live Windows read.
  • tests/test_gui_widgets.py: status line names each active file with its use and the system-managed flag; with the reader patched to [] the line matches the old text (with and without a sample, and with no configured files).
  • Ran the commit-memory, GUI widget, system monitor, main app, admission gate and resource guard tests locally (all pass); ruff check/format clean; ty check src diagnostics unchanged from master.

🤖 Generated with Claude Code

jamesabel and others added 2 commits September 28, 2026 21:05
…atus line

Add commit_memory.active_pagefiles() (NtQuerySystemInformation /
SystemPageFileInformation): every page file the kernel has active right now with
its live size, use and peak, in bytes, with the same fail-open contract as
commit_charge_and_limit / pagefile_breakdown. The registry's PagingFiles value only
holds the boot-time configuration: it misses a file activated after boot
(NtCreatePagingFile) and records system-managed files with no size.

The System metrics window's commit status line now names each active file with its
live use (refreshed every tick; the read is ~50 us), flags the registry's
system-managed file, and totals the parts; it falls back to the previous
registry-based text when the kernel read is unavailable. Parser kept separate
(parse_pagefile_information) and struct-tested on every platform.

Includes the spec (docs/pytest-fly-active-pagefiles-spec.md). Bumps to v0.10.6.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…orks off Windows too

os.path.splitdrive knows drive letters only on Windows; the paths come from the Windows kernel and are Windows paths on every platform (the cross-platform GUI test showed the flag missing on Linux).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.42254% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.67%. Comparing base (2388c4d) to head (237891a).

Files with missing lines Patch % Lines
src/pytest_fly/pytest_runner/commit_memory.py 63.15% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
- Coverage   85.75%   85.67%   -0.08%     
==========================================
  Files          74       74              
  Lines        6380     6450      +70     
==========================================
+ Hits         5471     5526      +55     
- Misses        909      924      +15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamesabel
jamesabel merged commit bfa652b into master Sep 29, 2026
3 checks passed
@jamesabel
jamesabel deleted the active-pagefiles branch September 29, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants