tests: cover PerReasonRefusalCensus sanitization, bounds, ranking, and delta reports #3752
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3752
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3750"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ammmae0x on GitHub · 2026-12-01 15:10 UTC · original
Ammmae0x:tests/per-reason-refusal-unit→main· +1801 −0 · 5 files · 1 commits · merged 2026-12-01 17:04 UTCRefs #1149. Portable C++17 unit tests for
x2w_startup::PerReasonRefusalCensus(src/startup_stubs/per_reason_refusal_census.h) with zero edits to existing files: 5 new files only (+1801/-0).What landed — commit
21a2916f, branchtests/per-reason-refusal-unit:tests/per_reason_refusal_unit_check.cpp: 26 cases — constructor/reason sanitization (nullptr/"" fallbacks, CR/LF to spaces, 31-char label and 63-char reason truncation), distinct(key, reason)pairs vs duplicates (first_frame preserved, frame -1 omitted vs 0 emitted), thedetail_entries == 8budget,max_entries == 128saturation (overflow, total, distinct keys, per-key totals past the pair cap up tomax_keys == 1024, unstored-key calls past 1024), key 0 ranked exclusion and pair cap,report()deltas (forced reports leave delta state intact,top_keys == 32ranking with smaller-key tie-break, key-overflow omission/emission, unkeyed deltas), and multi-threadednote()+report()stress. All constants used inside lambdas arestatic constexpr; pure in-memory, no temp files.tests/cmake/per_reason_refusal_unit.cmake: per-case CTests +_all, and 7WILL_FAIL TRUEheader-copy mutation controls (reason_overwrite,detail_budget,key_tie_order,key_zero_ranked,forced_report_delta,sanitize_newline,overflow_account).tests/per_reason_refusal_unit_meta_check.py: audits the contract and compiles/runs the real C++ check and every mutation against a real C++ copy (1:1 sets, zero model-only mutants; temp dirs removed infinally). It runs real compiles withg++when present, triesclotherwise, and fails naming both when neither is present.tests/checks/python-linux/per_reason_refusal_unit.txtanddocs/experiments/per-reason-refusal-unit.md.Linux verification (this host,
g++ -std=c++17 -Wall -Wextra -Wpedantic -Werror):PASS: per_reason_refusal_unit: 26/26 cases passedPASS: per_reason_refusal_unit: 26 cases, 7/7 mutations killed (g++)_all+ 7WILL_FAILmutation controls)form_coverage_check.py,docs_links_check.py(208 files / 802 links), andbidi_controls_check.py(2827 files) pass;diff --checkclean; merge-tree vsorigin/mainexits 0; zero personal paths.Caught in development: duplicate
note()calls return false by design, so the delta cases assert them as plain calls, not as detailed notes; and a duplicated pair re-ranks first in the key totals, so the periodic-delta case pinskey-total 1for the changed key.Caveat: no mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter.
Windows Verification (
21a2916f)git merge-tree --write-tree upstream/main HEAD->952585ae(exit 0),git diff --check upstream/main...HEADcleanpy_compile,form_coverage_check.py,docs_links_check.py(209 files, 806 links),bidi_controls_check.py(2830 files),per_reason_refusal_unit_meta_check.py(cl:26 cases, 7/7 mutations killed) passeddev34/34 passed (1.08s);release34/34 passed (0.98s); directper_reason_refusal_unit_check.exe(dev&release):PASS: per_reason_refusal_unit: 26/26 cases passed. AI-assisted.