Commit Graph
250 Commits
Author SHA1 Message Date
dotCooCoo cb837fa47a xtask: test-lint census skips stringified helpers and reads struct closure params
An asserting helper inside `stringify!` is not evaluated, so it no longer
counts as a check that runs for each entry. Closure parameter lists may now
hold struct patterns (`|Row { c }|`), so a parameter that shadows the entry
is seen. A path segment in a pattern (`entry::Row { .. }`) does not bind a
name.
2026-12-03 07:10:52 -08:00
dotCooCoo 6ec484819a xtask: test-lint census guards apply only to the operand they control
- An `&&` left of an `||` alternative belongs to the `||`'s left
  operand, so `false && ready || { reset(); true }` now counts the
  reset. A group that holds the alternative (`false && (a || b)`) is
  still guarded by the outer `&&`.
- A `?` after a block expression (`{ prepare() }?`) can leave a polled
  async block. A block that is the body of an expression closure
  (`|| { ... }?`) leaves only that closure.
- `return`, `break` and `continue` inside `stringify!` are not
  evaluated, and a call inside `stringify!` does not feed the entry.
2026-12-03 06:08:23 -08:00
dotCooCoo 0613c48c50 xtask: test-lint census exits read match alternatives and skip stringify!
A single pipe now ends a closure's parameter list only when an opening
pipe stands in a closure position, so the `|` of a match arm such as
`0 | 1 => return` no longer hides that return from the census rule. A
closure that a match arm yields (`_ => |_: ()| return`) still keeps its
return to itself.

A `?` inside the arguments of `stringify!` is not evaluated and no longer
counts as an exit from the enclosing async block.
2026-12-03 05:09:30 -08:00
dotCooCoo 45388081a8 xtask: test-lint census exits ignore closure bodies and return operands
When the census rule asks whether a write can run at all, a return statement
directly before it in the closure or async block now rules it out, while a
return inside a condition still leaves it possibly executed.

A return or ? in an expression-bodied closure (`let _f = || return;`) leaves
only that closure, not the enclosing async block. The operand of a return
(`return app.run(c);`) runs before the return, and a call after a bare return
in a tuple element does not. A ? after whitespace or a comment
(`prepare() ?;`) is still an exit.
2026-12-03 04:40:25 -08:00
dotCooCoo cfebc3e61b xtask: test-lint census rule follows early exits and captured writes
A polled async block, a called closure or a nested for body can be left
before the call: a return or ? leaves a closure or async block, and a
break or continue leaves a nested for body. The census exemption no
longer counts a call after such an exit. Exits inside a nested closure,
async block or inner loop leave only that one, and a closure with a
return type is recognized as nested.

A write to a capture inside an async move block or a move closure now
changes the block's own copy until the block ends, instead of being
skipped. A later call in the block that receives the replaced value no
longer counts as feeding the entry, while the outer binding keeps it.
2026-12-03 04:10:32 -08:00
dotCooCoo 4bb9f7dc92 xtask: test-lint census rule skips writes that cannot run
- An async block whose `async` and `move` are separated by a comment or
  extra spaces is found with `async_block_keyword`.
- A write inside an `async move` block to a local the block declares
  counts as a write; only writes to captures are skipped.
- A literal `false` left of `&&` or `true` left of `||` keeps the right
  side from running, also when the lint asks whether a write may run.
  `a && true || ...` is not a literal left operand.
- A closure passed to `drop` (or `mem::drop`, `std::mem::drop`,
  `core::mem::drop`) is not called.
2026-12-03 03:09:51 -08:00
dotCooCoo c9ef0845a5 xtask: test-lint census rule follows closure writes, async blocks and nested guards
The census rule leaves out a loop that feeds each entry into a
computation, so it needs to know which calls and assignments in the loop
body run. It misjudged these shapes:

- A parameter of an async closure (`async |mut c: Command| { ... }`) or
  one whose type contains `->` did not shadow the entry.
- An async block awaited where it is written (`async { ... }.await`,
  `(async { ... }).await`) or passed straight to `block_on` counted as
  never run, for both calls and assignments. An `||` before it still
  guards it, and an `async move` block still writes only its own copies.
- An inner binding assigned the entry stayed hidden by a shadow of an
  outer binding of the same name.
- `ready || accept({ 0 }, wrap(app.run(c)))` lost the `||` guard.
- A closure with parameters stored in `Some(...)` counted as called.
- A closure call was found past the end of the block that binds the
  closure.
