Commit Graph
74 Commits
Author SHA1 Message Date
bflatastic 780bfa081e Merge remote-tracking branch 'origin/main' into fix-1428
# Conflicts:
#	crates/testkit/Cargo.toml
2026-11-30 01:48:36 +07:00
dotCooCoo 0e8f90585d testkit: reject a zero case count in prop::config and run its tests in the it binary
config(0) without PROPTEST_CASES, or PROPTEST_CASES=0, now panics instead of
letting a property suite pass without running a case. The prop tests move
from their own test target into tests/it/prop.rs, behind the prop feature.
2026-11-29 00:50:53 -08:00
dotCooCoo 5209d1817e testkit: reject an unknown PROPTEST_RNG_ALGORITHM in prop::config
For a value it does not know, proptest prints a warning and falls back
to ChaCha, so a reproduction run with a misspelled algorithm used a
different generator and could pass. `config` now parses the variable
itself: `xs`, `cc` and `rc` select their generators, `pt` and any other
value make it panic, and an unset variable keeps the generator from
`Config::default()`.
2026-11-28 15:03:52 -08:00
dotCooCoo c32bb21596 testkit: reject PROPTEST_RNG_ALGORITHM=pt in prop::config
The pass-through generator reads caller-supplied bytes instead of a u64
seed, so a runner built from `config` with `PROPTEST_RNG_ALGORITHM=pt`
panicked inside proptest with a message that did not name the variable.
`config` now panics with a message naming `PROPTEST_RNG_ALGORITHM`.

New child-process tests cover the rejected `pt` value and check that the
XorShift generator (`xs`) is kept with the pinned seed and repeats its draws.
2026-11-28 08:09:01 -08:00
dotCooCoo 876cb5b12f Merge main into feat/craft-testkit-prop 2026-11-28 05:41:17 -08:00
dotCooCoo b5b5ca3fb6 Merge main into feat/craft-testkit-log 2026-11-28 05:17:37 -08:00
dotCooCoo 235fe4146a Merge main into feat/craft-testkit-log 2026-11-28 02:19:46 -08:00
dotCooCoo 3b82e85521 Merge main into feat/craft-testkit-prop 2026-11-28 02:16:47 -08:00
dotCooCoo 68ab810760 Merge main into feat/craft-testkit-mcp 2026-11-28 02:16:39 -08:00
dotCooCoo 565513eab9 Validate MCP tool results and drain output during shutdown 2026-11-26 16:57:19 -08:00
dotCooCoo 48b9770c15 testkit: bound retained notification bytes 2026-11-26 15:41:25 -08:00
dotCooCoo ce2f746e4c testkit: validate MCP replies and stop failed queued writes 2026-11-26 15:22:47 -08:00
dotCooCoo 0265dd5f52 Testkit: an empty table inside name or head no longer fails rename_family
The overlap check treated a table of length 0 whose offset points inside
the name or head table as sharing bytes, so rename_family returned
MalformedFont for a valid face. An overlap now needs at least one shared
byte. Nonempty overlapping tables are still refused.
2026-11-25 21:15:05 -08:00
dotCooCoo 3a4427a57f craft-testkit: close waits for the rest of the MCP child's stderr after it exits
close waited for the stderr thread only as long as close_grace, so with a
short or zero grace the bytes still in the pipe when the child exited could
be missing from CloseOutcome::stderr. It now waits up to 5 s after the child
exits, and only a process that keeps the child's stderr open waits that long.
2026-11-25 20:07:39 -08:00
dotCooCoo 92d264e811 Merge main into feat/craft-testkit-log 2026-11-25 19:57:06 -08:00
dotCooCoo 20f1cddbc9 Merge main into feat/craft-testkit-mcp 2026-11-25 19:54:43 -08:00
dotCooCoo bb9472cff4 Merge main into feat/craft-testkit-prop 2026-11-25 19:48:52 -08:00
dotCooCoo f825dd1b3f craft-testkit: font tests join the crate's one test binary
tests/fonts.rs moves to tests/it/fonts.rs and tests/it/main.rs adds it as a
module, so craft-testkit keeps a single integration test binary.
2026-11-25 19:27:25 -08:00
dotCooCoo 3c7f7d5c8b Merge main into feat/craft-testkit-fonts 2026-11-25 19:23:06 -08:00
dotCooCoo 793744d7ce Testkit: a nested library loaded by its own targets stays a crate root
A `src/lib.rs` below another package's `src` folder was treated as a
module whenever any declaration named it, including one in its own
package's binary. Its `extern crate muda as m;` then did not reach its
modules, and a `::m::PredefinedMenuItem::quit` call there was missed.
Only a declaration outside the package's `build.rs` and its `src`,
`tests`, `examples` and `benches` folders now makes it a module.
2026-11-25 16:53:01 -08:00
dotCooCoo dc2e7e8a54 Merge main into feat/craft-testkit-guards 2026-11-25 15:09:52 -08:00
dotCooCoo c48164d045 craft-testkit: skip brace-delimited macro input in predefined_quit
A macro's input in braces, `m! { ... }`, is skipped like one in
parentheses or brackets, so a `mod` or `extern crate` written there no
longer carries a crate root's extern prelude names to other files.
2026-11-24 00:04:42 -08:00
dotCooCoo c6b28caf8e craft-testkit: skip mod declarations in macro input and nested src roots loaded as modules
predefined_quit no longer follows a `mod` declaration in a macro's
input, an attribute or a `macro_rules!` body when it carries a crate
root's extern prelude names to other files. A `src/lib.rs` or
`src/main.rs` below a package's `src` folder that a declaration loads
is read as a module, not as a crate root of its own.
2026-11-24 00:01:22 -08:00
dotCooCoo ba150c85dc craft-testkit: keep extern crate in argument blocks and module target folders in their package
An `extern crate` in a block inside a call's arguments or an array is a
real declaration, so predefined_quit now reads it. The tokens skipped are
a macro's input in parentheses or brackets, an attribute's input and the
body of a `macro_rules!` definition.

