Count completed frames correctly in fault-book reports #597

Open
github-bot wants to merge 1 commit from github-bot/gh-597 into main AGit
Owner

@⁠shiaho777 on GitHub · 2026-12-04 13:06 UTC · original
shiaho777:fix/faultbook-frame-count → main · +41 −16 · 2 files · 1 commits · open

The recorder enables capture just after a frame boundary, then writes one end marker for each frame it captures. A five-marker book therefore covers five frames of faults, although there are only four measurable intervals between the markers. The report used four for both calculations.

Use the marker count for event rates and the interval count for elapsed time. Exclude events following the final marker from per-frame totals, and compare the hot-block fraction against 75% without rounding down. The regression book has blocks that fault in three and four of five frames. Only the second qualifies.

Verified with python3 -m unittest discover -s scripts -p test_faultbook.py and cargo xtask policy. The fixture generates the records in a temporary directory.

**@⁠shiaho777** on GitHub · 2026-12-04 13:06 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/597) `shiaho777:fix/faultbook-frame-count` → `main` · +41 −16 · 2 files · 1 commits · open The recorder enables capture just after a frame boundary, then writes one end marker for each frame it captures. A five-marker book therefore covers five frames of faults, although there are only four measurable intervals between the markers. The report used four for both calculations. Use the marker count for event rates and the interval count for elapsed time. Exclude events following the final marker from per-frame totals, and compare the hot-block fraction against 75% without rounding down. The regression book has blocks that fault in three and four of five frames. Only the second qualifies. Verified with `python3 -m unittest discover -s scripts -p test_faultbook.py` and `cargo xtask policy`. The fixture generates the records in a temporary directory.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 13:11:19 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-12-04 16:18 UTC · original

The new counting matches what the recorder writes, checked on a book made by the real recorder.

A recorder-made book. With a temporary test (not committed) in a diagnostics build, I ran faultbook::frame and note through one full 40-frame capture. The faults were made up: block 7 in 29 of the frames, block 8 in 30, block 9 in all 40. The file holds 40 end markers, as you describe.

main this PR
"blocks faulting in three frames of four or more" 3 (block 7 counted, at 72.5%) 2
faults a frame from those blocks 2.5 1.8
time a frame 2.4 ms 2.4 ms

Tested at 353e654b, directly on current main (5e44415b). Windows 11 Pro, Python 3.12.10.

  • python -m unittest discover -s scripts -p test_faultbook.py: 2 passed, three runs. cargo xtask policy: clean.
  • The new test guards the change: it fails with main's script, and with each of these undone alone: dividing by the marker count, dividing the time by the intervals, dropping events after the last marker, the unrounded 75%.
  • Made-up books that are empty, have no marker, or have one marker are read without an error.

Not tested: a book from a running title. I did not run the Rust suite for this one, as only the two Python files change.

AI use: Claude Code (Claude Opus 5.5) ran the tests, read the diff and the recorder, and wrote this report.

**@⁠fromthemoonx** on GitHub · 2026-12-04 16:18 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/597#issuecomment-7417209727) The new counting matches what the recorder writes, checked on a book made by the real recorder. **A recorder-made book.** With a temporary test (not committed) in a `diagnostics` build, I ran `faultbook::frame` and `note` through one full 40-frame capture. The faults were made up: block 7 in 29 of the frames, block 8 in 30, block 9 in all 40. The file holds 40 end markers, as you describe. | | `main` | this PR | |---|---|---| | "blocks faulting in three frames of four or more" | 3 (block 7 counted, at 72.5%) | 2 | | faults a frame from those blocks | 2.5 | 1.8 | | time a frame | 2.4 ms | 2.4 ms | **Tested** at `353e654b`, directly on current `main` (`5e44415b`). Windows 11 Pro, Python 3.12.10. - `python -m unittest discover -s scripts -p test_faultbook.py`: 2 passed, three runs. `cargo xtask policy`: clean. - The new test guards the change: it fails with `main`'s script, and with each of these undone alone: dividing by the marker count, dividing the time by the intervals, dropping events after the last marker, the unrounded 75%. - Made-up books that are empty, have no marker, or have one marker are read without an error. **Not tested:** a book from a running title. I did not run the Rust suite for this one, as only the two Python files change. **AI use:** Claude Code (Claude Opus 5.5) ran the tests, read the diff and the recorder, and wrote this report.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/597/head:github-bot/gh-597'
git switch 'github-bot/gh-597'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-597'
git switch 'github-bot/gh-597'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-597'
git switch 'github-bot/gh-597'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-597'
git switch 'main'
git merge --squash 'github-bot/gh-597'
git switch 'main'
git merge --ff-only 'github-bot/gh-597'
git switch 'main'
git merge 'github-bot/gh-597'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.