- An assignment in a closure dropped with `let _` or stored in
  parentheses (`let _saved = (|| { ... });`) ended the entry alias.
- An assignment in a closure that is called only conditionally kept the
  alias. Assignments now use a "may run" mode of the same check that
  finds calls, so a call that may be skipped still counts and a call
  that can never run does not.
2026-12-02 14:04:50 -08:00
dotCooCoo 9106f122bd Merge main into fix/ci-select-tests 2026-12-02 10:20:03 -08:00
.CooCoo 2be104c287 Merge pull request #10553 from dotCooCoo/fix/test-lint-base-size-first
xtask: test-lint checks a base file's blob size before reading it
2026-12-02 09:51:29 -08:00
.CooCoo c45fd2d457 Merge pull request #10585 from dotCooCoo/fix/census-lint-review-points
xtask: test-lint census rule counts a computation only where it runs on the entry
2026-12-02 09:51:23 -08:00
dotCooCoo 722e35895b Merge main into fix/test-lint-helper-ignore-wrapper-guards 2026-12-02 08:25:10 -08:00
dotCooCoo a62b477090 Merge main into fix/census-lint-review-points 2026-12-02 08:19:51 -08:00
dotCooCoo 5594da577b xtask: test-lint census rule ends tail assignments at their block and tells closure locals from captures
An assignment that ends a block without a semicolon (`{ input = c }`) now
makes its alias at the block's close instead of after the next statement.

A `let` inside a move closure, or one of its parameters, now counts as a
local binding: an assignment to it ends the alias as it does outside a
closure. Assignments to outer captures are still skipped.

A closure stored with `let` in `Some`, `Ok`, `Err`, `Box::new`, `Rc::new`
or `Arc::new` and never used again does not run, so its assignments no
longer end an alias. A closure passed to any other call may run and still
ends it.

An async closure called where it is written now runs when the call is
passed straight to `block_on` (a trailing comma included), unless the
`block_on` sits inside another closure.
2026-12-02 08:17:39 -08:00
.CooCoo 766d1cece8 Merge pull request #10591 from dotCooCoo/fix/test-lint-all-rules-fail
xtask: test-lint fails on a hit of any rule in the changed lines
2026-12-02 08:17:26 -08:00
dotCooCoo 12355cb529 xtask: test-lint fails on a hit of any rule in the changed lines
all-unguarded, only-weak, exit-status-only, no-assertion, early-return,
env-gate-unset, census, mirror, constant-echo, fixture-only and
exact-pixel only listed their hits before. Their hits on changed lines
and tests now fail the check like the other rules. A
`// test-lint: allow <rule> <reason>` comment still exempts a hit, and
hits on unchanged lines still do not fail.

A never-run test that builds on macOS or Windows is still listed
without failing, since it runs locally on that platform.

Docs: docs/development.md.
2026-12-02 07:42:17 -08:00
dotCooCoo aee21d8bb7 Merge main into fix/ci-select-tests 2026-12-02 07:27:01 -08:00
dotCooCoo 959af106ba Merge main into fix/ci-select-tests 2026-12-02 07:25:30 -08:00
dotCooCoo 8fd6ba499e Merge main into fix/rebalance-test-shards 2026-12-02 07:24:39 -08:00
.CooCoo d4fbb1402e Merge pull request #10260 from dotCooCoo/fix/plugins-tree-audit-in-checks
CI: the plug-in grant call-site audit runs in the checks shard
2026-12-02 07:13:43 -08:00
dotCooCoo 806aec918a xtask: test-lint census rule counts a computation only where it runs on the entry
The census rule leaves out a loop that feeds each entry into a
computation. It now checks that the computation runs, and that it runs
on the entry:

- An alias assigned another value no longer holds the entry, and one
  assigned the entry holds it. Assignments in an empty loop, an async
  block, a move closure or a closure the loop never calls do not change
  the alias, and one that may be skipped does not make one.
- A nested for body counts only when its source is a literal range or
  array that is not empty.
- A block in an earlier argument keeps the enclosing || or && that can
  skip the call.
- Calling an async closure counts only when the future is awaited or
  passed to block_on.
- A closure that is not bound with let counts only when it is called
  where it is written; a parenthesized initializer binds the closure.
- A closure call resolves to the binding in scope at the call, so a
  later let of the same name takes it.
- A conjunction inside a parenthesized operand of an asserted && is
  required, unless an || at its level can bypass it.
