Count completed frames correctly in fault-book reports #597

Open
shiaho777 wants to merge 1 commit from upstream-pr/597 into main
shiaho777 commented 2026-12-04 13:06:45 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by shiaho777 on 2026-12-04T13:06:45Z.


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.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5647027680 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/597). Originally posted by [shiaho777](https://github.com/shiaho777) on 2026-12-04T13:06:45Z. --- 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.
fromthemoonx commented 2026-12-04 16:18:29 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by fromthemoonx on 2026-12-04T16:18:29Z.


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.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7417209727 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/597#issuecomment-7417209727). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-04T16:18:29Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/597:upstream-pr/597'
git switch 'upstream-pr/597'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/597'
git switch 'upstream-pr/597'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/597'
git switch 'upstream-pr/597'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/597'
git switch 'main'
git merge --squash 'upstream-pr/597'
git switch 'main'
git merge --ff-only 'upstream-pr/597'
git switch 'main'
git merge 'upstream-pr/597'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
readmet3xt-lab/foxhound!597
No description provided.