Skip to content

Test that the fault search keeps its map of pairs within its memory limit, and fix two names - #912

Merged
perlinm merged 4 commits into
mainfrom
fix/fault-search-and-count-tests
Nov 16, 2026
Merged

perlinm merged 4 commits into
mainfrom
fix/fault-search-and-count-tests

Conversation

@perlinm

@perlinm perlinm commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Motivation

This pull request gathers three small follow-ups.

  • certify_bounded_fault_propagation takes memory_limit, which bounds the lookup tables of its fault search, and its guide says that the search builds its closing map of pairs of fault classes only if the map fits. _split_memory_limit makes that decision, and a test checks it, but no test checked that FaultLister obeys it: building the map regardless changed no result, only the memory used, and passed every test.
  • FaultLister._closing_pairs_fit also holds the cap of 2^31 pairs, so it says whether to build the map, not whether the map fits.
  • test_a_deformed_self_dual_counter_shares_its_basis_family checks that a SWEL gate keeps a self-dual counter self-dual and its counts exact, not how many basis families the counter keeps.

Changes

  • test_listing_matches_brute_force already wrapped _get_closing_map with a pass-through recorder. It now records the memory limit of each lister that builds a nonempty map of pairs, and checks that some listers with memory for the map build it, and that none without memory does. Its comment about listings without memory now allows for the empty map of pairs of fewer than two classes.
  • _closing_pairs_fit, and the local pairs_fit of _split_memory_limit, are renamed _should_build_closing_pairs and should_build_pairs, as _table_should_grow in the same module names its decision.
  • The counter test is renamed test_a_swel_gate_keeps_a_self_dual_counter_self_dual_and_exact, and its docstring says that the gate follows a count. Its assertions are unchanged.

Validation

The listing test now fails if _closing_pairs ignores the decision and always builds the map, and if it never builds the map. Two independent reviewers judged this check worth adding rather than over-testing, since it guards the documented effect of a public argument that no result shows. For the counter test, a rename was preferred to an assertion on how many basis families a counter keeps, which is a storage choice rather than a result.

perlinm and others added 4 commits November 16, 2026 16:08
…t is

_closing_pairs_fit also holds the cap on the number of pairs, so call it
_build_closing_pairs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…he memory

No test checked that FaultLister respects its decision not to build the
closing map of pairs: building it always changed no result, only the
memory used.  Record the memory limit of each listing that builds a map
of pairs of two or more classes, and correct the comment about listings
without memory.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
It checks that the counter stays self-dual and exact, not how many basis
families it keeps.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Name the decision should_build_pairs, as _table_should_grow names its
own, and clarify the recorder's comment and the two tests' docstrings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@perlinm
perlinm merged commit 2ed5ca6 into main Nov 16, 2026
9 checks passed
@perlinm
perlinm deleted the fix/fault-search-and-count-tests branch November 16, 2026 21:30
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.

1 participant