2026-12-02 07:11:24 -08:00
dotCooCoo d308e9d017 xtask: check the CI shard-members lines in every shard, not in one test
With test selection, a pull request that moves a crate between shards in
GROUPS without changing ci.yml could skip the shard holding the test
that compared the two. `shards::check`, which every shard and warm leg
runs, now compares them and fails with both lists.
2026-12-02 06:38:09 -08:00
dotCooCoo 0f3bd62ddc Merge main into fix/rebalance-test-shards 2026-12-02 06:35:21 -08:00
dotCooCoo a02c432ba2 Merge main into fix/rebalance-test-shards 2026-12-02 06:15:55 -08:00
dotCooCoo ffa83d3a7f Merge main into fix/plugins-tree-audit-in-checks 2026-12-02 06:09:48 -08:00
dotCooCoo c3bd6d7a0b Merge main into fix/ci-select-tests 2026-12-02 06:04:42 -08:00
dotCooCoo cf51c8894c xtask: test-lint decodes string continuations in cfg_attr paths and keeps census hits for fixed ranges
A path string that continues on the next line with a backslash now
decodes to the joined file name, so the conditional route is kept.
A range argument with two fixed bounds (1..4, 1..=4) no longer counts
as an input, so the round-trip census diagnostic stays; a range with a
variable bound still suppresses it. Adds a test for a bracket in a
cfg_attr path filename keeping its sibling cfg gate.
2026-12-02 05:55:33 -08:00
dotCooCoo 1361bb3b5c Merge main into fix/census-behavior-tables 2026-12-02 05:23:02 -08:00
dotCooCoo 1eb22f6134 xtask: test-lint census entry reads skip path segments, comment gaps and block statements
- An entry name after `::` (`defaults::c`) is a path segment, not a read of the loop binding.
- A `let` initializer scans to the end of its statement, so a block initializer binds its tail
  (`{ prepare(); c }`) and not the earlier statements in the block; `if let` and `while let`
  end at their block.
- A call keeps its name when masked comment whitespace sits before `(`, except after a keyword
  (`if (a)`).
- The argument-guard and alias tests now depend on the logic they cover.
2026-12-02 03:01:11 -08:00
dotCooCoo fde52f43a2 xtask: test-lint resolves shadowed helpers, literal selectors and aliases
- A renamed import (`use super::other::near as comparison;`) no longer
  counts as a call with a path; an import that keeps the name still does.
- A bare call to a helper's name checks for a local binding in scope
  (`let near = || {}; near();`), skipping type annotations, field labels
  and path segments in patterns.
- Helpers passed in assertion failure messages no longer count as checks.
- A match-arm binding covers the arm's guard, and the arm's pattern stops
  at the block of the arm before it.
- `#[ ignore = "..."]` with whitespace is read as an ignore attribute,
  both for diagnostic tests and for ignore-without-reason.
- Literal ranges read `0x`, `0o` and `0b` bounds.
- A pin compares literal arguments (`r.items("active")` against
  `r.items("archived")`), and does not count when a clone or borrow of the
  source made before the snapshot is still alive.
- A function parameter named like a constant table is not the table.
2026-12-02 02:38:11 -08:00
.CooCoo 9a7ebdd8a2 Merge pull request #10549 from dotCooCoo/fix/test-lint-plain-path-decode
xtask: test-lint decodes escapes in #[path] values
2026-12-02 02:15:50 -08:00
dotCooCoo 70e69a1750 Merge main into fix/plugins-tree-audit-in-checks 2026-12-02 02:13:53 -08:00
dotCooCoo 2b6847da7e Merge main into fix/ci-select-tests 2026-12-02 02:11:22 -08:00
dotCooCoo b8e72d686c xtask: test-lint checks a base file's blob size before reading it
The changed-lines mode read each base file with `git show` and only then
compared the length of the trimmed, lossily decoded text with the 16 MiB
limit, so a large blob was loaded in full before it was skipped, and
trailing whitespace and invalid UTF-8 changed the length it was judged
by. The base reads now take each blob's size from one `git ls-tree -l`
listing of `crates`, `apps` and `xtask` (or `git cat-file -s` for a path
the listing does not hold) and run `git show` only for blobs within the
limit.
2026-12-02 02:11:07 -08:00
dotCooCoo 859a6b4dd3 xtask: test-lint decodes escapes in #[path] values
A plain #[path = "\x63hild.rs"] after #[cfg_attr(windows, path = "child.rs")]
loads child.rs on Linux and FreeBSD, but test-lint compared the undecoded
spelling with the file name, dropped that route and reported a test in
child.rs as never-run. The plain attribute and the path argument of
cfg_attr now decode the escapes of an ordinary string literal with the
same unescape the cfg values use. Raw string literals are read as written.
2026-12-02 01:33:38 -08:00
dotCooCoo b65de1d729 Merge main into chore/never-run-test-allows 2026-12-02 01:21:47 -08:00
dotCooCoo df12f897d4 xtask: test-lint reads a closure body past turbofish commas
An expression closure such as `|body: fn()| forward::<u8, u16>(body)`
ended at the comma inside the turbofish, so a parameter named like an
asserting helper stopped shadowing it at that comma. The closure body
now skips a turbofish whole.