A file in a `tests`, `bin`, `examples` or `benches` folder inside a known
package is a crate root only where cargo_target places it, so a module
that a `#[path]` attribute loads from `src/foo/tests/` no longer adds its
`extern crate` names to the crate's extern prelude.
2026-11-23 23:56:42 -08:00
dotCooCoo 07c8443ca7 craft-testkit: prop::config rejects an unparsable PROPTEST_RNG_SEED or PROPTEST_CASES
A set PROPTEST_RNG_SEED that is not a u64, or PROPTEST_CASES that is not
a u32, now makes config panic with the variable and its value. Before,
proptest printed a warning and kept its own default, so a mistyped seed
ran the suite with a random seed and a mistyped count ran 256 cases.
2026-11-22 07:34:04 -08:00
dotCooCoo 99cdde8d71 craft-testkit: read target folders at their place in a known package only
With a package folder found among the scanned files, `cargo_target`
accepts only Cargo's own target places below it (`build.rs`,
`src/bin/*.rs`, `src/bin/*/main.rs`, and the same in `tests`, `examples`
and `benches`), so `src/foo/tests/helper.rs` and `src/foo/src/bin/x.rs`
stay modules. A folder that holds files directly in `src/bin` is also a
package folder, unless it is inside the `src` folder of a package with a
`src/lib.rs` or `src/main.rs`, so a binary-only package keeps its binaries
as crate roots.
2026-11-19 21:49:17 -08:00
dotCooCoo 1b5bcc24f0 craft-testkit: predefined_quit skips never-compiled and macro-input root aliases
- A `mod` or `extern crate` declaration in an item whose `cfg` is false on
  every configuration (`cfg(any())`, `cfg(false)`, `cfg(not(all()))`) no
  longer carries a crate root's `extern crate muda as m;` alias to other
  files or binds `m` in its own file. A predicate that is false only on
  some targets still counts.
- An `extern crate` inside parentheses or brackets, such as a macro's
  input, is not read as a declaration.
- A `mod.rs` directly in `src/bin`, `tests`, `examples` or `benches` is a
  crate root, as Cargo's auto-discovery builds it as a target.
- Target folders are read below the package folder only: the nearest
  folder above a file that holds a `src/lib.rs` or `src/main.rs` among the
  scanned files. A package under a folder named `tests` keeps its
  `build.rs` and test files as crate roots.
