• 
      

    Move interesting-lines detection into its own module.

    Review Request #15214 — Created July 31, 2026 and updated

    Information

    Review Board
    release-9.x

    Reviewers

    The scanning for "interesting lines" (function and class definition
    headers shown on collapsed diff chunks) lived in the Differ, driven by
    regex tables in diffviewer/filetypes.py. This change moves it into a new
    diffviewer.interesting_lines module, in preparation for detecting
    these lines with tree-sitter.

    The new module hosts the regex tables, an InterestingLine type, and a
    get_interesting_lines() entry point (currently regex-only).
    DiffChunkGenerator.generate_chunks() now computes the interesting
    lines for both file revisions directly, and _get_interesting_headers()
    reads those instead of asking the differ.

    The legacy Differ API keeps working for third parties:

    • Differ.add_interesting_line_regex() is deprecated for removal in Review
      Board 11.0 but still contributes results for now.
    • Differ.get_interesting_lines() runs the regex scanner, since no parsed
      tree is available at that layer. DiffChunkGenerator is the supported
      path going forward.
    • filetypes.py re-exports HEADER_REGEXES and HEADER_REGEX_ALIASES
      for backwards compatibility.

    I've rewritten the interesting-lines tests as parameterized pytest cases
    as part of this.

    Ran unit tests.

    Summary ID
    Move interesting-lines detection into its own module.
    The scanning for "interesting lines" (function and class definition headers shown on collapsed diff chunks) lived in the `Differ`, driven by regex tables in diffviewer/filetypes.py. This change moves it into a new `diffviewer.interesting_lines` module, in preparation for detecting these lines with tree-sitter. The new module hosts the regex tables, an `InterestingLine` type, and a `get_interesting_lines()` entry point (currently regex-only). `DiffChunkGenerator.generate_chunks()` now computes the interesting lines for both file revisions directly, and `_get_interesting_headers()` reads those instead of asking the differ. The legacy Differ API keeps working for third parties: - `Differ.add_interesting_line_regex()` is deprecated for removal in Review Board 11.0 but still contributes results for now. - `Differ.get_interesting_lines()` runs the regex scanner, since no parsed tree is available at that layer. `DiffChunkGenerator` is the supported path going forward. - `filetypes.py` re-exports `HEADER_REGEXES` and `HEADER_REGEX_ALIASES` for backwards compatibility. The interesting-lines tests are rewritten as parametrized pytest cases with no-op database fixtures. Testing Done: Ran unit tests.
    sqsmuzqzzuovksrlvpssvkpxpvnvowsr
    Checks run (2 succeeded)
    flake8 passed.
    JSHint passed.