Skip to content

Point the distance guides' code maps at stable names, and check cited sections - #1070

Open
perlinm wants to merge 1 commit into
mainfrom
docs/distance-guide-trim
Open

perlinm wants to merge 1 commit into
mainfrom
docs/distance-guide-trim

Conversation

@perlinm

@perlinm perlinm commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Motivation

The guides of qldpc.codes.distance map the symbols and concepts of their algorithms to the code that implements them. Some cells of those maps name the parameters and locals of compiled kernels, such as memos, stamp, resume, and frontier_depth of the connected-cluster search, and best, support, and prefixes of the Brouwer-Zimmermann scans, so that every restructuring of a kernel has to edit the guides too. Separately, the package's modules and guides cite guide sections by number in about 500 places, such as "Section 3.9", and nothing checks that those sections exist, so renumbering a guide would break the citations silently.

Changes

  • The concept-to-code glossary of brouwer_zimmermann_code.md (§4.3) and the table of connected_cluster.md §4 now name only modules, classes, functions, and fields of SearchTuning or Certificate. A parameter, local, or private attribute is dropped only where the docstring of the function or class that owns it describes it, and the cell points to that function or class instead. Two names that no docstring describes stay: levels of _search_supports and next_weight of _SectorSearch. Every row keeps its concept, and README "Where to look" changes in one cell.
  • Nothing else in the guides changes: every heading and anchor of §4.1–4.3, which about 20 links target; §4.1's definitions and its argument for sharing the planning buffer and cached stopping steps across threads; §4.2, §4.4, §4.5, and §5 of both guides; and the prose on compilation and nogil in connected_cluster.md §4.
  • A new test, test_cited_sections_and_anchors_exist in _readme_test.py, checks that each section that a module or guide of the package cites by number exists in the guide that the citation refers to. That guide is the one that the citation names, as in "of connected_cluster.md"; otherwise one that the module says it cites; otherwise the connected-cluster guide for _connected_cluster/, and the Brouwer-Zimmermann guide elsewhere. The test reads citations that break across lines of a docstring or comment, and skips citations of sections of other works, such as papers in a guide's references. It also checks that each anchor of a link into these guides, from a Markdown file of the repository outside hidden directories, names a heading. The README's "Working here" says what the test checks.

Testing

The new test passes on the current guides. It fails, naming the file and line, on each of six planted breaks:

  • a Brouwer-Zimmermann module citing a missing section;
  • a connected-cluster module citing a missing section;
  • a citation naming connected_cluster.md, with a section that only the Brouwer-Zimmermann guide has, both on one line and broken across two lines;
  • a broken anchor in circuits/certification/fault_propagation.md;
  • a broken anchor in experiments/distance_tuning/README.md.

To check each trimmed cell, a reviewer can compare it with the docstring that it now points to.

… sections

The concept-to-code tables of brouwer_zimmermann_code.md and connected_cluster.md, and README "Where to look", now name modules, classes, functions, and fields of SearchTuning or Certificate.  A parameter, local, or private attribute is dropped only where the docstring of the function or class that owns it describes it, and the cell points to that function or class instead.

A new test in _readme_test.py checks that each section that the package cites by number exists in the guide that the citation refers to, including citations that break across lines, and that each anchor of a link into the guides, from a Markdown file of the repository, names a heading.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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