Skip to content

test(docs): cite models/base.py by symbol so the guard stops drifting (#5201) - #5217

Merged
Qubitium merged 1 commit into
mainfrom
fix/docs-contract-symbol-citation-5201
Nov 18, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/docs-contract-symbol-citation-5201

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Fixes #5201.

Problem

main is red:

FAILED tests/test_docs_contract_refs.py::test_contract_reference_resolves[docs/generate-cpu-offload-autograd.md-gptqmodel/models/base.py-generate-3939]

docs/generate-cpu-offload-autograd.md:18 cited gptqmodel/models/base.py:3939-3944 for generate. #5165 repaired that citation when def generate was at 3902; #5176 moved it to 3941 and #5182 to 3948, outside LINE_WINDOW = 8.

Fix

  • Cite gptqmodel/models/base.py::generate in the doc, as the test header already recommends for a file that moves often.
  • Drop the line-anchored registry duplicate, leaving one SYMBOL_CITATION entry.
  • Convert the other guarded base.py:359 citation (_quantize_summary_counts in docs/quantize-run-summary.md) to the symbol form.
  • Add test_models_base_citations_use_the_symbol_form, which rejects any future line-numbered citation into models/base.py in the registry. That file grows with nearly every fix PR, so this is the third round of the same breakage.

Verification

tests/test_docs_contract_refs.py ................. 33 passed

The new guard fails as intended when a line citation is reintroduced:

AssertionError: cite `gptqmodel/models/base.py` by symbol, not line number:
[('docs/quantize-run-summary.md', '_quantize_summary_counts', 359)]

ruff check clean.

…#5201)

`docs/generate-cpu-offload-autograd.md` cited `gptqmodel/models/base.py:3939`
for `generate`. Three merges after #5165 repaired it, #5176 and #5182 moved
`def generate` to 3948, outside `LINE_WINDOW`, so
`test_docs_contract_refs.py::test_contract_reference_resolves` was red on
`main`.

Cite the symbol instead, as the test's own header already recommends for a
file that moves often. The registry keeps one `SYMBOL_CITATION` entry instead
of the line-anchored duplicate.

Also convert the remaining guarded `base.py:359` citation
(`_quantize_summary_counts`) and add
`test_models_base_citations_use_the_symbol_form`, which rejects any future
line-numbered citation into `models/base.py` in the registry. That file grows
with nearly every fix PR, so a line citation drifts within a couple of merges.
@Qubitium
Qubitium merged commit 0d8a672 into main Nov 18, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/docs-contract-symbol-citation-5201 branch November 18, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant