Skip to content

ci(dylint): test the allowlist gate and match the lints' parser - #1924

Merged
zackees merged 1 commit into
mainfrom
agent/test-dylint-allowlists
Nov 5, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/test-dylint-allowlists

Conversation

@zackees

@zackees zackees commented Nov 5, 2026

Copy link
Copy Markdown
Member

Test backlog item 3 of 4 from ci/gate_script_tests.toml's untested list
(#1915 ratchet): ci/check_dylint_allowlists.py had zero tests.

The gate's promise is "a Dylint allowlist entry names a file that exists", i.e.
the exemption a developer added is real. It was checking a different language
than the 24 lints that consume these files. Every one of them parses with

ALLOWLIST.lines().map(str::trim)
    .filter(|line| !line.is_empty() && !line.startswith('#'))
    .any(|allowed| normalized.ends_with(allowed))     // normalized: '\' -> '/'

while the gate did raw.split("#", 1)[0].strip() and (ROOT / path).is_file().
Five ways the gate blessed an exemption that does not exist:

  1. Inline comment -- crates/x/src/lib.rs # legit, see #826 was stripped to
    the path, found on disk, and reported "current". The lints keep the comment
    inside the pattern, so the entry never matches and the lint stays red. This is
    not hypothetical contributor error: ban_raw_path_prefix_compare,
    ban_raw_subprocess and cli_no_build_deploy_direct_use all instruct
    "include an inline comment" on the entry. Now a hard error explaining that
    the reason goes on its own # line.
  2. Backslash entry -- the lints compare against a /-rewritten source path,
    so crates\a\src\lib.rs can never match; on a POSIX checkout a file can
    literally be named that, so the gate found it and passed. Now dead.
  3. Absolute / .. entry -- (ROOT / entry).is_file() resolves outside the
    repo, so an entry no source path can ever end with validated against an
    unrelated file. Now dead.
  4. Orphan allowlist -- two lints shipped src/allowlist.txt files that their
    lib.rs never include_str!s: ban_unwrap_in_production (3 entries) and
    require_oncelock_install_before_use (2 entries). Neither lint has any
    allowlist machinery at all, so every entry in those files excused nothing
    while the gate certified them as current. ban_unwrap_in_production's three
    sites are test-module .unwrap() calls now covered by the lint's
    #[cfg(test)] module walk, and dylints/README.md already describes both
    lints as allowlist-free. Both dead files are deleted here; a comment-only
    unread allowlist (the three "internal bridge APIs + dylint bans (total sweep, no grandfathering) #844 ships this lint with ZERO entries" files)
    stays legal -- it is documentation, not a claim.
  5. Vacuity -- zero allowlists found printed "Dylint allowlist paths are
    current" with rc 0. A renamed/pruned dylints/ (or a sparse checkout) now
    fails instead of asserting nothing.

Also split main into allowlist_files / entry_of / entry_error /
lint_reads / check so each rule is testable and C901 stays clean.

Real output

  • python -m unittest ci.test_check_dylint_allowlists -- 25/25 OK
  • hosted self-test set (DRIFT_UNITTEST_MODULES) -- 235 -> 260 tests OK
  • gate_script_coverage --budget 3 -- every workflow-invoked gate accounted for
    (untested 4 -> 3, MAX_UNTESTED 4 -> 3, registry entry added)
  • check_python_complexity -- All checks passed
  • ruff check + ruff format --check -- clean
  • render_workflows --check -- clean
  • ci/check_dylint_allowlists.py on this tree -- rc 0, 24 allowlists

RED proven by four in-place mutations, each restored afterwards:

mutation failing tests
entry_of back to split("#", 1)[0] 2 (inline-comment cases)
orphan check disabled 1
vacuity guard removed 2
entry_error -> None 5

The real-repository tests assert the whole inventory is still discovered
(>= 24 allowlists), that no live entry carries an inline comment, and that every
allowlist with entries is actually read by its lib.rs -- so the two deletions
above cannot silently come back.

`ci/check_dylint_allowlists.py` consumed allowlists differently from the
24 lints that read them, so it certified exemptions that could never match:
an inline `#` comment was stripped (the lints keep it in the pattern), a
POSIX-legal `crates\a\src\lib.rs` filename passed, an absolute or `..`
entry resolved outside the repo, an orphan allowlist no `lib.rs` loads was
checked anyway, and zero allowlists found printed "current" with rc 0.

Delete the two orphan allowlist files that excused nothing
(`ban_unwrap_in_production`, `require_oncelock_install_before_use`), add
`ci/test_check_dylint_allowlists.py` (25 tests), and ratchet `untested`
4 -> 3.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 8388e66 Nov 5, 2026
31 checks passed
@zackees
zackees deleted the agent/test-dylint-allowlists branch November 5, 2026 22:37
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant