Repository navigation
ci(dylint): test the allowlist gate and match the lints' parser - #1924
Merged
Merged
Conversation
`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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test backlog item 3 of 4 from
ci/gate_script_tests.toml'suntestedlist(
#1915ratchet):ci/check_dylint_allowlists.pyhad 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
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:
crates/x/src/lib.rs # legit, see #826was stripped tothe 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_subprocessandcli_no_build_deploy_direct_useall instruct"include an inline comment" on the entry. Now a hard error explaining that
the reason goes on its own
#line./-rewritten source path,so
crates\a\src\lib.rscan never match; on a POSIX checkout a file canliterally be named that, so the gate found it and passed. Now dead.
..entry --(ROOT / entry).is_file()resolves outside therepo, so an entry no source path can ever end with validated against an
unrelated file. Now dead.
src/allowlist.txtfiles that theirlib.rsneverinclude_str!s:ban_unwrap_in_production(3 entries) andrequire_oncelock_install_before_use(2 entries). Neither lint has anyallowlist machinery at all, so every entry in those files excused nothing
while the gate certified them as current.
ban_unwrap_in_production's threesites are test-module
.unwrap()calls now covered by the lint's#[cfg(test)]module walk, anddylints/README.mdalready describes bothlints 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.
current" with rc 0. A renamed/pruned
dylints/(or a sparse checkout) nowfails instead of asserting nothing.
Also split
mainintoallowlist_files/entry_of/entry_error/lint_reads/checkso each rule is testable and C901 stays clean.Real output
python -m unittest ci.test_check_dylint_allowlists-- 25/25 OKDRIFT_UNITTEST_MODULES) -- 235 -> 260 tests OKgate_script_coverage --budget 3-- every workflow-invoked gate accounted for(
untested4 -> 3,MAX_UNTESTED4 -> 3, registry entry added)check_python_complexity-- All checks passedruff check+ruff format --check-- cleanrender_workflows --check-- cleanci/check_dylint_allowlists.pyon this tree -- rc 0, 24 allowlistsRED proven by four in-place mutations, each restored afterwards:
entry_ofback tosplit("#", 1)[0]entry_error->NoneThe 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 deletionsabove cannot silently come back.