Skip to content

[TEST] tests/test_docs_contract_refs.py (#4791) red on main: #4839 shifted ModelWriter in writer.py by 17 lines, docs/native-checkpoint-export.md still cites :1886 #4864

Closed

Description

@Qubitium

Found on main @ 5cded90, RTX 4090 host (CPU-only test).

What is wrong

tests/test_docs_contract_refs.py (added by #4791 for #4762) is red on main. It checks each pinned doc citation file:line against the symbol's definition within +-8 lines. #4839 (174d3cba3, AWQ load bridge fix for #4795) added 17 lines above ModelWriter in gptqmodel/models/writer.py, so the citation in docs/native-checkpoint-export.md:29 (gptqmodel/models/writer.py:1886: ModelWriter) now points 17 lines above the definition (def ModelWriter is at writer.py:1903).

$ CUDA_VISIBLE_DEVICES="" pytest -q tests/test_docs_contract_refs.py
FAILED tests/test_docs_contract_refs.py::test_contract_reference_resolves[docs/native-checkpoint-export.md-gptqmodel/models/writer.py-ModelWriter-1886]
1 failed, 19 passed in 3.41s

It passed when #4791 merged (20 passed). The first unrelated change to writer.py broke it.

Suggested fix

  • Re-point docs/native-checkpoint-export.md:29 to writer.py:1903.
  • To stop the next drift: either make the guard derive the line from the symbol (inspect.getsourcelines) and only check that the doc's file:symbol pair resolves, or cite symbols without line numbers in these contract tables. With hard-coded lines, every PR that touches a cited file has to edit the docs, or this test goes red.

Test that should have caught it

The test itself caught it, but the #4839 PR merged with it red, so this file is evidently not in the pre-merge CPU lane. Adding tests/test_docs_contract_refs.py (6 s, CPU, no downloads) to the default CI lane would block the next drift.

Severity

Low: a red test on main, plus one stale docs citation.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-53ba17eb4d83 finished this issue.

    Pull request: #4877

    Fix the stale writer.py line refs in tests/test_docs_contract_refs.py after #4839 shifted ModelWriter; run the docs contract test and the doc-ref audit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions