← Back to Pull requests

feat(doc): auto-generated Verso migration, 2026-11-19 #46290

Closed
unknown closed this pull request without merging on Nov 25, 2026 10:41 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 17:32 UTC
Author

This PR auto-migrates docstrings to Verso in all files where doc-gen reports the same output.

The files from this branch come from #46256 (the unfiltered output of lake exe verso-migrate-docstrings);
The doc-gen diff script comes from #45994;
To verify the claim about doc-gen output being identical, run ./scripts/doc-gen-diff.py $(git merge-base verso-migrate-identical-2026-11-19 master) verso-migrate-identical-2026-11-19 and see that the script does not report any differences. (This will take a long time and consume substantial disk space, since it involves building Mathlib and its docs twice!)

Not all docstrings might have migrated cleanly: those cases detected by the migration script are wrapped in set_option doc.verso false ... set_option doc.verso true. I'm undecided if we want to filter out those cases, or accept them and count them against tech debt. (They certainly do not cause the diff script to complain!)

This PR is clearly too bulky to be reviewed, and too complicated to be entirely automatically checked. I propose that everyone interested in Verso docstrings can take subsets of the diffs and extract them to their own PRs, and then ping me on Zulip to request review.

We merged about ~1300 files with Verso docstrings already, and this PR contains ~5500, where there are still ~2200 files left with docstrings that change in some way on roundtripping. Scrolling through the diff output I see for example:
#-Header levels change;
Line breaks moved around and other whitespace changes (TODO: make the diff script not care about line breaks in running text);
Some autolinks not being recognized.

The diff script ignores links if they point to other pages in doc-gen output (since these depend on the commit), and the difference between <li><p>...</p></li> (Verso) and <li>...</li> (default Markdown output).

---
<!-- Your PR title will become the first line of the commit message.

In this box, the text above the --- (if not empty) will be appended
to the commit message, and can be used to give additional context or
details. Please leave a blank newline before the ---, otherwise GitHub
will format the text above it as a title.

For details on the "pull request lifecycle" in mathlib, please see:
https://leanprover-community.github.io/contribute/index.html

In particular, note that most reviewers will only notice your PR
if it passes the continuous integration checks.
Please ask for help on https://leanprover.zulipchat.com if needed.

When merging, all the commits will be squashed into a single commit
listing all co-authors.

Co-authors in the squash commit are gathered from two sources:

First, all authors of commits to this PR branch are included. Thus,
one way to add co-authors is to include at least one commit authored by
each co-author among the commits in the pull request. If necessary, you
may create empty commits to indicate co-authorship, using commands like so:

git commit --author="Author Name <author@email.com>" --allow-empty -m "add Author Name as coauthor"

Second, co-authors can also be listed in lines at the very bottom of
the commit message (that is, directly before the ---) using the following format:

Co-authored-by: Author Name <author@email.com>

If you are moving or deleting declarations, please include these lines
at the bottom of the commit message (before the ---, and also before
any "Co-authored-by" lines) using the following format:

Moves:

  • Vector. -> List.Vector.

  • ...
  • Deletions:

  • Nat.bit1_add_bit1

  • ...
  • Any other comments you want to keep out of the PR commit should go
    below the ---, and placed outside this HTML comment, or else they
    will be invisible to reviewers.

    If this PR depends on other PRs, please list them below this comment,
    using the following format:

  • depends on: #abc [optional extra text]

  • depends on: #xyz [optional extra text]
  • -->

    Diff: 486 lines (+364 / -122) across 6 files Reviewer: grunweg Review duration: 6788m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.76) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.76 · 486 lines diff across 6 files
    0.76
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.370
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.076
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #46290"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.5% (HIGH) · Higher = larger blast radius
    75.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.8% · Safe to merge
    29.8%