Skip to content

A drift report clips wide lines at column 72, so a table-row change prints two identical strings #1448

Closed

Description

@FlorentinDUBOIS

check_doc_citations.py's drift report clips quoted lines at QUOTE_WIDTH = 72 characters. For a markdown table row — which is wide by construction and whose meaningful content sits well past column 72 — the before and after clip identically, so the report shows a reviewer two visually identical strings and tells them nothing about what changed.

Pre-existing, and low-impact while the guarded surface was source files only. It became more reachable once .md targets started resolving, because the citations most likely to point at a markdown file point at table rows: configuration catalogues, metrics tables, threshold listings.

Observed

From a scratch run that deliberately edited a cited row's text in place, the drift rule correctly fired and reported:

doc/configure_admin_ops.md:157: `doc/configure.md:1197` moved
  was: | `h2_stream_shrink_ratio`                | 2                       | S…
  now: | `h2_stream_shrink_ratio`                | 2                       | S…

The rule is right, the detection is right, and the operator-facing output is useless — the two lines differ only past the clip.

Why the obvious fix is not obviously right

Raising QUOTE_WIDTH fixes this case and makes every source-line report worse: a long Rust line would wrap or overflow a CI log column, and the constant was presumably chosen for that reason. The problem is not that 72 is too small, it is that a fixed left-anchored window is the wrong window when the difference is not at the start of the line.

Options, in rough order of how much I like them:

  1. Clip around the first difference rather than from column 0 — find the first differing offset between the two strings, and centre the window there with an ellipsis on whichever side is truncated. Fixes source lines and table rows alike, and needs no per-file-type knowledge.
  2. Report a character offset alongside the clipped text, so a reviewer at least knows where to look.
  3. Widen the window only when both strings begin with |. Cheap, but it special-cases markdown in a rule that should not care about file type, and it fails for any other wide non-table line.

Option 1 is the one I would write, but the choice is the implementer's — if there is a reason the left-anchored window matters that I am not seeing, say so and take option 2.

Asked for

Make a drift report distinguish the two lines it prints, for a cited line whose difference falls past the clip.

The self-test needs a fixture for this specifically: a cited line long enough that its differing region is beyond QUOTE_WIDTH, with an assertion that the reported was:/now: strings are not equal to each other. That assertion is the point — it is checkable without pinning the exact formatting, so it survives someone later changing the window strategy.

See it red first: the fixture must produce two identical clipped strings under the current code.

Do not fix this by removing the clip. An unbounded quote in CI output is a different failure, and the constant exists for a reason.

Activity

  1. added a commit that references this issue on Sep 23, 2026
    84a3235
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