Skip to content

An Over-Broad Non-Empty --exclude Silently Empties the Prose Gate's Scan, Because discover() Applies Exclusions Before the Scope Line Counts #1420

Closed as not planned

Description

@ptr727

#1417 added a guard refusing an empty --exclude value, because an exclusion is a substring test and the empty one is a substring of every key, so it emptied the scan while the run exited 0. That guard closes the empty value and nothing else. Any over-broad non-empty exclusion still narrows the scan silently.

Measured

Against this repository, at the merge base #1417 was reviewed on:

Invocation Result Exit
--diff <base> scope: 5 of 328 file(s) read, 455 changed line(s) as found
--diff <base> --exclude .md scope: 3 of 160 file(s) read, 440 changed line(s) 0
--diff <base> --exclude . scope: 0 of 2 file(s) read, 0 changed line(s) 0
--diff <base> --exclude / scope: 1 of 26 file(s) read 0

Why the scope line does not catch it

discover() applies the exclusions before discovered is counted, so the number the scope line reports as the denominator is already the post-exclusion figure. The line whose entire purpose, per its own docstring, is to tell "read nothing" from "found nothing" therefore never reports that an exclusion removed anything. It shows a smaller total and says nothing about why it is smaller.

The unread_diff_files floor cannot fire either, because it applies the same exclusions and so returns nothing.

Why this is the root-cause shape

The guard #1417 added is value-level: it inspects each exclusion string and refuses one particular value. The property actually worth protecting is scope-level, along the lines of refusing when a non-empty exclusion set removed every file the diff named, or reporting the count an exclusion removed on the scope line so a reader can see the narrowing.

The second is probably the better half to do first, since it costs no policy decision and turns a silent narrowing into a visible one. A refusal needs a rule about what degree of narrowing is legitimate, and a repository excluding a large vendored tree is a real and correct case.

Provenance

Raised by the fourth local review pass on #1417 and carried in that pull request's body as a reviewer item. Pre-existing rather than introduced by that change, and it is the one the maintainer flagged as wanting an answer. Recorded here rather than left in a merged pull request body. Merged as 0b4657d.

🤖 Generated with Claude Code

Activity

  1. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Declined per #2517, approved by the maintainer, under GOVERNANCE.md "Trust Boundaries and Hardening Effort": --exclude is typed by the maintainer, and the scope line prints the file counts, so an empty scan is visible rather than silent.

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