A count or emptiness getter on a pinned snapshot (`let _ = got.len();`)
keeps the pin; only a read of the receiver itself that is bound or
passed to a call may hand out an alias.
2026-12-02 01:11:04 -08:00
dotCooCoo cbd1936ae6 xtask: test-lint no longer reports helper, diagnostic and fixed-size false alarms
no-assertion:
- A call in a top-level test reaches the helper its own file defines. A
  non-asserting helper of the same name in another file of the crate no
  longer hides it. Names the file also calls with a path, and
  definitions below the file's top level, keep the crate's verdict.
- An `#[ignore = "reason"]` test that prints is a diagnostic and needs
  no assertion.
- An asserting function passed by name as a value
  (`keeping_settings(the_body)`, `run(&[body])`) counts as the test's
  check, also through a helper that passes it, unless a local binding,
  loop pattern, match arm or parameter shadows the name in scope, or the
  value is dropped (`drop(body)`, `let _ = Some(body)`, `(body,);`).

all-unguarded:
- A parenthesized range of literals or constants, `(0..3).all(...)`.
- A receiver whose source an earlier `assert_eq!` compares with a
  non-empty literal: a local collected from the receiver, or the call
  the receiver is bound to, when nothing changes the source in between.
  A shared borrow passed to a call outside an assertion may change it.
- A call to a function of the file that lists every row of a non-empty
  constant table without filtering it; every function of that name in
  the file has to do so.
2026-12-02 01:01:37 -08:00
dotCooCoo 35afebf9dd Merge main into fix/census-behavior-tables 2026-12-02 00:27:33 -08:00
dotCooCoo da8e9cc197 xtask: test-lint census leaves out loops that run each entry through a computation
A loop over a whole table whose body passes the entry to a call together
with other state (a command run, a file written, a render, a parse of
other input) checks behavior for each entry, so the census rule no
longer reports it. A lookup, a call on the entry alone, literal
arguments and calls in a failure message still count as a census.

The call counts only where it runs whenever the loop's assertions pass:
not after an `||`, not on the right of an `&&` whose result is not
asserted, not inside an `if`, `else`, `match` arm, `while` or async
body, and not inside a closure the loop never calls. A name counts as
the entry from the `let` that binds it from the entry to the end of its
block, and not where a nested loop, a closure parameter or another
`let` rebinds it or where it names a field. An asserting helper keeps a
loop out of the census only where it runs the same way, and a round trip
can read the entry as its receiver (`k.parse()`).
2026-12-02 00:03:36 -08:00
.CooCoo ed6619523c Merge pull request #10504 from dotCooCoo/fix/toolbar-chips-one-line
Tools: Color, Gradient and None share one line in a one-column rail
2026-12-01 22:45:13 -08:00
dotCooCoo 8b8e246713 xtask: test-lint keeps the route, suffix and census refinements main lacks
- never-run: in changed mode, a file that a crate target loaded at the
  base and no target loads now counts as compiled out, so removing the
  last `mod` or `#[path]` declaration on the way to it, or deleting the
  only target root that loads it, fails the check for its tests.
- reads-source: an `ends_with(".rs")` check counts only when it picks
  entries from a file listing (an iterator filter or a `for` loop over
  one), or when the function around it reads a file or calls a function
  in the file that does. A suffix check on a generated name in a test
  that reads nothing is not reported.
- census: a helper on the left of an `||` hides the whole-table check on
  the right only when it always runs: not behind an `&&`, and not inside
  one arm of an `if` or `match`.
- docs: unchanged-line `never-run` hits fail the command when the change
  takes away a test's last CI route.