2026-11-19 21:39:24 -08:00
dotCooCoo c451df07ae craft-testkit: a src folder above the package keeps its targets crate roots
`rust_sources` returns paths that include the folder it was given, so a
package under a folder such as `~/src` made every `src/bin` file and its
`build.rs` look nested, and predefined_quit missed `::menu` calls after
their `extern crate muda as menu;`. Files directly in `src/bin`, and
`main.rs` one folder below it, are now always crate roots, and another
target folder counts as nested only directly inside `src` or below a
`bin`, `tests`, `examples` or `benches` folder.
2026-11-19 20:40:23 -08:00
dotCooCoo 7120e4a2e5 craft-testkit: a package's build.rs and binary main.rs stay crate roots
Cargo builds a package's `build.rs` and `src/bin/<name>/main.rs` (and
`main.rs` one folder inside `tests`, `examples` or `benches`) as crates
of their own, also when another file loads them through `#[path]`.
predefined_quit now reads their `extern crate muda as menu;` as a crate
root's.
2026-11-19 20:35:59 -08:00
dotCooCoo fa829e4a37 craft-testkit: read identifier characters with std only
The guards need only std, so the unicode-ident dependency is removed.
Outside literals and comments Rust allows a non-ASCII character only in
an identifier or as white space, so the lexer reads every non-ASCII
character other than white space as part of an identifier. The
left-to-right and right-to-left marks and a byte order mark are read as
white space, so `t\u{200F}::Instant::now()` is still reported.
2026-11-19 20:31:49 -08:00
dotCooCoo 2477df8c86 craft-testkit: files in a package's target folders stay crate roots
Cargo builds every file in a package's `src/bin`, `tests`, `examples`
and `benches` folder as its own crate, also when another target
declares it as a module. predefined_quit now reads such a file's
`extern crate muda as menu;` as a crate root's. A target folder inside
`src` or inside another target folder still holds modules.
2026-11-19 20:27:34 -08:00
dotCooCoo abaaa097f9 craft-testkit: a crate root's extern crate alias reaches modules beside it
A crate root such as `src/bin/tool.rs` or `tests/foo.rs` declares its
modules in its own folder, so `mod child;` names `src/bin/child.rs`.
predefined_quit looked for them under `src/bin/tool/` and missed
`::menu::PredefinedMenuItem::quit` in the child after
`extern crate muda as menu;` in the root.
2026-11-19 20:21:13 -08:00
dotCooCoo ccaf31d4c9 craft-testkit: guards read identifiers that hold combining marks
The guards' lexer split an identifier at a nonspacing mark such as
U+0301, so `use std::time as t\u{301};` bound `t` and a later
`t\u{301}::Instant::now()` was not reported. Identifiers now follow the
Unicode XID_Start and XID_Continue properties, as rustc reads them,
through the unicode-ident crate that the workspace already locks.
2026-11-19 20:17:01 -08:00
FredApps 62f44de3d6 Consolidate related support tests 2026-11-19 13:07:16 +01:00
dotCooCoo 6a252215ad Merge main into feat/craft-testkit-prop 2026-11-16 20:49:58 -08:00
dotCooCoo 5f47a0abea craft-testkit: a malformed MCP reply to another id is a protocol error
A reply to an id the client is not waiting for was skipped without a
look at its shape, so a reply with both or neither of `result` and
`error`, or an error without an integer code and a string message, left
the waiting request to run into its deadline. It is now a protocol error
that closes the connection; a well-formed reply to another id is still
skipped.
2026-11-16 20:17:44 -08:00
dotCooCoo 958ced53eb craft-testkit: an MCP message whose id is not a string, number or null is a protocol error
A reply or request from the server with an id such as true, an array or
an object was skipped as an unrelated reply, so the request waited for
its deadline. It now returns a protocol error and closes the connection.
2026-11-16 20:13:36 -08:00
dotCooCoo f398434bb4 Merge main into feat/craft-testkit-mcp 2026-11-16 20:09:58 -08:00
dotCooCoo 80559321c9 Merge main into feat/craft-testkit-log
Main's craft-testkit (guards, deadline, hostile) replaces this branch's copy of the guards. The branch keeps only the log feature on top of it: crates/testkit/src/log.rs, its three test files, the feature and test targets in crates/testkit/Cargo.toml, the doc paragraph and module in lib.rs, the log section in the crate README, and log in craft-testkit's Cargo.lock entry.
2026-11-16 20:09:40 -08:00
.CooCoo c91e32eb67 craft-media-testkit: run hostile and with_deadline on craft-testkit (#1462) 2026-11-16 21:34:35 -05:00
dotCooCoo 70275fe34d craft-testkit: guards read absolute paths through the extern prelude and step over an if or match in a native cfg head
- std_instant no longer reads `::m::Instant` or `use ::m::Instant;` through a local alias `m` of
  `std::time`; a path that starts with `::` names an external crate.
- predefined_quit reads a name that `extern crate muda as m;` outside any braces of a crate root adds
  to the extern prelude like `muda`, with or without a leading `::`, in the root and in every file
  that a chain of `mod` declarations from it names.
- An `if` or `match` expression in the condition, scrutinee or iterator of a native cfg `if`, `while`,
  `match` or `for` is read to its last block, so the body that follows is covered.
2026-11-15 13:32:52 -08:00
dotCooCoo 6e6188c17d Merge feat/craft-testkit-guards into feat/craft-testkit-fonts 2026-11-14 20:27:50 -08:00
dotCooCoo da534b341f craft-testkit: guards follow names the muda crate is imported under
predefined_quit reports menu::PredefinedMenuItem::quit after use muda as menu;, use muda::{self as menu}; or extern crate muda as menu;, and reads those names in the scope of each path and import. A leading :: names an external crate, an extern crate of another crate shadows the name, and use muda as menu; binds menu to the crate only where muda names it.
2026-11-14 20:23:09 -08:00
dotCooCoo 2ec3ffee2b craft-testkit: the CACHEDIR.TAG FIFO test runs without a timeout
The test opens the FIFO for reading and writing and puts the signature
in the pipe before the scan. A scan that opened the FIFO would read the
signature and leave out `kept.rs` instead of blocking, so the test no
longer waits on a thread with a 30-second bound.
2026-11-14 20:12:06 -08:00
dotCooCoo 7ce5c2cc3d craft-testkit: guards read blocks in a native cfg if condition, renames through a local muda and cfg-gated time shadows
- A native-only `if`, `while`, `match` or `for` whose condition holds a
  block expression (`if { ready } { ... }`, `while !{ x }`, `unsafe`,
  `loop`, `async` and labeled blocks) is covered up to its real body, so
  `std_instant` skips the body.
- `predefined_quit` no longer follows `use muda::PredefinedMenuItem as
  Item;` or `type Alias = muda::PredefinedMenuItem;` when the braces
  around it bind `muda` to something else (`use other_menu as muda;`).
  `::muda::` still names the crate.
- In `std_instant`, a `use` or `mod` that binds an alias name to
  something else and carries its own `cfg` attribute that may be false
  on `wasm32-unknown-unknown` no longer hides an outer
  `use std::time as clock;`.
2026-11-14 20:08:41 -08:00
dotCooCoo fc64e4d176 Merge feat/craft-testkit-guards into feat/craft-testkit-fonts 2026-11-14 19:36:02 -08:00
dotCooCoo 7da619dc4e craft-testkit: guards keep names past the use-path limits, report underscore imports in groups and keep crate roots in module cycles
- A `use` whose path is longer than the copy limits still binds its name,
  and keeps its first segment, so another crate's long path no longer reads
  as an unbound `PredefinedMenuItem` and a long `crate::` path still reads as
  a possible re-export.
- `std_instant` reports `use std::{time::Instant as _};`; `_` only stops the
  name from being bound.
- `std_instant` checks the leaves read without aliases as well as the ones
  read through them, so an alias in a nested module no longer hides an outer
  `use std::{time::Instant};`.
- A cycle of `mod` declarations that no other file names keeps a crate
  root: its `lib.rs` or `main.rs`, or every member when it has neither. A
  `lib.rs` that names itself through a disabled `#[path]` declaration is
  checked again.
- `predefined_quit` does not report `muda::PredefinedMenuItem::quit` where
  a `use` or a `mod` in scope binds `muda` to something else
  (`use other_menu as muda;`); `::muda::` is still reported.
2026-11-14 19:15:51 -08:00
dotCooCoo 3396fa70fa Merge feat/craft-testkit-guards into feat/craft-testkit-fonts 2026-11-14 18:41:19 -08:00
dotCooCoo 97f970c58c craft-testkit: guards keep generic-bracket blocks in a native cfg item, read only a regular CACHEDIR.TAG and read names in their scope
std_instant ended a native-only fn, impl, trait, struct, enum or union item
at the closing brace of a block inside its angle brackets, such as the
const generic default in `struct Native<const N: usize = { 1 + 2 }>`, a
`Foo<{ N }>` argument, a return type or a `where` clause. The rest of the
item was then checked as web code. Blocks inside those angle brackets no
longer end the item, and the `>` of `->` does not close a bracket.

rust_sources opened a folder's CACHEDIR.TAG without checking its file
type, so it followed a symbolic link and could block on a FIFO. It now
reads the marker only when symlink_metadata reports a regular file;
any other marker is not read and the folder is listed.

predefined_quit reported a bare `PredefinedMenuItem::quit` when the file
imported another crate's type under that name or defined its own, and
applied a rename of muda's type (`use muda::PredefinedMenuItem as Item`)
to the whole file. A name used on its own is now read in the innermost
braces around it, within its module, that bind it: it is reported when
they import or alias muda's type, and not when they only bind another
type. An import or alias through `crate::`, `self::` or `super::`, a
binding inside an item with a `cfg` attribute and an associated type in
an `impl` or `trait` do not bind the name.

std_instant applied an alias of `std::time` (`use std::time as clock`)
to the whole file. A path or `use` through the alias is now reported
only where the alias is in scope by the same rule, so another module's
`use web_time as clock` is not read as `std::time`.
2026-11-14 18:36:00 -08:00
dotCooCoo 32dc18f238 Merge feat/craft-testkit-guards into feat/craft-testkit-fonts 2026-11-14 17:50:41 -08:00