2026-12-01 22:45:04 -08:00
.CooCoo 2f68b49692 Merge pull request #10534 from dotCooCoo/fix/test-lint-platform-only-tests
xtask: test-lint never-run lists tests that build on macOS or Windows without failing
2026-12-01 22:31:34 -08:00
dotCooCoo e727c01c13 Merge main into fix/test-lint-sleep-polls
main replaced the hit's per-file `also` ranges with `gates`, a list of
lines in the hit's own file. The sleep rule's loop and spawn spans now
add their lines to `gates`. The `last_literal` and `path_literal`
helpers that main replaced are left out.
2026-12-01 21:41:44 -08:00
dotCooCoo 906aa83b6c Merge main into fix/test-lint-platform-only-tests
main replaced Hit's `also` lines with `gates`; the merge keeps `gates`
and adds `report_only` beside it.
2026-12-01 21:41:39 -08:00
dotCooCoo c6c7de257f Dependencies: move the craft-libs pin to craft-libs main 77ade517
craft-libs #4659 (swatch chips that fit a one-column rail) and #4723
have merged, so every craft-libs rev moves from #4659's head edbf2117
to craft-libs main at 77ade517. The egui revisions move to 861d60a6,
the ones that craft-libs rev pins; winit stays at 0dfcec0e. Cargo.lock
changes only the sources of those packages.
2026-12-01 20:14:00 -08:00
dotCooCoo d1c255fa64 xtask: test-lint never-run lists tests that build on macOS or Windows without failing
never-run failed the check on tests of macOS- or Windows-only code, such
as the touchpad gesture tests in quickpenwheel.rs and the Windows
performance counter tests in vectorcraft-cli's perf.rs. CI cannot build
them on Linux, and they run locally on their platform.

A never-run hit on a test that still builds on macOS (aarch64 or x86_64)
or Windows (x86_64 or aarch64) is now listed with the report-only rules,
and its note says which platform to run it on. A test that no desktop
target builds, such as one gated on target_os = "ios" or
all(windows, unix), still fails the check.
2026-12-01 19:54:14 -08:00
dotCooCoo 40cd9932eb xtask: test-lint sleep rule checks the spawn call, std imports and counted loops
- A spawned sleep is exempt only when the closure is the direct argument
  of `spawn`, not of a call inside it such as `spawn(prepare(|| …))`.
- A bare `spawn` or `sleep`, and a `thread::` path, count only where a
  `use` brings them in from `std::thread`; `crate::thread::spawn` and
  `std::thread::{self as worker}` do not.
- A sleep hit inside a spawned closure spans through the end of the
  spawn statement, so an edit that adds `.join()` there counts as a
  change. The brace-less `spawn(|| thread::sleep(D))` form gets the
  same span.
- A block operand after a spaced `<` or `>` stays in the loop condition.
- `while n < bound` with `n = n + 1` or `n = n - 1` in the body is a
  counted loop, like `n += 1`.
- Calls inside the arguments of `println!`, `eprintln!` and the log
  macros are not polling work.
2026-12-01 18:25:30 -08:00
dotCooCoo c1b9fb98c3 Merge main into fix/test-lint-mirror-false-alarms 2026-12-01 18:24:34 -08:00
dotCooCoo 280ea946e5 Merge main into fix/test-lint-sleep-polls 2026-12-01 17:52:24 -08:00
dotCooCoo 8f66d6ce50 xtask: test-lint sleep rule reads counted loops, aliases and nested blocks
- A `while n < bound` loop that adds to or subtracts from `n` in its body
  counts its own passes, so calls in the bound (`attempts.len()`) no
  longer exempt the sleep. A condition that also has `&&` or `||` keeps
  its calls as polling evidence.
- A change to the loop or spawn closure around a reported sleep counts as
  a change to the hit, so an edit that removes the poll from the
  condition fails the changed-line check.
- `use std::thread::spawn as spawn_thread;` and
  `use std::thread::sleep as nap;` no longer bring in the bare names, and
  `thread::sleep_ms` no longer matches `thread::sleep`.
- A `thread::spawn` path counts only where a `use` binds `thread` to
  `std::thread`, so a local `mod thread` with its own `spawn` is not
  exempt.
- A `;` inside a nested block in a loop condition
  (`while !ready({ let key = 1; key })`) no longer ends the header, and a
  block after `||` stays part of the condition.
- A sleep in a `let` initializer block inside a dropped spawn closure is
  exempt like the closure's other sleeps; the same block inside a polling
  loop is still reported.
2026-12-01 17:52:24 -08:00