Skip to main content

candor_classify/
lib.rs

1//! candor-classify — the curated effect classifier (crate+path -> effect), extracted to a STABLE
2//! crate so both the nightly `rustc_private` lint AND a stable backend share ONE source of truth
3//! (no drift). Pure string logic; no rustc internals. The effect vocabulary lives in candor-report.
4
5use candor_report::EFFECTS;
6
7/// The canonical CANDOR_POLICY DSL parser (SPEC §6.2), shared by the nightly gate and candor-query.
8pub mod policy;
9#[cfg(test)]
10mod policy_props;
11
12/// The SURPRISE heuristic (the cold-repo hook) — SHARED so candor-scan's scan-time note and
13/// candor-query's `tour` verb can't drift. Generic over the effect element type.
14pub mod surface;
15
16/// The transitive least fixed point over a call graph — SHARED so the scanner's gate-side reason-class
17/// accumulator and candor-query's `unverified --class` filter resolve over the SAME reach.
18pub mod propagate;
19
20/// ⟨0.24⟩ The §6.2 GATE over an already-accumulated signature — SHARED so `candor-scan --policy` and
21/// `candor-query gate --report` (SPEC §3.1) are the same gate reached by two routes, not two gates.
22pub mod gate;
23
24/// Project-supplied rules, consulted only when the built-in `classify` returns None.
25pub fn classify_extra(
26    crate_name: &str,
27    path: &str,
28    extra: &[(&'static str, bool, String)],
29) -> Option<&'static str> {
30    for (eff, is_crate, prefix) in extra {
31        let hit = if *is_crate { crate_name.starts_with(prefix.as_str()) } else { path.starts_with(prefix.as_str()) };
32        if hit {
33            return Some(eff);
34        }
35    }
36    None
37}
38
39/// The exact third-party crates `classify` has effect rules for, and the crate-name
40/// PREFIXES it recognizes. This is the single source of truth for "what candor knows":
41/// it is emitted beside the JSON report (`<prefix>.calibrated.json`) so the Claude Code
42/// receipt's coverage check reads candor's real coverage instead of a hand-copied list.
43/// Keep in lockstep with `classify` below — the `db_crates_are_calibrated` and
44/// `calibrated_crates_are_live` tests (in this crate's `tests` module) enforce both directions.
45pub const CALIBRATED_CRATES: [&str; 82] = [
46    // network (aws_config resolves credentials over the network on `.load()`;
47    // git2 remote ops — fetch/push/connect — contact the network; async_net is smol's net layer;
48    // pnet is raw L2/L3 packet capture)
49    "reqwest", "isahc", "ureq", "curl", "aws_config", "git2", "tokio_tcp", "tokio_udp", "async_net",
50    "async_nats", "lapin", "lettre", "tungstenite", "elasticsearch", "tonic", "rdkafka", "pnet",
51    // directory traversal (ignore = gitignore-aware walker, powers ripgrep/fd; its walk executors are Fs)
52    // + filesystem watching (notify = inotify/FSEvents/kqueue wrapper; powers watchexec/cargo-watch)
53    "ignore", "notify",
54    // database (see DB_CRATES in classify)
55    "sqlx", "rusqlite", "postgres", "tokio_postgres", "diesel", "redis", "mongodb",
56    "mysql", "mysql_async", "sea_orm", "deadpool_postgres",
57    // filesystem (async_fs = smol; fs_err = std::fs wrapper; tempfile; glob) / entropy /
58    // subprocess (async_process = smol; duct) / env (dotenvy/dotenv) / clock (time) / log / clipboard
59    "memmap2", "fs_err", "async_fs", "tempfile", "glob",
60    "rand", "getrandom", "fastrand",
61    // entropy: the password-hashing tier (salt mints + bcrypt's internal salt) + the OsRng source
62    "argon2", "bcrypt", "scrypt", "pbkdf2", "password_hash", "rand_core",
63    "portable_pty", "async_process", "duct",
64    "dotenvy", "dotenv",
65    "chrono", "time", "tracing", "log", "arboard",
66    // compiler diagnostic emission (a dylint lint's output) — see the Log rules in classify
67    "rustc_lint", "rustc_errors",
68    // raw syscalls via FFI — the syscall-name table that lights up the FFI-thin tier (nix is routed
69    // through the same table by leaf name, so a consumer of nix is covered without nix's own source)
70    "libc", "nix", "rustix",
71    // coverage-differential additions (verb-keyed; see the per-crate rules near the end of classify):
72    // sync TLS core + native-tls variants (Net); env/dir resolution + argv + LS_COLORS (Env);
73    // sqlx-core execution terminals (Net/Db); directory walk + timestamp mutation + same-file (Fs);
74    // process-spawn helpers (Exec); signal handler + interactive-tty prompts (Ipc); env_logger (Log);
75    // jiff/backoff clock reads (Clock).
76    "rustls", "native_tls_crate", "tokio_native_tls",
77    "etcetera", "wild", "lscolors",
78    "sqlx_core", "walkdir", "filetime", "clircle",
79    "execute", "ctrlc", "clap", "jiff", "env_logger",
80    "dialoguer", "console", "terminal_colorsaurus", "backoff", "grep_cli",
81    // TUI: the terminal is a user dialogue channel (Ipc), exactly as dialoguer/console already rule.
82    // crossterm does the tty I/O; ratatui renders to a Buffer and drives a backend that does.
83    "crossterm", "ratatui",
84    // tracing_subscriber: the fmt INIT terminals write program output (Log); the EnvFilter constructors
85    // read RUST_LOG (Env). Everything else — layers, formatters, filter types — is a builder.
86    "tracing_subscriber",
87];
88
89pub const CALIBRATED_PREFIXES: [&str; 3] = ["aws_sdk_", "aws_smithy", "cap_"];
90
91/// Crates `classify` matches by PATH prefix rather than crate-name equality (their effectful modules
92/// are recognised, e.g. `tokio::net::`/`async_std::fs::`/`mio::net::`), so they're absent from
93/// `CALIBRATED_CRATES` (which the liveness test probes by crate name). The coverage check must still
94/// treat them as *covered* — otherwise it would mislabel the most common async crates as blind spots.
95pub const PATH_CALIBRATED_CRATES: [&str; 3] = ["tokio", "async_std", "mio"];
96
97/// The FFI-thin syscall crates whose `CALIBRATED_CRATES` membership is INCOMPLETE BY DESIGN.
98///
99/// For every OTHER calibrated crate, "classify returned None" is a REVIEWED verdict — the table covers
100/// the crate's effectful surface, so a miss means the call really is pure, and candor-scan's coverage
101/// ledger exempts all of `CALIBRATED_CRATES` from blind-spot disclosure on exactly that theory (a
102/// calibrated crate's silence is informative). That does not hold for `libc`/`nix`/`rustix`: the table
103/// above DELIBERATELY skips their generic fd verbs (`read`/`write`/`close`/`lseek`/`dup`/`fcntl`/...)
104/// because a fixed label would mis-categorise an ambiguous fd (file? socket? pipe?) as often as it
105/// helps — an honest no-classify, not a purity finding. Real programs that touch these crates go
106/// through those exact verbs constantly (`libc::read(fd, ..)` IS the effect, not a builder step), so the
107/// blanket exemption converted "no rule here" into a confident, silent purity claim: `fn drain(fd: i32)
108/// { libc::read(fd, buf, 64); }` reported zero effects AND zero disclosure (R59, SOUNDNESS.md) — worse
109/// than an uncalibrated dependency, which at least discloses `invisible`.
110///
111/// Consumed ONLY by candor-scan's coverage-ledger filter (the same one-consumer site
112/// `coverage_has_exactly_one_anchor_and_exactly_one_consumer` enforces), to carve these three OUT of the
113/// `CALIBRATED_CRATES` exemption there — an unclassified call into them still joins the ledger and
114/// disclosed `invisible`, exactly like a call into an uncalibrated dependency, while their CLASSIFIED
115/// calls (`open`/`close`/`socket`/...) are untouched (they never reach the ledger at all — see
116/// `blind_direct`'s `classified.is_none()` gate). Deliberately NOT removed from `CALIBRATED_CRATES`
117/// itself: that list means "classify has SOME live rules here" (true — the FS/NET/EXEC/IPC/ENV/CLOCK/
118/// RAND tables all fire for these three), and stays the honest `.calibrated.json` sidecar contract.
119pub const CALIBRATED_BUT_PARTIAL_CRATES: [&str; 3] = ["libc", "nix", "rustix"];
120
121/// SOUNDNESS R311 — the version each calibrated crate's rules were actually WRITTEN AGAINST.
122///
123/// `CALIBRATED_CRATES` converts "no rule matched" into "reviewed, and pure", with no disclosure. That
124/// claim is evidence about SOURCE SOMEONE READ, and it was being granted on the crate NAME alone — so
125/// an upstream release extended it, silently, to code that did not exist when the review happened.
126/// Measured 2026-09-07: the sea_orm rule block says in terms that it was "verified against sea-orm
127/// 1.1.20 source"; the calibrated fixture resolved 2.0.2, whose `DatabaseExecutor`,
128/// `RestrictedConnection`, `RestrictedTransaction`, `RbacContext` and `RusqliteSharedConnection` carry
129/// 43 public entry points that no rule can name and every one of which read PURE.
130///
131/// A crate resolving ABOVE its ceiling is downgraded to `CALIBRATED_BUT_PARTIAL_CRATES` behaviour:
132/// matched calls keep their rules (they are still right), unmatched calls rejoin the ledger and
133/// disclose `invisible` instead of reading as reviewed-pure. Fail-closed AT THE POINT THE CLAIM IS
134/// MADE — the coverage gate can only ever notify us afterwards.
135///
136/// EXACT, not major-only, and the direction is deliberate: an exact ceiling fails NOISY (a minor bump
137/// discloses until someone re-reviews and moves the line) while major-only fails SILENT — and the
138/// minor direction is not hypothetical, since redis 1.6.0 -> 1.7.0 and mongodb 3.8.1 -> 3.9.0 both
139/// produced real uncovered entry points in the same measurement. Per the family's denylist rule, start
140/// strict and relax against measured disclosure volume, never the reverse.
141///
142/// A crate ABSENT from this table keeps its unconditional exemption: the ceiling is a denylist of
143/// versions known to be beyond the review, not an allowlist of versions blessed by it. Adding a crate
144/// here is what makes its claim honest, so the table is expected to grow toward `CALIBRATED_CRATES`.
145// SOUNDNESS R328 — this table is MERGED, never rewritten. `bbd7615` replaced it wholesale with a
146// freshly-computed dict and silently dropped NINE entries (dialoguer, dotenv, dotenvy, grep_cli, isahc,
147// lettre, portable_pty, tempfile, postgres) while its own commit message claimed "four crates are
148// deliberately absent, each with a stated reason in the code". Eight had no stated reason and every one
149// of them cites a version in its own rules — they are exactly the crates the ceiling exists to protect,
150// and the protection would have been gone the moment any of them published. Effect classes at stake:
151// Net (isahc), SMTP (lettre), Exec (portable_pty), Fs (tempfile), Env (dotenv/dotenvy), Ipc (dialoguer).
152//
153// DELIBERATELY ABSENT, and this is the complete list:
154//   postgres  — R313. Its recorded 0.7.10 was TOKIO-postgres's version, lifted by a regex from a comment
155//               about a different crate; postgres ships 0.19.x. No verified baseline exists and inventing
156//               one is the claim-without-review this table exists to stop.
157//   async_fs, getrandom — their rules match on CRATE NAME alone, so no path can go stale.
158//   rand_core — R320/R333 unresolved.
159pub const CALIBRATED_CEILINGS: [(&str, &str); 70] = [
160    ("arboard", "3.6.1"),
161    ("argon2", "0.6.0"),
162    ("async_nats", "0.35.1"),
163    ("async_process", "2.5.0"),
164    ("aws_config", "1.12.0"),
165    ("backoff", "0.4.0"),
166    ("bcrypt", "0.19.3"),
167    ("chrono", "0.4.45"),
168    ("clap", "4.6.6"),
169    ("clircle", "0.6.1"),
170    ("console", "0.15.11"),
171    ("crossterm", "0.28.1"),
172    ("ctrlc", "3.5.2"),
173    ("curl", "0.4.50"),
174    ("deadpool_postgres", "0.14.2"),
175    ("dialoguer", "0.12.0"),
176    ("diesel", "2.3.13"),
177    ("dotenv", "0.15.0"),
178    ("dotenvy", "0.15.7"),
179    ("duct", "1.1.2"),
180    ("elasticsearch", "8.19.0-alpha.1"),
181    ("env_logger", "0.11.11"),
182    ("etcetera", "0.11.0"),
183    ("execute", "0.3.0"),
184    ("fastrand", "2.5.0"),
185    ("filetime", "0.2.29"),
186    ("fs_err", "3.3.1"),
187    ("git2", "0.20.4"),
188    ("glob", "0.3.4"),
189    ("grep_cli", "0.1.12"),
190    ("ignore", "0.4.33"),
191    ("isahc", "2.0.1"),
192    ("jiff", "0.2.35"),
193    ("lapin", "4.10.0"),
194    ("lettre", "0.11.23"),
195    ("log", "0.4.34"),
196    ("lscolors", "0.21.0"),
197    ("memmap2", "0.9.11"),
198    ("mongodb", "3.8.1"),
199    ("mysql", "28.0.0"),
200    ("mysql_async", "0.37.0"),
201    ("native_tls_crate", "0.2.18"),
202    ("notify", "8.2.0"),
203    ("password_hash", "0.6.1"),
204    ("pbkdf2", "0.13.0"),
205    ("pnet", "0.35.0"),
206    ("portable_pty", "0.9.0"),
207    ("rand", "0.10.2"),
208    ("ratatui", "0.29.0"),
209    ("rdkafka", "0.39.0"),
210    ("redis", "1.6.0"),
211    ("reqwest", "0.13.4"),
212    ("rusqlite", "0.39"),
213    ("rustls", "0.23.43"),
214    ("scrypt", "0.12.0"),
215    ("sea_orm", "1.1.20"),
216    ("sqlx", "0.9.0"),
217    ("sqlx_core", "0.9.0"),
218    ("tempfile", "3.27.0"),
219    ("terminal_colorsaurus", "1.0.3"),
220    ("time", "0.3.55"),
221    ("tokio_native_tls", "0.3.1"),
222    ("tokio_postgres", "0.7.18"),
223    ("tonic", "0.12.3"),
224    ("tracing", "0.1.44"),
225    ("tracing_subscriber", "0.3.23"),
226    ("tungstenite", "0.30.0"),
227    ("ureq", "2.12.1"),
228    ("walkdir", "2.5.0"),
229    ("wild", "2.2.1"),
230];
231
232/// `true` when `resolved` is a version this crate's rules were NOT written against — i.e. strictly
233/// newer than its ceiling. Unknown crate, unparseable version, or an exact match: `false`, keep the
234/// exemption. Comparison is numeric per dotted component so `1.10.0 > 1.9.0`; a pre-release or build
235/// suffix on the resolved version is treated as ABOVE the release it decorates, which is the
236/// charging direction.
237/// Version-only comparison: is `a` strictly newer than `b`? Shared with `candor-scan`'s lockfile
238/// parser so "which of two versions of one crate do we keep" is answered by the SAME comparator that
239/// decides whether a version is beyond review — one authority, not two spellings that drift.
240pub fn calibration_exceeded_raw(a: &str, b: &str) -> bool {
241    let parts = |v: &str| -> Vec<u64> {
242        v.split(['+', '-']).next().unwrap_or("")
243            .split('.')
244            .map(|p| p.parse::<u64>().unwrap_or(0))
245            .collect()
246    };
247    let (x, y) = (parts(a), parts(b));
248    for i in 0..x.len().max(y.len()) {
249        let (p, q) = (x.get(i).copied().unwrap_or(0), y.get(i).copied().unwrap_or(0));
250        if p != q {
251            return p > q;
252        }
253    }
254    a != b
255}
256
257pub fn calibration_exceeded(crate_name: &str, resolved: &str) -> bool {
258    let Some((_, ceiling)) = CALIBRATED_CEILINGS.iter().find(|(c, _)| *c == crate_name) else {
259        return false;
260    };
261    let parts = |v: &str| -> Vec<u64> {
262        v.split(['+', '-']).next().unwrap_or("")
263            .split('.')
264            .map(|p| p.parse::<u64>().unwrap_or(0))
265            .collect()
266    };
267    let (r, c) = (parts(resolved), parts(ceiling));
268    if r.is_empty() {
269        return false;
270    }
271    for i in 0..r.len().max(c.len()) {
272        let (a, b) = (r.get(i).copied().unwrap_or(0), c.get(i).copied().unwrap_or(0));
273        if a != b {
274            return a > b;
275        }
276    }
277    // Equal numerically: a pre-release/build suffix means it is not the reviewed artifact.
278    resolved != *ceiling
279}
280
281
282/// Crates REVIEWED AND FOUND TO PERFORM NO EFFECT OF THEIR OWN — the κ ledger treats them as covered, so
283/// their calls stop being disclosed blind spots.
284///
285/// SEPARATE FROM `CALIBRATED_CRATES` BY NECESSITY, not taste. That list means "classify has effect rules
286/// here", and `calibrated_crates_are_live` fails any entry no rule matches — "a dead entry would silently
287/// suppress a real coverage warning". A genuinely pure crate has no rule to be live, so it cannot go
288/// there; without this list the only way to silence its noise would be to invent a rule, which is worse.
289///
290/// **THIS LIST MANUFACTURES PURITY CLAIMS, so an entry needs evidence and not a reputation.** A crate here
291/// stops being disclosed and starts being believed. Each of these was checked against its source in the
292/// local cargo registry for `std::{fs,net,process,env}` and stdio use, and every apparent hit was a DOC
293/// COMMENT (serde_json's `/// [`File`]: std::fs::File`, serde_yml's `///  io::stdout()`):
294///
295///   serde_json 1.0.151, serde_yml 0.0.12, toml 1.1.3, regex 1.13.1, sha2 0.11.0
296///
297/// `color_eyre` was on the same filing and is NOT here — FETCHED AND CHECKED 2026-08-03, and it is not
298/// pure. It reads `RUST_BACKTRACE` / `RUST_LIB_BACKTRACE` / `RUST_SPANTRACE` / `COLORBT_SHOW_HIDDEN`
299/// (Env, `config.rs:939..1175`) and **opens source files to render code snippets** (Fs,
300/// `config.rs:248`). It is also not CALIBRATED, deliberately: the `File::open` sits inside
301/// `impl fmt::Display for SourceSection`, reached when a report is RENDERED rather than through any named
302/// verb a caller invokes — so there is no path for a rule to match, and calibrating the crate would turn
303/// that render path into an unmatched path, i.e. a PURITY CLAIM over the file read. Its calls therefore
304/// stay disclosed as a blind spot. The noise is real; it is also honest, and that is the right trade.
305///
306/// THE SERIALIZER CAVEAT, worth stating because it is the one that looks wrong: `serde_json::from_reader`
307/// and `to_writer` do move bytes — but through a handle the CALLER had to obtain, and obtaining it (a
308/// `File::open`, a `TcpStream::connect`) is already classified on the caller. The crate performs no
309/// syscall of its own, so charging it would double-count an effect the caller already carries.
310pub const REVIEWED_PURE_CRATES: [&str; 5] = ["serde_json", "serde_yml", "toml", "regex", "sha2"];
311
312/// The completeness gate's escape hatch (`eval/coverage-gate/`, `tests/coverage_gate.rs`): exact
313/// (crate, consumer-facing path) pairs a human has read and found genuinely pure, despite `candor-scan`
314/// self-scanning the crate's own vendored source finding a reachable Fs/Net/Db/Exec effect there. SEPARATE
315/// from `REVIEWED_PURE_CRATES` — that list exempts a WHOLE crate from the coverage LEDGER's crate-level
316/// disclosure; this one exempts a single ENTRY from the completeness GATE's per-function differential.
317/// The gate's generator run (2026-08-27) found 669 self-scan-confirmed entries `classify()` already
318/// recognizes (checked in as `covered.tsv`, asserted every push) and 251 it did not yet recognize under
319/// any guessed spelling (checked in as `open.tsv`, a ratchet — NOT individually hand-verified, see that
320/// file's header). An `open.tsv` row belongs here ONLY once read against the crate's real source and
321/// confirmed to perform no effect (the SAME evidence bar `REVIEWED_PURE_CRATES` documents) — until then
322/// it stays in the ratchet as an open question, not a silent assumption. The five below were the first
323/// batch, from the 2026-08-27 coverage-gate triage:
324///
325///   - `curl::Multi::timeout` — this file's own `curl` rule (above) already documents WHY: `Easy::
326///     timeout` is a pure `CURLOPT_TIMEOUT` setter sharing the `::timeout` leaf, and an under-report on
327///     the rare event-loop kick beats mis-tagging every consumer that sets a timeout.
328///   - `execute::command` / `execute::shell` — this file's own `execute` rule (above) already documents
329///     WHY: both free functions only BUILD a `std::process::Command` (no `.spawn()`/`.output()`/
330///     `.status()` call in either body) and return it to the caller, who spawns it themselves — the
331///     caller's own `Command::spawn()` carries the effect. Self-scan's raw "Exec" signal comes from
332///     `std::process::Command::new`'s coarse whole-type rule (constructing a `Command` is Exec by
333///     default, narrowed only for crates like `async_process` that document their own pure-setter
334///     surface), not from an actual subprocess launch in either function.
335///   - `elasticsearch::Response::content_type` — a pure accessor reading a header off an ALREADY-received
336///     response (`self.response.headers().get(..)`, http/response.rs:61) — no I/O of its own. Self-scan's
337///     raw "Net" signal is the underlying HTTP client response type's coarse whole-type propagation, not
338///     a second network round-trip.
339///   - `rusqlite::Context::get_connection` — this file's own rusqlite rule (above) already documents WHY:
340///     it hands back a `ConnectionRef` BORROWED from the ALREADY-established connection a running SQL
341///     function executes within (`ffi::sqlite3_context_db_handle`, not a syscall) — the same "handle
342///     accessor, not a syscall" shape as `TcpStream::local_addr`.
343///
344/// The next two (2026-08-28, the widened-CORE audit's `Ipc` batch — see `eval/coverage-gate/generate.py`
345/// for why `Ipc` only entered the trigger set that day) are a DIFFERENT reason than the five above: not
346/// "no effect", but genuinely UNREACHABLE — the item really does perform the effect self-scan found, but
347/// no external consumer can ever name it, because the module it lives in is declared with no `pub` at
348/// all and neither the module nor the item is re-exported anywhere in the crate root (checked against
349/// real source, both ways):
350///   - `dialoguer::Paging::render_prompt` — `dialoguer::paging` is a bare `mod paging;` (dialoguer
351///     0.12.0, lib.rs:62: `use paging::Paging;`, not `pub use`), so `pub struct Paging` and its `pub fn
352///     render_prompt` (which DOES call `Term::flush`, a real Ipc effect per this file's own `console`
353///     rule) are internal machinery every `Select`/`MultiSelect`-style prompt uses to render its own
354///     paginated view — the effect is already charged at THOSE public entry points' own `::interact*`
355///     rule (above), not double-counted here.
356///   - `mysql::Stream::connect_socket` — `mysql::io` is a bare `mod io;` (mysql 28.0.0, lib.rs:897, no
357///     `pub use` of `io::*` or `Stream` anywhere), so `pub enum Stream` and its `pub fn connect_socket`
358///     (a real Unix-domain-socket `connect()`, Ipc) are reachable only from within the crate's own
359///     connection-establishment code — a real consumer can't name `mysql::Stream` at all, let alone call
360///     a bare constructor on it.
361pub const REVIEWED_PURE_ENTRIES: &[(&str, &str)] = &[
362    ("curl", "curl::Multi::timeout"),
363    ("execute", "execute::command"),
364    ("execute", "execute::shell"),
365    ("elasticsearch", "elasticsearch::Response::content_type"),
366    ("rusqlite", "rusqlite::Context::get_connection"),
367    ("dialoguer", "dialoguer::Paging::render_prompt"),
368    ("mysql", "mysql::Stream::connect_socket"),
369];
370
371/// Representative path tails (each appended to a crate name) that the `calibrated_crates_are_live`
372/// liveness test probes: at least one must match for every `CALIBRATED_CRATES` entry, else the entry is
373/// dead. Exported as ONE source of truth because the nightly lint crate (`src/lib.rs`) runs the SAME
374/// liveness test — when the two probe lists were duplicated they drifted, and a rule keyed on a
375/// distinctive tail (pnet `::datalink::channel`, ignore `::WalkBuilder::build_parallel`, notify
376/// `::RecommendedWatcher::new`) added to only one list silently broke the other crate's `cargo test`.
377pub const CALIBRATION_PROBE_TAILS: &[&str] = &[
378    "::X::send", "::X::execute", "::X::call", "::X::query", "::X::fetch_one", "::Remote::fetch",
379    "::datalink::channel", "::WalkBuilder::build_parallel", "::RecommendedWatcher::new",
380    "::X::connect", "::Utc::now", "::X::load", "::__private_api::log", "::tempfile", "::glob",
381    "::X::run", "::dotenv", "::random", "::emit", "::X::emit_span_lint", "::X::anything",
382    "::X::draw",
383    "::SaltString::generate", "::hash", "::OsRng::fill_bytes",
384    // verb-precise crates whose whole-crate rules were narrowed to the effectful surface (the pure
385    // accessors/ctors/data-types now return None), so the liveness probe must name an EFFECTFUL path:
386    "::Mmap::map", "::event", "::u32", "::Clipboard::get_text", "::spawn_command",
387    // coverage-differential crates (each needs ≥1 effectful tail; existing tails already cover
388    // native_tls_crate/tokio_native_tls/sqlx_core via ::X::connect, execute via ::X::execute, jiff via ::now):
389    "::read_tls", "::home_dir", "::args", "::from_env", "::IntoIter::next", "::set_file_mtime",
390    "::surely_conflicts_with", "::set_handler", "::get_matches", "::init", "::interact",
391    "::write_line", "::background_color", "::retry", "::build",
392];
393
394/// Database client crates whose execution verbs are I/O (see the DB branch in `classify`).
395/// Module-level so `db_crates_are_calibrated` can enforce `DB_CRATES ⊆ CALIBRATED_CRATES`.
396pub const DB_CRATES: [&str; 11] = [
397    "sqlx", "rusqlite", "postgres", "tokio_postgres", "diesel", "redis", "mongodb",
398    "mysql", "mysql_async", "sea_orm", "deadpool_postgres",
399];
400
401/// Pure file-descriptor *ownership-transfer* leaves. These ADOPT an already-open descriptor
402/// (`from_raw_fd`/`from_raw_socket`/`from_raw_handle`), EXTRACT/BORROW one
403/// (`into_raw_fd`/`into_raw_socket`/`into_raw_handle`, `as_raw_fd`/`as_raw_socket`/`as_raw_handle`),
404/// or UNWRAP an async wrapper back to its std type (`into_std`) — none of them issue a syscall or
405/// perform I/O. calling a PURE function effectful is a FABRICATION — the precision failure (candor's cardinal sin is the opposite direction, the silent under-report) — and these collide with the
406/// coarse std-type PREFIX rules (`std::net::TcpStream`/`std::fs::File`/`std::os::unix::net` → Net/Fs/Ipc)
407/// even though the descriptor was opened ELSEWHERE. The portable_pty/async_process Exec rule already
408/// exempts `from_raw_fd`; this generalises the same carve-out across the net/fs/ipc prefix rules.
409/// (Found by a real-world sweep of tokio: `TcpStream::into_std`, `*::from_raw_fd`, `*::as_raw_fd` all
410/// fabricated Net/Fs/Ipc.)
411const PURE_FD_TRANSFER: &[&str] = &[
412    "from_raw_fd", "from_raw_socket", "from_raw_handle",
413    "into_raw_fd", "into_raw_socket", "into_raw_handle",
414    "as_raw_fd", "as_raw_socket", "as_raw_handle",
415    "into_std",
416    // `SocketAddr::from_pathname` (std/async-std unix net) builds an address STRUCT from a path —
417    // it opens no socket. The `std::os::unix::net` prefix rule below would otherwise fabricate Ipc
418    // on it. (Found sweeping socket2: `SockAddr::as_unix` → `from_pathname` reported Ipc.)
419    "from_pathname",
420];
421
422/// The std I/O **handle** types whose methods the scanner's receiver inference may route into
423/// `classify` as `Type::method`.
424///
425/// WHY A LIST AND NOT "std". The std rules in `classify` are a MIXTURE: a few are type-precise with
426/// reviewed pure-accessor carve-outs (`std::net::TcpStream` → Net minus `local_addr`/`peer_addr`/…;
427/// `std::process::Command` → Exec minus `get_program`/`get_args`/…), but most are coarse MODULE
428/// prefixes (`std::fs::` → Fs) written for free functions and constructors. Applied to arbitrary
429/// method calls, a coarse prefix charges an effect for reading a struct field: `std::fs::Metadata`,
430/// `DirEntry`, `Permissions` and `FileType` all sit under `std::fs::` and are pure DATA. So the
431/// scanner used to skip EVERY std-rooted receiver — which shut the door on the pure data types and on
432/// the real handles alike, and `fn run(cmd: &mut Command) { cmd.spawn(); }` certified PURE while it
433/// spawned a process (a silent false all-clear; the `cc` crate's `command_helpers::spawn` was a live
434/// instance). This list re-opens the door for the handles ONLY.
435///
436/// MEMBERSHIP RULE, and the reason it is safe to apply a whole-type rule to an inferred method call:
437/// a type belongs here only when EVERY method on it is either the effect itself or an already-carved-
438/// out pure read-back. That holds for an open descriptor's handle — a `File`/`TcpStream`/`Child` does
439/// nothing but I/O on the thing it owns — and the `PURE_FD_TRANSFER` guard at the top of `classify`
440/// exempts the `as_raw_fd`/`into_std` family for all of them before any prefix rule runs.
441///
442/// THE OPTION-BUILDERS, `OpenOptions` and `DirBuilder`, were absent for exactly this rule and now
443/// satisfy it: each has a type-keyed carve-out in `classify` subtracting its pure setters, so only its
444/// TERMINAL VERB (`open` / `create`) is Fs. The exclusion was written as "a narrow residual, not the
445/// reported hole" and MEASURED otherwise — `fn load(o: &OpenOptions, p: &Path) { o.open(p) }` opened a
446/// file and reported NOTHING, the same silent false all-clear as the `Command` parameter, while a
447/// setter-only `OpenOptions::new().read(true)` reported `Fs` for opening nothing. The order the old
448/// comment prescribed is the order taken: the verb-precise rules went in FIRST, and this list widened
449/// onto them. `ReadDir` stays out — its `next` IS a syscall, but nothing distinguishes it from any
450/// other iterator's `next`, so no verb-precise rule can be written and the honest miss stands.
451///
452/// `std::path::Path`/`PathBuf` are NOT here: they are pure data with an effectful STAT sub-surface —
453/// the exact inverse shape — and they route through their own verb-precise carve-out in the scanner.
454const STD_EFFECT_HANDLES: &[&str] = &[
455    // Exec — the whole type is the subprocess boundary (`new` names a program, `arg`/`env` build the
456    // invocation, `spawn`/`output`/`status` run it); the read-back getters are already carved out.
457    "std::process::Command",
458    "std::process::Child",
459    // Net — an open socket. `connect`/`accept`/`read`/`write`/`shutdown`/`set_*` are socket syscalls;
460    // `local_addr`/`peer_addr`/`nodelay`/`ttl`/`take_error` are carved out.
461    "std::net::TcpStream",
462    "std::net::TcpListener",
463    "std::net::UdpSocket",
464    // Ipc — a Unix-domain socket, the same shape as the TCP/UDP handles above.
465    "std::os::unix::net::UnixStream",
466    "std::os::unix::net::UnixListener",
467    "std::os::unix::net::UnixDatagram",
468    // Fs — an open file. Every method reads, writes, syncs, truncates or stats it; the descriptor
469    // conversions are carved out by `PURE_FD_TRANSFER`.
470    "std::fs::File",
471    // Fs — the option-builders, whose PURE setters are subtracted by the type-keyed carve-outs in
472    // `classify` so that only the terminal verb (`OpenOptions::open`, `DirBuilder::create`) routes to Fs.
473    "std::fs::OpenOptions",
474    "std::fs::DirBuilder",
475];
476
477/// Is `ty` a std I/O handle type whose methods may be routed into `classify` by the scanner's
478/// receiver inference? See `STD_EFFECT_HANDLES` for the membership rule and the named exclusions.
479pub fn is_std_effect_handle(ty: &str) -> bool {
480    STD_EFFECT_HANDLES.contains(&ty)
481}
482
483/// Classify a resolved callee by the crate it belongs to and its full path.
484pub fn classify(crate_name: &str, path: &str) -> Option<&'static str> {
485    // Pure fd ownership-transfer/extraction leaves are never an effect, regardless of which std I/O
486    // type they hang off — exempt them BEFORE the coarse prefix rules can fabricate Net/Fs/Ipc.
487    if PURE_FD_TRANSFER.contains(&path.rsplit("::").next().unwrap_or(path)) {
488        return None;
489    }
490    if crate_name.starts_with("aws_sdk_") || crate_name.starts_with("aws_smithy") {
491        // Only request dispatch is network I/O; builder setters/accessors are pure.
492        if path.ends_with("::send") || path.ends_with("::send_with") {
493            return Some("Net");
494        }
495        return None;
496    }
497    // aws-config resolves credentials/region on `.load()` — it reaches the IMDS metadata
498    // endpoint / STS over the network (and reads ~/.aws + env). Builders (`defaults()`,
499    // `SdkConfig::builder()`, `BehaviorVersion::latest()`) are pure; the `load` is the I/O.
500    // (Found hardening on a real app, ebman: `builder.load().await` was classified pure.)
501    //
502    // THE FIX: `load_from_env()` (lib.rs:170/188, both the `behavior-version-latest` and deprecated
503    // forms) is `from_env().load().await` / `load_defaults(latest).await` one call down — the crate's OWN
504    // "convenience wrapper" (its own doc comment's phrase) around the already-modelled `.load()` — but
505    // `"load_from_env".ends_with("::load")` is false, so the wrapper read pure. Same vein as
506    // `ignore::Walk::new`.
507    if crate_name == "aws_config" {
508        if path.ends_with("::load") || path.ends_with("::load_defaults") || path.ends_with("::load_from_env") {
509            return Some("Net");
510        }
511        return None;
512    }
513    // git2 (libgit2 FFI): remote operations contact the network; everything else is local
514    // to the .git directory. Match the remote verbs precisely — NOT bare `::clone`, which is
515    // the `Clone`-trait dup of a `Remote` handle (pure), not `Repository::clone`. (Found
516    // hardening on gitui: `remote.fetch`/`remote.push` were classified network-free — a git
517    // client reporting it makes no network calls.)
518    //
519    // `Repository::clone`/`clone_recurse`/`clone_local`/`init` (via `RepoBuilder::clone`) IS the
520    // thing the comment above named and then excluded anyway: the bare `::clone` denylist meant
521    // to keep out `Remote::clone` (the derived trait dup) also swallowed `Repository::clone` —
522    // libgit2's actual network clone, and arguably git2's single most common entry point. A
523    // fabrication corpus round caught it: `git2::Repository::clone(url, path)` reported ZERO
524    // effects and passed `deny Net` at exit 0. FQN-exact (like the `reqwest::get` disambiguation
525    // a few lines up) so the fix doesn't just re-widen `::clone` and reintroduce the very
526    // over-charge the comment was written to prevent: `Remote::clone` (and `Repository::clone`'s
527    // own `Clone` derive, if it has one) must still read pure.
528    if crate_name == "git2" {
529        if path.ends_with("::fetch")
530            || path.ends_with("::push")
531            || path.ends_with("::download")
532            || path.ends_with("::connect")
533            || path.ends_with("::connect_auth")
534            || path.ends_with("::ls")
535            || path.ends_with("::upload")
536            || path == "git2::Repository::clone"
537            || path == "git2::Repository::clone_recurse"
538            || path == "git2::build::RepoBuilder::clone"
539            // A FOURTH+FIFTH true positive in the same gap the `Repository::clone` fix left open:
540            // `Submodule::clone`/`Submodule::update` (submodule.rs:39,234) call `raw::git_submodule_clone`/
541            // `git_submodule_update` DIRECTLY — the exact FFI leaves already in this file's own
542            // FFI-tier NET table below, but only when a caller names the raw `ffi`/`raw::` leaf itself.
543            // git2's documented, standard submodule-init idiom (`sub.clone(None)` /
544            // `sub.update(true, None)`) never does that — it calls the safe wrapper, which carried no
545            // rule of its own and read pure under `deny Net`. FQN-exact, matching the `Repository::clone`
546            // fix's own discipline: a bare `::update`/`::clone` substring would sweep in git2's many pure
547            // `update_*` setters (`CheckoutBuilder::update_only`, `DiffOptions::update_index`, …) and the
548            // derive-`Clone` dup on every other git2 type.
549            || path == "git2::Submodule::clone"
550            || path == "git2::Submodule::update"
551            // `Remote::list`/`RemoteConnection::list` (remote.rs:378,755) call `raw::git_remote_ls`
552            // directly — the reference-advertisement fetch already in the FFI-tier NET table below,
553            // reached the same way `Submodule::clone`/`update` were: the safe wrapper's OWN name
554            // (`list`, not `ls`) never matched the `::ls` suffix this block already carried (which, on
555            // git2 0.20, matches no real method at all — dead weight kept for whatever older API it once
556            // fit). FQN-exact so a `list` on some other git2 type (none exist today, but the same
557            // discipline as `Submodule::clone` above) can't be swept in by a bare suffix later.
558            || path == "git2::Remote::list"
559            || path == "git2::RemoteConnection::list"
560        {
561            return Some("Net");
562        }
563        // THE COVERAGE-GATE SWEEP (2026-08-27): every one of these is a public entry point whose body
564        // calls a `raw::git_*` FFI leaf ALREADY in this file's own FS FFI-tier table below (config.rs/
565        // index.rs/odb.rs/packbuilder.rs/reference.rs/repo.rs/treebuilder.rs, verified against git2
566        // 0.20.4 source) — but that table is UNREACHABLE for a real consumer's call, because it only
567        // fires when self-scan resolves the FFI leaf's OWN crate (`libgit2_sys`, via git2's internal
568        // `use libgit2_sys as raw`), never for `crate_name == "git2"`, which returns from THIS block
569        // first. A consumer never spells `raw::git_repository_open`; they call `git2::Repository::open`,
570        // which fell through this entire branch to `None` — the exact `ignore::Walk::new` shape (a
571        // lower-level rule the top-level entry point never reaches) but affecting git2's single most
572        // common local operations (`Repository::open`/`init`), not an edge case. FQN-exact, not a
573        // `::open`/`::write`/`::read` suffix — those verbs are common enough elsewhere (`Odb::reader`
574        // isn't `::read`, `TreeBuilder`/`Index`/`PackBuilder::write` share the name with plenty of pure
575        // builder setters on other types) that a bare suffix would either miss these or over-charge.
576        if path == "git2::Config::add_file"
577            || path == "git2::Config::open"
578            || path == "git2::Config::open_default"
579            || path == "git2::Index::add_all"
580            || path == "git2::Index::add_path"
581            || path == "git2::Index::read"
582            || path == "git2::Index::write"
583            || path == "git2::Index::write_tree"
584            || path == "git2::Index::write_tree_to"
585            || path == "git2::Odb::read"
586            || path == "git2::Odb::reader"
587            || path == "git2::Odb::write"
588            || path == "git2::Odb::writer"
589            || path == "git2::PackBuilder::write"
590            || path == "git2::Reference::delete"
591            || path == "git2::Reference::set_target"
592            || path == "git2::Repository::blob_path"
593            || path == "git2::Repository::checkout_head"
594            || path == "git2::Repository::checkout_index"
595            || path == "git2::Repository::checkout_tree"
596            || path == "git2::Repository::commit"
597            || path == "git2::Repository::discover"
598            || path == "git2::Repository::discover_path"
599            || path == "git2::Repository::init"
600            || path == "git2::Repository::init_bare"
601            || path == "git2::Repository::init_opts"
602            || path == "git2::Repository::open"
603            || path == "git2::Repository::open_bare"
604            || path == "git2::Repository::open_ext"
605            || path == "git2::Repository::open_from_env"
606            || path == "git2::Repository::reference"
607            || path == "git2::Repository::tag"
608            || path == "git2::TreeBuilder::write"
609        {
610            return Some("Fs");
611        }
612        // `Cred::credential_helper` (cred.rs:121) calls `CredentialHelper::execute` (cred.rs:326),
613        // which — on every code path — spawns a REAL `sh -c "<helper> get"` (or, if `sh` itself fails to
614        // spawn, the helper binary directly) via `std::process::Command::spawn` to resolve
615        // `credential.helper`-configured auth (cred.rs:370-390): a real subprocess launch a caller
616        // authenticating against a private remote is one call away from (`Cred::credential_helper(cfg,
617        // url, user)` is the crate's own documented way to honor `credential.helper`), not a lower-level
618        // implementation detail. FQN-exact: `execute` alone is far too generic to key on blindly.
619        if path == "git2::Cred::credential_helper" || path == "git2::CredentialHelper::execute" {
620            return Some("Exec");
621        }
622        return None;
623    }
624    // libc — raw syscalls via FFI. The FFI-thin tier (nix, and the syscall layer beneath rusqlite/git2)
625    // is invisible to a name classifier unless we model libc directly: a 35-crate calibration
626    // (eval/calibration) showed nix reporting ZERO library effects because every wrapper bottoms out in
627    // an unrecognised `libc::*` call. Classify by syscall name, but ONLY the UNAMBIGUOUS ones — the
628    // socket family is Net, path/dir syscalls are Fs, spawn/exec/wait is Exec, SysV/pipe IPC is Ipc,
629    // env/clock/entropy each their own. We deliberately SKIP the generic file-descriptor ops
630    // (read/write/close/lseek/dup/fcntl/ioctl/poll/select/epoll*/mmap): they operate on ANY fd — file,
631    // socket, or pipe — so a fixed label would mis-categorise as often as it helps. An honest
632    // no-classify (under-report) beats emitting the WRONG effect. Pure conversions (htons/inet_pton/
633    // gmtime) are also skipped.
634    //
635    // `nix` (the idiomatic SAFE libc wrapper, in ~every Rust systems/CLI crate) is routed through the
636    // SAME table: its functions keep the syscall leaf name (`nix::fcntl::open`, `nix::sys::socket::connect`,
637    // `nix::unistd::execvp`). Without this, a CONSUMER of nix analysed without nix's own source (the
638    // stable scanner, single-crate) sees `nix::*` cross-crate and under-reports — serialport-rs opens its
639    // device via `nix::fcntl::open` and reported ZERO Fs. The nightly lint reaches `libc::*` THROUGH nix's
640    // body; this gives the scanner the same coverage directly. (Found sweeping serialport-rs.)
641    // `rustix` is the same shape as nix but does RAW syscalls (no libc underneath), so its functions MUST
642    // be classified directly. Its leaf names are the syscall names too (`rustix::time::clock_settime`,
643    // `rustix::fs::mkfifoat`/`symlink`/`stat`, `rustix::net::connect`) — route it through the same table.
644    // The rustix-specific `*at`/variant leaves it doesn't share with libc just under-report (the safe
645    // direction). VALIDATED, not speculative: coreutils' `date` reads/sets the clock via
646    // `rustix::time::clock_getres`/`clock_settime` and reported Clock=0; the file I/O that goes through
647    // std::fs was already correct, which is why only the rustix-only effects (Clock/Ipc) were missing.
648    if crate_name == "libc" || crate_name == "nix" || crate_name == "rustix" {
649        let f = path.rsplit("::").next().unwrap_or(path);
650        // path / directory / metadata syscalls (incl. *64 and *at variants) — `LIBC_FS`, hoisted to module
651        // level so the AS-EFF-008 masking guard reads THE SAME TABLE (SOUNDNESS R806); see `masks_locator`.
652        const FS: &[&str] = LIBC_FS;
653        // socket family — these operate only on sockets, so Net is unambiguous (AF_UNIX domain isn't
654        // visible at the call, so a Unix socket reads as Net rather than Ipc; acceptable over-general).
655        const NET: &[&str] = LIBC_NET;
656        // process creation / replacement / reaping
657        const EXEC: &[&str] = LIBC_EXEC;
658        // pipes / FIFOs / SysV + POSIX message queues, semaphores, shared memory; socketpair (AF_UNIX)
659        const IPC: &[&str] = &[
660            "pipe", "pipe2", "mkfifo", "mkfifoat", "socketpair", "msgget", "msgsnd", "msgrcv", "msgctl",
661            "semget", "semop", "semtimedop", "semctl", "shmget", "shmat", "shmdt", "shmctl", "mq_open",
662            "mq_send", "mq_receive", "mq_timedsend", "mq_timedreceive", "mq_close", "mq_unlink",
663        ];
664        const ENV: &[&str] = &["getenv", "secure_getenv", "setenv", "putenv", "unsetenv", "clearenv"];
665        const CLOCK: &[&str] = &[
666            "time", "gettimeofday", "clock_gettime", "clock_getres", "nanosleep", "clock_nanosleep",
667            // SETTING the system clock is a clock effect too (was unclassified — found on coreutils `date`,
668            // which sets it via `clock_settime`).
669            "clock_settime", "settimeofday", "stime", "adjtime", "adjtimex", "clock_adjtime",
670        ];
671        const RAND: &[&str] = &["getrandom", "getentropy", "arc4random", "arc4random_buf", "arc4random_uniform"];
672        if FS.contains(&f) {
673            return Some("Fs");
674        }
675        if NET.contains(&f) {
676            return Some("Net");
677        }
678        if EXEC.contains(&f) {
679            return Some("Exec");
680        }
681        if IPC.contains(&f) {
682            return Some("Ipc");
683        }
684        if ENV.contains(&f) {
685            return Some("Env");
686        }
687        if CLOCK.contains(&f) {
688            return Some("Clock");
689        }
690        if RAND.contains(&f) {
691            return Some("Rand");
692        }
693        return None;
694    }
695    // C-library FFI bindings: libsqlite3 (under rusqlite) and libgit2 (under git2). Like the libc tier,
696    // these crates are thin Rust over a C library, so their real I/O is invisible until the C entry
697    // points are named. Match by the DISTINCTIVE C function name (`sqlite3_*` / `git_*`) via the call's
698    // LEAF — independent of the binding crate's alias: rusqlite calls `ffi::sqlite3_step`, git2 calls
699    // `raw::git_remote_fetch`, and the nightly lint resolves the same to `libsqlite3_sys`/`libgit2_sys`;
700    // all spellings share the leaf. Only the I/O-performing entry points are listed — the in-memory
701    // accessors (`sqlite3_bind_*`/`sqlite3_column_*`, `git_*_oid`/strarray/options builders) stay pure,
702    // so a non-listed `sqlite3_`/`git_` leaf returns None (under-report, never a wrong effect). Calibrated
703    // + validated against rusqlite 0.39 / git2 0.20 source (eval/calibration).
704    {
705        let leaf = path.rsplit("::").next().unwrap_or(path);
706        if let Some(rest) = leaf.strip_prefix("sqlite3_") {
707            let _ = rest;
708            // SQLite C API operations that touch the database (open/exec/step/prepare/backup/blob/wal).
709            //
710            // SOUNDNESS R166 — MEMBERSHIP CRITERION, stated because the list was extended and the next
711            // reader needs to know what "already audited" covers. A leaf belongs here when it either
712            // (a) reads or writes DATABASE CONTENT (disk or the in-memory image), or (b) mutates the
713            // registry of code the engine will later RUN — the extension/auto-extension registry, whose
714            // effect is not local to the calling frame. The audit boundary was the WHOLE `sqlite3_*`
715            // surface rusqlite 0.40.2 mentions (185 distinct symbols diffed against this list), not the
716            // one name the row was filed for: `sqlite3_auto_extension` arrived with its `_cancel_`/
717            // `_reset_` siblings and with four content-I/O leaves nobody had looked at.
718            //
719            // DELIBERATELY STILL ABSENT, so this is not read as "the surface is covered": the
720            // CALLBACK-INSTALLING entry points (`sqlite3_create_function[_v2]`,
721            // `sqlite3_create_window_function`, `sqlite3_create_collation_v2`, `sqlite3_create_module_v2`,
722            // `sqlite3_*_hook`, `sqlite3_set_authorizer`, `sqlite3_progress_handler`, `sqlite3_trace_v2`).
723            // Those register a UDF/hook on ONE connection for the life of that connection; they perform no
724            // database I/O themselves, and the opaque-callback boundary is already disclosed by the
725            // scanner's own `Unknown` at the call site that hands the function pointer across. The
726            // auto-extension registry is the case that differs: it is PROCESS-GLOBAL and outlives every
727            // connection, so its consequence cannot be attributed to a caller's own frame at all.
728            // Unexamined and named as such: the libgit2 (`git_*`) table below got no equivalent sweep.
729            const DB: &[&str] = &[
730                "sqlite3_open", "sqlite3_open_v2", "sqlite3_open16", "sqlite3_close", "sqlite3_close_v2",
731                "sqlite3_exec", "sqlite3_step", "sqlite3_prepare", "sqlite3_prepare_v2",
732                "sqlite3_prepare_v3", "sqlite3_prepare16", "sqlite3_prepare16_v2", "sqlite3_prepare16_v3",
733                "sqlite3_get_table", "sqlite3_backup_init", "sqlite3_backup_step", "sqlite3_backup_finish",
734                "sqlite3_blob_open", "sqlite3_blob_read", "sqlite3_blob_write", "sqlite3_blob_reopen",
735                "sqlite3_load_extension", "sqlite3_wal_checkpoint", "sqlite3_wal_checkpoint_v2",
736                // (b) the PROCESS-GLOBAL extension registry — every one of these changes what a LATER
737                // `sqlite3_open` on any connection will execute, and `sqlite3_load_extension` (already
738                // above) is the same capability one call along.
739                "sqlite3_auto_extension", "sqlite3_cancel_auto_extension", "sqlite3_reset_auto_extension",
740                "sqlite3_enable_load_extension",
741                // (a) further DATABASE-CONTENT I/O the original list missed: whole-image load/save,
742                // a forced page-cache flush to disk, a direct VFS file operation, and arming the
743                // automatic WAL checkpoint writes whose manual twin is already listed.
744                "sqlite3_deserialize", "sqlite3_serialize", "sqlite3_db_cacheflush",
745                "sqlite3_file_control", "sqlite3_wal_autocheckpoint",
746            ];
747            return DB.contains(&leaf).then_some("Db");
748        }
749        if leaf.starts_with("git_") {
750            // libgit2: remote/transport operations contact the network … (incl. submodule clone/update,
751            // which `git_clone`/fetch the subrepo over its remote — `allow_fetch` defaults on; an A/B on
752            // git2 0.20 caught `Submodule::update`/`clone` reporting no `Net`).
753            const NET: &[&str] = &[
754                "git_clone", "git_remote_connect", "git_remote_connect_ext", "git_remote_fetch",
755                "git_remote_download", "git_remote_upload", "git_remote_push", "git_remote_ls",
756                "git_submodule_clone", "git_submodule_update",
757            ];
758            // … and repository/index/odb/checkout/ref/config operations touch the on-disk .git store.
759            const FS: &[&str] = &[
760                "git_repository_open", "git_repository_open_ext", "git_repository_open_bare",
761                "git_repository_init", "git_repository_init_ext", "git_repository_discover",
762                "git_checkout_tree", "git_checkout_head", "git_checkout_index", "git_index_read",
763                "git_index_write", "git_index_write_tree", "git_index_write_tree_to",
764                "git_index_add_bypath", "git_index_add_all", "git_odb_open", "git_odb_read",
765                "git_odb_write", "git_odb_open_wstream", "git_odb_open_rstream",
766                "git_blob_create_fromdisk", "git_blob_create_fromworkdir", "git_blob_create_from_disk",
767                "git_blob_create_from_workdir", "git_blob_create_from_stream", "git_commit_create",
768                "git_commit_create_v", "git_reference_create", "git_reference_set_target",
769                "git_reference_delete", "git_config_open_default", "git_config_open_ondisk",
770                "git_config_add_file_ondisk", "git_tag_create", "git_treebuilder_write",
771                "git_packbuilder_write",
772            ];
773            if NET.contains(&leaf) {
774                return Some("Net");
775            }
776            if FS.contains(&leaf) {
777                return Some("Fs");
778            }
779            return None;
780        }
781        if leaf.starts_with("curl_") {
782            // libcurl (under the `curl` crate, called `curl_sys::curl_*`). Only the entry points that
783            // PERFORM network I/O: the blocking transfer (`curl_easy_perform`), raw socket send/recv,
784            // the HTTP/2 keepalive PING (`upkeep`), and the multi-interface transfer pumps. The large
785            // pure surface (setopt/init/cleanup/reset/getinfo/escape/multi_add_handle/fdset/info_read)
786            // stays unclassified, as do `curl_multi_wait`/`poll` (readiness WAIT on sockets, no payload —
787            // the loop's `perform` is the tagged boundary, per the I/O-boundary principle). An A/B on
788            // curl 0.4 caught the whole crate reporting ZERO Net (`Easy::perform` read as pure).
789            const NET: &[&str] = &[
790                "curl_easy_perform", "curl_easy_send", "curl_easy_recv", "curl_easy_upkeep",
791                "curl_multi_perform", "curl_multi_socket_action",
792            ];
793            return NET.contains(&leaf).then_some("Net");
794        }
795        if let Some(op) = leaf.strip_prefix("SSL_") {
796            // OpenSSL (libssl, under the `openssl`/`native-tls` crates, called `ffi::SSL_*`). The TLS
797            // handshake and record I/O run over the peer socket -> Net. Unlike libc read/write, an SSL_*
798            // op is ~always over a network BIO (the rare memory-BIO/sans-IO case is the honest exception
799            // we accept). The crypto surface (EVP_*/SHA*/AES*) and pure setup (SSL_CTX_new/SSL_set_fd) are
800            // NOT here; `BIO_*` is skipped (a BIO may be memory or socket). Validated vs openssl 0.9 source.
801            const SSL_NET: &[&str] = &[
802                "connect", "accept", "do_handshake", "read", "read_ex", "write", "write_ex", "peek",
803                "peek_ex", "shutdown",
804            ];
805            return SSL_NET.contains(&op).then_some("Net");
806        }
807    }
808    // HTTP clients use the same builder pattern as the AWS SDK: only the dispatch is
809    // I/O. (Found by the eval: ebman's reqwest calls to the Anthropic API + webhooks
810    // were silently classified network-free because reqwest wasn't recognized.)
811    if crate_name == "reqwest" || crate_name == "isahc" {
812        // The dispatch (`::send`/`::execute`) is the I/O. PLUS the one-shot CONVENIENCE functions
813        // `reqwest::get` / `reqwest::blocking::get` / `isahc::get`, which send immediately — they're
814        // an EXACT match (not `Client::get`, the builder) to avoid false-positiving the builder path.
815        // (Found running on `xh`: a one-shot `reqwest::get(url)` was classified network-free.)
816        if path.ends_with("::send")
817            || path.ends_with("::execute")
818            || path == "reqwest::get"
819            || path == "reqwest::blocking::get"
820            || path == "isahc::get"
821        {
822            return Some("Net");
823        }
824        // THE URL-BEARING BUILDER METHODS: `Client::{get,post,put,delete,patch,head,request}(URL)`.
825        // Real code almost never uses `reqwest::get(url)`; the DOMINANT idiom is the builder chain
826        // `Client::new().post(url).send()` / `Client::builder().build()?.post(url).send()`. The `.send()`
827        // already classifies `Net` — but the URL literal rides the `.post(url)` call, NOT `.send()`, so
828        // without classifying the URL-naming step `Net` the endpoint is NEVER captured and the `Llm`
829        // host refinement can't fire (ebman's `api.anthropic.com` call read as bare Net, undisclosed as
830        // Llm — the dogfood silent under-report). Classifying these `Net` (idempotent with the eventual
831        // `.send()`) makes the scanner capture the URL from their string arg. `request(method, url)`'s
832        // url is its SECOND arg — the scanner's first-string-literal capture still gets it when the
833        // method is a literal string, and misses it (honest under-report) when the method is an
834        // expression. The pure builder surface (`::header`, `::json`, `::body`, `::query`, …) stays None.
835        if path.ends_with("::get")
836            || path.ends_with("::post")
837            || path.ends_with("::put")
838            || path.ends_with("::delete")
839            || path.ends_with("::patch")
840            || path.ends_with("::head")
841            || path.ends_with("::request")
842        {
843            return Some("Net");
844        }
845        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against isahc 2.0.1 — isahc-only, since
846        // reqwest has no equivalent free-function async family:
847        //
848        // `get_async`/`head_async`/`post_async`/`put_async`/`delete_async`/`send_async` (lib.rs:357-500)
849        // are the crate's async one-shot convenience functions — `HttpClient::shared().get_async(uri)`
850        // etc., the exact async mirror of the already-covered `isahc::get`, dispatching immediately.
851        // `HttpClient::new`/`HttpClientBuilder::build` (client.rs:629,444) are genuinely NOT lazy like
852        // reqwest's `Client::new`: `build()` unconditionally calls `agent_builder.spawn()`
853        // (agent/mod.rs:63), which spawns a background OS thread running `AgentContext::run` — curl's
854        // multi-handle event loop that DOES perform the real socket reads/writes for every request later
855        // sent through this client. Confirmed via self-scan on isahc's own source: `AgentBuilder::spawn`
856        // reaches `Net` through that same call chain, not a guess.
857        if crate_name == "isahc"
858            && (path == "isahc::get_async"
859                || path == "isahc::head_async"
860                || path == "isahc::post_async"
861                || path == "isahc::put_async"
862                || path == "isahc::delete_async"
863                || path == "isahc::send_async"
864                || path.ends_with("HttpClient::new")
865                || path.ends_with("HttpClientBuilder::build"))
866        {
867            return Some("Net");
868        }
869        // `reqwest::multipart::Part::file` (blocking/multipart.rs:223) opens the given path directly
870        // (`std::fs::File::open`) to attach it as a form part — genuinely Fs, not Net (the eventual
871        // upload is charged at `.send()`, already covered above).
872        //
873        // NOT modelled: `h3_client::pool::PoolClient::send_request` (async_impl/h3_client/pool.rs:207)
874        // — `mod async_impl;` is PRIVATE in reqwest's lib.rs (only `self::async_impl::multipart` is
875        // selectively re-exported), so `PoolClient` is unreachable from outside the crate; the real
876        // HTTP/3 dispatch a consumer can actually reach is the already-covered `::send`/`::execute`.
877        // Removed from open.tsv rather than guessed.
878        // SOUNDNESS R337 — THE WRAPPER, not the wrapped. candor already charges
879        // `native_tls_crate::Identity::from_pkcs8`/`from_pkcs12` `Fs` (the clause below), and the reason
880        // it does is concrete rather than defensive: on the security-framework backend those create a
881        // real `tempfile::TempDir` and write a keychain into it —
882        // `native-tls-0.2.18/src/imp/security_framework.rs:93` (`identity.keychain`, `from_pkcs8`) and
883        // `:167` (`tmp.keychain`, `from_pkcs12`). But candor classifies the call a CONSUMER writes, not
884        // the dependency body behind it, so a consumer who reaches that code through its idiomatic
885        // wrapper matched no rule at all — and in a CALIBRATED crate an unmatched path is a claim of
886        // reviewed purity with no disclosure. A call taking only BYTES writes a file on macOS, and it
887        // read pure.
888        //
889        // Swept for the CLASS rather than the two rows the coverage gate handed me: every caller of
890        // `native_tls{,_crate}::Identity::from_pkcs8|from_pkcs12` in the local registry is reqwest
891        // (0.11/0.12/0.13, all three spelling these the same way), lettre, and `tcp_stream` — which is
892        // NOT calibrated, so its calls disclose rather than claim purity and it needs no rule.
893        //
894        // Suffix-matched, not exact-path, because all three reqwest majors carry the same names; and
895        // narrow on purpose. The SIBLINGS are the fabrication control and they must stay pure:
896        // `reqwest::tls::Identity::from_pem` is rustls-only, a `Cursor` over a buffer (tls.rs:373), and
897        // lettre's `Certificate::from_der`/`from_pem` reach `native_tls::Certificate::*`, which imports
898        // items with no keychain and no temp dir (security_framework.rs:206,212).
899        // SOUNDNESS R342 — THE RESPONSE BODY IS READ FROM THE SOCKET, and `resp.text().await` is one of
900        // the most-written lines in Rust networking. `send()` is charged; the methods that DRAIN what it
901        // returned were not, so a helper that takes a `Response` and reads it — an extremely common
902        // shape — was a positive purity claim on a CALIBRATED crate. Executed at reqwest 0.13.4:
903        // `r.text()`, `r.json()` and `r.bytes()` all ABSENT while `c.get(..).send()` was `['Net']`.
904        //
905        // Verified in the source rather than assumed: `text` -> `text_with_charset` -> `bytes` ->
906        // `do_bytes`, which is `BodyExt::collect(self.res.into_body()).await`
907        // (`async_impl/response.rs:433`) — it drains the body off the wire. `chunk` and `bytes_stream`
908        // are the streaming spellings of the same read; charging the stream CONSTRUCTOR follows this
909        // file's own `Command::new` convention, where the effect is attributed at the point the caller
910        // asks for it rather than at the poll nobody can see.
911        //
912        // Scoped by `Response::` and not by the bare verb: `::text` and `::json` are far too common a
913        // leaf to match crate-wide. Found by the coverage gate the moment R185 taught the scanner to
914        // see through `Option`/`Result` unwraps — the same "closing a silence makes consumers' gaps
915        // visible" shape recorded on R302 and R337.
916        if crate_name == "reqwest"
917            && path.contains("Response::")
918            && (path.ends_with("::text")
919                || path.ends_with("::text_with_charset")
920                || path.ends_with("::json")
921                || path.ends_with("::bytes")
922                || path.ends_with("::chunk")
923                || path.ends_with("::bytes_stream"))
924        {
925            return Some("Net");
926        }
927        if crate_name == "reqwest"
928            && (path.ends_with("::Identity::from_pkcs12_der")
929                || path.ends_with("::Identity::from_pkcs8_pem"))
930        {
931            return Some("Fs");
932        }
933        if crate_name == "reqwest" && path.ends_with("::Part::file") {
934            return Some("Fs");
935        }
936        return None;
937    }
938    if crate_name == "ureq" && path.ends_with("::call") {
939        return Some("Net");
940    }
941    // THE COVERAGE-GATE SWEEP (2026-08-27), verified against ureq 2.12.1 (the version this ratchet's
942    // rows were generated from — 3.x, also cached locally, rewrote this surface beyond recognition and
943    // is a different question for a future pass). `::call` above is the no-body dispatch terminal;
944    // these are its siblings:
945    //
946    // `Request::send`/`send_bytes`/`send_form`/`send_json`/`send_string` (request.rs:78-296) are the
947    // WITH-BODY dispatch terminals — `do_call(Payload::..)`, the exact same terminal `call` reaches with
948    // an empty payload. Missing them left every `agent.post(url).send_json(&body)` (the dominant idiom
949    // for a JSON API call) silently pure.
950    // `ureq::agent`/`request`/`request_url` (lib.rs:513,539,561) are real gaps in a stranger way: each
951    // one's own body contains a REACHABLE (if `is_test(true)` was ever called — itself a `pub fn` a
952    // consumer or another dependency could invoke) call to `testserver::test_agent()`, which binds a
953    // real listening `TcpStream` (see `TestServer::new` below) — self-scan's whole-body reachability
954    // treats that as real, and per this project's over-approximate-rather-than-miss discipline (a
955    // toggleable global flag routing traffic through an internal listener is exactly the kind of path a
956    // security-conscious caller wants disclosed, not silently pure), so does this rule. `agent()` is also
957    // the crate's OWN base for `request`/`request_url` (`agent().request(..)`), and `request`/
958    // `request_url` additionally carry the URL argument — matching the reqwest/isahc precedent above of
959    // classifying the URL-bearing constructor `Net` too (idempotent with the eventual `.call()`/`.send()`)
960    // so the destination is captured even if a caller never re-touches the returned `Request`.
961    if crate_name == "ureq"
962        && (path.ends_with("::send")
963            || path.ends_with("::send_bytes")
964            || path.ends_with("::send_form")
965            || path.ends_with("::send_json")
966            || path.ends_with("::send_string")
967            || path == "ureq::agent"
968            || path == "ureq::request"
969            || path == "ureq::request_url"
970            || path == "ureq::unversioned::transport::RustlsConnector::connect"
971            || path == "ureq::tls::rustls::RustlsConnector::connect"
972            || path == "ureq::RustlsConnector::connect")
973    {
974        return Some("Net");
975    }
976    // NOT modelled (both removed from open.tsv, not guessed):
977    //   `ureq::Arc::connect` — the ratchet's generator strips generic arguments from an impl header, so
978    //   `impl TlsConnector for Arc<rustls::ClientConfig>` (rtls.rs:88) produced the type name "Arc" — a
979    //   bogus path (`ureq::Arc` names nothing; `Arc` is std's, not ureq's) that no consumer could ever
980    //   write. The trait method itself is real (ureq's own internal TLS dispatch, invoked by `.call()`,
981    //   already covered), but no FQN a real caller would spell resolves through this guess.
982    //   `ureq::TestServer::new` — `TestServer` (testserver.rs:62) lives in `mod testserver;` (lib.rs:444),
983    //   PRIVATE with no re-export, so `ureq::TestServer` is unreachable from outside the crate (the
984    //   listener it binds is real, but only `agent()`'s internal `is_test` branch above can reach it).
985    // The `curl` crate (libcurl's safe binding — cargo's own HTTP client): the dispatch verbs are
986    // `perform` (Easy/Easy2/Transfer/Multi), raw-socket `send`/`recv`, the keepalive `upkeep`, and the
987    // multi-interface `action` (socket_action). The big setopt-style builder surface stays pure.
988    // `Multi::timeout` is deliberately NOT matched: `Easy::timeout` is a pure CURLOPT_TIMEOUT setter
989    // sharing the leaf — an under-report on the rare event-loop kick beats mis-tagging every consumer
990    // that sets a timeout. (Consumer-side companion to the curl_* FFI tier, same A/B finding.)
991    if crate_name == "curl"
992        && (path.ends_with("::perform")
993            || path.ends_with("::send")
994            || path.ends_with("::recv")
995            || path.ends_with("::upkeep")
996            || path.ends_with("::action"))
997    {
998        return Some("Net");
999    }
1000    // The modern async-HTTP / TLS / QUIC / DNS stack — the LAYER reqwest/ureq/isahc build on, and that
1001    // crates use DIRECTLY. Found by the independent-method differential on `oha` (2026-06-17): candor
1002    // honestly DISCLOSED these as blind but never CLASSIFIED them, leaving real Net reaches uncovered.
1003    // Verb-keyed (the pure type/builder/codec surface stays None) and CRATE-GATED, so generic verbs
1004    // (request/connect/get/read/write/accept) never fabricate across unrelated crates. Same precision
1005    // discipline as the reqwest/curl rules above; complements the scan_builder_entry_effect entries.
1006    match crate_name {
1007        // hyper 1.x client connection I/O (the builder/Body/Request types stay pure).
1008        "hyper" if path.ends_with("::send_request") || path.ends_with("::handshake") => return Some("Net"),
1009        // hyper-util's pooled legacy Client + its TCP connectors.
1010        "hyper_util" if path.ends_with("::request") || path.ends_with("::connect") => return Some("Net"),
1011        // hickory (trust-dns) resolver — issues DNS queries over the network.
1012        "hickory_resolver"
1013            if path.ends_with("::lookup_ip") || path.ends_with("::lookup") || path.ends_with("_lookup")
1014                || path.ends_with("::resolve") => return Some("Net"),
1015        // HTTP/3 over QUIC.
1016        "h3" if path.ends_with("::send_request") || path.ends_with("::recv_data")
1017            || path.ends_with("::recv_response") || path.ends_with("::send_data") => return Some("Net"),
1018        // QUIC transport (UDP socket send/recv): connection setup, datagrams, AND the stream byte I/O
1019        // (`RecvStream::read*` / `SendStream::write*` / `finish`). Opening a stream is caught above, but a
1020        // fn that only HOLDS a stream and reads/writes it would otherwise read silent-pure (review: a Net
1021        // under-report). Crate-gated to quinn, where these verbs are unambiguously the socket I/O.
1022        "quinn" if path.ends_with("::connect") || path.ends_with("::accept") || path.ends_with("::open_bi")
1023            || path.ends_with("::open_uni") || path.ends_with("::accept_bi") || path.ends_with("::accept_uni")
1024            || path.ends_with("::send_datagram") || path.ends_with("::read_datagram")
1025            || path.ends_with("::read") || path.ends_with("::read_chunk") || path.ends_with("::read_chunks")
1026            || path.ends_with("::read_to_end") || path.ends_with("::write") || path.ends_with("::write_all")
1027            || path.ends_with("::write_chunk") || path.ends_with("::write_chunks")
1028            || path.ends_with("::finish") => return Some("Net"),
1029        // TLS-over-TCP stream adapters — the actual socket handshake/I/O (the config/cert types stay pure).
1030        "tokio_rustls" | "native_tls"
1031            if path.ends_with("::connect") || path.ends_with("::accept") || path.ends_with("::handshake") =>
1032            return Some("Net"),
1033        // AF_VSOCK host<->guest sockets — inter-process / VM comms.
1034        "tokio_vsock" if path.ends_with("::connect") || path.ends_with("::bind") || path.ends_with("::accept") =>
1035            return Some("Ipc"),
1036        // Loads the OS trust store from disk (cert files / keychain).
1037        "rustls_native_certs" if path.ends_with("::load_native_certs") => return Some("Fs"),
1038        // `rlimit` reads/mutates the process's kernel resource limits — the closest bucket is Env (host/
1039        // process config); no dedicated process-state bucket exists, so getrlimit (read) and setrlimit
1040        // (mutate) share it. NOTE: `num_cpus::get`/`get_physical` are deliberately NOT modeled — asking the
1041        // OS for the CPU count is a near-pure topology query, and std's equivalent `thread::
1042        // available_parallelism` classifies pure; modeling it as Env would spray Env over every thread-pool
1043        // constructor (review: a high-noise over-report) for no capability a reviewer cares about.
1044        "rlimit" if path.ends_with("::getrlimit") || path.ends_with("::setrlimit")
1045            || path.ends_with("::increase_nofile_limit") => return Some("Env"),
1046        // rustls — the SYNC TLS core (tokio_rustls/native_tls above are the async/system adapters). The
1047        // record-layer I/O is `read_tls`/`write_tls` (pull/push raw bytes through a held `io::Read`/`Write`)
1048        // and `complete_io` (loops them until the handshake/buffers drain). The config/cert/builder types
1049        // (`ClientConfig`/`ServerConfig`/`ConfigBuilder`) are PURE. `process_new_packets` is deliberately
1050        // EXCLUDED — it only decrypts ALREADY-buffered bytes (no socket touch; docs say call it AFTER
1051        // read_tls), so flagging it would over-report Net on the pure decrypt step.
1052        "rustls" if path.ends_with("::read_tls") || path.ends_with("::write_tls")
1053            || path.ends_with("::complete_io") => return Some("Net"),
1054        // native-tls under its alternate crate name + the tokio async wrapper (the `native_tls` arm above
1055        // is the common name). The TLS handshake over a TcpStream is Net; the builder/cert types are pure.
1056        "native_tls_crate" | "tokio_native_tls"
1057            if path.ends_with("::connect") || path.ends_with("::accept")
1058                || path.ends_with("::handshake") => return Some("Net"),
1059        _ => {}
1060    }
1061    // THE COVERAGE-GATE SWEEP (2026-08-27) — two crate-root CONSTRUCTORS the verb-keyed match above
1062    // never reached because neither ends in connect/accept/handshake, verified against their real
1063    // per-platform impl (native-tls 0.2.18, rustls 0.23.43):
1064    //
1065    // `native_tls_crate::TlsConnector::new` (lib.rs:481, the PUBLIC newtype wrapper around the private
1066    // per-platform `imp::TlsConnector`) reads the system trust store — on the openssl backend it loads
1067    // the probed cert file/dir from disk before any socket exists. `Identity::from_pkcs8` (lib.rs:178,
1068    // wrapping `imp::Identity::from_pkcs8`) on the security-framework (macOS) backend creates a real
1069    // temporary keychain file on disk to import the PKCS8 key into.
1070    // `rustls::KeyLogFile::new` (key_log_file.rs:88) reads `$SSLKEYLOGFILE` and, if set, opens (creating
1071    // if needed) that file in append mode — a real, if opt-in, disk write path independent of the sync
1072    // TLS record-layer I/O the `rustls` arm above already covers.
1073    // SOUNDNESS R331 — …and `TlsConnector::builder`, which is the SAME trust-store read reached by the
1074    // other spelling. `TlsConnector::new` is literally `TlsConnector::builder().build()`
1075    // (`native-tls-0.2.18/src/lib.rs:481`), and `TlsConnectorBuilder::build` (`:451`) is where
1076    // `imp::TlsConnector::new` — the openssl-backend cert-file/dir load — actually runs. The builder
1077    // spelling is the DOMINANT idiom the moment any option is set, and it is what `reqwest` itself
1078    // writes (`reqwest-0.12.28/src/async_impl/client.rs:529`).
1079    //
1080    // **KEYED ON `builder`, NOT ON `build`, AND THAT IS THE WHOLE FIX.** The first attempt added
1081    // `ends_with("TlsConnectorBuilder::build")` and moved nothing, so the row was closed with the
1082    // conclusion that the scanner "never types `TlsConnector::builder()`" and the repair had to be
1083    // receiver typing. **That conclusion was wrong.** `.build()` is a method on a foreign-returned
1084    // receiver and cannot be typed without a return index for a foreign crate — but `TlsConnector::
1085    // builder()` is a PATH call, recorded and classified exactly like `TlsConnector::new` beside it.
1086    // Charging the constructor rather than the terminal is also this file's own convention
1087    // (`Command::new`). Over-charge direction: a `builder()` whose `.build()` never happens, which is
1088    // not a shape anyone writes.
1089    //
1090    // WHY IT LOOKED LIKE NOTHING WAS RECORDED: under the calibration exemption a call that classifies
1091    // `None` is DROPPED from the report, so "no calls recorded" is what a correct scan of an exempt
1092    // crate looks like — not evidence that the receiver went untyped. Measured: under the PLAIN
1093    // `native_tls::` spelling (not calibrated) the same body is PRESENT with `invisible: ["native_tls"]`,
1094    // a disclosure; under `native_tls_crate` (the calibrated rename reqwest and tungstenite use) it is
1095    // ABSENT with nothing hidden. The rename is what turns a disclosure into a purity claim.
1096    if matches!(crate_name, "native_tls" | "native_tls_crate")
1097        && (path.ends_with("TlsConnector::new")
1098            || path.ends_with("TlsConnector::builder")
1099            || path.ends_with("Identity::from_pkcs8")
1100            || path.ends_with("Identity::from_pkcs12"))
1101    {
1102        return Some("Fs");
1103    }
1104    if crate_name == "rustls" && path.ends_with("KeyLogFile::new") {
1105        return Some("Fs");
1106    }
1107    // THE COVERAGE-GATE REFRESH (2026-10-08): `KeyLogFile::log` (rustls-0.23.45 key_log_file.rs:100) is
1108    // `try_write` -> `file.write_all(..)` (:67) on the SSLKEYLOGFILE it opened.
1109    if crate_name == "rustls"
1110        && matches!(path, "rustls::KeyLogFile::log" | "rustls::key_log_file::KeyLogFile::log")
1111    {
1112        return Some("Fs");
1113    }
1114    // Message-queue clients fully encapsulate the socket (the underlying tokio::net lives
1115    // inside the crate, unseen), so a user's connect/publish/consume calls ARE the I/O
1116    // boundary — to a remote broker, hence Net. Match the broker round-trip verbs (snake_case
1117    // methods); the CamelCase option/property builders stay pure. (Found hardening on consumer
1118    // apps: lapin `basic_publish`/`queue_declare` and async-nats `publish`/`subscribe` were
1119    // classified pure — a message-queue client reporting no I/O.)
1120    if crate_name == "async_nats" {
1121        if path.ends_with("::connect")
1122            || path.contains("::publish")
1123            || path.ends_with("::subscribe")
1124            || path.ends_with("::queue_subscribe")
1125            || path.contains("::request")
1126            || path.ends_with("::flush")
1127        {
1128            return Some("Net");
1129        }
1130        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against async-nats 0.35.1 (the version this
1131        // ratchet's rows were generated from — 0.50.0, also cached locally, removed/relocated this
1132        // exact surface, a separate question for a future pass):
1133        //
1134        // `connect_with_options` (lib.rs:891) is the crate's OWN real entry point `connect()` calls one
1135        // hop down — the actual handshake, missing because the verb list above matches the bare
1136        // `::connect` suffix, not the `_with_options` sibling.
1137        // `ConnectOptions::credentials_file`/`with_credentials_file` (options.rs:417,438) load a real
1138        // credentials file off disk via `auth_utils::load_creds` before authenticating — Fs, not Net
1139        // (the network round-trip these feed happens later, at `connect`).
1140        // `ServerAddr::socket_addrs` (lib.rs:1473) does `tokio::net::lookup_host` — a real DNS query.
1141        if path == "async_nats::connect_with_options" {
1142            return Some("Net");
1143        }
1144        if path == "async_nats::ConnectOptions::credentials_file"
1145            || path == "async_nats::ConnectOptions::with_credentials_file"
1146        {
1147            return Some("Fs");
1148        }
1149        if path == "async_nats::ServerAddr::socket_addrs" {
1150            return Some("Net");
1151        }
1152        return None;
1153    }
1154    if crate_name == "lapin" {
1155        if path.ends_with("::connect")
1156            || path.ends_with("::create_channel")
1157            || path.contains("::basic_")
1158            || path.contains("::queue_")
1159            || path.contains("::exchange_")
1160            || path.contains("::tx_")
1161            || path.ends_with("::confirm_select")
1162            || path.ends_with("::close")
1163        {
1164            return Some("Net");
1165        }
1166        return None;
1167    }
1168    // SMTP email — lettre's `Transport::send` is the network dispatch; Message building is
1169    // pure. (Found hardening on a lettre consumer: `mailer.send(&email)` classified pure.)
1170    //
1171    // THE COVERAGE-GATE SWEEP (2026-08-27), verified against lettre 0.11.23 source — the TLS-setup and
1172    // connection-establishment family this crate's own `send` rule never reached:
1173    //
1174    // `TlsParameters::new`/`new_rustls` (client/tls.rs:598,617) and `TlsParametersBuilder::build`/
1175    // `build_rustls` (tls.rs:325,446) — `build_rustls` calls `rustls_native_certs::load_native_certs()`
1176    // (a real OS-trust-store read) plus `tracing::debug!`; `build()` dispatches to it under the
1177    // (textually-visible, cfg-gated) `rustls` feature. `SmtpTransport`/`AsyncSmtpTransport::{from_url,
1178    // relay,starttls_relay}` (transport.rs:90,114,243; async_transport.rs:135,169,306) each construct a
1179    // `TlsParameters` directly (`relay`/`starttls_relay`) or via the crate's OWN `pub(crate)
1180    // from_connection_url` (`from_url`) — real TLS setup a consumer never spells `TlsParameters` to
1181    // reach. `FileTransport::read` (transport/file/mod.rs:216) calls `std::fs::read` directly.
1182    if crate_name == "lettre" {
1183        if path.ends_with("::send") || path.ends_with("::send_raw") {
1184            return Some("Net");
1185        }
1186        // THE COVERAGE-GATE REFRESH (2026-10-08), read against lettre-0.11.23 source: the SMTP client
1187        // connection layer, which `send` above reaches but a consumer driving the protocol by hand never
1188        // names. `SmtpConnection::connect` -> `NetworkStream::connect` (connection.rs:66, a TCP dial);
1189        // `command` -> `write_all` + `flush` on the stream (:275); `read_response` -> `read_line` (:289);
1190        // `quit`/`test_connected`/`auth`/`message`/`message_iter`/`starttls` are `command` +
1191        // `read_response`; `abort` sends QUIT and `shutdown`s the socket (:178). The async twins
1192        // (async_connection.rs) are the same over tokio, `connect_with_transport` reading the greeting.
1193        // `AsyncNetworkStream::{connect_tokio1, upgrade_tls}` dial / handshake the socket (the sync
1194        // `NetworkStream` is in the private `mod net;` and nameable by no consumer — no rule, as before);
1195        // `Tokio1Executor::connect` is `AsyncSmtpConnection::connect_tokio1` (executor.rs:140). NOT charged:
1196        // the accessors (`server_info`, `has_broken`, `can_starttls`, `is_encrypted`, `peer_*`,
1197        // `certificate_chain`, `tls_verify_result`, `set_stream`).
1198        if let Some((ty, m)) = type_method(path, "lettre", &["", "transport::smtp::client"]) {
1199            const CONN: &[&str] = &["connect", "connect_tokio1", "connect_with_transport", "starttls", "quit",
1200                "abort", "test_connected", "auth", "message", "message_iter", "command", "read_response"];
1201            let hit = match ty {
1202                "SmtpConnection" | "AsyncSmtpConnection" => CONN.contains(&m),
1203                "AsyncNetworkStream" => matches!(m, "connect_tokio1" | "upgrade_tls"),
1204                "Tokio1Executor" => m == "connect",
1205                _ => false,
1206            };
1207            if hit {
1208                return Some("Net");
1209            }
1210        }
1211        // SOUNDNESS R337 — lettre's half of the same wrapper gap. `Identity::from_pem(pem, key)`
1212        // (transport/smtp/client/tls.rs:749) is `native_tls::Identity::from_pkcs8(pem, key)`, which on
1213        // macOS writes a temporary keychain. The `::Identity::` in the suffix is load-bearing: the
1214        // `Certificate::from_pem` twenty lines above it (`:676`) is in-memory and must stay pure, and a
1215        // bare `::from_pem` would charge both.
1216        if path.ends_with("::Identity::from_pem") {
1217            return Some("Fs");
1218        }
1219        if path == "lettre::TlsParametersBuilder::build"
1220            || path == "lettre::transport::smtp::client::TlsParametersBuilder::build"
1221            || path == "lettre::TlsParametersBuilder::build_rustls"
1222            || path == "lettre::transport::smtp::client::TlsParametersBuilder::build_rustls"
1223            || path == "lettre::TlsParameters::new"
1224            || path == "lettre::transport::smtp::client::TlsParameters::new"
1225            || path == "lettre::TlsParameters::new_rustls"
1226            || path == "lettre::transport::smtp::client::TlsParameters::new_rustls"
1227            // SOUNDNESS R331 — the `_native` half of the same family, which this enumeration never had.
1228            // It surfaced the moment `TlsConnector::builder` started charging: the coverage gate's
1229            // oracle saw `Fs` on `TlsParameters::new_native` and `TlsParametersBuilder::build_native`
1230            // and `classify()` had no rule for either. `build_native` is `TlsConnector::builder()`
1231            // (`lettre-0.11.23/src/transport/smtp/client/tls.rs:338`) and `new_native` delegates
1232            // straight to it (`:610`); the already-listed `build`/`new` reach whichever backend is
1233            // enabled and were covered, so the list held every variant EXCEPT the one named after the
1234            // backend that does the disk read.
1235            //
1236            // `build_boring`/`new_boring` are deliberately NOT added. `build_boring` (`:384`) builds a
1237            // `boring::ssl::SslConnector`, and openssl's `SslConnector::builder` calls
1238            // `set_default_verify_paths()` — so it is PROBABLY `Fs` too, but `boring` is not a crate
1239            // this file has read, and the last three defects in this area came from charging a path
1240            // whose body nobody had opened. Left for a pass that reads it.
1241            || path == "lettre::TlsParameters::new_native"
1242            || path == "lettre::transport::smtp::client::TlsParameters::new_native"
1243            || path == "lettre::TlsParametersBuilder::build_native"
1244            || path == "lettre::transport::smtp::client::TlsParametersBuilder::build_native"
1245            || path == "lettre::SmtpTransport::from_url"
1246            || path == "lettre::SmtpTransport::relay"
1247            || path == "lettre::SmtpTransport::starttls_relay"
1248            || path == "lettre::AsyncSmtpTransport::from_url"
1249            || path == "lettre::AsyncSmtpTransport::relay"
1250            || path == "lettre::AsyncSmtpTransport::starttls_relay"
1251            || path == "lettre::FileTransport::read"
1252        {
1253            return Some("Fs");
1254        }
1255        // `AsyncStd1Executor::{connect,fs_read,fs_write}` (executor.rs:223,260,265, the sealed
1256        // `Executor` trait impl — `#[doc(hidden)]` in lettre's own source, so this is a narrower, less-
1257        // visited surface than the others above, but genuinely reachable: both the trait and the type
1258        // are `pub`, re-exported at the crate root) dial a real connection / read+write real files.
1259        // `AsyncSmtpConnection`/`AsyncNetworkStream::connect_asyncstd1` (client/async_connection.rs:121,
1260        // client/async_net.rs:207) dial a real `async-std` TCP connection — reachable only via the
1261        // module-qualified path (`transport::smtp::client::`), since neither type is re-exported at the
1262        // crate root (unlike `TlsParameters`'s sibling forms, which at least reach `client::` — the dual
1263        // spellings above, same shape as rusqlite's `Blob`/`Backup`).
1264        if path == "lettre::AsyncStd1Executor::connect"
1265            || path == "lettre::AsyncSmtpConnection::connect_asyncstd1"
1266            || path == "lettre::transport::smtp::client::AsyncSmtpConnection::connect_asyncstd1"
1267            || path == "lettre::AsyncNetworkStream::connect_asyncstd1"
1268            || path == "lettre::transport::smtp::client::AsyncNetworkStream::connect_asyncstd1"
1269        {
1270            return Some("Net");
1271        }
1272        if path == "lettre::AsyncStd1Executor::fs_read" || path == "lettre::AsyncStd1Executor::fs_write" {
1273            return Some("Fs");
1274        }
1275        // NOT included: `NetworkStream::{shutdown,set_read_timeout,set_write_timeout}` (client/net.rs)
1276        // LOOK like three more hits (self-scan flags them too, propagating from the coarse
1277        // `std::net::TcpStream` whole-handle rule) but `mod net;` (client/mod.rs:50) is PRIVATE and
1278        // `NetworkStream` is never re-exported (only imported crate-internally via a bare `use
1279        // self::net::NetworkStream;`, mod.rs:35) — no external consumer can ever name the type, so no
1280        // rule was added despite self-scan flagging it (the same `InnerConnection`/`RawStatement` shape
1281        // as the rusqlite fix elsewhere in this file).
1282        return None;
1283    }
1284    // WebSockets — tungstenite (the modern successor to the old `websocket` crate). connect
1285    // and the socket read/write/send are network; Message constructors are pure. (Found on a
1286    // tungstenite consumer: connect + send + read classified pure.)
1287    //
1288    // THE FIX: `connect` only names the URL-dialing client entry point. tungstenite ALSO ships the
1289    // stream-first client/server handshake free functions — `client`/`client_with_config` (client.rs:176,
1290    // 152: "use this if you need a nonblocking handshake ... or a custom stream") and
1291    // `accept`/`accept_with_config`/`accept_hdr`/`accept_hdr_with_config` (server.rs:23-63) — each of
1292    // which does `{Client,Server}Handshake::start(stream, ..).handshake()`, the REAL WS upgrade
1293    // handshake read/write over an already-open stream. These are the documented way to run tungstenite
1294    // over a caller-managed TCP/TLS/mio stream (exactly the shape most async runtimes use, since
1295    // tungstenite itself is sync/transport-agnostic) — missing from a verb list keyed only on the
1296    // dial-it-yourself `connect` spelling. Same vein as `git2::Submodule::clone`/`ignore::Walk::new`: an
1297    // established effect's SIBLING entry point absent from the allowlist.
1298    if crate_name == "tungstenite" {
1299        if path.ends_with("::connect")
1300            || path.ends_with("::connect_with_config")
1301            || path.ends_with("::client")
1302            || path.ends_with("::client_with_config")
1303            || path.ends_with("::client_tls")
1304            || path.ends_with("::client_tls_with_config")
1305            || path.ends_with("::accept")
1306            || path.ends_with("::accept_with_config")
1307            || path.ends_with("::accept_hdr")
1308            || path.ends_with("::accept_hdr_with_config")
1309            || path.ends_with("::read")
1310            || path.ends_with("::write")
1311            || path.ends_with("::send")
1312            || path.ends_with("::close")
1313            || path.ends_with("::flush")
1314            || path.ends_with("::read_message")
1315            || path.ends_with("::write_message")
1316        {
1317            return Some("Net");
1318        }
1319        return None;
1320    }
1321    // elasticsearch: request builders are pure; only the `.send()` dispatch is HTTP I/O
1322    // (same shape as reqwest / the AWS SDK). (Found on an elasticsearch consumer.)
1323    // SOUNDNESS R342 — …and the RESPONSE BODY, one wrapper up from reqwest's. `Response::json` is
1324    // `self.response.json::<B>().await` (`http/response.rs:102`) — reqwest's body drain, which this file
1325    // now charges — and `text`/`bytes`/`exception` are the same read. A consumer writing
1326    // `client.search(..).send().await?.json().await?` had the `send` charged and the read silent.
1327    //
1328    // This is EXACTLY the distinction this file's own exclusion list already draws for this type:
1329    // `Response::content_type` is documented there as a pure accessor reading a header off an
1330    // ALREADY-received response. `status_code`/`headers` are the same shape and stay pure; the body
1331    // methods are not accessors, they pull the remaining bytes off the wire. Both halves are asserted
1332    // in the test so the line between them cannot move by accident.
1333    if crate_name == "elasticsearch"
1334        && path.contains("Response::")
1335        && (path.ends_with("::json")
1336            || path.ends_with("::text")
1337            || path.ends_with("::bytes")
1338            || path.ends_with("::exception"))
1339    {
1340        return Some("Net");
1341    }
1342    if crate_name == "elasticsearch" && path.ends_with("::send") {
1343        return Some("Net");
1344    }
1345    // gRPC — tonic. The transport connect and the Grpc client RPC dispatch are network;
1346    // codecs and request/response wrappers are pure. (connect repro-confirmed on a consumer;
1347    // the unary/streaming RPC verbs are from the tonic::client::Grpc API.)
1348    //
1349    // THE COVERAGE-GATE FIX: the rule above only ever covered the CLIENT half. `Router::serve`/
1350    // `::serve_with_shutdown` (transport/server/mod.rs:783,811) are the SERVER's own most common entry
1351    // points — a tonic quickstart's last line — and both bind a real listening socket via
1352    // `TcpIncoming::new` (incoming.rs:197: `StdTcpListener::bind(addr)`), the crate's other bare-`pub`
1353    // constructor (`Server<L>::serve_with_shutdown` at mod.rs:530 is a DIFFERENT, `pub(crate)` method on
1354    // a different receiver — not reachable, and not this one). A `deny Net` on a gRPC SERVER app missed
1355    // its own listen call entirely.
1356    if crate_name == "tonic" {
1357        if path.ends_with("::connect")
1358            || path.ends_with("::unary")
1359            || path.ends_with("::server_streaming")
1360            || path.ends_with("::client_streaming")
1361            || path.ends_with("::streaming")
1362            || path.ends_with("::Router::serve")
1363            || path.ends_with("::Router::serve_with_shutdown")
1364            || path == "tonic::TcpIncoming::new"
1365            || path == "tonic::transport::server::TcpIncoming::new"
1366        {
1367            return Some("Net");
1368        }
1369        return None;
1370    }
1371    // Kafka — rdkafka (FFI to librdkafka). Producer send + consumer poll/recv/subscribe/
1372    // commit are network round-trips to the brokers. (API-calibrated + unit-tested; a real
1373    // repro needs librdkafka/cmake, deferred.)
1374    if crate_name == "rdkafka" {
1375        if path.ends_with("::send")
1376            || path.ends_with("::send_result")
1377            || path.ends_with("::recv")
1378            || path.ends_with("::poll")
1379            || path.ends_with("::subscribe")
1380            || path.ends_with("::commit")
1381            || path.ends_with("::commit_message")
1382            || path.ends_with("::commit_consumer_state")
1383            || path.ends_with("::store_offset")
1384            || path.ends_with("::seek")
1385            || path.ends_with("::fetch_metadata")
1386            || path.ends_with("::fetch_watermarks")
1387            || path.ends_with("::flush")
1388        {
1389            return Some("Net");
1390        }
1391        return None;
1392    }
1393    // cap-std: capability-oriented std. I/O goes *through* a held capability handle
1394    // (Dir/Pool/Clock/...), so these calls ARE the effect. Recognising them means a
1395    // cap-std project's real I/O is detected and matches the capability it declared
1396    // (via `declared_caps`/`capstd_cap`) — conformance against unforgeable capabilities.
1397    if crate_name.starts_with("cap_") {
1398        if path.contains("::net::Unix") || path.contains("::os::") {
1399            return Some("Ipc");
1400        }
1401        if path.contains("::net") {
1402            return Some("Net");
1403        }
1404        if path.contains("::time") {
1405            return Some("Clock");
1406        }
1407        if path.contains("::fs") || crate_name == "cap_tempfile" || crate_name == "cap_directories" {
1408            return Some("Fs");
1409        }
1410        return None;
1411    }
1412    // Local IPC (Unix-domain sockets) is I/O but not *network* — keep it distinct so
1413    // CANDOR_NO_AMBIENT and audits don't conflate it with internet access. async-std puts its
1414    // Unix sockets under `os::unix::net` (mirroring std); async-net (smol's net layer) under
1415    // `unix`.
1416    if path.starts_with("tokio::net::Unix")
1417        || path.starts_with("std::os::unix::net")
1418        || path.starts_with("async_std::os::unix::net")
1419        || path.starts_with("async_net::unix")
1420    {
1421        return Some("Ipc");
1422    }
1423    // Raw packet capture / raw sockets — libpnet (the dominant low-level networking crate; powers
1424    // bandwhich, sniffers, custom-protocol tools). `datalink::channel` opens an L2 socket and
1425    // `transport::transport_channel` an L3/L4 raw socket — both ARE network I/O. Packet construction
1426    // (pnet_packet / pnet_base, MacAddr, Ethernet frames…) is pure and stays unclassified. The actual
1427    // frame read/write happens via methods on the returned Sender/Receiver (trait-object dispatch the
1428    // syntactic backend can't resolve), so the channel-open call is the precise Net boundary. (Found
1429    // scanning bandwhich — a packet sniffer — which reported Net 0.)
1430    if crate_name == "pnet" || crate_name == "pnet_datalink" || crate_name == "pnet_transport" {
1431        if path.ends_with("::channel") || path.ends_with("::transport_channel") {
1432            return Some("Net");
1433        }
1434        return None;
1435    }
1436    // Directory traversal — `ignore` (BurntSushi's gitignore-aware walker; powers ripgrep, fd). The walk
1437    // EXECUTORS read the directory tree from disk = Fs. Type-precise on purpose: the configuration builders
1438    // (`OverrideBuilder::build`, `GitignoreBuilder::build`, the `WalkBuilder` setters) and `DirEntry`
1439    // accessors are PURE — only `WalkBuilder::build`/`build_parallel` (which kick off the walk) and
1440    // `WalkParallel::run` (which drives it) touch the filesystem. A bare `build` would wrongly flag the
1441    // config builders. (Found scanning fd — a file finder — which reported Fs 2: its own `fs::read_dir`
1442    // was caught, but the `ignore`-based traversal that IS fd was invisible cross-crate.)
1443    //
1444    // `Walk::new`/`Walk::from_iter` are the crate's own documented convenience constructors — literally
1445    // `WalkBuilder::new(path).build()` / `WalkBuilder::from_iter(paths).build()` in `ignore`'s own source
1446    // (walk.rs:1128-1146) — but a verb list keyed only on `WalkBuilder::build`/`build_parallel`/
1447    // `WalkParallel::run`/`add_ignore` never sees `Walk::new(root)` (the crate's own top-level doc example
1448    // and the SAME shape as the already-fixed `walkdir::WalkDir::new`/`git2::Repository::clone`: a
1449    // documented public entry point that reaches the modelled effect through a wrapper the allowlist
1450    // didn't name). `deny Fs` over `for e in Walk::new(root) { .. }` exited 0. Charged at the SAME
1451    // construction site as `WalkBuilder::build` — no receiver typing needed, it's a plain `Expr::Call` on
1452    // `ignore::Walk::new`/`ignore::Walk::from_iter`, crate-gated so an unrelated `Walk::new` (a different
1453    // crate, or a local type) cannot match this arm.
1454    if crate_name == "ignore" {
1455        if path == "ignore::WalkBuilder::build"
1456            || path == "ignore::WalkBuilder::build_parallel"
1457            || path.ends_with("::WalkParallel::run")
1458            // `add_ignore(path)` LOOKS like a config setter but reads that ignore file from disk at call
1459            // time (it returns the read error) — unlike the pure `add_custom_ignore_filename(name)` which
1460            // only stores a filename string. The lone Fs-touching builder method in the otherwise-pure setter
1461            // surface, so it was silently pure under the covered-crate floor.
1462            || path == "ignore::WalkBuilder::add_ignore"
1463            || path == "ignore::Walk::new"
1464            || path == "ignore::Walk::from_iter"
1465        {
1466            return Some("Fs");
1467        }
1468        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against ignore 0.4.33 — the gitignore-matcher
1469        // construction family, a DIFFERENT public surface from the walk-builder family above:
1470        //
1471        // `Gitignore::new` (gitignore.rs:103) opens and reads the given file directly via
1472        // `GitignoreBuilder::add`. `Gitignore::global` (gitignore.rs:141) reads `$PWD` then delegates to
1473        // `GitignoreBuilder::new(cwd).build_global()`. `GitignoreBuilder::add` (gitignore.rs:405) is the
1474        // crate's own per-file loader — `File::open` + line-by-line read — the same shape `add_ignore`
1475        // above was fixed for, on the SIBLING type. `GitignoreBuilder::build_global`/
1476        // `gitconfig_excludes_path` (gitignore.rs:377,583) resolve git's global excludesfile: read
1477        // `GIT_CONFIG_GLOBAL`/`XDG_CONFIG_HOME`/`HOME` env vars, then open and parse whichever gitconfig
1478        // file they point at. `WalkBuilder::build_matchers` (walk.rs:675) is the incremental-walk
1479        // sibling of the already-covered `build_parallel` — same `self.build_ignore()` call, different
1480        // caller-facing verb. `IncrementalIgnore::matched`/`matched_with_errors` (incremental.rs:194,213)
1481        // are the newer per-directory incremental-walk API: each lazily loads that directory's ignore
1482        // files (and, when `max_filesize` is set, `stat`s the candidate file) as the walk descends.
1483        //
1484        // `Gitignore`/`GitignoreBuilder`/`gitconfig_excludes_path` live in `pub mod gitignore;`
1485        // (lib.rs:59) but — unlike `Walk`/`WalkBuilder` two lines up (`pub use crate::walk::{..}`,
1486        // lib.rs:52) — are NOT re-exported at the crate root, so the only real, compilable spelling is
1487        // the module-qualified one (proven by a consumer fixture: `ignore::Gitignore::new` does not
1488        // exist, `ignore::gitignore::Gitignore::new` does). `IncrementalIgnore` IS re-exported at the
1489        // root (`pub use crate::incremental::{..}`, lib.rs:51), so the bare form is correct there.
1490        if path == "ignore::gitignore::Gitignore::new"
1491            || path == "ignore::gitignore::Gitignore::global"
1492            || path == "ignore::gitignore::GitignoreBuilder::add"
1493            || path == "ignore::gitignore::GitignoreBuilder::build_global"
1494            || path == "ignore::gitignore::gitconfig_excludes_path"
1495            || path == "ignore::WalkBuilder::build_matchers"
1496            || path == "ignore::IncrementalIgnore::matched"
1497            || path == "ignore::IncrementalIgnore::matched_with_errors"
1498            || path == "ignore::DirEntry::metadata"
1499            || path == "ignore::walk::DirEntry::metadata"
1500            || path == "ignore::WalkParallel::visit"
1501            || path == "ignore::walk::WalkParallel::visit"
1502        {
1503            return Some("Fs");
1504        }
1505        return None;
1506    }
1507    // Filesystem watching — `notify` (the de-facto fs-watch crate: watchexec, cargo-watch, mdbook). A
1508    // watcher opens an OS notification handle (inotify / FSEvents / kqueue / ReadDirectoryChanges) and
1509    // registers paths — observing filesystem state changes = Fs. The lifecycle boundary: any
1510    // `*Watcher::new` constructor (RecommendedWatcher/PollWatcher/INotifyWatcher/FsEventWatcher/…), the
1511    // `recommended_watcher` convenience fn, and the `watch`/`unwatch` registration verbs. `Config`/`Event`/
1512    // `EventKind` data types stay pure. (Found scanning watchexec: its watcher-`create` read Fs 0.)
1513    if crate_name == "notify" {
1514        if path.ends_with("Watcher::new")
1515            || path.ends_with("::recommended_watcher")
1516            || path.ends_with("::watch")
1517            || path.ends_with("::unwatch")
1518            // `ReadDirectoryChangesWatcher::create` (windows.rs:475, `pub use windows::
1519            // ReadDirectoryChangesWatcher` at the crate root) is a SECOND, directly-callable
1520            // constructor distinct from the `Watcher::new` trait method above — it takes a raw
1521            // meta-event channel `Watcher::new`'s impl builds internally by calling THIS same
1522            // `create`, then spawns the real ReadDirectoryChangesW watch server thread.
1523            || path.ends_with("ReadDirectoryChangesWatcher::create")
1524        {
1525            return Some("Fs");
1526        }
1527        return None;
1528    }
1529    // std DNS resolution — `("host", 80).to_socket_addrs()` / `std::net::lookup_host("host")` perform a
1530    // real getaddrinfo query (Net), but the classify table covered only the socket I/O *types*, so they
1531    // floored silently (sweep [37]; the syntactic engine modelled DNS only at the libc layer).
1532    if path.ends_with("::to_socket_addrs")
1533        || path == "std::net::lookup_host"
1534        || path.ends_with("ToSocketAddrs::to_socket_addrs")
1535    {
1536        return Some("Net");
1537    }
1538    // Raw sockets. Match the I/O *types* only — `std::net` also holds pure data types
1539    // (SocketAddr, IpAddr, …) whose construction must NOT be flagged.
1540    if path.starts_with("std::net::TcpStream")
1541        || path.starts_with("std::net::TcpListener")
1542        || path.starts_with("std::net::UdpSocket")
1543        || path.starts_with("tokio::net::")
1544    {
1545        // …but the PURE accessors read back local/option state — no network I/O — so the whole-type Net
1546        // rule fabricated Net on them (sweep [24], the precision failure; mirrors the arboard/memmap2 accessor
1547        // carve-outs). local_addr/peer_addr return bound/connected addresses; nodelay/ttl/take_error read
1548        // socket options/state. Every genuine verb (connect/read/write/send/recv/accept) stays Net.
1549        if path.ends_with("::local_addr")
1550            || path.ends_with("::peer_addr")
1551            || path.ends_with("::nodelay")
1552            || path.ends_with("::ttl")
1553            || path.ends_with("::take_error")
1554        {
1555            return None;
1556        }
1557        return Some("Net");
1558    }
1559    // Legacy tokio 0.1 socket crates — `tokio_tcp`/`tokio_udp` are *entirely* networking
1560    // (no pure types to over-flag), so the whole crate is Net. (Found hardening on websocat,
1561    // which is still on tokio 0.1: its `tokio_tcp::TcpStream::connect` was classified
1562    // network-free — a network tool confidently reporting 0 Net.)
1563    if matches!(crate_name, "tokio_tcp" | "tokio_udp") {
1564        return Some("Net");
1565    }
1566    // The other async runtimes mirror tokio's module layout, and their `net` modules hold only
1567    // socket I/O types (the pure `SocketAddr`/`IpAddr` are re-exports that resolve to `std::net`,
1568    // so they're excluded by def-path). `mio` is the low-level non-blocking-socket layer under
1569    // tokio/others; `async_net` is smol's net crate. Closes the async-std/smol/mio gap the
1570    // tokio_tcp note flagged. (Calibrated by module structure — these crates ARE networking — not
1571    // a live repro; the TCP/UDP types are defined in-crate so the def-path prefix is exact.)
1572    if path.starts_with("async_std::net::")
1573        || path.starts_with("mio::net::")
1574        || crate_name == "async_net"
1575    {
1576        return Some("Net");
1577    }
1578    // Database clients. Like the AWS/HTTP builders, only the execution verbs are I/O;
1579    // query *construction* is pure. Best-effort across crates (tune via CANDOR_CONFIG).
1580    // Note: bare `::query` is deliberately omitted — it executes in postgres/rusqlite but
1581    // only *builds* in sqlx, so including it would false-positive sqlx's `query()` builder.
1582    if DB_CRATES.contains(&crate_name) {
1583        // Postgres / SQLite-family clients: `query`/`batch_execute`/`prepare`/etc. ARE the
1584        // execution (round-trips to the server). sqlx is the outlier where bare `query()`
1585        // only BUILDS — it keeps the narrow set below. (Found by running on a real
1586        // tokio-postgres app, pgman: candor had reported only 4 of ~20 DB call sites.)
1587        if matches!(crate_name, "postgres" | "tokio_postgres" | "deadpool_postgres" | "rusqlite") {
1588            // `PG_DB_VERBS`, hoisted to module level so the AS-EFF-008 masking guard reads the SAME
1589            // table (SOUNDNESS R806; see `masks_locator` and `PG_DB_VERBS_NO_SQL`).
1590            const PG: &[&str] = PG_DB_VERBS;
1591            if PG.iter().any(|v| path.ends_with(v)) {
1592                return Some("Db");
1593            }
1594            // THE COVERAGE-GATE SWEEP (2026-08-27): `CancelToken::cancel_query` (tokio-postgres
1595            // cancel_token.rs:34) opens a BRAND NEW connection to the server to send a raw CancelRequest
1596            // packet — real socket I/O, but not a query round-trip on an existing connection like the PG
1597            // verb list above, so bucketed `Net` rather than `Db`.
1598            if matches!(crate_name, "tokio_postgres" | "postgres")
1599                && path.ends_with("CancelToken::cancel_query")
1600            {
1601                return Some("Net");
1602            }
1603            // rusqlite only: opening the database IS the connection establishment (`Connection::
1604            // open`/`open_in_memory`/`open_with_flags` — the embedded analog of `::connect`).
1605            //
1606            // THE FIX: rusqlite 0.32's `Connection` type has SIX `open*` constructors, not three —
1607            // `open_with_flags_and_vfs` and `open_in_memory_with_flags_and_vfs` call the real
1608            // `InnerConnection::open_with_flags` (the sqlite3_open_v2 FFI) directly (lib.rs:492,530), and
1609            // `open_in_memory_with_flags` (lib.rs:515) calls `Connection::open_with_flags(":memory:", ..)`
1610            // — but an exact-suffix allowlist keyed on the THREE simplest names never matches any of
1611            // them (`"open_in_memory_with_flags".ends_with("::open_with_flags")` is false: the suffix
1612            // check needs the string to END in that literal tail, and `_and_vfs`/`_with_flags` add
1613            // characters AFTER it). The same shape as `ignore::Walk::new`: a sibling spelling of an
1614            // already-modelled constructor missing from the allowlist, silently pure because rusqlite is
1615            // calibrated. Match on the `Connection::open` PREFIX rather than enumerating every suffix —
1616            // every current and future `Connection::open*` constructor opens a real handle. Scoped to the
1617            // `Connection::` segment specifically (not a bare leaf prefix) so an unrelated same-crate
1618            // `open`-prefixed method on a DIFFERENT type (e.g. the private `pragma::Sql::open_brace`,
1619            // which pushes one char to a string buffer — no I/O) cannot be swept in by accident.
1620            //
1621            // Same sighting, different constructor: `Connection::blob_open` and `Blob::reopen` call
1622            // `ffi::sqlite3_blob_open`/`sqlite3_blob_reopen` directly (blob/mod.rs:218,251) — genuinely
1623            // Db, and `sqlite3_blob_open`/`sqlite3_blob_reopen` are already in this file's own FFI-leaf DB
1624            // table above (matched only when a caller names the raw `ffi::` leaf directly) — but rusqlite's
1625            // own documented safe wrapper, the incremental-BLOB-I/O API every rusqlite blob consumer
1626            // actually calls, carried no rule of its own.
1627            if crate_name == "rusqlite"
1628                && (path.contains("::Connection::open")
1629                    || path.ends_with("::Connection::blob_open")
1630                    || path.ends_with("::Blob::reopen"))
1631            {
1632                return Some("Db");
1633            }
1634            // THE COVERAGE-GATE SWEEP (2026-08-27): same shape again, and the SAME root cause as
1635            // `git2`'s — this `if crate_name == "rusqlite"` block returns unconditionally, so it never
1636            // reaches this file's own `sqlite3_*` FFI-leaf table below even though every one of these
1637            // calls a leaf ALREADY listed there (`sqlite3_backup_init`/`_step`, `sqlite3_blob_read`/
1638            // `_write`). Verified against rusqlite 0.32.1 source. `Backup::new`/`new_with_names` are the
1639            // crate's own online-backup constructors (backup.rs:187,200); `step`/`run_to_completion`
1640            // drive it; `Connection::backup`/`restore` (backup.rs:61,99) are the one-call convenience
1641            // wrappers around the same API and need their OWN rule since a consumer calling THEM never
1642            // names `Backup` at all. `Blob::{read,write}_at[_exact]`/`raw_read_at[_exact]`/
1643            // `write_all_at` (blob/pos_io.rs) are the incremental-BLOB positional-I/O methods, each
1644            // calling `ffi::sqlite3_blob_read`/`_write` directly. `Connection::from_handle`/
1645            // `_owned`/`extension_init2` and the free fn `init_auto_extension` (lib.rs:950,999,966;
1646            // auto_extension.rs:26) wrap a caller-supplied raw `*mut ffi::sqlite3` into a live
1647            // `Connection` — the loadable-extension entry points, same "produces a live connection"
1648            // effect as `Connection::open`, just over a handle the caller already has instead of one
1649            // this call opens itself (the `tokio_postgres::connect_raw`/`sea_orm::connect_proxy` shape).
1650            //
1651            // NOT included: `InnerConnection::*` and `RawStatement::step` LOOK like six more hits (self-
1652            // scan flags them too) but `mod inner_connection;`/`mod raw_statement;` (lib.rs:119,127) are
1653            // PRIVATE — despite `pub struct InnerConnection`/`RawStatement`, neither type has any public
1654            // path a real consumer could ever name or obtain a value of, so no rule was added for them
1655            // (a rule would be dead weight, never reachable). `Context::get_connection` (functions.rs)
1656            // is ALSO left out, deliberately: it returns a `ConnectionRef` accessor to an
1657            // ALREADY-established connection (`ffi::sqlite3_context_db_handle`, not an I/O verb) — the
1658            // same "handle accessor, not a syscall" shape as `TcpStream::local_addr`, not confirmed
1659            // enough to charge without risking the over-charge this file's history has repeatedly warned
1660            // against. THE COVERAGE-GATE SWEEP (2026-08-27) resolved this from "left in the ratchet"
1661            // to a formal call: `REVIEWED_PURE_ENTRIES` now carries `("rusqlite",
1662            // "rusqlite::Context::get_connection")` so the gate stops re-flagging it every refresh.
1663            //
1664            // TWO SPELLINGS EACH for `Backup`/`Blob`/`init_auto_extension`: none of the three is
1665            // re-exported at rusqlite's crate root (unlike `Connection`, declared directly in lib.rs), so
1666            // the ONLY real spelling a consumer can write is the module-qualified one
1667            // (`rusqlite::backup::Backup::new`, `rusqlite::blob::Blob::read_at`,
1668            // `rusqlite::auto_extension::init_auto_extension`) — but the coverage-gate ratchet recorded
1669            // the SHORT, technically-unreachable guess (`generate.py` always adds a bare
1670            // `{crate}::{Type}::{fn}` guess as a possible root-alias, without confirming a `pub use`
1671            // actually exists for it). Both are listed: the short form so this fix closes the exact row
1672            // the ratchet carries, the long form so it fires for what a real consumer's source (proven
1673            // against a compiling fixture) actually contains — dropping the long form would leave the
1674            // real gap open while the bookkeeping said closed.
1675            if crate_name == "rusqlite"
1676                && (path == "rusqlite::Backup::new"
1677                    || path == "rusqlite::backup::Backup::new"
1678                    || path == "rusqlite::Backup::new_with_names"
1679                    || path == "rusqlite::backup::Backup::new_with_names"
1680                    || path == "rusqlite::Backup::step"
1681                    || path == "rusqlite::backup::Backup::step"
1682                    || path == "rusqlite::Backup::run_to_completion"
1683                    || path == "rusqlite::backup::Backup::run_to_completion"
1684                    || path == "rusqlite::Connection::backup"
1685                    || path == "rusqlite::Connection::restore"
1686                    || path == "rusqlite::Blob::read_at"
1687                    || path == "rusqlite::blob::Blob::read_at"
1688                    || path == "rusqlite::Blob::read_at_exact"
1689                    || path == "rusqlite::blob::Blob::read_at_exact"
1690                    || path == "rusqlite::Blob::raw_read_at"
1691                    || path == "rusqlite::blob::Blob::raw_read_at"
1692                    || path == "rusqlite::Blob::raw_read_at_exact"
1693                    || path == "rusqlite::blob::Blob::raw_read_at_exact"
1694                    || path == "rusqlite::Blob::write_at"
1695                    || path == "rusqlite::blob::Blob::write_at"
1696                    || path == "rusqlite::Blob::write_all_at"
1697                    || path == "rusqlite::blob::Blob::write_all_at"
1698                    || path == "rusqlite::Connection::from_handle"
1699                    || path == "rusqlite::Connection::from_handle_owned"
1700                    || path == "rusqlite::Connection::extension_init2"
1701                    || path == "rusqlite::init_auto_extension"
1702                    || path == "rusqlite::auto_extension::init_auto_extension"
1703                    || path == "rusqlite::Statement::insert"
1704                    || path == "rusqlite::statement::Statement::insert"
1705                    || path == "rusqlite::Statement::raw_execute"
1706                    || path == "rusqlite::statement::Statement::raw_execute"
1707                    // SOUNDNESS R342 — `Rows::next` STEPS the statement: it is `self.advance()?`
1708                    // (`rusqlite-0.39.0/src/row.rs:40`), i.e. `sqlite3_step`, which is where a query's
1709                    // rows actually come from. Iterating a result set is the ordinary way to read from
1710                    // sqlite and it carried no `Db`. `advance` is listed beside it because it is `pub`
1711                    // and is the same call one level down.
1712                    || path == "rusqlite::Rows::next"
1713                    || path == "rusqlite::row::Rows::next"
1714                    || path == "rusqlite::Rows::advance"
1715                    || path == "rusqlite::row::Rows::advance")
1716            {
1717                return Some("Db");
1718            }
1719            // THE COVERAGE-GATE REFRESH (2026-10-08), read against rusqlite-0.39.0 source. Transactions,
1720            // savepoints and pragmas are SQL round-trips through `execute_batch`/`query_row`/`prepare`,
1721            // which this block already charges, but a consumer calling the wrapper never names them:
1722            //   * `Transaction::new`/`new_unchecked` -> `conn.execute_batch("BEGIN …")` (transaction.rs:125);
1723            //     `commit`/`rollback`/`finish` -> `execute_batch("COMMIT"/"ROLLBACK")` (:192,:204,:219);
1724            //     `savepoint`/`savepoint_with_name` -> `Savepoint::with_name_` -> `execute_batch("SAVEPOINT …")` (:253).
1725            //   * `Savepoint::{new, with_name, savepoint, savepoint_with_name}` (same `SAVEPOINT`), `commit`
1726            //     (`RELEASE`, :314), `rollback` (`ROLLBACK TO`, :328), `finish` (:342).
1727            //   * `Connection::{transaction_with_behavior, unchecked_transaction, savepoint,
1728            //     savepoint_with_name}` (:427,:465,:495,:507) construct the two above.
1729            //   * `Connection::pragma_query_value`/`pragma_update_and_check` -> `query_row` (pragma.rs:154,:262),
1730            //     `pragma_query`/`pragma` -> `prepare` + rows (:172,:209), `pragma_update` -> `execute_batch` (:238).
1731            // NOT charged: `drop_behavior`/`set_drop_behavior` (a field), and the private `pragma::Sql` builder.
1732            if crate_name == "rusqlite" {
1733                if let Some((ty, m)) = type_method(path, "rusqlite", &["", "transaction", "pragma"]) {
1734                    let hit = match ty {
1735                        "Transaction" => matches!(m, "new" | "new_unchecked" | "commit" | "rollback" | "finish"
1736                            | "savepoint" | "savepoint_with_name"),
1737                        "Savepoint" => matches!(m, "new" | "with_name" | "savepoint" | "savepoint_with_name"
1738                            | "commit" | "rollback" | "finish"),
1739                        "Connection" => matches!(m, "transaction_with_behavior" | "unchecked_transaction"
1740                            | "savepoint" | "savepoint_with_name" | "pragma" | "pragma_query"
1741                            | "pragma_query_value" | "pragma_update" | "pragma_update_and_check"),
1742                        _ => false,
1743                    };
1744                    if hit {
1745                        return Some("Db");
1746                    }
1747                }
1748            }
1749            return None;
1750        }
1751        // redis: the way redis is ACTUALLY used is the high-level `Commands`/`AsyncCommands`
1752        // traits (`con.get`/`set`/`hset`/`lpush`/…) — every method is a round-trip — plus
1753        // connection establishment. The shared VERBS below only catch the low-level
1754        // `cmd("GET").query(con)`, so without this a normal redis user's calls classify as
1755        // PURE. (Found hardening on redis-rs: a fn doing `con.get`/`set` reported no effects.)
1756        // SOUNDNESS R335 — the SENTINEL module, which the rules above reach only by accident. redis's
1757        // `sentinel` surface is how a client finds the current master in a failover deployment, and
1758        // every lookup TALKS TO THE SENTINEL SERVERS: `Sentinel::master_for` runs
1759        // `find_master_address` (a `SENTINEL masters` round-trip) and its own doc says "this will
1760        // connect to the master node to verify that it considers itself master"; `get_sentinel_client`
1761        // opens a client per address and issues `ROLE` until one answers. Measured on redis 1.6.0 —
1762        // which is this crate's REVIEWED CEILING, so the calibration exemption applied and every one of
1763        // them read as a positive purity claim, in both the receiver-typed and UFCS spellings.
1764        //
1765        // A DENYLIST, not the enumeration the surrounding rules use, and that is the point. The
1766        // enumerate-the-connecting-verbs shape is what goes stale: a release that ADDS a lookup verb
1767        // adds a SILENCE, the cardinal direction. Inverted, the whole module is `Db` except its
1768        // config surface, so a new verb is charged by default and only a new PURE verb costs a
1769        // fabrication. The exempt set is not guessed: every `pub fn` leaf in redis-1.6.0/src/sentinel.rs
1770        // is one of 33 names, and `build` / `new` / `set_*` are exactly the ones that touch no socket
1771        // (`Sentinel::build` parses URLs via `into_connection_info`; `SentinelClientBuilder::build`
1772        // assembles a config struct). The `contains("::Sentinel")` arm is not the loose match R321
1773        // punished: the module's ENTIRE public surface was enumerated before writing it, and no item
1774        // named `Sentinel*` exists anywhere else in the crate, nor any of these verb names.
1775        if crate_name == "redis"
1776            && (path.starts_with("redis::sentinel::") || path.contains("::Sentinel"))
1777        {
1778            let m = path.rsplit("::").next().unwrap_or(path);
1779            if m == "build" || m == "new" || m.starts_with("set_") {
1780                return None;
1781            }
1782            // §E1 HIT COUNTER (`CANDOR_ALIAS_DEBUG`) for `bin/corpus-ab.py --mark`.
1783            if std::env::var("CANDOR_ALIAS_DEBUG").is_ok() {
1784                eprintln!("R335SENTINEL {path}");
1785            }
1786            return Some("Db");
1787        }
1788        // THE COVERAGE-GATE REFRESH (2026-10-08), read against redis-1.7.1 source. The sync `Connection`'s
1789        // raw protocol pair and the sync `PubSub` reader touch the socket directly:
1790        // `send_packed_command` -> `send_bytes` -> `reader.write_all(bytes)` (connection.rs:1661,:1053);
1791        // `recv_response` -> `read(true)` -> `parser.parse_value(reader)` (:1668,:1850);
1792        // `PubSub::get_message` -> `self.con.read(false)` (:2204). `Net`, not the `Db` the command verbs
1793        // carry: these move bytes, they issue no command. Exact type segment (`type_method`), so
1794        // `MultiplexedConnection`/`ClusterConnection` are not swept in.
1795        if crate_name == "redis" {
1796            if let Some((ty, m)) = type_method(path, "redis", &["", "connection"]) {
1797                if (ty == "Connection" && matches!(m, "send_packed_command" | "recv_response"))
1798                    || (ty == "PubSub" && m == "get_message")
1799                {
1800                    return Some("Net");
1801                }
1802            }
1803        }
1804        if crate_name == "redis"
1805            && (path.contains("Commands::")
1806                // THE COVERAGE-GATE SWEEP (2026-08-27), a pre-existing over-report found in passing:
1807                // `path.contains("::get_connection")` is a SUBSTRING match, so it also matched
1808                // `Client::get_connection_info` (client.rs:78) — a pure accessor returning an
1809                // already-stored `&ConnectionInfo`, no round-trip at all. Verified against redis 1.6.0.
1810                || (path.contains("::get_connection") && !path.ends_with("::get_connection_info"))
1811                || path.contains("::get_async_connection")
1812                || path.contains("::get_multiplexed_async_connection")
1813                // a live `ConnectionManager` round-trips (Db), but `ConnectionManagerConfig` is a pure
1814                // in-memory builder (set_number_of_retries/set_max_delay) — exclude it (adversarial review).
1815                // `ConnectionManager::clone` is an Arc refcount bump — no Db round-trip (sweep [27]).
1816                || (path.contains("ConnectionManager") && !path.contains("ConnectionManagerConfig")
1817                    && !path.ends_with("::clone"))
1818                || path.ends_with("::query")
1819                || path.ends_with("::query_async")
1820                || path.ends_with("::req_command")
1821                || path.ends_with("::req_packed_command")
1822                || path.ends_with("::req_packed_commands"))
1823        {
1824            return Some("Db");
1825        }
1826        // mongodb: a document-store API with none of the SQL verbs — the user calls
1827        // `coll.find_one`/`insert_one`/`aggregate`/… and `Client::with_uri_str`. Without
1828        // these a mongodb user's calls classify PURE. (Found hardening: a fn doing
1829        // `find_one`+`insert_one` reported no effects.) Handle accessors (name/namespace)
1830        // and option/doc builders don't match these verbs, so they stay pure.
1831        //
1832        // THE FIX: `Client::with_options(options)` IS `with_uri_str`'s own body one call down —
1833        // `with_uri_str` (client.rs:179) is literally `ClientOptions::parse(uri).await?;
1834        // Client::with_options(options)`, and `with_options` (client.rs:188) is where the topology/
1835        // monitoring actually spins up. A caller who already holds a `ClientOptions` (built
1836        // programmatically, or via `ClientOptions::parse` called separately) uses `with_options`
1837        // directly — mongodb's OWN alternate entry point for the identical effect, missing from an
1838        // allowlist keyed only on the URI-string spelling. Same shape as `ignore::Walk::new` and
1839        // diesel's `establish`: a sibling constructor of an already-modelled effect. Verified against
1840        // mongodb 3.8.1 source for both the async (`client.rs`) and sync (`sync/client.rs`) `Client`.
1841        if crate_name == "mongodb" {
1842            const MONGO: [&str; 28] = [
1843                "::with_uri_str", "::with_options", "::connect", "::find", "::find_one", "::insert_one",
1844                "::insert_many", "::update_one", "::update_many", "::delete_one",
1845                "::delete_many", "::replace_one", "::aggregate", "::count_documents",
1846                "::estimated_document_count", "::count", "::distinct", "::run_command",
1847                "::find_one_and_update", "::find_one_and_delete", "::find_one_and_replace",
1848                "::list_collections", "::list_collection_names", "::list_databases",
1849                "::list_database_names", "::create_collection", "::create_index", "::watch",
1850            ];
1851            if MONGO.iter().any(|v| path.ends_with(v)) {
1852                return Some("Db");
1853            }
1854            // THE COVERAGE-GATE SWEEP (2026-08-27), verified against mongodb 3.8.1 — the client-side
1855            // field-level encryption (CSFLE) surface, entirely unrelated to the CRUD verb list above.
1856            //
1857            // `ClientEncryption::decrypt` (client/csfle/client_encryption.rs:195) is an ordinary `pub
1858            // async fn` that bottoms out in `CryptExecutor::run_ctx` (client/csfle/state_machine.rs:106),
1859            // a state-machine loop that — depending on state — runs a real `list_collections` query
1860            // against the key-vault database, executes a real command against `mongocryptd` (respawning
1861            // the child process if the connection drops), and fetches data keys from the key vault:
1862            // genuinely Net (and, via mongocryptd respawn, Exec), reached from a manual decrypt call, not
1863            // a guess. Suffix-matched because the real path runs through a re-export hop the ratchet's
1864            // crate-root-alias guess skips: `ClientEncryption` is defined inside `pub(crate) mod csfle;`
1865            // (client.rs:4) and reachable only via `pub use crate::client::csfle::client_encryption;` at
1866            // the crate root (lib.rs:74) — `mongodb::client_encryption::ClientEncryption`, not bare
1867            // `mongodb::ClientEncryption`. The name is specific enough within this crate that a suffix
1868            // match carries no fabrication risk (crate-gated, and `ClientEncryption` exists nowhere else
1869            // in mongodb's own source).
1870            if path.ends_with("ClientEncryption::decrypt") {
1871                return Some("Net");
1872            }
1873            // NOT modelled (removed from open.tsv, not guessed): `CreateDataKey::execute` /
1874            // `Encrypt::execute` — a DIFFERENT false-guess shape from every other row in this pass.
1875            // `CreateDataKey`/`Encrypt` (action/csfle/create_data_key.rs, action/csfle/encrypt.rs) are
1876            // the crate's real, publicly re-exported Action-builder types (`mongodb::action::csfle::
1877            // {CreateDataKey,Encrypt}`) — but the SAME effect self-scan found (the real `run_ctx` call)
1878            // lives in `impl Action for CreateDataKey<'a> { async fn execute(self) -> .. { .. } }`
1879            // (client/csfle/client_encryption/create_data_key.rs:14), which is the INPUT to the
1880            // `#[action_impl]` proc macro, not a real method: the `Action` trait (action.rs:104) declares
1881            // only `optional`, and its own doc comment says the crate's action types are "executed via
1882            // `await` (or `run` if using the sync client)" — the macro consumes this `execute` fn body
1883            // and re-emits it as `IntoFuture::into_future`, so no compiled `CreateDataKey`/`Encrypt`
1884            // value ever has a method literally named `execute` a consumer could call. Self-scan found a
1885            // real function performing a real effect; it is just never reachable under this spelling
1886            // (nor, by construction, under ANY spelling — a consumer's call site is `.await`, not a
1887            // `.execute()` method call, so candor-scan would need to resolve the `IntoFuture` desugaring
1888            // itself to see this at all, a different, deeper question than a classify() rule can answer).
1889            return None;
1890        }
1891        // mysql / mysql_async: the `query`/`exec` families + `get_conn`/`ping` execute
1892        // immediately — no build-then-execute split like sqlx, so matching `::query` is safe
1893        // here. Same DB-verb-dialect gap class as redis/mongodb; calibrated from the Queryable
1894        // API (unit-tested; a real-app repro is the remaining confirmation).
1895        //
1896        // THE FIX: `Conn::new(opts)` is each crate's OWN primary connection constructor — not a
1897        // pool helper like `get_conn`, but the raw handle. `mysql::Conn::new` (conn/mod.rs:342) calls
1898        // `conn.connect_stream()?; conn.connect()?` directly; `mysql_async::Conn::new` (conn/mod.rs:921)
1899        // returns a future that does the same handshake. Real connection establishment, same shape as
1900        // diesel's `establish`/rusqlite's `open*` — but `::new` never appeared in this verb list, so a
1901        // bare `Conn::new(opts)?` (the crate's OWN first doctest example) read pure. Scoped to the
1902        // `Conn::` segment specifically (`::new` alone is far too generic a suffix to key on blindly —
1903        // `Opts`/`Pool`/query-result types in the same two crates have their own pure `new`s).
1904        if matches!(crate_name, "mysql" | "mysql_async") {
1905            if path.ends_with("::Conn::new") {
1906                return Some("Db");
1907            }
1908            const MY: [&str; 16] = [
1909                "::query", "::query_first", "::query_iter", "::query_map", "::query_fold",
1910                "::query_drop", "::exec", "::exec_first", "::exec_iter", "::exec_map",
1911                "::exec_fold", "::exec_drop", "::exec_batch", "::prep", "::ping", "::get_conn",
1912            ];
1913            if MY.iter().any(|v| path.ends_with(v)) {
1914                return Some("Db");
1915            }
1916            // THE COVERAGE-GATE SWEEP (2026-08-27), verified against mysql_async 0.37.0:
1917            // `Conn::from_url` (conn/mod.rs:1059) is `Conn::new(Opts::from_str(url)?)` one hop down —
1918            // the crate's OWN alternate entry point for the identical connect effect `Conn::new` above
1919            // already carries, same shape as `ignore::Walk::new`/diesel's `establish`.
1920            // `WhiteListFsHandler::handle` (local_infile_handler/builtin.rs:58, the `GlobalHandler` impl
1921            // for `LOAD DATA LOCAL INFILE`) opens a real file off the caller-supplied whitelist —
1922            // reachable at the crate root (`pub use self::local_infile_handler::{builtin::
1923            // WhiteListFsHandler, ..}`, lib.rs:500).
1924            if path == "mysql_async::Conn::from_url" {
1925                return Some("Db");
1926            }
1927            if path.ends_with("WhiteListFsHandler::handle") {
1928                return Some("Fs");
1929            }
1930            // NOT modelled (all three removed from open.tsv, not guessed): `mysql::MyTcpBuilder::connect`/
1931            // `Stream::connect_tcp`/`Stream::make_secure` (mysql, not mysql_async — io/tcp.rs, io/mod.rs,
1932            // io/tls/native_tls_io.rs). `mod io;` is PRIVATE in mysql's lib.rs with no re-export of
1933            // `MyTcpBuilder`/`Stream`, so none of the three is a path any external consumer can name —
1934            // the crate's real, externally-reachable connect effect is `Conn::new` above (already
1935            // covered), which calls into this private `io` module internally. Also NOT modelled:
1936            // `mysql_async::PathOrBuf::read` (opts/mod.rs) — `PathOrBuf` is declared in the same private
1937            // `mod opts;` whose OTHER types (`Opts`, `OptsBuilder`, …) ARE individually `pub use`-
1938            // re-exported at the crate root (lib.rs:493) but `PathOrBuf` specifically is not, so it too
1939            // is unreachable — the same private-module shape as tempfile's `imp::` functions above.
1940            return None;
1941        }
1942        // sea_orm: an ORM whose execution is split from building (like sqlx). The query
1943        // BUILDERS (`Entity::find`, `Entity::insert`) are pure; execution happens at `.all`/
1944        // `.one`/`.count`/`.stream` and `Insert/Update/Delete::exec`. The write path via an
1945        // ActiveModel (`model.insert(db)`) executes too — distinguished from the `EntityTrait`
1946        // builder by the trait in the path (`ActiveModelTrait::`). (Found hardening on a
1947        // sea_orm consumer app: `.all(db)` reads and `ActiveModel::insert` writes were pure.)
1948        if crate_name == "sea_orm" {
1949            // sea_orm RE-EXPORTS sea_query (`sea_orm::sea_query::…`), whose builder algebra collides with
1950            // the execution verbs: `Func::count(col)` builds a COUNT() expr, `Condition::all()` AND-groups
1951            // filters, `Expr::count(…)` — all PURE, none touch a db. The `::all`/`::count`/`::one` execution
1952            // rule fabricated Db on them (sweep [5]). sea_query is pure query construction end-to-end, so
1953            // exclude the whole re-exported namespace first.
1954            if path.contains("sea_query") {
1955                return None;
1956            }
1957            if path.ends_with("::all")
1958                || path.ends_with("::one")
1959                || path.ends_with("::count")
1960                || path.ends_with("::stream")
1961                || path.ends_with("::exec")
1962                || path.ends_with("::exec_with_returning")
1963                || path.ends_with("::exec_without_returning")
1964                || path.ends_with("::connect")
1965                // `Database::connect_proxy` (database/mod.rs:139, behind the `proxy` feature) is
1966                // `Database::connect`'s sibling for a caller-supplied `ProxyDatabaseTrait` backend —
1967                // same effect (produces a live `DatabaseConnection`), different verb, missing from an
1968                // allowlist keyed on the plain `connect` spelling.
1969                || path.ends_with("::connect_proxy")
1970                || path.ends_with("::execute")
1971                || path.ends_with("::execute_unprepared")
1972                || path.ends_with("::query_one")
1973                || path.ends_with("::query_all")
1974                || path.ends_with("::fetch_page")
1975                || path.ends_with("::num_items")
1976                || path.contains("ActiveModelTrait::")
1977            {
1978                return Some("Db");
1979            }
1980            // THE COVERAGE-GATE SWEEP (2026-08-27): sea_orm's TRANSACTION and PAGINATION families,
1981            // verified against sea-orm 1.1.20 source — each of these was found effectful by self-scan
1982            // under no guessed spelling this allowlist already covered.
1983            //
1984            // `DatabaseConnection::transaction`/`transaction_with_config` (db_connection.rs:302,345, the
1985            // `TransactionTrait` impl) is the crate's documented callback-transaction API
1986            // (`db.transaction(|txn| ...)`) — every sqlx-backed match arm dispatches to the
1987            // `SqlxXxxPoolConnection::transaction` methods FQN-listed below, a real BEGIN. FQN-exact
1988            // (not a bare `::transaction` suffix) because `MockDatabaseConnection`/`ProxyDatabaseConnection`
1989            // (driver/mock.rs, driver/proxy.rs, both feature-gated) have their OWN `begin`/`commit`/
1990            // `rollback`/`ping`/`transaction` methods sharing every one of these verb names — a mock
1991            // backend performs no real I/O by construction, and a caller-supplied proxy is a callback
1992            // boundary, not a provable effect; a bare suffix would fabricate Db on both.
1993            if path == "sea_orm::DatabaseConnection::transaction"
1994                || path == "sea_orm::DatabaseConnection::transaction_with_config"
1995                // BONUS, found while proving the above reachable with a real consumer fixture (not in
1996                // the original coverage-gate ratchet — self-scan's own reachability pass didn't flag
1997                // these, apparently because it doesn't track an enum match arm's payload binding as a
1998                // typed receiver, but they dispatch through the identical match-on-`self` shape as
1999                // `transaction` two lines up): `DatabaseConnection::ping` (db_connection.rs:462) and the
2000                // `TransactionTrait::begin`/`begin_with_config` impl (db_connection.rs:246,268) — a fixture
2001                // proved `ping` silently read pure with no rule at all.
2002                || path == "sea_orm::DatabaseConnection::ping"
2003                || path == "sea_orm::DatabaseConnection::begin"
2004                || path == "sea_orm::DatabaseConnection::begin_with_config"
2005                // `DatabaseTransaction::commit`/`rollback` (transaction.rs:119,159) call
2006                // `<sqlx::X as sqlx::Database>::TransactionManager::commit`/`rollback` directly — real
2007                // COMMIT/ROLLBACK, not sea_orm's OWN `::begin`/`::run` (both `pub(crate)`, unreachable).
2008                || path == "sea_orm::DatabaseTransaction::commit"
2009                || path == "sea_orm::DatabaseTransaction::rollback"
2010                // The three sqlx-backed pool connections' OWN `begin`/`ping`/`transaction` (driver/
2011                // sqlx_{mysql,postgres,sqlite}.rs) — `begin`/`transaction` acquire a pool connection and
2012                // start a real transaction, `ping` round-trips `conn.ping()` to the server.
2013                || path == "sea_orm::SqlxMySqlPoolConnection::begin"
2014                || path == "sea_orm::SqlxMySqlPoolConnection::ping"
2015                || path == "sea_orm::SqlxMySqlPoolConnection::transaction"
2016                || path == "sea_orm::SqlxPostgresPoolConnection::begin"
2017                || path == "sea_orm::SqlxPostgresPoolConnection::ping"
2018                || path == "sea_orm::SqlxPostgresPoolConnection::transaction"
2019                || path == "sea_orm::SqlxSqlitePoolConnection::begin"
2020                || path == "sea_orm::SqlxSqlitePoolConnection::ping"
2021                || path == "sea_orm::SqlxSqlitePoolConnection::transaction"
2022                // `Paginator::fetch`/`fetch_and_next`/`into_stream`/`num_pages`/`num_items_and_pages`
2023                // (executor/paginator.rs) all transitively reach `fetch_page`/`num_items` — already-
2024                // covered verbs — but each is ALSO a documented entry point a real consumer calls
2025                // directly (`cake::Entity::find().paginate(db, 50).into_stream()`, the crate's own
2026                // pagination doc example) and needs its own rule for the same reason
2027                // `Connection::backup` needed one beside `Backup::new` in rusqlite.
2028                || path == "sea_orm::Paginator::fetch"
2029                || path == "sea_orm::Paginator::fetch_and_next"
2030                || path == "sea_orm::Paginator::into_stream"
2031                || path == "sea_orm::Paginator::num_pages"
2032                || path == "sea_orm::Paginator::num_items_and_pages"
2033                // `Insert`/`Inserter`/`TryInsert::exec_with_returning_keys`/`_many` (executor/insert.rs)
2034                // are sibling spellings of the already-covered `::exec_with_returning` (same shape as
2035                // rusqlite's `open_with_flags_and_vfs` beside `open_with_flags`): each calls through to
2036                // the same underlying `exec_with_returning_keys`/`_many` executor, a real INSERT.
2037                || path.ends_with("::exec_with_returning_keys")
2038                || path.ends_with("::exec_with_returning_many")
2039            {
2040                return Some("Db");
2041            }
2042            return None;
2043        }
2044        // (Reached by sqlx + diesel — the build-vs-execute-split crates.) `first` is diesel's
2045        // LIMIT-1 round trip and `load_iter` its 2.x streaming execution; `fetch_many` is sqlx's
2046        // multi-result stream. All crate-gated, so a std `Vec::first` never resolves here.
2047        //
2048        // `establish` is diesel's OWN name for `::connect` — `Connection::establish(url)`
2049        // (connection/mod.rs:243), implemented by opening the real backend handle in
2050        // `SqliteConnection`/`PgConnection`/`MysqlConnection::establish` (sqlite/connection/mod.rs:230,
2051        // pg/connection/mod.rs:176, mysql/connection/mod.rs:158 — each does the real file-open/socket-
2052        // connect). It is diesel's canonical, and by far most common, connection entry point — every
2053        // diesel quickstart opens with it — yet it shares no verb spelling with `::connect`, so it fell
2054        // through this allowlist to `None`, and because `diesel` IS a CALIBRATED_CRATES entry the miss
2055        // produced NO `coverage.uncovered` disclosure either (that ledger is crate-level: a calibrated
2056        // crate's unmatched path reads as reviewed-pure, not as a gap) — the same silent-purity shape as
2057        // `ignore::Walk::new` above, one call away from `establish_test_transaction`/`establish_inner`,
2058        // which are diesel's own private plumbing and stay unmatched (no `::` in the allowed suffix keeps
2059        // this exact-verb, not a substring match).
2060        const VERBS: [&str; 20] = [
2061            "::execute", "::query_row", "::query_map", "::query_one", "::fetch_one",
2062            "::fetch_all", "::fetch_optional", "::fetch", "::fetch_many", "::connect",
2063            "::acquire", "::begin", "::commit", "::rollback", "::load", "::load_iter",
2064            "::first", "::get_result", "::get_results", "::establish",
2065        ];
2066        if VERBS.iter().any(|v| path.ends_with(v)) {
2067            return Some("Db");
2068        }
2069        return None;
2070    }
2071    // std::path::Path / PathBuf STAT-family methods hit the filesystem (each is a stat/readlink/
2072    // readdir syscall) — unlike the rest of the std::path surface, which is pure string manipulation
2073    // (join/file_name/extension/parent/…). Verb-precise so the scanner's receiver inference can safely
2074    // route a `path.symlink_metadata()` method call here. (A blackout screen caught gix-dir — an entire
2075    // directory WALKER — reporting ZERO Fs because all its I/O is Path-method calls; same class as
2076    // fd's residual `Path::symlink_metadata` under-report.)
2077    if let Some(m) = path
2078        .strip_prefix("std::path::Path::")
2079        .or_else(|| path.strip_prefix("std::path::PathBuf::"))
2080    {
2081        const STAT: &[&str] = &[
2082            "metadata", "symlink_metadata", "canonicalize", "read_link", "read_dir", "exists",
2083            "try_exists", "is_file", "is_dir", "is_symlink",
2084        ];
2085        return STAT.contains(&m).then_some("Fs");
2086    }
2087    // OPTION-BUILDERS, the shape SPEC §1 ⟨0.32⟩ separates from an invocation object: "option-builders for
2088    // other effects (`OpenOptions`, request builders) stay pure because their resource arrives at the
2089    // terminal verb, which is charged at its own call site". An `OpenOptions` holds a handful of bools and
2090    // names no file; `DirBuilder` holds one bool and a mode. Both sit under the coarse `std::fs::` prefix
2091    // below, which charged Fs for `OpenOptions::new()` and for every `o.read(true)` — MEASURED: a
2092    // `let o = OpenOptions::new().read(true);` with no `open` ANYWHERE reported `Fs`.
2093    //
2094    // A DENYLIST, and keyed on the TYPE. Only the provably-pure setters/ctors are subtracted; anything
2095    // else under the type keeps its effect, so the terminal verb (`OpenOptions::open`, `DirBuilder::create`)
2096    // stays Fs and a std addition we have not read about fails in the safe direction. The type key is not
2097    // decoration: `create` is a pure flag SETTER on `OpenOptions` and the mkdir SYSCALL on `DirBuilder` —
2098    // one leaf, opposite answers. (candor-java keys the same carve-out by DESCRIPTOR, because its collision
2099    // is an overload — `command()` reads back, `command(List)` sets. Rust has no overloads, so the type IS
2100    // the discriminator; a bare-name denylist would silence `DirBuilder::create`.)
2101    if let Some(m) = path.strip_prefix("std::fs::OpenOptions::") {
2102        const PURE: &[&str] = &[
2103            // the builder itself + the std flag setters
2104            "new", "read", "write", "append", "truncate", "create", "create_new",
2105            // the platform extension setters (`OpenOptionsExt`, unix + windows)
2106            "mode", "custom_flags", "security_qos_flags", "access_mode", "share_mode", "attributes",
2107            // derives
2108            "clone", "default", "fmt", "eq", "ne", "hash",
2109        ];
2110        return (!PURE.contains(&m)).then_some("Fs");
2111    }
2112    if let Some(m) = path.strip_prefix("std::fs::DirBuilder::") {
2113        const PURE: &[&str] = &["new", "recursive", "mode", "clone", "default", "fmt"];
2114        return (!PURE.contains(&m)).then_some("Fs");
2115    }
2116    // THE PLATFORM `fs` MODULES — `std::os::{unix,windows,wasi}::fs`. Measured 2026-09-02, ground truth
2117    // EXECUTED (a `cargo run` that really created a symlink on disk and then stat'd it back):
2118    // `std::os::unix::fs::symlink`, `chown`, `lchown` and `chroot` all read PURE, so `deny Fs` over a
2119    // crate whose only filesystem write is a symlink exited 0. The `std::fs::` prefix below is the whole
2120    // filesystem rule and these modules are simply not under it — the platform-specific half of std's
2121    // filesystem API had no rule at all. (Found tracing why `tokio::fs::symlink` carries no `Fs` of its
2122    // own; its body is `asyncify(move || std::os::unix::fs::symlink(..))`.)
2123    //
2124    // A DENYLIST keyed on the TRAIT, exactly like `OpenOptions`/`DirBuilder` above and for the same
2125    // reason: subtract only the provably-pure surfaces, so a std addition nobody here has read about
2126    // fails in the SAFE direction. What is subtracted, and why each is pure:
2127    //   * `MetadataExt` / `DirEntryExt` / `FileTypeExt` — accessors over data ALREADY fetched by the
2128    //     `metadata()`/`read_dir()` call that is charged at its own site. `m.uid()` issues no syscall.
2129    //   * `PermissionsExt` — reads/sets bits on an in-memory `Permissions`; the syscall is
2130    //     `set_permissions`, charged under `std::fs::`.
2131    //   * `OpenOptionsExt` / `DirBuilderExt` — SPEC §1 ⟨0.32⟩ option-builders: the resource arrives at
2132    //     the terminal verb (`open`/`create`), which is charged at its own call site.
2133    // `FileExt` is deliberately NOT subtracted — `read_at`/`write_at`/`seek_read`/`seek_write` are the
2134    // positional-I/O syscalls and are exactly what this rule must keep.
2135    if let Some(rest) = path
2136        .strip_prefix("std::os::unix::fs::")
2137        .or_else(|| path.strip_prefix("std::os::windows::fs::"))
2138        .or_else(|| path.strip_prefix("std::os::wasi::fs::"))
2139    {
2140        const PURE_TRAITS: &[&str] = &[
2141            "MetadataExt::", "DirEntryExt::", "DirEntryExt2::", "FileTypeExt::",
2142            "PermissionsExt::", "OpenOptionsExt::", "DirBuilderExt::",
2143        ];
2144        return (!PURE_TRAITS.iter().any(|t| rest.starts_with(t))).then_some("Fs");
2145    }
2146    // THE PLATFORM `process` MODULES — `std::os::{unix,windows,wasi}::process`. SOUNDNESS R141, the
2147    // EXACT SIBLING of the `fs` rule above, and unruled for the same reason it was: R130 closed
2148    // `std::os::*::fs` and translated that question across ENGINES while never translating it across
2149    // SIBLING MODULES of the namespace it had just found unruled.
2150    //
2151    // Ground truth EXECUTED when the row was filed: a consumer printed `before`, then
2152    // `EXECED-THROUGH-LIB`, and never reached the following line — `CommandExt::exec` is `execvp` and
2153    // really does replace the process image. Re-measured at HEAD 2026-09-27 on a 5-function fixture:
2154    // `CommandExt::exec(c)`, `std::os::unix::process::CommandExt::exec(c)` and
2155    // `fn f<C: CommandExt>(c: &mut C) { c.exec() }` were all ABSENT from `functions[]` — no `Unknown`,
2156    // no `unresolved` — and `deny Exec`, `pure` and `deny Exec Unknown` all exited 0, while on the SAME
2157    // tree the RECEIVER spelling `c.exec()` exited 1 and the sibling-namespace UFCS control
2158    // `FileExt::read_at(f, b, 0)` exited 1. So this is the one-spelling-of-two shape of R130 itself:
2159    // `c.exec()` was only ever charged because the receiver types to `std::process::Command` and the
2160    // whole-type rule below answers; nothing answered for the trait-path spelling.
2161    //
2162    // A DENYLIST keyed on the TRAIT, exactly like the `fs` rule and for the same reason — subtract only
2163    // the provably-pure surfaces so a std addition nobody here has read about fails in the SAFE
2164    // direction. What is subtracted, and why each is pure:
2165    //   * `ExitStatusExt` / `ExitStatusError` / `ExitCodeExt` — accessors and constructors over an
2166    //     ALREADY-COLLECTED status (`signal()`, `core_dumped()`, `from_raw(n)`). The wait that produced
2167    //     it is charged at its own site under `std::process::Child`.
2168    //   * `parent_id` — `getppid()`, a read of this process's own identity, no spawn. Kept at PARITY
2169    //     with `std::process::id`, which carries no rule either; subtracting it here rather than
2170    //     leaving it to the Exec cliff is the one place this rule departs from "unrecognised keeps
2171    //     Exec", and it is named rather than folded in.
2172    // Everything else keeps Exec: `CommandExt::{exec, pre_exec, arg0, uid, gid, groups,
2173    // process_group}` and the windows `CommandExt::{creation_flags, raw_arg, …}` / `ChildExt`. That is
2174    // also what the receiver spelling already answers — `c.uid(0)` reports `['Exec']` at HEAD — so this
2175    // rule makes the two spellings agree rather than inventing a new verdict for either.
2176    if let Some(rest) = path
2177        .strip_prefix("std::os::unix::process::")
2178        .or_else(|| path.strip_prefix("std::os::windows::process::"))
2179        .or_else(|| path.strip_prefix("std::os::wasi::process::"))
2180    {
2181        const PURE: &[&str] =
2182            &["ExitStatusExt::", "ExitStatusError::", "ExitCodeExt::", "parent_id"];
2183        return (!PURE.iter().any(|t| rest.starts_with(t))).then_some("Exec");
2184    }
2185    // Filesystem. `tokio::fs`/`async_std::fs` are the async mirrors of `std::fs`; `async_fs` is
2186    // smol's fs crate; `fs_err` is a drop-in `std::fs` wrapper (its whole surface is fs I/O).
2187    if path.starts_with("std::fs::")
2188        || path.starts_with("tokio::fs::")
2189        || path.starts_with("async_std::fs::")
2190        || crate_name == "async_fs"
2191        || crate_name == "fs_err"
2192    {
2193        return Some("Fs");
2194    }
2195    // memmap2: only `MmapOptions::map*` (and the in-place `Mmap::flush`/`make_*` protection
2196    // changes / `remap`) actually issue the mmap/msync/mprotect/mremap syscall = Fs. The rest of the
2197    // crate is PURE: `MmapOptions::new`/setters BUILD the request, and once a region is mapped, reads
2198    // over it (`Mmap::len`/`is_empty`/`as_ptr`/`as_mut_ptr`/`deref` into the byte slice) are plain
2199    // memory access with no syscall. Whole-crate Fs fabricated Fs on those reads (a `m.len()` the
2200    // scanner's receiver inference routes to `memmap2::Mmap::len`). Match the syscall-issuing verbs;
2201    // everything else returns None (pure). `map*` covers `map`/`map_mut`/`map_exec`/`map_copy`/
2202    // `map_copy_read_only`/`map_raw`/`map_raw_read_only`/`map_anon`.
2203    if crate_name == "memmap2" {
2204        let m = path.rsplit("::").next().unwrap_or(path);
2205        if m.starts_with("map")
2206            || m == "flush"
2207            || m == "flush_async"
2208            || m == "flush_range"
2209            || m == "flush_async_range"
2210            || m == "remap"
2211            || m.starts_with("make_")
2212            || m == "advise"
2213            || m == "advise_range"
2214            || m == "lock"
2215            || m == "unlock"
2216        {
2217            return Some("Fs");
2218        }
2219        return None;
2220    }
2221    // tempfile: creating a temp file/dir touches the disk. Match the create/persist verbs (the
2222    // `Builder` setters — prefix/suffix/rand_bytes — stay pure). `persist`/`keep` rename/retain
2223    // the file on disk; `close` removes it.
2224    if crate_name == "tempfile"
2225        && (path.ends_with("::tempfile")
2226            || path.ends_with("::tempfile_in")
2227            || path.ends_with("::tempdir")
2228            || path.ends_with("::tempdir_in")
2229            || path.ends_with("NamedTempFile::new")
2230            || path.ends_with("NamedTempFile::new_in")
2231            || path.ends_with("TempDir::new")
2232            || path.ends_with("TempDir::new_in")
2233            || path.ends_with("::persist")
2234            || path.ends_with("::persist_noclobber")
2235            || path.ends_with("::keep"))
2236    {
2237        return Some("Fs");
2238    }
2239    // THE COVERAGE-GATE SWEEP (2026-08-27), verified against tempfile 3.27.0 source — the SIBLING
2240    // constructors/closers the create/persist verb list above never reached:
2241    //
2242    // `Builder::make`/`make_in` (lib.rs:716,739) are the crate's OWN documented escape hatch for a
2243    // caller-supplied factory (`Builder::new().make_in(dir, |path| UnixListener::bind(path))`) — real
2244    // disk creation via `util::create_helper`, same mechanism as `Builder::tempfile`/`tempfile_in`
2245    // two lines up, just a different entry verb.
2246    // `NamedTempFile::with_prefix`/`with_prefix_in`/`with_suffix`/`with_suffix_in` (file/mod.rs:630-677)
2247    // are one-call convenience wrappers documented as equivalent to `Builder::new().prefix(..).tempfile()`
2248    // — real creation, missing because the verb list matched `NamedTempFile::new`/`new_in` but not these.
2249    // `NamedTempFile::reopen` (file/mod.rs:951) calls the platform `imp::reopen`, a real `open`/`fstat`
2250    // pair (found the original file was replaced, or hands back a fresh handle to it).
2251    // `TempPath::close` (file/mod.rs:161) and `TempDir::close` (dir/mod.rs:470) `fs::remove_file`/
2252    // `remove_dir_all` the real path — `NamedTempFile::close` (file/mod.rs:727) is a thin `self.path.close()`
2253    // delegate to the same `TempPath::close`, so matching the `::close` suffix (crate-gated, and the ONLY
2254    // three `pub fn close` in this crate) catches it too without a separate rule.
2255    // `SpooledTempFile::set_len` (spooled.rs:134) calls `File::set_len` on the real disk file once the
2256    // in-memory buffer has spilled past `max_size` — the crate's own roll-over threshold, not a corner case.
2257    //
2258    // NOT included: `tempfile::create`/`create_named`/`reopen` (dir/imp/any.rs, file/imp/windows.rs,
2259    // file/imp/unix.rs) — despite being `pub fn`, `mod dir;`/`mod file;` are PRIVATE at the crate root
2260    // (lib.rs:202,204) with no re-export of the `imp` submodules, so no external consumer can ever name
2261    // these paths; the ratchet's generator guesses a crate-root alias for every candidate regardless of
2262    // whether one is real (the same "second, related shape" gap the previous pass's rusqlite/lettre
2263    // private-module findings already documented — restricted_types()/is_bare_pub check a type's or fn's
2264    // OWN visibility keyword, not its enclosing module chain). Removed from open.tsv rather than guessed.
2265    if crate_name == "tempfile"
2266        && (path == "tempfile::Builder::make"
2267            || path == "tempfile::Builder::make_in"
2268            || path == "tempfile::NamedTempFile::with_prefix"
2269            || path == "tempfile::NamedTempFile::with_prefix_in"
2270            || path == "tempfile::NamedTempFile::with_suffix"
2271            || path == "tempfile::NamedTempFile::with_suffix_in"
2272            || path == "tempfile::NamedTempFile::reopen"
2273            || path == "tempfile::SpooledTempFile::set_len"
2274            || path.ends_with("::close"))
2275    {
2276        return Some("Fs");
2277    }
2278    // glob: walks the filesystem to expand a pattern (the returned iterator reads directories).
2279    // `Pattern::matches` is pure string matching — match only the directory-walking entry points.
2280    if crate_name == "glob" && (path.ends_with("::glob") || path.ends_with("::glob_with")) {
2281        return Some("Fs");
2282    }
2283    // Password-hashing / KDF crates — the entropy tier (the TS engine's CTA lesson: an invisible
2284    // argon2 landed on exactly the call a security review cares about). In this engine's
2285    // verb-precise style the ENTROPY is the salt mint: `SaltString::generate(OsRng)` in the
2286    // password-hash API family, and bcrypt's `hash`/`hash_with_result` (salt minted internally).
2287    // Verification and explicit-salt hashing are deterministic recomputation — pure. `rand_core`
2288    // carries the OsRng source itself (otherwise the most common salt mint is invisible).
2289    if matches!(crate_name, "argon2" | "scrypt" | "pbkdf2" | "password_hash") {
2290        // SOUNDNESS R318 — `SaltString::generate` was this block's ONLY match target and the type was
2291        // DELETED upstream in password-hash 0.6.0 (0.5.0: 21 occurrences; 0.6.1: zero). Everything below
2292        // it fell through to `return None`, so all four crates asserted purity — including on
2293        // `argon2.hash_password(password)`, the one-argument DEFAULT TRAIT METHOD at
2294        // `password-hash-0.6.1/src/lib.rs:107` whose body is `let salt = try_generate_salt()?;`. That is
2295        // the most documented call shape in the family, minting OS entropy, reading pure, on crates whose
2296        // entire purpose is a security review.
2297        //
2298        // `ends_with`, NOT `contains`: `hash_password_with_salt` takes an explicit salt and is
2299        // deterministic recomputation — correctly PURE — and a `contains` match would fabricate `Rand`
2300        // on it. `hash_password_with_rng` DOES draw, from the caller's RNG, so it is charged.
2301        // The old `SaltString::generate` clause is kept: it is still the right answer for 0.5.x.
2302        if path.contains("SaltString::generate")
2303            || path.ends_with("::generate_salt")
2304            || path.ends_with("::try_generate_salt")
2305            // SOUNDNESS R330 — this suffix is a DEFAULT, refined by arity at the call site. `hash_password`
2306            // is one name with two signatures (see `password_hash_explicit_salt` below), and the path
2307            // cannot tell them apart. Charging here and NARROWING there is deliberate: a consumer that
2308            // never consults the refinement keeps the over-report, never the silence.
2309            || path.ends_with("::hash_password")
2310            || path.ends_with("::hash_password_with_rng")
2311        {
2312            return Some("Rand");
2313        }
2314        return None;
2315    }
2316    if crate_name == "bcrypt" {
2317        // SOUNDNESS R319 — this list was EXACTLY bcrypt's internal-salt surface at 0.15.1 and fell
2318        // behind by ADDITION, not by rename: 0.19.3 adds four more verbs that each document "the salt
2319        // is generated randomly using the OS randomness" and reach `getrandom::fill`. A stale-PATH
2320        // check could never have found this, because every old path still exists and still works —
2321        // a version ceiling catches additions, a path check only catches removals.
2322        // The explicit-salt family (`hash_with_salt`, `hash_with_salt_bytes`,
2323        // `non_truncating_hash_with_salt*`) stays PURE: the caller supplies the salt.
2324        if path.ends_with("::hash")
2325            || path.ends_with("::hash_with_result")
2326            || path.ends_with("::non_truncating_hash")
2327            || path.ends_with("::hash_bytes")
2328            || path.ends_with("::non_truncating_hash_bytes")
2329            || path.ends_with("::non_truncating_hash_with_result")
2330        {
2331            return Some("Rand");
2332        }
2333        return None;
2334    }
2335    if crate_name == "rand_core" {
2336        if path.contains("OsRng")
2337            || path.ends_with("::next_u32")
2338            || path.ends_with("::next_u64")
2339            || path.ends_with("::fill_bytes")
2340            // SOUNDNESS R333 — the FALLIBLE trait. rand_core 0.10 splits `RngCore` from `TryRngCore`,
2341            // and `SysRng` (the renamed `OsRng`) is fallible, so `try_next_u32` is the natural API on
2342            // it. `ends_with("::next_u32")` does NOT match `::try_next_u32`, so the modern spelling of
2343            // a real entropy draw read PURE. Third instance in one day, after R319 and R321, of the
2344            // same shape: an upstream rename is rarely just a rename — it arrives with an API SHAPE
2345            // change, and a suffix list written against the old shape stops covering the new one.
2346            || path.ends_with("::try_next_u32")
2347            || path.ends_with("::try_next_u64")
2348            || path.ends_with("::try_fill_bytes")
2349        {
2350            return Some("Rand");
2351        }
2352        return None;
2353    }
2354    // Randomness / entropy. `getrandom`/`fastrand` are effectful end-to-end. `rand` is NOT — it
2355    // mixes entropy/generation (effectful) with *pure* distribution constructors (`Uniform::new`,
2356    // `Normal::new`) and deterministic-seed constructors (`seed_from_u64`). Flagging the whole crate
2357    // over-reported those as `Rand`; match only the calls that actually consume randomness — the
2358    // entropy sources (`OsRng`, `thread_rng`/`rng`, `from_entropy`/`from_os_rng`) and the generation
2359    // verbs (`gen*`/`random*`/`fill*`/`sample*`/`next_u*`). A `Uniform::new` is now correctly pure.
2360    if crate_name == "getrandom" {
2361        // SOUNDNESS R1150 — …except its ERROR VALUE. `getrandom::Error` is a wrapped error code; its own methods
2362        // (`raw_os_error`, `code`, `new_custom`, the derived `eq`/`hash`, `Debug`/`Display`) read or format that
2363        // code and draw nothing. Charged with the crate, rand_core 0.9.x's DERIVED `OsError::eq` read `Rand`
2364        // (EXECUTED: no draw happens). Every drawing entry point (`fill`, `fill_uninit`, `u32`, `u64`,
2365        // `getrandom`, `SysRng`'s methods) is not on `Error`, and keeps `Rand`.
2366        // `&Error` is the by-reference operator key (`getrandom::&Error::eq`, R1131).
2367        if path.split("::").skip(1).any(|s| s.trim_start_matches('&') == "Error") {
2368            return None;
2369        }
2370        return Some("Rand");
2371    }
2372    // fastrand: like `rand`, it mixes entropy-consuming generation (effectful) with PURE deterministic
2373    // pieces. `Rng::with_seed(42)` is a DETERMINISTIC seeded constructor (consumes no entropy — the same
2374    // seed gives the same stream), and `Rng::fork`/`Rng::clone` just split/copy existing state. Those are
2375    // PURE; whole-crate Rand fabricated Rand on them. The effect is the value-drawing methods (`u32`/
2376    // `usize`/`bool`/`f64`/`char`/`alphanumeric`/`choice`/`choose_multiple`/`shuffle`/`fill`/the range
2377    // forms) AND the entropy-seeded entry points: bare `Rng::new()` (seeds from the global entropy-backed
2378    // generator), `fastrand::seed`, and the top-level `fastrand::u32(..)` free functions (which draw from
2379    // the thread-local generator). `with_seed` is exempted explicitly; any other method on an `Rng`
2380    // (i.e. a value draw) is Rand.
2381    if crate_name == "fastrand" {
2382        let m = path.rsplit("::").next().unwrap_or(path);
2383        // Provably pure: deterministic seeded ctor + state split/copy.
2384        if m == "with_seed" || m == "fork" || m == "clone" {
2385            return None;
2386        }
2387        // Everything else fastrand exposes either draws a value or seeds from entropy → Rand. (The crate
2388        // has no pure data types beyond the `Rng` handle itself, so a non-draw stray would have to be a
2389        // method we don't recognise — keep the effect, the safe direction.)
2390        return Some("Rand");
2391    }
2392    if crate_name == "rand" {
2393        let rng_verb = path.ends_with("::gen")
2394            || path.ends_with("::gen_range")
2395            || path.ends_with("::gen_bool")
2396            || path.ends_with("::gen_ratio")
2397            || path.ends_with("::random")
2398            || path.ends_with("::random_range")
2399            || path.ends_with("::random_bool")
2400            || path.ends_with("::random_ratio")
2401            || path.ends_with("::random_iter") // rand 0.9 iterator generator
2402            || path.ends_with("::gen_iter")
2403            || path.ends_with("::fill")
2404            || path.ends_with("::fill_bytes")
2405            || path.ends_with("::try_fill")
2406            || path.ends_with("::try_fill_bytes")
2407            || path.ends_with("::sample")
2408            || path.ends_with("::sample_iter")
2409            || path.ends_with("::next_u32")
2410            || path.ends_with("::next_u64")
2411            // SOUNDNESS R333 — the FALLIBLE trait, in the `rand` block as well as `rand_core`'s. Two
2412            // verb lists answer one question ("is this a draw?") and only one had been widened, which
2413            // is why the first half of this fix moved nothing: correct code on a path the call does not
2414            // take. `TryRngCore`'s verbs are the natural API on the fallible `SysRng`.
2415            || path.ends_with("::try_next_u32")
2416            || path.ends_with("::try_next_u64")
2417            || path.ends_with("::thread_rng")
2418            || path.ends_with("::rng")
2419            || path.ends_with("::from_entropy")
2420            || path.ends_with("::from_os_rng");
2421        // `OsRng` is the OS entropy SOURCE, but `clone`/`fork`/`default` just copy or construct the
2422        // (zero-sized) handle and draw no entropy — pure, exactly like the `fastrand` arm's clone/fork
2423        // exemption above. The actual draws (`fill_bytes`/`next_u*`/…) are caught by `rng_verb`. Without
2424        // this exemption the blanket `contains("OsRng")` fabricated `Rand` on `OsRng::clone` (adversarial
2425        // review: OsRng is a unit struct, cloning consumes nothing).
2426        let m = path.rsplit("::").next().unwrap_or(path);
2427        let os_rng = path.contains("OsRng") && !matches!(m, "clone" | "fork" | "default");
2428        // SOUNDNESS R320 — …and the SAME clause for the type's CURRENT NAME. rand 0.10 renamed the OS
2429        // entropy source to `SysRng` and moved it to `getrandom`, re-exporting it as
2430        // `rand::rngs::SysRng` (`rand-0.10.2/src/rngs/mod.rs:119`). Measured, not assumed: candor
2431        // resolves the crate from the path the CONSUMER writes, so `rand::rngs::SysRng` arrives with
2432        // crate_name `rand` and lands here — NOT in getrandom's whole-crate exemption, which is what
2433        // R320 left open. The asymmetry that leaves was executed on a fixture: with `OsRng` as the
2434        // receiver an unrecognised verb charges `Rand` (the `contains` clause is the safety margin over
2435        // the verb list); with `SysRng` it read PURE. So the margin protected the DELETED spelling and
2436        // not its replacement, which is the wrong way round for a type whose only purpose is to draw
2437        // from the OS. Same construction exemption for the same reason — `SysRng` is a unit struct
2438        // (`getrandom-0.4.3/src/sys_rng.rs:34`), so copying the handle consumes nothing.
2439        let sys_rng = path.contains("SysRng") && !matches!(m, "clone" | "fork" | "default");
2440        // §E1 HIT COUNTER (`CANDOR_ALIAS_DEBUG`), for `bin/corpus-ab.py --mark`: a widened charge that
2441        // moves no rows is either inert or unreached, and those two print identically.
2442        if sys_rng && std::env::var("CANDOR_ALIAS_DEBUG").is_ok() {
2443            eprintln!("R320SYSRNG {path}");
2444        }
2445        if rng_verb || os_rng || sys_rng {
2446            return Some("Rand");
2447        }
2448        return None;
2449    }
2450    // Subprocess spawning. `tokio::process` is the async mirror of `std::process` — it exists
2451    // only to spawn/control subprocesses (`Command`/`Child`, no pure data types like std's
2452    // `Stdio`/`ExitStatus`/`exit`), so spawning through it is Exec just the same. Without this an
2453    // async app's `tokio::process::Command::new(..).spawn()` classified pure — a silent under-report
2454    // of subprocess execution, the dangerous direction (mirrors the tokio::fs/tokio::net coverage).
2455    if path.starts_with("std::process::Command")
2456        || path.starts_with("std::process::Child")
2457        || path.starts_with("tokio::process::Command")
2458        || path.starts_with("tokio::process::Child")
2459        || path.starts_with("async_std::process::Command")
2460        || path.starts_with("async_std::process::Child")
2461    {
2462        // PURE read-backs of the builder's stored fields / the cached pid — no spawn, no syscall — so the
2463        // whole-type Exec rule fabricated Exec on them (sweep [23]; mirrors the portable_pty getter carve-
2464        // out just below). get_program/get_args/get_envs/get_current_dir read the Command; Child::id reads
2465        // the cached pid. Every genuine verb (new/spawn/output/status/wait/kill) stays Exec.
2466        if path.ends_with("::get_program")
2467            || path.ends_with("::get_args")
2468            || path.ends_with("::get_envs")
2469            || path.ends_with("::get_current_dir")
2470            || path.ends_with("Child::id")
2471        {
2472            return None;
2473        }
2474        return Some("Exec");
2475    }
2476    // portable_pty / async_process are whole-crate Exec EXCEPT for the proven-pure surface they expose:
2477    // the `CommandBuilder` GETTERS (`get_argv`/`get_cwd`/`get_env`/`as_unix_command_line`…) read back
2478    // configuration, and the PURE DATA types (`PtySize::default`, `ExitStatus`/`Stdio`/`CommandBuilder`
2479    // construction/setters). The earlier `is_cmd_naming_method` fix stopped the head-refinement LEAK, but
2480    // the BASE Exec still fabricated on these accessors (a `cmd.get_cwd()` the scanner routes to
2481    // `portable_pty::CommandBuilder::get_cwd`). Subtract the read-back getters and the obvious pure
2482    // ctors/setters; the spawn/wait/exec surface (`spawn_command`/`openpty`/`wait`/`kill`/`exec`…) keeps
2483    // Exec. SUBTRACT only what is provably pure — when unrecognised, KEEP Exec (the safe direction).
2484    if crate_name == "async_process" || crate_name == "portable_pty" {
2485        let m = path.rsplit("::").next().unwrap_or(path);
2486        // THE COVERAGE-GATE SWEEP (2026-08-27): `CommandBuilder::get_shell` (cmdbuilder.rs:544, unix)
2487        // LOOKS like a config read-back getter — same `get_` naming as the pure getters below — but its
2488        // unix body calls `nix::unistd::access(shell, X_OK)`, a real filesystem-access syscall, before
2489        // falling back to a password-database lookup if `$SHELL` isn't set or isn't executable. Carved
2490        // out of the `get_` prefix exemption BEFORE it, not folded into it — the one getter this crate
2491        // exposes that is not actually pure. Verified against portable-pty 0.9.0.
2492        if m == "get_shell" {
2493            return Some("Fs");
2494        }
2495        // configuration read-back getters — pure (no spawn).
2496        if m.starts_with("get_") || m == "as_unix_command_line" {
2497            return None;
2498        }
2499        // pure data-type ctors/setters/derives that NAME no program and spawn nothing.
2500        if matches!(
2501            m,
2502            "default" | "new" | "piped" | "null" | "inherit" | "from_raw_fd"
2503                | "arg" | "args" | "arg0" | "env" | "envs" | "env_clear" | "env_remove"
2504                | "cwd" | "current_dir" | "rows" | "cols"
2505                | "clone" | "fmt" | "eq" | "ne" | "hash"
2506        ) {
2507            return None;
2508        }
2509        return Some("Exec");
2510    }
2511    // duct: a subprocess-orchestration crate. `cmd()`/`cmd!` only *build* an Expression; the
2512    // spawn/wait happens at `run`/`read`/`start`. Match the execution verbs, not the builder.
2513    if crate_name == "duct"
2514        && (path.ends_with("::run")
2515            || path.ends_with("::read")
2516            || path.ends_with("::start")
2517            || path.ends_with("::read_chars")
2518            // `Expression::reader` (lib.rs:357) calls the already-covered `.start()` internally to
2519            // launch the child and hands back a streaming `ReaderHandle` — a distinct public entry
2520            // point from `start` itself, so the suffix match above never reached it.
2521            || path.ends_with("Expression::reader"))
2522    {
2523        return Some("Exec");
2524    }
2525    if path.starts_with("std::env::") {
2526        return Some("Env");
2527    }
2528    // dotenvy / dotenv: load environment variables (reading a `.env` file and mutating the process
2529    // environment). Match the load/read entry points; `Error`/builder types stay pure.
2530    if matches!(crate_name, "dotenvy" | "dotenv")
2531        && (path.ends_with("::dotenv")
2532            || path.ends_with("::dotenv_override")
2533            || path.ends_with("::from_path")
2534            || path.ends_with("::from_path_override")
2535            || path.ends_with("::from_filename")
2536            || path.ends_with("::from_filename_override")
2537            || path.ends_with("::from_read")
2538            || path.ends_with("::from_read_override")
2539            || path.ends_with("::load")
2540            || path.ends_with("::var")
2541            || path.ends_with("::vars"))
2542    {
2543        return Some("Env");
2544    }
2545    // THE COVERAGE-GATE SWEEP (2026-08-27), verified against dotenv 0.15.0 and dotenvy 0.15.7
2546    // (byte-identical shape in both crates) — the ITERATOR-returning siblings of the load verbs above,
2547    // which return the parsed pairs instead of mutating the environment but still touch disk to get
2548    // them: `dotenv_iter`/`from_filename_iter` (lib.rs) resolve and open a `.env`-shaped file exactly
2549    // like `dotenv`/`from_filename` two lines up (same `Finder::new().find()` call); `from_path_iter`
2550    // opens the given path directly. Bucketed `Env` for consistency with the rest of this family rather
2551    // than `Fs` (self-scan's raw signal): the crate's OWN purpose is env-var loading, and splitting the
2552    // iterator variants into a different effect bucket from their non-iterator siblings would be an
2553    // arbitrary distinction a reviewer gains nothing from.
2554    //
2555    // NOT included: `Finder::find` / the free fn `find` (find.rs) — both are used only via a PRIVATE
2556    // `use crate::find::Finder;` (no `pub use`) inside a private `mod find;` (lib.rs), so neither
2557    // `dotenv(y)::Finder` nor `dotenv(y)::find` is a path any external consumer can compile a call to;
2558    // the ratchet's generator still guesses a crate-root alias for every candidate (the same private-
2559    // module shape as tempfile's `imp::` functions above). Removed from open.tsv rather than guessed.
2560    if matches!(crate_name, "dotenvy" | "dotenv")
2561        && (path.ends_with("::dotenv_iter")
2562            || path.ends_with("::from_filename_iter")
2563            || path.ends_with("::from_path_iter"))
2564    {
2565        return Some("Env");
2566    }
2567    // Wall-clock reads. Match the `now` accessor precisely (ends_with), not any path
2568    // containing the substring "now". The `time` crate (distinct from `std::time`/`chrono`)
2569    // reads the clock via `now_utc`/`now_local` (and the deprecated `Instant::now`).
2570    if (crate_name == "chrono" || path.starts_with("std::time::")) && path.ends_with("::now") {
2571        return Some("Clock");
2572    }
2573    if crate_name == "time"
2574        && (path.ends_with("::now_utc") || path.ends_with("::now_local") || path.ends_with("::now"))
2575    {
2576        return Some("Clock");
2577    }
2578    // `tracing`: same principle as the `log` facade below — the crate's TYPES are pure data, so match
2579    // the emit, not the whole crate. The actual program output is the macro-expanded
2580    // `Subscriber::event`/`event!`/`Span::*enter*` dispatch and the `Span::new*`/`Span::record`
2581    // recording path that drives the subscriber. The data-type accessors — `Level::as_str`,
2582    // `Span::is_disabled`/`metadata`/`id`, and constructing/reading `Level`/`LevelFilter`/`Span`/
2583    // `Event`/`Metadata`/`Field`/`FieldSet`/`Id` — are PURE (no output is produced), so whole-crate Log
2584    // fabricated Log on them. Match the emit verbs; everything else returns None.
2585    if crate_name == "tracing" {
2586        let m = path.rsplit("::").next().unwrap_or(path);
2587        // The user-facing emit MACROS (`tracing::info!`/`warn!`/…) — candor-scan is pre-expansion, so it
2588        // sees the raw macro path `tracing::info`, not the expanded `__tracing`/`Subscriber::event` the
2589        // deep (post-expansion) engine sees. Only the macro names; the pure DATA types (Level/Span/Event)
2590        // have other tails and stay None.
2591        if m == "trace" || m == "debug" || m == "info" || m == "warn" || m == "error"
2592            || m == "trace_span" || m == "debug_span" || m == "info_span" || m == "warn_span"
2593            || m == "error_span" || m == "span"
2594            || m == "event"
2595            || m == "new_span"
2596            || m == "record"
2597            || m == "record_follows_from"
2598            || m == "enter"
2599            || m == "exit"
2600            || m == "in_scope"
2601            || m == "entered"
2602            || path.contains("::__macro_support")
2603            || path.contains("::__tracing")
2604            || path.contains("Subscriber::event")
2605            || path.contains("Subscriber::new_span")
2606            || path.contains("Subscriber::enter")
2607            || path.contains("Subscriber::exit")
2608        {
2609            return Some("Log");
2610        }
2611        return None;
2612    }
2613    // The `log` facade: its macros route through `log::__private_api`; the crate's types
2614    // (`Level`, `LevelFilter`) are pure, so match the logging entry, not the whole crate.
2615    if crate_name == "log" {
2616        // Expanded macro form (deep engine) OR the raw user-facing macro names (candor-scan, pre-expansion).
2617        // `log::Level`/`LevelFilter`/`Record`/`Metadata` have other tails, so the type surface stays pure.
2618        let m = path.rsplit("::").next().unwrap_or(path);
2619        if path.contains("::__private_api")
2620            || m == "error" || m == "warn" || m == "info" || m == "debug" || m == "trace" || m == "log"
2621        {
2622            return Some("Log");
2623        }
2624    }
2625    // Compiler diagnostic emission — the ONE genuinely effectful operation in the otherwise-pure
2626    // rustc_* surface (a dylint lint's actual OUTPUT: it writes warnings/errors to the compiler's
2627    // diagnostic sink). Classified `Log` (same family as `tracing`/`log` — program output). Match the
2628    // emission verbs precisely; rustc_lint/rustc_errors are mostly pure types (Lint, LintId, the Diag
2629    // BUILDERS), and only the terminal `emit`/`emit_span_lint` actually produces output.
2630    if crate_name == "rustc_lint"
2631        && (path.ends_with("::emit_span_lint")
2632            || path.ends_with("::span_lint")
2633            || path.ends_with("::span_lint_hir"))
2634    {
2635        return Some("Log");
2636    }
2637    if crate_name == "rustc_errors"
2638        && (path.ends_with("::emit")
2639            || path.ends_with("::emit_diagnostic")
2640            || path.ends_with("::emit_now"))
2641    {
2642        return Some("Log");
2643    }
2644    // arboard: the effectful surface is the `Clipboard` handle's read/write verbs (each talks to the
2645    // OS clipboard / X11/Wayland/Win32/NSPasteboard server). The data types — chiefly `arboard::Error`
2646    // (whose `Display`/`to_string` formatting is pure) and the `ImageData`/`GetExtLinux`/`SetExtLinux`
2647    // option types — are PURE, so whole-crate Clipboard fabricated Clipboard on e.g. an error
2648    // `to_string()`. Match the handle verbs; everything else returns None. `Clipboard::new` opens the
2649    // connection to the clipboard server, so it's an effect too; `get`/`set` return the
2650    // builder-then-read `Get`/`Set` cursors whose `text`/`image`/`html` terminals do the I/O.
2651    //
2652    // THE ~79-CRATE R59-CLASS AUDIT (2026-08-28), verified against arboard 3.6.1: `file_list`
2653    // (lib.rs:205,251, `Get::file_list`/`Set::file_list`) is the SAME builder-then-terminal shape as
2654    // `text`/`image`/`html` two lines up — reading/writing the clipboard's file-path list — but was
2655    // missing, not because it's ambiguous (it's the only `file_list` in the crate) but because
2656    // `eval/coverage-gate/generate.py`'s own generator only triggers on a self-scan `inferred` set
2657    // containing Fs/Net/Db/Exec; Clipboard isn't in that trigger set, so a missing Clipboard verb is
2658    // structurally invisible to the completeness gate regardless of phrasing. `Clear::default`
2659    // (lib.rs:265) is `Clipboard::clear`'s own documented alternate entry point
2660    // (`clear() { self.clear_with().default() }`, lib.rs:156-158) — the SAME "sibling constructor"
2661    // shape as `ignore::Walk::new` beside `WalkBuilder::build`; `clear_with()` itself doesn't share
2662    // `clear`'s leaf, so neither the constructor nor its terminal was covered. `default` is otherwise
2663    // unused in this crate (no derived `Default` impls), so the bare leaf carries no fabrication risk
2664    // once crate-gated.
2665    if crate_name == "arboard" {
2666        let m = path.rsplit("::").next().unwrap_or(path);
2667        if m == "new"
2668            || m == "get"
2669            || m == "set"
2670            || m == "clear"
2671            || m == "get_text"
2672            || m == "set_text"
2673            || m == "set_html"
2674            || m == "get_image"
2675            || m == "set_image"
2676            || m == "text"
2677            || m == "image"
2678            || m == "html"
2679            || m == "file_list"
2680            || m == "default"
2681        {
2682            return Some("Clipboard");
2683        }
2684        return None;
2685    }
2686    // ── Coverage-differential additions (calibrated against each crate's real API; see the per-crate
2687    //    notes). All verb-keyed + crate-gated, with the pure builder/config/data surface returning None.
2688
2689    // `etcetera` — XDG/known-folder base+app directory resolution. Each dir ACCESSOR reads the
2690    // environment at call time (`$HOME`/`$XDG_*` on Unix, `%APPDATA%`/`%LOCALAPPDATA%` on Windows), and
2691    // the `choose_*`/`home_dir` entry points read `$HOME`. The `AppStrategyArgs` data struct and the
2692    // strategy types themselves are PURE. (Found DISCLOSED-but-unmodeled in 3/4 differential projects.)
2693    if crate_name == "etcetera" {
2694        let m = path.rsplit("::").next().unwrap_or(path);
2695        if m == "home_dir"
2696            || m == "choose_base_strategy" || m == "choose_native_strategy" || m == "choose_app_strategy"
2697            || m == "config_dir" || m == "data_dir" || m == "cache_dir"
2698            || m == "state_dir" || m == "runtime_dir" || m == "data_local_dir"
2699        {
2700            return Some("Env");
2701        }
2702        return None;
2703    }
2704    // `sqlx-core` (crate `sqlx_core`) — the execution terminals under the sqlx core (the `sqlx` builder
2705    // table maps `sqlx::query*`; here it's the core `Executor`/`Connection`/`Pool` round-trips). Opening
2706    // the connection is the network boundary (Net); the query/transaction round-trips are Db. The
2707    // `*Options`/query-builder/row data types are PURE. Crate-gated so the generic verbs never spread.
2708    if crate_name == "sqlx_core" {
2709        if path.ends_with("::connect") || path.ends_with("::connect_with") {
2710            return Some("Net");
2711        }
2712        if path.ends_with("::fetch") || path.ends_with("::fetch_all") || path.ends_with("::fetch_one")
2713            || path.ends_with("::fetch_optional") || path.ends_with("::fetch_many")
2714            || path.ends_with("::execute") || path.ends_with("::execute_many")
2715            || path.ends_with("::prepare") || path.ends_with("::prepare_with")
2716            || path.ends_with("::acquire") || path.ends_with("::begin") || path.ends_with("::ping")
2717        {
2718            return Some("Db");
2719        }
2720        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against sqlx-core 0.8.6/0.9.0 (identical
2721        // shape in both) — the free-function surface under `pub mod fs`/`pub mod net::tls`/
2722        // `pub mod migrate`, none of which end in the connect/fetch/execute verbs above:
2723        //
2724        // `fs::{read,read_to_string,create_dir_all,remove_file,remove_dir,remove_dir_all,read_dir}`
2725        // (fs.rs) are direct `std::fs::*` calls off-loaded to `spawn_blocking` — sqlx's OWN async
2726        // filesystem shim, used by the migrator to read `.sql` files and by SQLite to manage on-disk
2727        // databases. `net::tls::handshake` (net/tls/mod.rs:69) is the real TLS handshake dispatch
2728        // reqwest/ureq-style crates already model — sqlx has its OWN copy because it drives the
2729        // handshake over its own `Socket` trait rather than a `TcpStream` directly.
2730        // `migrate::resolve_blocking`/`resolve_blocking_with_config` (migrate/source.rs:151,156) are
2731        // `#[doc(hidden)]` but still `pub use`-exported at `sqlx_core::migrate` (mod.rs:16) — real,
2732        // callable, and reads the migrations directory off disk (`fs::read_dir` + per-file `canonicalize`).
2733        //
2734        // NOT included: `net::tls::tls_rustls::RustlsSocket::poll_{flush,read_ready,write_ready,
2735        // shutdown}` — `RustlsSocket` is declared inside `mod tls_rustls;` (net/tls/mod.rs), which is
2736        // PRIVATE with no re-export, so no external consumer can ever name it (the same private-module
2737        // shape as tempfile's `imp::` functions above). Removed from open.tsv rather than guessed.
2738        if path == "sqlx_core::fs::read"
2739            || path == "sqlx_core::fs::read_to_string"
2740            || path == "sqlx_core::fs::create_dir_all"
2741            || path == "sqlx_core::fs::remove_file"
2742            || path == "sqlx_core::fs::remove_dir"
2743            || path == "sqlx_core::fs::remove_dir_all"
2744            || path == "sqlx_core::fs::read_dir"
2745            || path.ends_with("::migrate::resolve_blocking")
2746            || path.ends_with("::migrate::resolve_blocking_with_config")
2747            || path == "sqlx_core::config::Config::try_from_path"
2748            || path == "sqlx_core::Config::try_from_path"
2749            || path == "sqlx_core::config::Config::try_from_path_or_default"
2750            || path == "sqlx_core::Config::try_from_path_or_default"
2751            || path == "sqlx_core::config::Config::try_from_crate_or_default"
2752            || path == "sqlx_core::Config::try_from_crate_or_default"
2753        {
2754            return Some("Fs");
2755        }
2756        if path.ends_with("::net::tls::handshake") {
2757            return Some("Net");
2758        }
2759        return None;
2760    }
2761    // `walkdir` — recursive directory traversal. Charged at `WalkDir::new` (construction), the SAME
2762    // point `ignore::WalkBuilder::build`/`glob::glob` are charged, and NOT at `IntoIter::next` (driving
2763    // the iterator) as this rule originally read. The disk read (`read_dir`+`stat`) is technically lazy
2764    // — nothing happens until the value is iterated — but `.next()` is reached ONLY through a receiver
2765    // typed as `walkdir::IntoIter`, and candor-scan's receiver-typing (`ctor_type`/`resolve_recv_type`)
2766    // hard-blocks the `.into_iter()` verb (a guard against fabricating onto a DIFFERENT std type, e.g.
2767    // `Vec::into_iter()` -> `std::vec::IntoIter`) with no per-crate exception for the SAME-crate case.
2768    // `WalkDir::into_iter()` returns `walkdir::IntoIter` (same crate as `WalkDir` itself, exactly the
2769    // shape the blocklist exists to protect, not the shape it should be blocking) — so every idiomatic
2770    // form (`for e in WalkDir::new(p)`, `.into_iter().count()`, `.into_iter().filter_map(..)`, an
2771    // untyped `let it = ...into_iter(); it.next()`) never reaches a typed `IntoIter::next` receiver and
2772    // read silent-pure under the OLD rule, with `deny Fs` exiting 0 over code that walks the filesystem.
2773    // Charging at `WalkDir::new` needs no receiver typing at all — it's a plain `Expr::Call`, robust to
2774    // however the iterator is later consumed. `max_depth`/`follow_links`/`sort_by`/`into_iter` (the
2775    // BUILDER chain, no I/O until pulled) and the cached `DirEntry::path`/`file_name`/`file_type`/`depth`
2776    // accessors (`file_type` makes NO syscall) stay PURE — matched by nothing here, so they fall through.
2777    // The `IntoIter::next`/`DirEntry::metadata` rule is KEPT, not dead: it still fires whenever the
2778    // concrete `walkdir::IntoIter` type reaches `.next()` by a route the blocklist doesn't gate — an
2779    // EXPLICIT type annotation (`let it: walkdir::IntoIter = ...`), a struct field declared with that
2780    // type, or a local fn's declared return type — real, if rarer, shapes than the inline-chain idiom.
2781    // (Companion to the already-modeled `ignore`.)
2782    if crate_name == "walkdir" {
2783        if path.ends_with("::WalkDir::new")
2784            || path.ends_with("::IntoIter::next")
2785            || path.ends_with("::DirEntry::metadata")
2786        {
2787            return Some("Fs");
2788        }
2789        return None;
2790    }
2791    // `filetime` — file-timestamp mutation. The `set_*` free fns issue utimes/utimensat/futimens (Fs).
2792    // `FileTime::now` reads the system clock (Clock). The `FileTime::from_*`/`zero` value constructors
2793    // (incl. `from_last_modification_time(&Metadata)` etc., which read an ALREADY-loaded `&Metadata`, not
2794    // the disk) and the `seconds`/`nanoseconds` accessors are PURE.
2795    if crate_name == "filetime" {
2796        if path.ends_with("::set_file_mtime") || path.ends_with("::set_file_atime")
2797            || path.ends_with("::set_file_times") || path.ends_with("::set_symlink_file_times")
2798            || path.ends_with("::set_file_handle_times")
2799        {
2800            return Some("Fs");
2801        }
2802        if path.ends_with("::FileTime::now") {
2803            return Some("Clock");
2804        }
2805        return None;
2806    }
2807    // `execute` — the `Execute` trait that extends `std::process::Command` with run helpers. The
2808    // `execute*` verbs SPAWN a child process (Exec). The `execute::command`/`shell` free fns and the
2809    // `command!`/`command_args!` macros only BUILD a Command (no spawn) and stay PURE.
2810    if crate_name == "execute" {
2811        if path.contains("::execute") {
2812            return Some("Exec");
2813        }
2814        return None;
2815    }
2816    // `ctrlc` — installs an OS signal handler (Unix SIGINT/SIGTERM/SIGHUP, Windows CTRL_C_EVENT) and
2817    // spawns its handler thread. Signals are an inter-process control channel, so the closest bucket is
2818    // Ipc (candor has no dedicated Signal effect; same judgment as routing SysV/pipe IPC to Ipc).
2819    if crate_name == "ctrlc" {
2820        if path.ends_with("::set_handler") || path.ends_with("::try_set_handler") {
2821            return Some("Ipc");
2822        }
2823        return None;
2824    }
2825    // `clap` — argument parsing. ONLY the terminals that read `std::env::args_os` at call time are an
2826    // effect (Env): `get_matches`/`get_matches_mut`/`try_get_matches` and the derive `parse`/`try_parse`.
2827    // clap is MOSTLY PURE: the ENTIRE builder surface (`Command::new`/`arg`/`about`/`Arg::new`) stays
2828    // None, and crucially the `*_from`/`*_parse_from` variants take an EXPLICIT iterator (they do NOT
2829    // read argv) so they stay pure too.
2830    //
2831    // THE ~79-CRATE R59-CLASS AUDIT (2026-08-28): this file used to leave `Arg::env` unmodeled, calling
2832    // bare `::env` "too generic to gate safely" — the same words used for libc's genuinely ambiguous fd
2833    // verbs. It isn't the same shape: `Arg::env(name)` calls `env::var_os(&name)` DIRECTLY at builder
2834    // time (verified against clap_builder 4.6.6, builder/arg.rs:2205-2213 — real, immediate, not
2835    // deferred to `get_matches()`), and — unlike a bare fd, which could be Fs/Net/Ipc — `clap_builder`
2836    // has exactly ONE `pub fn` ending `::env` in its entire source (`Arg::env`; the deprecated
2837    // `Arg::env_os` is a one-line delegate to it). This whole match arm is already crate-gated on
2838    // `crate_name == "clap"`, so no ambiguity survives to fabricate on: a fixture proved the untreated
2839    // gap silently vanishes the function ("functions": [] — the exact R59 shape, worse than an
2840    // uncalibrated dependency, since `clap` is fully `CALIBRATED_CRATES` and the miss reads as
2841    // reviewed-pure rather than disclosed). Classified, not carved into
2842    // `CALIBRATED_BUT_PARTIAL_CRATES`, because the effect IS unambiguous once actually checked.
2843    if crate_name == "clap" {
2844        if path.ends_with("::get_matches") || path.ends_with("::get_matches_mut")
2845            || path.ends_with("::try_get_matches")
2846            || path.ends_with("::parse") || path.ends_with("::try_parse")
2847            || path.ends_with("::env") || path.ends_with("::env_os")
2848        {
2849            return Some("Env");
2850        }
2851        return None;
2852    }
2853    // `jiff` — date/time. `Timestamp::now`/`Zoned::now`/`Zoned::now_with` read the wall clock (Clock).
2854    // `tz::TimeZone::system`/`get` and `tz::db().get` read the system tzdb files from disk
2855    // (`/etc/localtime`, `/usr/share/zoneinfo`; `system` is also `$TZ`-overridable — Fs is the dominant
2856    // op, modeled as Fs). The `Span`/`civil` date math and `Timestamp`/`Zoned` arithmetic are PURE.
2857    if crate_name == "jiff" {
2858        if path.ends_with("::now") || path.ends_with("::now_with") {
2859            return Some("Clock");
2860        }
2861        if path.ends_with("::TimeZone::system") || path.ends_with("::TimeZone::get")
2862            || path.ends_with("::TimeZoneDatabase::get")
2863            // `TimeZone::try_system` (tz/timezone.rs:391) is `TimeZone::system`'s fallible sibling —
2864            // same `crate::tz::system::get(crate::tz::db())` call, real localtime/zoneinfo disk read.
2865            || path.ends_with("::TimeZone::try_system")
2866        {
2867            return Some("Fs");
2868        }
2869        return None;
2870    }
2871    // `env_logger` — installs the global logger and emits to stderr; reads `RUST_LOG`/`RUST_LOG_STYLE`.
2872    // The init terminals are the effect (Log — program output, same family as `log`/`tracing`). The
2873    // `Builder::new`/`build` and the format/filter/target config setters are PURE.
2874    if crate_name == "env_logger" {
2875        if path.ends_with("::init") || path.ends_with("::try_init")
2876            || path.ends_with("::init_from_env") || path.ends_with("::try_init_from_env")
2877        {
2878            return Some("Log");
2879        }
2880        return None;
2881    }
2882    // `dialoguer` — interactive terminal prompts. The `interact*` verbs read stdin + write the tty (a
2883    // console dialogue with the user — Ipc, like the other local-channel effects). The
2884    // `with_prompt`/`default`/`items`/`validate_with` BUILDERS are PURE.
2885    if crate_name == "dialoguer" {
2886        if path.ends_with("::interact") || path.ends_with("::interact_on")
2887            || path.ends_with("::interact_text") || path.ends_with("::interact_text_on")
2888            || path.ends_with("::interact_opt") || path.ends_with("::interact_on_opt")
2889        {
2890            return Some("Ipc");
2891        }
2892        // `Editor::edit` (edit.rs:93) writes the caller's string to a real tempfile, spawns
2893        // `$VISUAL`/`$EDITOR` on it via `process::Command::spawn().wait()`, then reads the result back
2894        // — a real subprocess launch, not a terminal-dialogue read/write like the verbs above.
2895        if path.ends_with("Editor::edit") {
2896            return Some("Exec");
2897        }
2898        // WIDENED-CORE AUDIT (2026-08-28): `Editor::new`/`Editor::default` (edit.rs:54,44) call
2899        // `get_default_editor()` (edit.rs:31), which reads `env::var_os("VISUAL")` then `("EDITOR")`
2900        // IMMEDIATELY at construction — a real, independent Env read a consumer triggers just by
2901        // building an `Editor`, whether or not `.edit()` is ever called (the SAME "builder-time env
2902        // read, separate from the terminal verb" shape as `clap::Arg::env`, R59-class). Verified against
2903        // dialoguer 0.12.0: `get_default_editor` is the ONLY caller of either `env::var_os`, so there is
2904        // no ambiguity gating this to just these two constructors.
2905        if path.ends_with("Editor::new") || path.ends_with("Editor::default") {
2906            return Some("Env");
2907        }
2908        return None;
2909    }
2910    // `tracing_subscriber` — the subscriber that gives `tracing` somewhere to go. TWO effects, and the
2911    // filing said "Log/Fs": VERIFIED against 0.3.23, the Fs half is WRONG.
2912    //
2913    //   Log — `fmt/fmt_layer.rs:749` defaults `make_writer: io::stdout`, so the fmt INIT terminals install
2914    //         a subscriber that writes program output. Same family as `log`/`tracing`/`env_logger`.
2915    //   Env — `fmt/mod.rs:1219` reads `RUST_LOG` on the `init()` path, `fmt_layer.rs` reads `NO_COLOR`,
2916    //         and `filter/env/builder.rs:189,203` read `env::var(self.env_var_name())`.
2917    //
2918    // NOT Fs. The only `std::fs` in the crate is `impl MakeWriter for std::fs::File` — the crate ACCEPTING
2919    // a caller-supplied File, not opening one. The caller's `File::create` is classified on the caller, so
2920    // charging Fs here would double-count, exactly the `serde_json::from_reader` caveat one crate over.
2921    //
2922    // The builders (`fmt()`, `layer()`, `with_writer`, `with_target`, `EnvFilter::new`) are PURE: they
2923    // describe a subscriber. Only the INIT terminals install one, and only the from-env constructors read.
2924    if crate_name == "tracing_subscriber" {
2925        if path.ends_with("::init") || path.ends_with("::try_init") {
2926            return Some("Log");
2927        }
2928        if path.ends_with("::from_default_env") || path.ends_with("::try_from_default_env")
2929            || path.ends_with("::from_env") || path.ends_with("::from_env_lossy")
2930            || path.ends_with("::try_from_env")
2931        {
2932            return Some("Env");
2933        }
2934        return None;
2935    }
2936    // `crossterm` — the terminal driver. The tty is a USER DIALOGUE CHANNEL, so this is Ipc, matching the
2937    // ruling `dialoguer`/`console`/`terminal_colorsaurus` already carry rather than a new one.
2938    //
2939    // VERIFIED against crossterm-0.28.1 rather than assumed: `command.rs` `execute`/`queue` end in
2940    // `self.flush()?` on the writer (real code, not a doc example), `event::read`/`poll` read tty input,
2941    // and `terminal::{enable,disable}_raw_mode` + `size`/`window_size` talk to the device.
2942    //
2943    // `size`/`window_size`/`is_raw_mode_enabled` ARE classified, and that is deliberate: once a crate is
2944    // CALIBRATED every unmatched path becomes a PURITY CLAIM rather than a disclosed blind spot, so a tty
2945    // ioctl left to fall through would be claimed pure. The genuinely pure surface — the Command VALUE
2946    // types (`Print`, `MoveTo`, `SetForegroundColor`), the style/event data types — carries none of these
2947    // tails and stays pure correctly.
2948    if crate_name == "crossterm" {
2949        if path.ends_with("::execute") || path.ends_with("::queue")
2950            || path.ends_with("::event::read") || path.ends_with("::event::poll")
2951            || path.ends_with("::enable_raw_mode") || path.ends_with("::disable_raw_mode")
2952            || path.ends_with("::size") || path.ends_with("::window_size")
2953            || path.ends_with("::is_raw_mode_enabled")
2954        {
2955            return Some("Ipc");
2956        }
2957        // `terminal::supports_keyboard_enhancement` (terminal/sys/unix.rs:188, re-exported `pub use
2958        // sys::supports_keyboard_enhancement` in terminal.rs) drives the SAME channel as
2959        // `event::read`/`enable_raw_mode` above (it toggles raw mode, then reads/polls terminal events
2960        // to detect the kitty keyboard protocol) — bucketed `Ipc` for consistency with the rest of this
2961        // tty-dialogue family rather than the `Fs` self-scan's raw signal reports (that signal traces
2962        // through the crate's internal event source opening `/dev/tty` as a fallback fd, the same
2963        // primitive `tty_fd` below wraps — not a distinct effect from the terminal channel itself).
2964        //
2965        // NOT modelled: `tty_fd` (terminal/sys/file_descriptor.rs:124) — declared inside `pub(crate) mod
2966        // sys;` (terminal.rs:99), so despite being `pub fn` it is unreachable from outside the crate
2967        // (only used internally by the event source). Removed from open.tsv rather than guessed.
2968        if path.ends_with("::supports_keyboard_enhancement") {
2969            return Some("Ipc");
2970        }
2971        return None;
2972    }
2973    // `ratatui` — the TUI renderer, and the single loudest source of disclosed-blind calls measured in the
2974    // 2026-07-14 four-ecosystem sweep (3,345 across three real repos). The backlog filed it as
2975    // "mark reviewed-pure"; VERIFYING against ratatui-0.29.0 REFUTES that for part of the surface:
2976    // `terminal/terminal.rs` `draw`/`flush`/`clear`/`autoresize`/`hide_cursor`/`show_cursor` end in a
2977    // backend flush, and `backend/` writes to the terminal. Marking the whole crate pure would have
2978    // claimed purity over the one API that actually writes.
2979    //
2980    // So the split is where the sweep's noise actually is: the BULK of those 3,345 calls are widget,
2981    // layout, buffer, style and text constructors — genuinely pure, and now covered rather than disclosed.
2982    // The Terminal/backend verbs are Ipc, same channel as crossterm underneath them.
2983    if crate_name == "ratatui" {
2984        // CARVE-OUT FIRST: `widgets::canvas` is an IN-MEMORY grid. `Context::draw(&shape)` sets
2985        // `self.dirty` and paints into a `Painter` — no terminal, no writer, provably pure — but it ends
2986        // in `::draw` and the tails below would have charged it `Ipc`. MEASURED as a live fabrication on a
2987        // fixture (`plot(ctx) -> ['Ipc']`) before this line existed, and it is a HOT path: a TUI drawing
2988        // charts or maps calls it per shape per frame.
2989        //
2990        // A DENYLIST (carve out the proven-pure module) rather than an allowlist of `Terminal::`, per the
2991        // family rule: an allowlist silently under-reports whatever it forgot, and the write surface here
2992        // is Terminal AND the backends (`CrosstermBackend::flush`), so pinning to `Terminal::` would drop
2993        // a direct backend call. Reading the crate, canvas is the only module whose methods collide with
2994        // these tails.
2995        if path.contains("::canvas::") {
2996            return None;
2997        }
2998        if path.ends_with("::draw") || path.ends_with("::try_draw") || path.ends_with("::flush")
2999            || path.ends_with("::autoresize") || path.ends_with("::clear")
3000            || path.ends_with("::hide_cursor") || path.ends_with("::show_cursor")
3001            || path.ends_with("::insert_before")
3002            || path.ends_with("::set_cursor_position") || path.ends_with("::get_cursor_position")
3003        {
3004            return Some("Ipc");
3005        }
3006        return None;
3007    }
3008    // `console` — terminal handle + styling. The `Term` read/write verbs do tty I/O (Ipc, the user
3009    // dialogue channel; note there is NO `write_str` — `Term` impls `io::Write`). The free-fn terminal
3010    // detection (`colors_enabled`/`user_attended`) reads `CLICOLOR`/`CLICOLOR_FORCE` (Env). The `Style`
3011    // color/format methods and the text utils (`strip_ansi_codes`/`pad_str`/`measure_text_width`) are PURE.
3012    //
3013    // THE ~79-CRATE R59-CLASS AUDIT (2026-08-28): the note above ("no `write_str` — `Term` impls
3014    // `io::Write`") RECORDED the trait impl without covering it. `Term::write`/`Term::flush` (console
3015    // 0.15.11, term.rs:622-633) call `self.write_through(buf)` — the SAME primitive `write_line` already
3016    // charges Ipc for — and `Term::read` (term.rs:650-654) calls `io::stdin().read(buf)` directly. These
3017    // are a second, real entry point to the identical tty channel, missed because `read`/`write`/`flush`
3018    // are the names every I/O type shares — but crate-gated on `crate_name == "console"`, term.rs
3019    // defines exactly one of each (verified against the real source; no ambiguity survives the gate,
3020    // same shape as `clap::Arg::env`). Left unclassified, a fn calling only `term.write_all(..)` (no
3021    // `write_line`) read as reviewed-pure, since `console` is fully `CALIBRATED_CRATES`.
3022    if crate_name == "console" {
3023        if path.ends_with("::write_line") || path.ends_with("::read_line")
3024            || path.ends_with("::read_line_initial_text") || path.ends_with("::read_char")
3025            || path.ends_with("::read_key") || path.ends_with("::read_key_raw")
3026            || path.ends_with("::read_secure_line")
3027            || path.ends_with("Term::write") || path.ends_with("Term::flush")
3028            || path.ends_with("Term::read")
3029        {
3030            return Some("Ipc");
3031        }
3032        if path.ends_with("::colors_enabled") || path.ends_with("::colors_enabled_stderr")
3033            || path.ends_with("::user_attended") || path.ends_with("::user_attended_stderr")
3034        {
3035            return Some("Env");
3036        }
3037        return None;
3038    }
3039    // `terminal_colorsaurus` — queries the terminal's colours by writing OSC 10/11 escapes and reading the
3040    // reply (bidirectional tty dialogue — Ipc, consistent with dialoguer/console). Nothing else is I/O.
3041    if crate_name == "terminal_colorsaurus" {
3042        if path.ends_with("::background_color") || path.ends_with("::foreground_color")
3043            || path.ends_with("::color_palette")
3044            // SOUNDNESS R321 — FQN-exact, not a suffix. `1.0.3` added
3045            // `ColorPalette::theme_mode(&self)` (src/lib.rs:112), a PURE derived accessor
3046            // comparing `perceived_lightness()` on two already-fetched colours, alongside the
3047            // effectful free `theme_mode(options)` (src/lib.rs:157). A `::theme_mode` suffix
3048            // charges `Ipc` to both. Counterpart to R319: the same upstream mechanism — a
3049            // release ADDING a name — under-reports in one crate and fabricates in another,
3050            // depending only on whether the new name is effectful.
3051            || path == "terminal_colorsaurus::theme_mode"
3052        {
3053            return Some("Ipc");
3054        }
3055        return None;
3056    }
3057    // `backoff` — retry-with-backoff. `retry`/`retry_notify` consult the clock and `thread::sleep`
3058    // between attempts (Clock). The `ExponentialBackoff`/builder config is PURE. (The user closure's own
3059    // effects are out of scope here — we model only backoff's own Clock effect.)
3060    if crate_name == "backoff" {
3061        if path.ends_with("::retry") || path.ends_with("::retry_notify") {
3062            return Some("Clock");
3063        }
3064        return None;
3065    }
3066    // `lscolors` — LS_COLORS parsing. ONLY `from_env` reads the environment (Env). `from_string`/
3067    // `style_for_path`/`style_for*` and the `Style` type take explicit input and are PURE.
3068    if crate_name == "lscolors" {
3069        if path.ends_with("::from_env") {
3070            return Some("Env");
3071        }
3072        return None;
3073    }
3074    // `wild` — argv with glob expansion. `args`/`args_os` read `std::env::args(_os)` (Env). Nothing else.
3075    if crate_name == "wild" {
3076        if path.ends_with("::args") || path.ends_with("::args_os") {
3077            return Some("Env");
3078        }
3079        return None;
3080    }
3081    // `grep_cli` — only the firm effect is modeled: `CommandReaderBuilder::build` spawns a child process
3082    // (Exec). The `is_readable_stdin`/`is_tty_*` fd probes (isatty/fstat on the std descriptors) are
3083    // deliberately NOT modeled — candor doesn't classify `IsTerminal`/isatty as an effect anywhere, and
3084    // they read no data; flagging them would be an inconsistent over-report.
3085    if crate_name == "grep_cli" {
3086        if path.ends_with("::build") {
3087            return Some("Exec");
3088        }
3089        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against grep-cli 0.1.12 — the sibling entry
3090        // points to `::build` above, none of which end in that suffix:
3091        //
3092        // `CommandReader::new` (process.rs:195) is `CommandReaderBuilder::new().build(cmd)` — the same
3093        // spawn, reached through the type's own one-call constructor instead of the builder.
3094        // `CommandReader::close` (process.rs:218) drops the child's stdout handle then calls
3095        // `self.child.wait()` — `std::process::Child::wait` is ALREADY classified `Exec` elsewhere in
3096        // this file (reaping/blocking on a spawned child is part of the subprocess lifecycle this
3097        // project tracks), and self-scan resolves `self.child`'s concrete `process::Child` type to
3098        // confirm it, not a guess.
3099        // `DecompressionMatcher::command` (decompress.rs:179) builds a REAL `Command::new(&decomp_cmd.bin)`
3100        // naming an actual decompressor binary (gzip/xz/bzip2/…) and returns it un-spawned — the same
3101        // "constructs a real argv, caller spawns it" shape `Cred::credential_helper` was classified for
3102        // in git2 (see the FQN-exact rule near this file's top).
3103        // `DecompressionReader::new` (decompress.rs:352) is `DecompressionReaderBuilder::new().build(path)`,
3104        // which calls the already-covered `CommandReaderBuilder::build` two hops down.
3105        // `patterns_from_path` (pattern.rs:82) opens and reads the given file directly (`std::fs::File::
3106        // open`) — unrelated to the Exec family above, genuinely Fs.
3107        // SOUNDNESS R342 — `DecompressionReader::close` was the sibling this enumeration missed. It is
3108        // `match self.rdr { Ok(ref mut rdr) => rdr.close(), Err(_) => Ok(()) }` (`decompress.rs:383`),
3109        // i.e. the already-listed `CommandReader::close` one level up, so it reaps the same child. Its
3110        // `CommandReader` counterpart was listed and it was not — measured on a consumer fixture:
3111        // `CommandReader::close` charged `Exec` and `DecompressionReader::close` read ABSENT.
3112        //
3113        // The `read` pair is listed for the same reason one hop over: reading a `DecompressionReader`
3114        // or a `CommandReader` pulls bytes from the child's stdout, which is the point of having
3115        // spawned it. FQN-exact rather than a `::read`/`::close` suffix, because both are far too
3116        // common a leaf to match crate-wide — the R321 lesson.
3117        //
3118        // Found because R185 taught the scanner to see through `match self.rdr { Ok(..) }`, which made
3119        // grep-cli's own self-scan nominate it. The rule is what a CONSUMER needs; the self-scan only
3120        // pointed at it.
3121        if path == "grep_cli::CommandReader::new"
3122            || path == "grep_cli::CommandReader::close"
3123            || path == "grep_cli::CommandReader::read"
3124            || path == "grep_cli::DecompressionMatcher::command"
3125            || path == "grep_cli::DecompressionReader::new"
3126            || path == "grep_cli::DecompressionReader::close"
3127            || path == "grep_cli::DecompressionReader::read"
3128            || path == "grep_cli::decompress::DecompressionReader::close"
3129            || path == "grep_cli::decompress::DecompressionReader::read"
3130            || path == "grep_cli::process::CommandReader::close"
3131            || path == "grep_cli::process::CommandReader::read"
3132        {
3133            return Some("Exec");
3134        }
3135        if path == "grep_cli::patterns_from_path" {
3136            return Some("Fs");
3137        }
3138        return None;
3139    }
3140    // `clircle` — detects whether two handles are the same file (cycle protection). `Identifier::try_from`
3141    // (File/Stdio) issues an `fstat`, and `surely_conflicts_with` does an `lseek` (`stream_position`) — both
3142    // Fs. The `PartialEq`/`Hash` comparisons read stored dev/ino and are PURE. (The named methods
3143    // `are_identical`/`same_file` do NOT exist in the crate — not modeled.)
3144    if crate_name == "clircle" {
3145        if path.ends_with("::try_from") || path.ends_with("::surely_conflicts_with") {
3146            return Some("Fs");
3147        }
3148        return None;
3149    }
3150    None
3151}
3152
3153pub fn cap_from_name(name: &str) -> Option<&'static str> {
3154    EFFECTS.iter().copied().find(|e| *e == name)
3155}
3156
3157/// Refine the `Exec` cliff (spec §4 ⟨0.5⟩): the effects a *literal, statically-known* subprocess
3158/// head implies, matched by basename (`/usr/bin/curl` → `curl`). The head's effects are ADDED to a
3159/// caller that already carries `Exec` (a subprocess is still spawned — `Exec` is never dropped); an
3160/// unrecognised or dynamically-built head returns `&[]` and keeps the bare cliff (never guess). A
3161/// **candor engine** reads `Fs`/`Env` only — spec §7 item 12 (the analyzer self-boundary) guarantees
3162/// that, so that case is spec-supplied, not curation. The rest is a small curated table under the
3163/// same under-report rule as the crate classifier. INVARIANT: every head here is an external tool
3164/// that does NOT run the analysed project's own code (so `make`/`npm`/`cargo` are deliberately
3165/// absent — they stay the cliff). The reference engines share this table so the `Exec` boundary —
3166/// the one boundary every engine hits — refines identically (the §4-consistency argument).
3167/// SPEC §2 `fs` — for a call ALREADY classified `Fs`, the read/write direction its path implies.
3168/// `["read"]`, `["write"]`, `["read","write"]`, or `[]` when the verb does not say.
3169///
3170/// THE EMPTY CASE IS THE DISCIPLINE. §2: *"when `Fs` is reached but its kind is unknown … the field MUST
3171/// be omitted rather than guessed. An empty or partial `fs` would be read as a positive claim ('reads but
3172/// never writes'), which is the §4 trust contract's forbidden direction."* So an unrecognised verb
3173/// contributes nothing and the field stays absent; absence means "kind undetermined", never "read-only".
3174///
3175/// A syntactic refinement of an effect already proved, NOT a soundness claim. Deliberately the same
3176/// vocabulary as candor-java's `fsKind`, candor-swift's and candor-ts's — the surface is spec'd four-way,
3177/// and four engines inventing four verb tables for one field is how a shared field stops meaning one thing.
3178pub fn fs_kind(path: &str) -> &'static [&'static str] {
3179    // the terminal segment is the verb (`std::fs::write`, `File::create`, `f.read_to_string`)
3180    let leaf = path.rsplit("::").next().unwrap_or(path);
3181    // `OpenOptions::open` is the one verb that does NOT carry its own direction — the direction was set
3182    // by the BUILDER chain (`.read(true)`/`.write(true)`), which this function cannot see. The READ list
3183    // below holds a bare `open` for `File::open`, unambiguously a read; letting an `OpenOptions` receiver
3184    // reach it publishes `fs: ["read"]` for a builder configured `write(true)`, and §2 reads that as the
3185    // positive claim "reads but never writes" — the forbidden direction. The paragraph under the READ
3186    // list has always SAID this; nothing implemented it, and it only became REACHABLE when
3187    // `OpenOptions::open` started classifying on its own — before, the `Fs` came from the
3188    // `OpenOptions::new` constructor, whose leaf claims nothing, so the field was simply absent.
3189    // MEASURED on this commit's own fix before this guard: `OpenOptions::new().read(true).open(p)` went
3190    // from `fs` ABSENT to `fs: ["read"]`, i.e. the fix minted a claim the engine cannot support. Keyed on
3191    // the TYPE segment, so it holds for the `fs_err`/`tokio::fs`/`async_std::fs` spellings too.
3192    if path.rsplit("::").nth(1) == Some("OpenOptions") {
3193        return &[];
3194    }
3195    // Reads the source AND writes the destination in one call.
3196    if matches!(leaf, "copy" | "rename" | "hard_link" | "soft_link" | "symlink") {
3197        return &["read", "write"];
3198    }
3199    const WRITE: &[&str] = &[
3200        "write", "write_all", "write_fmt", "write_vectored", "create", "create_new", "create_dir",
3201        "create_dir_all", "remove_file", "remove_dir", "remove_dir_all", "set_permissions",
3202        "set_len", "set_modified", "set_times", "append", "flush", "sync_all", "sync_data",
3203        "write_at", "truncate",
3204    ];
3205    const READ: &[&str] = &[
3206        "read", "read_to_string", "read_to_end", "read_exact", "read_dir", "read_link",
3207        "metadata", "symlink_metadata", "exists", "try_exists", "canonicalize", "open",
3208        "read_at", "file_type", "permissions", "modified", "accessed", "created", "len",
3209    ];
3210    if WRITE.contains(&leaf) { return &["write"]; }
3211    if READ.contains(&leaf) { return &["read"]; }
3212    // `OpenOptions` carries the direction in its BUILDER chain, not its terminal verb, so `.open()` on one
3213    // says nothing here and is deliberately left to the READ arm above only when it is `File::open`
3214    // (unambiguously a read). Anything else: no claim.
3215    if leaf.starts_with("write") || leaf.starts_with("append") { return &["write"]; }
3216    if leaf.starts_with("read") { return &["read"]; }
3217    &[]
3218}
3219
3220pub fn classify_command_head(cmd: &str) -> &'static [&'static str] {
3221    // Only UNAMBIGUOUS single-effect tools belong here. A multi-modal head (`git status` is local,
3222    // `git push` is Net; `rsync` local-vs-remote) would FABRICATE the effect for its common case —
3223    // the under-report rule forbids it, so such heads keep the bare cliff.
3224    match cmd.rsplit(['/', '\\']).next().unwrap_or(cmd) {
3225        "curl" | "wget" | "http" | "ssh" | "scp" | "sftp" | "ftp" | "telnet" => &["Net"],
3226        "psql" | "mysql" | "sqlite3" | "mongosh" | "mongo" | "redis-cli" | "cqlsh" | "influx" => &["Db"],
3227        // candor engines — Fs/Env only, guaranteed by spec §7 item 12 (the analyzer self-boundary)
3228        "candor" | "candor-run.sh" | "candor-scan" | "candor-query" | "candor-java"
3229        | "candor-classify" | "candor-report" | "cargo-candor" => &["Env", "Fs"],
3230        _ => &[],
3231    }
3232}
3233
3234/// Known machine-learning MODEL-provider hosts — the SPEC §1 ⟨0.13⟩ `Llm` host-literal refinement:
3235/// a statically-known `Net` request to one of these classifies `Llm` IN ADDITION to `Net` (Net is
3236/// never dropped — a model call IS network I/O, exactly as an `Exec`-refined subprocess keeps `Exec`),
3237/// just as a jdbc URL classifies `Db`. Matched by host, case-insensitive; a SUBDOMAIN of a listed host
3238/// counts. The reference engines share this table VERBATIM with candor-java's `Literals.MODEL_HOSTS`
3239/// (the analog of `classify_command_head`) so the `Net` boundary refines to `Llm` identically. An
3240/// UNKNOWN host stays bare `Net` — never guessed. Curated STARTER set; the §7 coverage ledger
3241/// discloses an uncovered provider like any other.
3242pub const MODEL_HOSTS: &[&str] = &[
3243    "api.openai.com",
3244    "api.anthropic.com",
3245    "generativelanguage.googleapis.com",
3246    "api.mistral.ai",
3247    "api.cohere.ai",
3248    "api.cohere.com",
3249    "api.groq.com",
3250    "api.together.xyz",
3251    "api.perplexity.ai",
3252    "openrouter.ai",
3253];
3254
3255/// Whether an endpoint HOST literal is a known model provider (case-insensitive; a subdomain of a
3256/// `MODEL_HOSTS` entry counts). Strips a `:port` suffix first. Two special forms carry their own rule,
3257/// matching candor-java's `Literals.isModelHost` exactly: any host whose port is `11434` is a local
3258/// Ollama endpoint (a LOOPBACK host — `localhost`/`127.0.0.1`/`::1` — on port 11434); and an AWS Bedrock
3259/// runtime host (the model-inference service label `bedrock-runtime`/`bedrock-agent-runtime`).
3260pub fn is_model_host(host_literal: &str) -> bool {
3261    // Strip any `:port` (via the shared host_part) and lowercase for the name comparisons.
3262    let host = policy::host_part(host_literal).to_ascii_lowercase();
3263    // Ollama is a LOCAL endpoint: :11434 → Llm ONLY on a loopback host (max-review r3 parity fix — "any
3264    // host on :11434" fabricated Llm on unrelated internal services on that port).
3265    if let Some((_, port)) = host_literal.rsplit_once(':') {
3266        if port == "11434" {
3267            return matches!(host.as_str(), "localhost" | "127.0.0.1" | "::1");
3268        }
3269    }
3270    if MODEL_HOSTS.contains(&host.as_str()) {
3271        return true;
3272    }
3273    // A subdomain of a known model host counts (`eu.api.openai.com` → api.openai.com).
3274    if MODEL_HOSTS.iter().any(|m| host.ends_with(&format!(".{m}"))) {
3275        return true;
3276    }
3277    // AWS Bedrock runtime: the FIRST label is the model-inference service (`bedrock-runtime.<region>.
3278    // amazonaws.com`), NOT the substring "bedrock" (which caught `bedrock-backups.s3.amazonaws.com`, an
3279    // S3 bucket) and NOT the control-plane `bedrock.<region>.amazonaws.com`.
3280    host.ends_with(".amazonaws.com")
3281        && matches!(host.split('.').next(), Some("bedrock-runtime") | Some("bedrock-agent-runtime"))
3282}
3283
3284/// ⟨0.20⟩ Curated telemetry / analytics / APM hosts — the `Net` destination-class `known-telemetry` set
3285/// (NET-DESTINATION-CLASS-DESIGN.md), shared VERBATIM with candor-java's `Literals.TELEMETRY_HOSTS` (like
3286/// `MODEL_HOSTS`). A benign observability endpoint. Matched by host, case-insensitive; a SUBDOMAIN of a
3287/// listed host counts. Tight, high-precision STARTER set — mis-including an exfil-capable host would
3288/// under-gate `deny Net[unknown-host]`.
3289pub const TELEMETRY_HOSTS: &[&str] = &[
3290    "sentry.io",
3291    "bugsnag.com",
3292    "rollbar.com",
3293    "segment.io",
3294    "segment.com",
3295    "mixpanel.com",
3296    "amplitude.com",
3297    "google-analytics.com",
3298    "analytics.google.com",
3299    "datadoghq.com",
3300    "datadoghq.eu",
3301    "newrelic.com",
3302    "nr-data.net",
3303    "honeycomb.io",
3304    "logtail.com",
3305    // ⟨0.20.1⟩ corpus-grown (a real-repo dogfood): more single-purpose analytics / session-replay / RUM
3306    // providers — vendor-specific product domains only (no general-purpose host), so no under-gate risk.
3307    "posthog.com",
3308    "plausible.io",
3309    "usefathom.com",
3310    "heapanalytics.com",
3311    "fullstory.com",
3312    "hotjar.com",
3313    "logrocket.com",
3314    "cloudflareinsights.com",
3315];
3316
3317/// Whether an endpoint HOST literal is in `set` (case-insensitive; a subdomain of a listed host counts).
3318/// Strips a `:port` suffix first via `host_part`. The shared membership test for `TELEMETRY_HOSTS` and the
3319/// config-declared partner set (mirrors candor-java's `Literals.hostInSet`).
3320pub fn host_in_set(host_literal: &str, set: &[&str]) -> bool {
3321    let host = policy::host_part(host_literal).to_ascii_lowercase();
3322    set.contains(&host.as_str()) || set.iter().any(|e| host.ends_with(&format!(".{e}")))
3323}
3324
3325/// Whether an endpoint HOST literal is a known telemetry/analytics/APM host (`TELEMETRY_HOSTS`).
3326pub fn is_telemetry_host(host_literal: &str) -> bool {
3327    host_in_set(host_literal, TELEMETRY_HOSTS)
3328}
3329
3330/// ⟨0.20⟩ The `Net` DESTINATION CLASS of a host literal (NET-DESTINATION-CLASS-DESIGN.md): `known-telemetry`
3331/// (curated), `known-partner` (config `net-partner` OR a model host — a declared-ish external API), else
3332/// `unknown-host` — the HONEST default (candor makes no claim; the security gate bites this). A partner set
3333/// is per-project (config-declared). Never fabricated onto a safe class: an unresolved host is unknown-host.
3334/// Mirrors candor-java's `Literals.netDestClass`.
3335pub fn net_dest_class(host_literal: &str, partners: &std::collections::BTreeSet<String>) -> &'static str {
3336    if is_telemetry_host(host_literal) {
3337        return "known-telemetry";
3338    }
3339    if partner_for(host_literal, partners).is_some() || is_model_host(host_literal) {
3340        return "known-partner";
3341    }
3342    "unknown-host"
3343}
3344
3345/// ⟨0.31⟩ WHICH declared partner a host matched, or `None` — the SAME match `net_dest_class` decides on,
3346/// extracted so the DISCLOSURE and the DECISION cannot use different rules.
3347///
3348/// That is not a stylistic preference. The reverted first attempt at the `net-partner` disclosure
3349/// re-implemented this match against a normaliser that KEEPS the port, so an observed
3350/// `partner.example:443` never equalled a declared `partner.example` and the disclosure came back
3351/// SILENTLY EMPTY on every real run — while the verdicts it was reporting on had flipped. A disclosure
3352/// normalised differently from the decision it reports can only be wrong, and one function with two
3353/// callers is what makes writing one impossible.
3354pub fn partner_for(
3355    host_literal: &str,
3356    partners: &std::collections::BTreeSet<String>,
3357) -> Option<String> {
3358    if partners.is_empty() {
3359        return None;
3360    }
3361    let host = policy::host_part(host_literal).to_ascii_lowercase();
3362    if partners.contains(&host) {
3363        return Some(host);
3364    }
3365    partners
3366        .iter()
3367        .find(|p| host.ends_with(&format!(".{p}")))
3368        .cloned()
3369}
3370
3371/// ⟨0.20⟩ The closed `Net` destination-class vocabulary, for the `deny Net[<dest…>]` policy filter.
3372pub const NET_DEST_CLASSES: &[&str] = &["known-telemetry", "known-partner", "unknown-host"];
3373
3374/// Curated Rust model-provider SDK crates — the SPEC §1 ⟨0.13⟩ `Llm` model-SDK surface, the Rust analog
3375/// of candor-java's `Rules.MODEL_SDK_PACKAGES`. A resolved call into one of these crates classifies
3376/// `Llm` + `Net` (the caller adds both — a model dispatch IS network I/O). NO method-name gating: these
3377/// are single-purpose provider clients, so ANY call into the crate is a model dispatch (matches the java
3378/// reference's judgment call). Curated STARTER list; the §7 coverage ledger discloses the rest.
3379pub const MODEL_SDK_CRATES: &[&str] = &[
3380    "async_openai",           // async-openai — the de-facto OpenAI client
3381    "anthropic_sdk",          // anthropic-sdk
3382    "anthropic",              // anthropic (community client crate)
3383    "aws_sdk_bedrockruntime", // AWS Bedrock runtime (invoke/converse) — the model surface of the aws-sdk family
3384    "ollama_rs",              // ollama-rs — local Ollama client
3385    "langchain_rust",         // langchain-rust — the LangChain invoke surfaces
3386    "mistralai",              // mistralai (Mistral client)
3387    "genai",                  // genai — a multi-provider model client
3388];
3389
3390/// Whether a resolved call's CRATE is a curated model-provider SDK (`MODEL_SDK_CRATES`) → the SPEC §1
3391/// ⟨0.13⟩ `Llm` model-SDK classification (the caller adds both `Llm` and `Net`). Crate-level, no
3392/// method gating — a single-purpose client, matching candor-java's `isModelSdkOwner`.
3393pub fn is_model_sdk_crate(crate_name: &str) -> bool {
3394    MODEL_SDK_CRATES.contains(&crate_name)
3395}
3396
3397/// The libc / nix / rustix PATH-and-directory syscall leaves `classify` charges `Fs` (incl. `*64` and
3398/// `*at` variants). Module-level, not local to `classify`, because it is ONE of the two answers to one
3399/// question: the AS-EFF-008 masking guard (`masks_locator`) reads this same table, so a leaf added here
3400/// is masked by default — see `LIBC_FS_NO_PATH` for the direction. SOUNDNESS R806.
3401pub const LIBC_FS: &[&str] = &[
3402            "open", "open64", "openat", "openat2", "creat", "creat64", "stat", "stat64", "lstat",
3403            "lstat64", "fstatat", "fstatat64", "newfstatat", "statx", "access", "faccessat",
3404            "faccessat2", "mkdir", "mkdirat", "rmdir", "unlink", "unlinkat", "rename", "renameat",
3405            "renameat2", "link", "linkat", "symlink", "symlinkat", "readlink", "readlinkat", "chmod",
3406            "fchmodat", "chown", "lchown", "fchownat", "truncate", "truncate64", "ftruncate",
3407            "ftruncate64", "opendir", "fdopendir", "readdir", "readdir64", "readdir_r", "closedir",
3408            "rewinddir", "seekdir", "telldir", "scandir", "mkstemp", "mkstemps", "mkostemp", "mkdtemp",
3409            "mknod", "mknodat", "chdir", "fchdir", "getcwd", "get_current_dir_name", "chroot",
3410            "pivot_root", "statfs", "statfs64", "fstatfs", "fstatfs64", "statvfs", "fstatvfs", "mount",
3411            "umount", "umount2", "fsync", "fdatasync", "sync", "syncfs", "sync_file_range", "fallocate",
3412            "posix_fallocate", "posix_fadvise", "sendfile", "sendfile64", "copy_file_range", "flock",
3413            "getdents", "getdents64", "utime", "utimes", "lutimes", "futimens", "utimensat", "futimesat",
3414            "realpath",
3415        ];
3416
3417/// The libc / nix / rustix socket-family leaves `classify` charges `Net`. See `LIBC_NET_NO_DESTINATION`.
3418pub const LIBC_NET: &[&str] = &[
3419            "socket", "setsockopt", "getsockopt", "bind", "listen", "accept", "accept4", "connect",
3420            "shutdown", "send", "sendto", "sendmsg", "sendmmsg", "recv", "recvfrom", "recvmsg",
3421            "recvmmsg", "getpeername", "getsockname", "getaddrinfo", "freeaddrinfo", "getnameinfo",
3422        ];
3423
3424/// The libc / nix / rustix process creation / replacement / reaping leaves `classify` charges `Exec`.
3425/// See `LIBC_EXEC_NO_PROGRAM`.
3426pub const LIBC_EXEC: &[&str] = &[
3427            "fork", "vfork", "clone", "clone3", "execl", "execlp", "execle", "execv", "execvp",
3428            "execvpe", "execve", "execveat", "fexecve", "posix_spawn", "posix_spawnp", "system",
3429            "popen", "pclose", "wait", "waitpid", "wait3", "wait4", "waitid",
3430        ];
3431
3432/// The Postgres / SQLite-family client verbs `classify` charges `Db` for `postgres`, `tokio_postgres`,
3433/// `deadpool_postgres` and `rusqlite` — the round-trips themselves. Module-level because the masking
3434/// guard reads it too (`masks_locator`, SOUNDNESS R806): every verb here takes the SQL text at
3435/// argument 0 except the three in `PG_DB_VERBS_NO_SQL`, so a verb added here is masked by default.
3436/// `(type, method)` of a `crate::[modules::]Type::method` path whose modules are exactly one of `mods`
3437/// (the crate-root re-export when `mods` holds `""`). Used by the coverage-gate rules below that name a
3438/// method on ONE type: comparing the type SEGMENT, not a suffix, so `MultiplexedConnection::recv_response`
3439/// can never satisfy a rule written for `Connection::recv_response`.
3440fn type_method<'a>(path: &'a str, krate: &str, mods: &[&str]) -> Option<(&'a str, &'a str)> {
3441    let rest = path.strip_prefix(krate)?.strip_prefix("::")?;
3442    let (head, method) = rest.rsplit_once("::")?;
3443    let (module, ty) = head.rsplit_once("::").unwrap_or(("", head));
3444    mods.contains(&module).then_some((ty, method))
3445}
3446
3447pub const PG_DB_VERBS: &[&str] = &[
3448                "::query", "::query_one", "::query_opt", "::query_raw", "::execute",
3449                "::batch_execute", "::simple_query", "::prepare", "::prepare_typed",
3450                "::copy_in", "::copy_out", "::transaction", "::connect",
3451                // `Config::connect_raw` (tokio-postgres config.rs:739) does the SAME protocol handshake
3452                // as `Config::connect` over a caller-supplied stream (a Unix socket, a TLS-terminated
3453                // proxy) instead of dialing one itself — real Db/Net I/O, missing because the verb
3454                // doesn't end in the plain `connect` spelling.
3455                "::connect_raw",
3456                // rusqlite's dialect of the same verbs (a verb-probe found the CANONICAL rusqlite
3457                // consumer API classifying pure): `query_row` is the one-row read, `query_map`/
3458                // `query_and_then` the many-row reads, `execute_batch` is rusqlite's name for
3459                // batch_execute, `prepare_cached` round-trips like prepare. `query_typed` is
3460                // tokio_postgres 0.7.10+.
3461                "::query_row", "::query_map", "::query_and_then", "::execute_batch",
3462                "::prepare_cached", "::query_typed",
3463                "::prepare_typed_cached",
3464];
3465
3466/// The members of `PG_DB_VERBS` that take NO SQL text, each checked against its signature:
3467/// `Client::transaction(&mut self)`, `connect(params, tls)` / `Config::connect_raw(stream, tls)` —
3468/// a connection string or a stream, never a query. A name wrongly listed here is a silent bypass;
3469/// a name missing from here is an over-mask that fails closed. SOUNDNESS R806.
3470pub const PG_DB_VERBS_NO_SQL: &[&str] = &["::transaction", "::connect", "::connect_raw"];
3471
3472/// The members of `LIBC_FS` that take NO path — every one operates on a file DESCRIPTOR, a `DIR*`
3473/// stream, or nothing — so a missing literal there hides no locator. **CHECKED AGAINST EACH SIGNATURE,
3474/// because this is a denylist on a masking guard: a path-taking name wrongly listed here is the
3475/// benign-sibling-literal bypass (R399), while a no-path name missing from here only over-masks.**
3476/// Everything else in `LIBC_FS` names a path, at argument 0 or — for the `*at` family — argument 1.
3477pub const LIBC_FS_NO_PATH: &[&str] = &[
3478    "ftruncate", "ftruncate64", "fdopendir", "readdir", "readdir64", "readdir_r", "closedir",
3479    "rewinddir", "seekdir", "telldir", "fchdir", "getcwd", "get_current_dir_name", "fstatfs",
3480    "fstatfs64", "fstatvfs", "fsync", "fdatasync", "sync", "syncfs", "sync_file_range", "fallocate",
3481    "posix_fallocate", "posix_fadvise", "sendfile", "sendfile64", "copy_file_range", "flock",
3482    "getdents", "getdents64", "futimens",
3483];
3484
3485/// The members of `LIBC_EXEC` that name NO program: process duplication (`fork`/`vfork`/`clone*`,
3486/// which run THIS image) and reaping (`wait*`, `pclose`). Every other member names what runs —
3487/// `system`/`popen` a shell command line, `exec*`/`posix_spawn*` a path or file name, `fexecve` an fd
3488/// whose program is invisible at the call. Same direction rule as `LIBC_FS_NO_PATH`.
3489pub const LIBC_EXEC_NO_PROGRAM: &[&str] = &[
3490    "fork", "vfork", "clone", "clone3", "wait", "waitpid", "wait3", "wait4", "waitid", "pclose",
3491];
3492
3493/// The members of `LIBC_NET` that name NO destination: socket setup and options, the LOCAL side
3494/// (`bind`/`listen`/`accept*` — where the process listens, never a place it reaches; ⟨0.29⟩
3495/// `is_net_binding`), use-verbs on an already-connected or already-bound socket (`send`/`recv*`),
3496/// teardown and read-backs. The destination-naming remainder is `connect`, `sendto`, `sendmsg`,
3497/// `sendmmsg`, and the resolver pair `getaddrinfo`/`getnameinfo`.
3498pub const LIBC_NET_NO_DESTINATION: &[&str] = &[
3499    "socket", "setsockopt", "getsockopt", "bind", "listen", "accept", "accept4", "shutdown", "send",
3500    "recv", "recvfrom", "recvmsg", "recvmmsg", "getpeername", "getsockname", "freeaddrinfo",
3501];
3502
3503/// Whether `crate_name` is one of the three crates `classify` routes through the libc syscall tables.
3504fn is_syscall_crate(crate_name: &str) -> bool {
3505    matches!(crate_name, "libc" | "nix" | "rustix")
3506}
3507
3508/// Whether a subprocess-builder method only MODIFIES the command (`.arg`, `.env`, `.current_dir`)
3509/// rather than NAMING the program (`Command::new`, `duct::cmd`). A WHOLE-CRATE-Exec crate
3510/// (`portable_pty`, `duct`, `async_process`) classifies *every* method as `Exec`, so the
3511/// head-refinement must skip these: an arg or env-var-name literal that happened to match a head
3512/// (`.env("psql", …)`, `.arg("curl")`) would FABRICATE that effect — the §1 under-report rule. The
3513/// method is the call path's last segment.
3514pub fn is_cmd_builder_method(method: &str) -> bool {
3515    matches!(
3516        method,
3517        "arg" | "args" | "arg0" | "env" | "envs" | "env_clear" | "env_remove" | "current_dir"
3518            | "cwd" | "stdin" | "stdout" | "stderr" | "pre_exec" | "creation_flags" | "uid" | "gid"
3519            | "groups" | "process_group"
3520    )
3521}
3522
3523/// Whether a subprocess method NAMES the program (so its first string literal IS the command head to
3524/// refine): `Command::new("curl")`, `duct::cmd("curl", …)`. The head-refinement must fire ONLY here —
3525/// an ALLOWLIST, not "any method except known modifiers". A whole-crate-Exec crate classifies EVERY
3526/// method as `Exec`, so a denylist leaked NON-naming methods that aren't modifiers — a getter like
3527/// `CommandBuilder::get_env("psql")` (reading back an env-var KEY, not a program) fed `"psql"` to the
3528/// head classifier and FABRICATED `Db` (review find). Only `new`/`cmd` name a program; everything else
3529/// (modifiers, getters `get_*`, custom builder methods) keeps the bare `Exec` cliff — under-refine
3530/// (safe) rather than fabricate. `std::process::Command` is verb-precise so getters never fire `Exec`
3531/// there anyway; the allowlist makes the whole-crate-Exec crates safe too.
3532pub fn is_cmd_naming_method(method: &str) -> bool {
3533    matches!(method, "new" | "cmd")
3534}
3535
3536/// The masking guard (AS-EFF-008): a Net call whose method takes the HOST/URL as an argument is
3537/// "establishing" — a classified Net call here with no captured host literal leaves the endpoint
3538/// structurally INVISIBLE (a runtime-built host), so the surface is incomplete and the gate must fail
3539/// closed (else a benign sibling literal masks the runtime endpoint). An ALLOWLIST of connection-
3540/// establishing verbs — the SAFE direction: a USE-verb on an already-connected socket
3541/// (`stream.write`/`read`/`flush`, `socket.send`/`recv`) is NOT here, so a missing literal there (the
3542/// host was fixed at `connect`) never false-positives. **THAT LAST CLAIM WAS FALSE AND IS WITHDRAWN —
3543/// see R379 in the body: under-catching an establishing verb IS a broken gate whenever a benign sibling
3544/// literal sits in the same function, which is the exact scenario the first sentence names.** The list is
3545/// now an ALLOWLIST still — see the R379 body below: the denylist inversion was BUILT, A/B'd over
3546/// 1,545 crates and REFUSED (544 rows over-masked). An earlier draft of this line said "now a
3547/// DENYLIST", which was a leftover from the rejected cut and asserted the opposite of the code it
3548/// sits on — the comment-asserting-safety shape this register records. The arg is the method (path's
3549/// last segment).
3550pub fn is_net_establishing(method: &str) -> bool {
3551    // SOUNDNESS R379 — the DNS RESOLVER verbs were missing, and their absence was a GATE BYPASS.
3552    //
3553    // `classify` (see the `hickory_resolver` arm) already maps `::lookup_ip`, `::lookup` and any
3554    // `*_lookup` to `Net`, and asserts it. This list did not, so a `Net` call whose host is a runtime
3555    // value was never marked `incomplete` and a benign sibling literal certified it. Measured against
3556    // real hickory-resolver 0.26.2, on a fixture that builds clean:
3557    //
3558    //     pub async fn masked(r: &Resolver<TokioRuntimeProvider>, host: &str) {
3559    //         let _ = r.lookup_ip("good.example.com").await;   // the benign literal
3560    //         let _ = r.lookup_ip(host).await;                 // the runtime target
3561    //     }
3562    //
3563    // reported `hosts:['good.example.com'] incomplete:NONE`, and `allow Net good.example.com` exited
3564    // **0** over a DNS resolution of a caller-controlled hostname. `TcpStream::connect(host)` — one
3565    // verb over, same fixture — marked `incomplete:['Net']` and failed closed. The mechanism was
3566    // sound; only the enumeration was short.
3567    //
3568    // THE DOC ABOVE USED TO CLAIM under-catching here is "a missed mask (sound-with-disclosure), never
3569    // a broken gate". That is false and is withdrawn: it is a broken gate whenever a benign sibling
3570    // literal shares the function, which is the scenario the guard's own first sentence names.
3571    //
3572    // **AND IT STAYS AN ALLOWLIST, WHICH IS NOT THE FAMILY'S USUAL DIRECTION — the exception is
3573    // measured and it is the same one `is_cmd_naming_method` states two doc-blocks up.** Inverting to
3574    // a denylist of use-verbs was built and A/B'd over all 1,545 registry crates: **544 rows gained
3575    // `incomplete` and none lost it**, because a WHOLE-CRATE-Net crate classifies EVERY method as Net,
3576    // so a denylist masks essentially everything in one — `cap-std` 66 rows, `hickory-net` 44. The
3577    // triggers it added were conversions, accessors and combinators (`into` 24, `from_std` 20,
3578    // `as_socket` 15, `setsockopt` 32, `map_err` 7, `ok` 5, `try_clone` 4) — none of which hides a
3579    // host. Worse, it masked **`bind` (31)**, which this very file has `is_net_binding` to exclude
3580    // because a bind address is where the process LISTENS, never a destination it reaches. So here the
3581    // allowlist is the precise side and the denylist is the leaky one, exactly as recorded for Exec.
3582    //
3583    // The resolver family is written out rather than the one spelling in hand (R346): `_lookup`
3584    // catches `reverse_lookup`/`srv_lookup`/`mx_lookup`/`txt_lookup`/`ipv4_lookup`/`ipv6_lookup` and
3585    // the rest of the record-type verbs in one test, mirroring `classify`'s own `ends_with("_lookup")`.
3586    method.ends_with("_lookup")
3587        || matches!(
3588            method,
3589            "connect"
3590                | "connect_timeout"
3591                | "get"
3592                | "post"
3593                | "put"
3594                | "patch"
3595                | "delete"
3596                | "head"
3597                | "request"
3598                | "send_to"
3599                | "lookup_host"
3600                | "to_socket_addrs"
3601                // R379 — the DNS resolver verbs `classify` already calls Net.
3602                | "lookup"
3603                | "lookup_ip"
3604                | "resolve"
3605        )
3606}
3607
3608/// ⟨0.29⟩ The Net verbs whose LOCATOR is at argument **1**, not 0 — the rust analogue of candor-ts's
3609/// `NET_URL_ARG1_MEMBERS`.
3610///
3611/// **A REGRESSION FOUND IN REVIEW, and the direction matters.** The positional-literal rung replaced
3612/// `first_str_lit` ("the first string literal ANYWHERE in the call") with `positional_str_lit(args, 0)`
3613/// as the UNIVERSAL default. That is right for `Fs`/`Db`/`Exec`, whose locator is always argument 0 —
3614/// but `is_net_establishing` already listed two verbs whose locator is not: `reqwest::Client::request`
3615/// takes `(Method, url)` and `UdpSocket::send_to` takes `(buf, addr)`. MEASURED after the swap:
3616/// `c.request(Method::GET, "https://api.example.com/v1")` published NO `hosts` at all and could not be
3617/// certified, while `c.get("https://api.example.com/v1")` certified normally.
3618///
3619/// ⟨0.29⟩ MEASURED FOR `request` ONLY. `send_to` is a METHOD on a receiver the STABLE syntactic backend
3620/// does not type, so `s.send_to(buf, "203.0.113.9:53")` is not classified at all there and its arg-1
3621/// literal is still uncaptured on the floor; the position is right and the deep engine can use it. Said
3622/// plainly because the first version of this fix's changelog listed both verbs as measured.
3623///
3624/// The direction is SAFE — an uncaptured locator fails closed, it never certifies something invisible —
3625/// which is exactly why it needed a review to find: the gate stayed sound and quietly stopped being
3626/// USABLE for a common shape. candor-ts avoided this by making its resolver verb-aware in the same rung;
3627/// this is that discipline arriving one engine late.
3628pub fn is_net_host_arg1(method: &str) -> bool {
3629    matches!(method, "request" | "send_to")
3630}
3631
3632/// ⟨0.29⟩ / ⟨0.40⟩ A LOCAL BIND/LISTEN VERB — the address it names is where the process LISTENS, never a
3633/// destination it reaches (SPEC §2 ⟨0.40⟩ *A BIND OR LISTEN ADDRESS IS WHERE THE PROCESS LISTENS*, PART 96
3634/// `a_litbind`). Its literal never enters `hosts`.
3635///
3636/// **MEASURED, and it is a false all-clear rather than a naming quibble.** `UdpSocket::bind("0.0.0.0:0")`
3637/// put `0.0.0.0:0` into `hosts`, the DESTINATION surface `allow Net` gates on (§2), and — because a
3638/// literal had been captured — nothing marked the surface incomplete. So:
3639///
3640/// ```text
3641/// let s = UdpSocket::bind("0.0.0.0:0")?;   // local
3642/// s.send_to(b"secrets", dst);              // destination is a RUNTIME value
3643/// allow Net 0.0.0.0   ->   policy ✓, exit 0
3644/// ```
3645///
3646/// A local listen address certified a send to an endpoint nobody can see. That is the masking evasion
3647/// AS-EFF-008 exists to close, reached through a verb whose literal is not a destination at all.
3648///
3649/// **A BIND MARKS NOTHING** (⟨0.40⟩). This doc used to say *"A BIND CANNOT BE CERTIFIED, EVER, which is
3650/// why this marks the surface incomplete"*, and that has been false since `16fb46f` dropped the hedge:
3651/// neither rust engine marks a bind, and both only withhold its literal. ⟨0.40⟩ makes the withholding the
3652/// rule — an ephemeral client's own `send_to`/`connect` carries its locator under `is_net_establishing`,
3653/// so hedging the bind as well made every UDP client uncertifiable while adding nothing a gate could use;
3654/// and a bind with nothing beside it still fails `allow Net` closed on its EMPTY literal surface. The
3655/// half of the old sentence that WAS right — *a server that binds and accepts talks to whoever connects*
3656/// — belongs to the ACCEPT, not the bind, and lives in `is_net_accepting`, which is why `accept` and
3657/// `incoming` are no longer members here.
3658pub fn is_net_binding(method: &str) -> bool {
3659    matches!(method, "bind" | "listen" | "bind_to_device")
3660}
3661
3662/// ⟨0.40⟩ A CALL THAT ACCEPTS CONNECTIONS — its peers are chosen by whoever connects, so no literal can name
3663/// them, and the unit's `Net` surface is INCOMPLETE (SPEC §2 ⟨0.40⟩ *A UNIT THAT ACCEPTS A CONNECTION …*,
3664/// AS-EFF-008, SEMANTICS §6 `masked_Net`; PART 96 `c_accept`). Both rust engines mark `incomplete` on a
3665/// `Net`-classified call this answers, WHETHER OR NOT a literal was captured (a server bootstrap's literal is
3666/// a LISTEN address, withheld like a bind's), and contribute no `hosts` entry for it.
3667///
3668/// **SOUNDNESS R817 — `accept`/`incoming` WERE MEMBERS OF `is_net_binding`, WHICH WITHHOLDS AND NEVER
3669/// MARKS**, so they were read exactly like a use-verb. `pub fn f(l: &TcpListener) { let _ =
3670/// TcpStream::connect("ok.example:80"); if let Ok((mut s, _)) = l.accept() { s.write_all(b"hi") } }`
3671/// reported `hosts: ["ok.example:80"]`, no `incomplete`, and `allow Net in f ok.example` exited **0** over a
3672/// server writing to whoever connected — EXECUTED: a client on 127.0.0.1 received the bytes.
3673///
3674/// The membership, by spelling (`path` is the resolved call path, `leaf` its last segment):
3675///   * `accept`, `accept4` (libc/nix/rustix), `poll_accept` (tokio's poll form), `incoming` and
3676///     `into_incoming` (std's iterator forms) — exact LEAF. `accept_bi`/`accept_uni` (quinn) are NOT here:
3677///     they accept a STREAM on a connection whose peer was already fixed by the endpoint's `accept`.
3678///   * tonic's `Router::serve`/`Router::serve_with_shutdown` and `TcpIncoming::new`, the server bootstraps
3679///     `classify` already charges `Net` — each binds a listener and begins accepting on it (classify's own
3680///     tonic arm cites the source lines). By PATH, because `serve`/`new` are not accept verbs anywhere else.
3681///
3682/// A wrong `true` over-masks and fails CLOSED, saying so; a wrong `false` is the benign-sibling-literal
3683/// bypass this row closed. An exact `accept` leaf also matches a TLS/WebSocket acceptor wrapping a stream
3684/// that was already accepted (`TlsAcceptor::accept(stream)`, `tungstenite::accept`) — whose peer is likewise
3685/// whoever connected, so the mark is redundant there, never false.
3686pub fn is_net_accepting(path: &str, leaf: &str) -> bool {
3687    matches!(leaf, "accept" | "accept4" | "poll_accept" | "incoming" | "into_incoming")
3688        || (path.starts_with("tonic::")
3689            && (path.ends_with("::Router::serve")
3690                || path.ends_with("::Router::serve_with_shutdown")
3691                || path.ends_with("::TcpIncoming::new")))
3692}
3693
3694/// The masking guard (AS-EFF-008), the `Fs` analog of `is_net_establishing`: whether an `Fs`-classified
3695/// call takes the filesystem PATH as a string argument (so a missing literal leaves the path
3696/// structurally INVISIBLE — a runtime-built path — and the surface is incomplete, fail-closed). An
3697/// ALLOWLIST of the path-NAMING free functions / constructors (`fs::write`/`read`/`File::open`/…), the
3698/// SAFE direction: a path-stat METHOD whose path is the RECEIVER (`p.metadata()`, `p.exists()`) is
3699/// invoked method-form and the caller gates on `!is_method`, so this never sees it; an op on an
3700/// already-opened handle (`file.write_all`, `mmap.flush`, `tempfile()` — a random name, no path arg)
3701/// is not here, so a missing literal there never false-positives. Under-catching an unusual
3702/// path-naming fn is a missed mask (sound-with-disclosure), ~~never a broken gate~~ — **AND THAT LAST
3703/// CLAUSE IS FALSE. SOUNDNESS R399.** R379 withdrew this exact sentence from `is_net_establishing` after
3704/// MEASURING it wrong, and R383 and R386 are counter-examples on this guard and its Db sibling: an
3705/// unlisted path-taking call contributes no locator, nothing marks the surface incomplete, and a benign
3706/// sibling literal then CERTIFIES the invisible destination — `allow Fs /etc/hostname` exit 0 over
3707/// `unixfs::chown(caller, …)`, with the control (`OpenOptions::open(caller)`) exiting 1. The sentence
3708/// survived here only because nobody re-read it after R379, and it is what licenses leaving the list
3709/// short. Under-catching is a BROKEN GATE, not a missed mask. The arg is the
3710/// method/fn leaf (the path's last segment).
3711pub fn is_fs_path_arg(leaf: &str) -> bool {
3712    matches!(
3713        leaf,
3714        // SOUNDNESS R399 — the POSIX ownership/root verbs take a path as argument 0 and were absent, so a
3715        // benign sibling literal certified them: `allow Fs /etc/hostname` exit 0 over
3716        // `unixfs::chown(caller, …)`, control `OpenOptions::open(caller)` exit 1. `std::os::unix::fs`.
3717        "chown"
3718            | "lchown"
3719            | "chroot"
3720        // std::fs / tokio::fs / async_std::fs / fs_err free functions taking a path argument
3721            | "write"
3722            | "read"
3723            | "read_to_string"
3724            | "read_dir"
3725            | "read_link"
3726            | "copy"
3727            | "rename"
3728            | "remove_file"
3729            | "remove_dir"
3730            | "remove_dir_all"
3731            | "create_dir"
3732            | "create_dir_all"
3733            | "hard_link"
3734            | "soft_link"
3735            | "symlink"
3736            | "symlink_file"
3737            | "symlink_dir"
3738            | "symlink_metadata"
3739            | "canonicalize"
3740            | "metadata"
3741            | "set_permissions"
3742            | "exists"
3743            | "try_exists"
3744            // File / OpenOptions constructors taking a path argument
3745            | "open"
3746            | "create"
3747            | "create_new"
3748    )
3749}
3750
3751/// SOUNDNESS R334 — IS THIS PATH SEGMENT THE OS ENTROPY SOURCE ITSELF (as a VALUE, not a verb)?
3752///
3753/// **THE DEFECT THIS EXISTS FOR.** Every entropy rule in the `rand` block keys on the CALLEE — a verb
3754/// (`from_os_rng`, `next_u32`, `fill_bytes`) or the source type in RECEIVER position
3755/// (`contains("OsRng")`/`contains("SysRng")`, R320). The idiomatic way to seed a userspace CSPRNG from
3756/// the OS puts the source in ARGUMENT position, where neither key can see it. Executed, one fixture,
3757/// four rows:
3758///
3759/// ```text
3760/// StdRng::try_from_rng(&mut SysRng)   ABSENT   quinn-proto-0.11.17 endpoint.rs:81
3761/// StdRng::from_rng(&mut OsRng)        ABSENT   the same hole in the OLD spelling
3762/// StdRng::from_seed([0u8; 32])        ABSENT   correct — deterministic, and the control
3763/// StdRng::from_os_rng()               ['Rand'] the verb form
3764/// ```
3765///
3766/// Both spellings, so this is NOT a rename residual and predates R320 — whose "stale `OsRng` clause"
3767/// framing would have sent the audit straight past it.
3768///
3769/// **WHY THE ARGUMENT AND NOT THE VERB.** `from_rng`/`try_from_rng` cannot simply be charged: their
3770/// effect is decided by what is passed to them, `from_rng(&mut pcg)` is deterministic, and there are
3771/// 802 `from_seed`/`seed_from_u64` call sites in this machine's registry cache — the deterministic
3772/// population is the larger one. Charging the verb is R330's mistake one crate over. The discriminator
3773/// is the ARGUMENT, so that is what is read.
3774///
3775/// **THE OVER-APPROXIMATION IS DELIBERATE AND STATED.** Naming one of these types as a VALUE is charged
3776/// wherever it appears in an argument list, including moves that do not themselves draw (`Some(OsRng)`,
3777/// `Box::new(SysRng)`). That is sound and it is also the ONLY place candor can see it: a source handed
3778/// off into a struct field is drawn from in some later function whose own call list never mentions it.
3779/// A user type coincidentally named `OsRng` would be charged too — an over-report, the safe direction,
3780/// and cheaper than the silence it replaces.
3781pub fn is_entropy_source_ident(seg: &str) -> bool {
3782    matches!(seg, "OsRng" | "SysRng")
3783}
3784
3785/// SOUNDNESS R338 — DOES THIS CALL ALSO READ THE SYSTEM TRUST STORE? A SECOND effect, not a
3786/// replacement for the one `classify` returns.
3787///
3788/// **THE DEFECT.** candor charges `native_tls::TlsConnector::new` `Fs` because on the openssl backend
3789/// it loads the probed cert file/dir from disk. Several calibrated crates construct that connector
3790/// INSIDE a public entry point, so the consumer's call discloses the transport effect and drops the
3791/// `Fs` — `tungstenite::client_tls` reports `['Net']`, and `deny Fs` passes over a real trust-store
3792/// read. `wrap_stream` does `tls_connector.map_or_else(TlsConnector::new, Ok)`
3793/// (`tungstenite-0.30.0/src/tls.rs:54`), so a caller supplying no connector gets `TlsConnector::new()`.
3794/// (The row the coverage gate nominated — `tungstenite::tls::encryption::native_tls::wrap_stream` — is
3795/// unreachable from outside: `mod tls;` is private at `lib.rs:32`. The reachable form is one level up.)
3796///
3797/// **WHY THIS IS SO SHORT: the sweep found four more crates and every one was PRICED AND REJECTED,
3798/// which is the deliverable rather than a gap.** Callers of `native_tls::TlsConnector::new` in the
3799/// local registry are redis, tungstenite, ureq, minreq and tokio-websockets.
3800///   - `minreq`, `tokio_websockets` — NOT calibrated, so their calls already disclose rather than
3801///     claim purity. No rule can improve them.
3802///   - `redis` — `ActualConnection::new` (`redis-1.6.0/src/connection.rs:932`) constructs it only for a
3803///     `rediss://` address, and the consumer-visible verb is `Client::get_connection`. Charging that
3804///     `Fs` would fabricate on every PLAIN redis user, which is the majority. Rejected on the trade.
3805///   - `ureq` — `agent.rs:265` takes `crate::default_tls_config()`, and ureq's default features are
3806///     `["tls", "gzip"]`: `native-certs` is OFF, so the default build resolves to
3807///     `rtls::root_certs()`'s `#[cfg(not(feature = "native-certs"))]` arm, which is
3808///     `webpki_roots::TLS_SERVER_ROOTS` — COMPILED IN, no disk read (`ureq-2.12.1/src/rtls.rs:82`).
3809///     Charging it would fabricate on the default build. Rejected on the evidence.
3810///
3811/// What is left is tungstenite's two explicitly-TLS-named entry points, where no caller is
3812/// over-charged: `client_tls` passes `None` for the connector unconditionally, and
3813/// `client_tls_with_config`'s callers are by definition doing TLS. **`tungstenite::connect` is a stated
3814/// residual, not an oversight** — it serves `ws://` and `wss://` alike, so charging it would hit real
3815/// plain-WebSocket users; the scheme is often a string literal candor already captures in `str_arg`,
3816/// which is the shape a future fix should use rather than a blanket charge.
3817pub fn reads_trust_store(crate_name: &str, path: &str) -> bool {
3818    crate_name == "tungstenite"
3819        && (path.ends_with("::client_tls") || path.ends_with("::client_tls_with_config"))
3820}
3821
3822/// SOUNDNESS R330 — IS THIS `hash_password` CALL PROVABLY THE EXPLICIT-SALT ONE (password-hash 0.5.x)?
3823///
3824/// **THE DEFECT THIS EXISTS FOR, and it was mine, introduced by R318's fix the previous day.** R318
3825/// correctly found that `hash_password` mints OS entropy — at password-hash **0.6.x**, where
3826/// `fn hash_password(&self, password)` (`lib.rs:107`) has the body `let salt = try_generate_salt()?;`.
3827/// At **0.5.0** (`traits.rs:33`) and argon2 **0.5.3** (`lib.rs:572`) the identical name is
3828/// `fn hash_password(&self, password, salt)`: the caller supplies the salt and the call is deterministic
3829/// recomputation — PURE. So the `ends_with`-not-`contains` guard R318 relied on was keyed on the 0.6.x
3830/// name, and at 0.5.x the explicit-salt call IS named `hash_password`. Measured: two calls with the same
3831/// stored salt produce byte-identical hashes, and all four 0.5.x spellings were charged `Rand`.
3832///
3833/// **Why arity and not the resolved version.** R330's remedy offered both. The version is only knowable
3834/// where a lockfile resolves, and `calibration_exceeded` is ONE-SIDED — it fires when resolved > ceiling,
3835/// so it can never see a rule that mis-describes an OLDER release, which is exactly this direction. The
3836/// arity is written at the call site, needs no lockfile, and distinguishes the two signatures exactly.
3837///
3838/// **The direction is stated so it cannot drift:** this returns true only for the shape it can PROVE is
3839/// explicit-salt. An unrecorded arity (`argc == 0`, every synthesized edge and every pre-R330 cache
3840/// entry) returns false and the call stays charged. Narrowing a sound over-approximation by DENYLIST,
3841/// never by allowlist — the family rule.
3842pub fn password_hash_explicit_salt(crate_name: &str, path: &str, argc: u8, method: bool) -> bool {
3843    if !matches!(crate_name, "argon2" | "scrypt" | "pbkdf2" | "password_hash")
3844        || !path.ends_with("::hash_password")
3845    {
3846        return false;
3847    }
3848    if argc == 0 {
3849        return false; // NOT RECORDED — see `Call::argc`. Unknown charges.
3850    }
3851    // `syn` hands a method call its args WITHOUT the receiver and a UFCS `Trait::method(&recv, ..)`
3852    // WITH it, so normalize to the non-receiver count before comparing: 0.5.x is `(password, salt)` = 2,
3853    // 0.6.x is `(password)` = 1.
3854    let non_receiver = if method { argc } else { argc - 1 };
3855    let hit = non_receiver == 2;
3856    // §E1 HIT COUNTER, the `CANDOR_ALIAS_DEBUG` pattern. A refinement that narrows a charge must be
3857    // able to prove it REACHED real code, because "nothing moved" and "the branch never ran" print the
3858    // same corpus A/B. This is what `bin/corpus-ab.py --mark` counts.
3859    if hit && std::env::var("CANDOR_ALIAS_DEBUG").is_ok() {
3860        eprintln!("R330EXPLICITSALT {path} argc={argc} method={method}");
3861    }
3862    hit
3863}
3864
3865/// ⟨0.29⟩ HOW MANY LEADING ARGUMENTS OF AN `Fs` PATH-TAKING CALL ARE PATHS.
3866///
3867/// **THE DEFECT THIS EXISTS FOR.** The literal harvester took the first string literal found ANYWHERE in
3868/// the argument list, so `fs::write(user_path, "/tmp/lit")` published `paths: ["/tmp/lit"]` — the BYTES
3869/// BEING WRITTEN — as the destination surface, and `allow Fs /tmp/lit` certified a write to an
3870/// attacker-controlled path at exit 0. Measured on candor-scan and candor-ts; candor-java and
3871/// candor-swift read the path POSITION and fail closed correctly. Removing the sibling literal made the
3872/// same call fail closed, which is what identified the mechanism: any literal in the call, in any
3873/// position, defeated the runtime-path incompleteness marker.
3874///
3875/// So the surface is read from the PATH POSITIONS and nowhere else, and every one of them must be a
3876/// literal for the surface to be complete. Two-path operations are the reason this is an arity and not a
3877/// boolean: `fs::copy("/safe", user_path)` has a literal at position 0 and still writes somewhere
3878/// nobody can see, so requiring only position 0 would leave the identical hole one argument along.
3879pub fn fs_path_arity(leaf: &str) -> usize {
3880    match leaf {
3881        "copy" | "rename" | "hard_link" | "soft_link" | "symlink" | "symlink_file" | "symlink_dir" => 2,
3882        _ => 1,
3883    }
3884}
3885
3886/// SOUNDNESS R383 — THE METHOD FORMS WHOSE PATH IS AN ARGUMENT, not the receiver.
3887///
3888/// `scan.rs`'s Fs masking arm reads `!c.method && is_fs_path_arg(leaf)`. The `!c.method` gate exists for
3889/// a real reason — the path-STAT methods (`p.metadata()`, `p.exists()`) carry the path as the RECEIVER,
3890/// so masking them would be wrong — but it excluded EVERY method form, and `OpenOptions::open(path)` is
3891/// a method whose path IS the argument. Measured, with the instrument calibrated first: a function doing
3892/// `File::open("/etc/hostname")` beside `OpenOptions::new().read(true).open(caller_path)` reported
3893/// `paths:['/etc/hostname'] incomplete:NONE`; `deny Fs` exited 1 and **`allow Fs /etc/hostname` exited
3894/// 0** — a policy saying "only /etc/hostname" going green over a caller-supplied path. The FREE-fn
3895/// spelling of the same call is the isolating control: it marks incomplete and fails closed.
3896///
3897/// **`argc` does not discriminate; the RECEIVER TYPE does.** Instrumented, the four shapes are
3898/// `OpenOptions::open` (argc 1, path IS the arg), `File::read_to_string` and `File::write` (argc 1,
3899/// BUFFER arg) and `Path::exists` (argc 0, path is the receiver).
3900///
3901/// **The family is from a 1,545-crate sweep, not from the one spelling that was found (R346):** the only
3902/// path-taking METHOD pairs in the registry are `OpenOptions::open` (69 std + 2 tokio + 9
3903/// `cap_primitives`) and `DirBuilder::create` (5 std + tokio). Every other method on those same receivers
3904/// is a builder modifier (`read`/`write`/`truncate`/`mode`) or a combinator (`map`/`map_err`/`or_else`/
3905/// `with_context`), and `std::fs::File`'s 267 method hits are all use-verbs whose path was fixed at open.
3906///
3907/// Matched on the TAIL of the resolved call path, so std, tokio, `cap_primitives` and `fs_err` are all
3908/// covered by one rule without naming a crate. **Stays an ALLOWLIST:** R379 built the denylist inversion
3909/// for the Net twin and the corpus refused it, and here a denylist over method forms would mask all 267
3910/// `File` use-verbs and every combinator on a whole-crate-Fs receiver.
3911///
3912/// **SOUNDNESS R417 — THE CAPABILITY-`Dir` FAMILY WAS ABSENT, AND IT IS A LIVE GATE BYPASS.**
3913/// `cap_std::fs::Dir` (and its `fs_utf8`/`cap_async_std` twins, and `openat::Dir`) is a whole second
3914/// filesystem API whose path is an ARGUMENT to a METHOD on a directory handle — `d.write(caller, …)`,
3915/// `d.open(caller)`, `d.remove_file(caller)`. MEASURED, with the free-fn spelling as the isolating
3916/// control in the same fixture:
3917///
3918/// ```text
3919/// control(caller)  std::fs::write("/tmp/benign",…); std::fs::write(caller,…)
3920///                  → paths:['/tmp/benign'] incomplete:['Fs']   allow Fs /tmp/benign → exit 1  ✔
3921/// mixed(d,caller)  std::fs::write("/tmp/benign",…); d.write(caller,…)
3922///                  → paths:['/tmp/benign'] incomplete:NONE     allow Fs /tmp/benign → exit 0  ✘
3923/// ```
3924///
3925/// The call path resolves in full (`cap_std::fs::Dir::write`), so this is not a resolution gap — the
3926/// guard simply had two names in it. `alone(d,caller)` confirms the call IS classified `Fs`: the
3927/// effect was seen, the locator was not, and nothing said so.
3928///
3929/// **WHY THIS HALF IS A DENYLIST WHILE THE REST OF THE GUARD IS AN ALLOWLIST**, which is not a
3930/// contradiction but the point: the allowlist above exists because the receiver is UNKNOWN, so masking
3931/// by default would swallow `File`'s 267 use-verbs. Here the receiver is KNOWN to be a directory
3932/// capability, and on that receiver essentially every method names a path — 24 of the 49 declared on
3933/// `cap_std::fs::Dir` are already `is_fs_path_arg` leaves, and most of the remaining 25 (`open_with`,
3934/// `open_dir`, `is_file`, `is_dir`, `symlink_contents`, `read_link_contents`, `create_dir_with`,
3935/// the `bind_unix_*`/`connect_unix_*` socket-path verbs) take one too. An allowlist here would be the
3936/// R346→R348 hand-list vein by construction: every name I failed to write down is a silent bypass, and
3937/// R399 settled that an under-catch on this guard is a BROKEN GATE, not a missed mask.
3938///
3939/// So the default on a `Dir` receiver is MASK, and the exceptions are the handful of methods that
3940/// provably take no path: handle-to-handle conversions and the iterator/`self`-only verbs. Being wrong
3941/// about one of those costs an over-mask on a rare API (fails CLOSED, disclosed); being wrong the other
3942/// way is the exit-0 above. [[candor-denylist-over-allowlist]] — say which direction it fails in first.
3943///
3944/// Scoped on the RECEIVER SEGMENT being exactly `Dir`, so `cap_std`, `cap_std::fs_utf8`,
3945/// `cap_async_std` and `openat` are covered by one rule without naming a crate — the same tail-matching
3946/// discipline as the two names above. A non-filesystem type that happens to be called `Dir` would be
3947/// over-masked, which fails closed.
3948/// SOUNDNESS R414 / SPEC ⟨0.37⟩ — **a RECEIVER-form path stat names its destination, and every engine
3949/// in this family was silent on it.** `p.exists()`, `p.metadata()`, `p.canonicalize()` reach the
3950/// filesystem against the path they are invoked ON; the locator is the RECEIVER, not an argument.
3951/// MEASURED before the clause was written, one variable, a benign allowed literal beside a
3952/// caller-chosen path:
3953///
3954/// ```text
3955/// fn f(p: &Path) { fs::write("/tmp/benign", b"x"); p.exists(); }
3956///   -> paths:['/tmp/benign'] incomplete:NONE   allow Fs /tmp/benign -> exit 0, "nothing hidden"
3957/// ```
3958///
3959/// The ARGUMENT spelling of the identical reach (`fs::metadata(p)`) was already marked, which is what
3960/// makes this a drift rather than a policy: `is_fs_path_arg` deliberately excluded the method form
3961/// because its receiver was assumed to be an OPEN HANDLE. That assumption holds for `File` and is
3962/// false for `Path` — a `Path` is a path VALUE, and a stat on it is `Fs` reaching that value.
3963///
3964/// **NO CARVE-OUT LIST, and that is structural rather than lucky.** The pure `Path` algebra —
3965/// `join`, `parent`, `file_name`, `extension`, `to_str`, `display`, `starts_with`, `to_path_buf`,
3966/// `as_path` — is NOT classified `Fs` (measured: a function calling all nine reports `fs:['write']`
3967/// from an unrelated sibling call and nothing else), so it never reaches the branch that consults
3968/// this predicate. The carve-out falls out of the classification, exactly as it does on the java
3969/// side, instead of being a list that must be kept in sync with `std`.
3970///
3971/// Matched on the RECEIVER SEGMENT so `std::path` and the `camino` mirrors are covered by one rule
3972/// without naming a crate. Being generous here is the SAFE direction: the predicate is only ever
3973/// consulted for a call the classifier ALREADY resolved to `Fs`, so an extra receiver name can at
3974/// worst over-mask (fails closed, disclosed), while a missing one is the exit-0 above — R399's
3975/// ruling that an under-catch on a masking guard is a broken gate, not a missed mask.
3976pub fn is_fs_receiver_locator(call_path: &str) -> bool {
3977    let mut segs = call_path.rsplit("::");
3978    let (Some(_leaf), Some(recv)) = (segs.next(), segs.next()) else { return false };
3979    matches!(recv, "Path" | "PathBuf" | "Utf8Path" | "Utf8PathBuf")
3980}
3981
3982/// SOUNDNESS R460 / SPEC ⟨0.37⟩ — **the Exec twin of `is_fs_receiver_locator`: a spawn's locator is
3983/// its RECEIVER, and rust was silent on it.** `is_cmd_naming_method` marks the surface incomplete at
3984/// `Command::new(<runtime value>)`, which covers every spelling that NAMES the program inside the
3985/// function. It cannot cover the spelling that names it somewhere else:
3986///
3987/// ```text
3988/// fn masked(cmd: &mut Command) { Command::new("git").status(); cmd.spawn(); }
3989///   -> cmds:['git'] incomplete:NONE   allow Exec git -> exit 0, "nothing hidden"
3990/// ```
3991///
3992/// MEASURED on the pre-fix binary, one variable — deleting the benign `Command::new("git")` line, and
3993/// nothing else, turns the same gate to exit 1. The real instance is tokio's own
3994/// `process::unix::spawn_child(cmd: &mut std::process::Command) { cmd.spawn()? }`, production source,
3995/// charged `Exec` with no `cmds` and no `incomplete`.
3996///
3997/// **A DENYLIST, and the direction is the point.** On a `Command` receiver essentially every method
3998/// that is not a documented BUILDER modifier reaches the boundary (`spawn`, `status`, `output`, `exec`,
3999/// and every async / pty mirror of them), so an allowlist of terminal names would be the R346→R348
4000/// hand-list vein by construction: each name not written down is a silent bypass. The carve-out is
4001/// `is_cmd_builder_method` — the SAME list the head-refinement already trusts, not a second copy of it
4002/// (§G, ask the authority) — plus the `get_*` getters that list's own doc-block names. Being wrong
4003/// about a carve-out costs an over-mask on a configure-only call (fails closed, disclosed); being
4004/// wrong the other way is the exit-0 above.
4005///
4006/// Scoped on the RECEIVER SEGMENT being exactly `Command`, so `std::process`, `tokio::process`,
4007/// `async_process` and the `std::os::unix` extension trait are one rule without naming a crate — the
4008/// same tail-matching discipline as `is_fs_receiver_locator`. The predicate is only ever consulted for
4009/// a call the classifier ALREADY resolved to `Exec`, so a non-spawning type that happens to be called
4010/// `Command` (clap's builder) is unreachable unless something already charged it Exec.
4011///
4012/// The DETERMINED receiver does not arrive here: the collector resolves a builder chain rooted at
4013/// `Command::new("git")` — inline or through a `let` binding — into `str_arg`, so only a receiver whose
4014/// program was never named in this function reaches the mask. That split is this fix's over-charge
4015/// control, and it is what keeps the dominant spelling certifiable.
4016pub fn is_exec_receiver_locator(call_path: &str) -> bool {
4017    let mut segs = call_path.rsplit("::");
4018    let (Some(leaf), Some(recv)) = (segs.next(), segs.next()) else { return false };
4019    // SOUNDNESS R808 — AND ITS EXTENSION TRAIT. The deep engine resolves `cmd.exec()` to the TRAIT method
4020    // `std::os::unix::process::CommandExt::exec`, not to `Command::exec`, so a receiver test on the
4021    // literal segment `Command` let the deep engine certify a caller-supplied `exec` while `candor-scan`
4022    // (which forms `Command::exec` from the typed receiver) flagged it — the R808 port's own boundary,
4023    // measured on the port's fixture one method over. `CommandExt`'s other members (`uid`, `gid`,
4024    // `groups`, `pre_exec`, `arg0`, `process_group`) are already `is_cmd_builder_method` carve-outs.
4025    matches!(recv, "Command" | "CommandExt") && !is_cmd_builder_method(leaf) && !leaf.starts_with("get_")
4026}
4027
4028pub fn is_fs_path_arg_method(call_path: &str) -> bool {
4029    if call_path.ends_with("OpenOptions::open") || call_path.ends_with("DirBuilder::create") {
4030        return true;
4031    }
4032    let mut segs = call_path.rsplit("::");
4033    let (Some(leaf), Some(recv)) = (segs.next(), segs.next()) else { return false };
4034    if recv != "Dir" {
4035        return false;
4036    }
4037    // The no-path exceptions on a directory capability: handle↔handle conversions, the entry
4038    // iterators, and the verbs whose only operand is `self`. Everything else on a `Dir` names a path.
4039    //
4040    // EVERY NAME HERE WAS CHECKED AGAINST ITS SIGNATURE, because a wrong entry here is not a precision
4041    // loss, it is the exit-0 above. `read_dir` was in this list on the first cut on the reasonable-
4042    // sounding grounds that `entries()` is the self-only form — and `cap_std::fs::Dir::read_dir` is
4043    // `fn read_dir<P: AsRef<Path>>(&self, path: P)`, so that entry was a bypass I had just written.
4044    // Adding a name here requires reading its signature, not recognising it.
4045    !matches!(
4046        leaf,
4047        "try_clone"
4048            | "into_std_file"
4049            | "from_std_file"
4050            | "into_std"
4051            | "from_std"
4052            | "entries"
4053            | "entries_utf8"
4054            | "dir_metadata"
4055            | "reopen_dir"
4056            | "remove_open_dir"
4057            | "remove_open_dir_all"
4058            | "open_parent_dir"
4059            | "rewind"
4060            | "as_raw_fd"
4061            | "as_fd"
4062    )
4063}
4064
4065/// The masking guard (AS-EFF-008), the `Db` analog of `is_net_establishing`: whether a `Db`-classified
4066/// call takes the raw SQL QUERY as a string argument (so a missing literal leaves the table
4067/// structurally INVISIBLE — a runtime-built query — and the surface is incomplete, fail-closed). An
4068/// ALLOWLIST of the SQL-string-bearing execution/prepare verbs, the SAFE direction: a
4069/// build-then-execute terminal that takes NO SQL string (sqlx/diesel/sea_orm `fetch*`/`load*`/`first`/
4070/// `all`/`one`/`stream`, the document-store `find*`/`insert*`/…), and a non-query op (`connect`/
4071/// `open`/`acquire`/`begin`/`commit`/`ping`/`get_conn`), are NOT here — their query is built
4072/// structurally (never a maskable string literal) so a missing literal must not false-positive.
4073/// Under-catching an unusual query verb is a missed mask (sound-with-disclosure), ~~never a broken
4074/// gate~~ — **FALSE, SOUNDNESS R399**, and R386 three lines below is this guard's own counter-example.
4075/// `mysql`'s `query_drop`/`query_iter` are that crate's PRIMARY API, take `Q: AsRef<str>`, and were
4076/// absent: `allow Db users` exited 0 over `c.query_drop(caller_sql)` beside one literal query, with the
4077/// verb-only control exiting 1. The arg is the method leaf (the path's last segment).
4078pub fn is_db_query_arg(leaf: &str) -> bool {
4079    // SOUNDNESS R386 — THE `sqlite3_*` C API TAKES SQL AND WAS ABSENT, so a benign sibling literal
4080    // certified arbitrary caller-supplied SQL. `classify` in this same crate maps `sqlite3_exec`/
4081    // `sqlite3_step`/`sqlite3_prepare*` to `Db`; this list had none of them, while candor-swift covers
4082    // the whole family by prefix — a cross-engine divergence, which is how it was found.
4083    //
4084    // MEASURED, calibrated first (`deny Db` exits 1): `conn.execute("INSERT INTO users (id) VALUES (1)",
4085    // [])` beside `sqlite3_exec(db, caller_sql, …)` reported `tables:['users'] incomplete:NONE` and
4086    // **`allow Db users` exited 0**. R383 recorded this gap as "REAL BUT NOT LIVE" on the grounds that a
4087    // C-string literal never reaches `tables` — true of an ISOLATED function, and the wrong shape: the
4088    // literal does not have to come from the masked call, only from the same FUNCTION.
4089    //
4090    // ONLY THE SQL-BEARING SPELLINGS. `sqlite3_step`/`_close`/`_serialize`/`_deserialize` carry no query,
4091    // and `sqlite3_open*` takes a FILENAME — masking that would claim a Db surface for an Fs locator,
4092    // which is the over-mask this allowlist exists to avoid. Direction stays an ALLOWLIST for the reason
4093    // R379 measured: a denylist over a whole-crate-Db crate masks every lifecycle verb in it.
4094    if matches!(
4095        leaf,
4096        "sqlite3_exec"
4097            | "sqlite3_prepare"
4098            | "sqlite3_prepare_v2"
4099            | "sqlite3_prepare_v3"
4100            | "sqlite3_prepare16"
4101            | "sqlite3_prepare16_v2"
4102            | "sqlite3_prepare16_v3"
4103            // R386's OWN BOUNDARY DEFECT, found by a release panel: `sqlite3_get_table(db, zSql, …)`
4104            // takes SQL as its second argument and `classify` maps it to `Db`, and the first cut of
4105            // this list — which cites R346 — omitted it. Two of the family's SQL-bearing spellings
4106            // written down out of three. Reach on the local registry is ZERO call sites (only
4107            // declarations in `libsqlite3-sys` and `sqlite-wasm-rs`), so this is latent, not live.
4108            | "sqlite3_get_table"
4109    ) {
4110        return true;
4111    }
4112    matches!(
4113        leaf,
4114        "execute"
4115            | "execute_batch"
4116            | "execute_unprepared"
4117            | "batch_execute"
4118            | "simple_query"
4119            | "query"
4120            | "query_one"
4121            | "query_opt"
4122            | "query_raw"
4123            | "query_row"
4124            | "query_map"
4125            // SOUNDNESS R399 — `mysql`'s OWN PRIMARY API was absent, and this is a live gate bypass rather
4126            // than the "missed mask" the struck sentence above promised. All four take `Q: AsRef<str>`
4127            // (`mysql-28.0.2/src/conn/queryable.rs:29,50,126`), so the SQL is a maskable string argument of
4128            // THIS call, which is the exact condition this list encodes. Measured: `allow Db users` exits 0
4129            // over `c.query_drop(caller_sql)` beside one literal query; the control, the same fixture with
4130            // the verb changed to `query`, exits 1.
4131            | "query_drop"
4132            | "query_iter"
4133            | "query_first"
4134            | "query_fold"
4135            // postgres COPY: the statement is a SQL string argument (`postgres-0.19.14/src/client.rs:492,520`).
4136            | "copy_in"
4137            | "copy_out"
4138            | "query_and_then"
4139            | "query_typed"
4140            | "query_all"
4141            | "prepare"
4142            | "prepare_typed"
4143            | "prepare_cached"
4144            | "exec"
4145            | "exec_first"
4146            | "exec_iter"
4147            | "exec_map"
4148            | "exec_fold"
4149            | "exec_drop"
4150            | "exec_batch"
4151            | "prep"
4152            | "run_command"
4153    )
4154}
4155
4156/// THE AS-EFF-008 MASKING GUARD, ONE AUTHORITY FOR BOTH RUST ENGINES. SOUNDNESS R806 / R808.
4157///
4158/// The question: this call carries a surface effect `eff` and NO literal locator was captured for it —
4159/// is its locator (host, program, path, SQL) therefore a RUNTIME value the gate cannot see? If so the
4160/// caller marks the surface `incomplete`, so a benign sibling literal cannot certify it.
4161///
4162/// **WHY ONE FUNCTION.** Both rust engines asked this question, each with its own copy of the
4163/// disjunction over the `is_*` predicates below, and the copies drifted: R460's receiver-locator arm and
4164/// R383's `OpenOptions::open` arm reached `candor-scan` and never the deep engine (R808). A rule added
4165/// here now reaches both, which is the only way this class stops recurring one crate over.
4166///
4167/// `leaf` is the call's own method/function name; `path` the resolved call path; `method` whether the
4168/// call is written in method form on a receiver (so a path-stat `p.exists()` is not mistaken for an
4169/// argument-form `fs::metadata(p)`, and the receiver-locator arms can fire). `crate_name` is the
4170/// resolved crate, used only to scope the table-derived FFI arms.
4171///
4172/// **THE DIRECTION, stated so it cannot drift:** a wrong `true` over-masks — the gate fails CLOSED and
4173/// says so; a wrong `false` is the benign-sibling-literal bypass, a broken gate (R399). Every arm that
4174/// reads a `classify` table below reads it with a NO-LOCATOR DENYLIST, so a leaf added to that table is
4175/// masked until someone reads its signature and says otherwise.
4176pub fn masks_locator(eff: &str, crate_name: &str, path: &str, leaf: &str, method: bool) -> bool {
4177    let by_list = match eff {
4178        "Net" => is_net_establishing(leaf),
4179        // SOUNDNESS R808 — the receiver arm is NOT gated on method form. `Command::spawn(cmd)` (UFCS)
4180        // runs the same caller-supplied program as `cmd.spawn()`, and with the gate BOTH engines
4181        // certified it at exit 0 on the unit and its caller. In call form the receiver is argument 0;
4182        // neither engine resolves a determined argument-0 command, so a UFCS spawn on a command built
4183        // in the same function over-masks (fails closed) — the rare spelling paying for the silent one.
4184        "Exec" => is_cmd_naming_method(leaf) || is_exec_receiver_locator(path),
4185        "Fs" => {
4186            (!method && is_fs_path_arg(leaf))
4187                || (method && is_fs_path_arg_method(path))
4188                || (method && is_fs_receiver_locator(path))
4189        }
4190        "Db" => is_db_query_arg(leaf),
4191        _ => false,
4192    };
4193    by_list || masks_locator_by_table(eff, crate_name, path, leaf)
4194}
4195
4196/// SOUNDNESS R806 — THE TABLE-DERIVED HALF OF `masks_locator`, separate only so a reach probe can ask
4197/// the very function the guard asks (`R806MASK` in candor-scan) rather than a copy of it.
4198///
4199/// Each hand list in `masks_locator` was SHORT against the `classify` table that charges the effect:
4200/// `is_fs_path_arg` held 28 names while `LIBC_FS` charges 92, `is_cmd_naming_method` held `new`/`cmd`
4201/// while `LIBC_EXEC` names `system`/`popen`/`exec*`/`posix_spawn*`, `is_net_establishing` lacked
4202/// `getaddrinfo`, and `is_db_query_arg` lacked `prepare_typed_cached` from `PG_DB_VERBS`. EXECUTED on
4203/// each: a caller's file really unlinked, a caller's shell command really run, a real resolver lookup,
4204/// all under `allow <E> in <unit> <benign literal>` at exit 0 on the unit AND its caller.
4205///
4206/// Adding the missing names would leave two tables to drift again the next time one grows — the shape
4207/// swift closed as R787 and java as R794, both by derivation. So these arms READ the charging table and
4208/// subtract a signature-checked NO-LOCATOR denylist: a leaf added to the table is masked by default.
4209pub fn masks_locator_by_table(eff: &str, crate_name: &str, path: &str, leaf: &str) -> bool {
4210    let syscall = is_syscall_crate(crate_name);
4211    match eff {
4212        "Net" => {
4213            syscall
4214                && LIBC_NET.contains(&leaf)
4215                && !LIBC_NET_NO_DESTINATION.contains(&leaf)
4216                // `rustix::net::sendmsg(socket, iov, control, flags)` takes NO address — rustix spells
4217                // the addressed forms `sendmsg_addr`/`sendmsg_v4`/`sendmsg_v6`/`sendmsg_unix` (not in
4218                // `LIBC_NET`, so unclassified). libc's and nix's `sendmsg` DO carry one (`msg_name` /
4219                // `addr: Option<&S>`), which is why this is scoped to the crate rather than the leaf.
4220                // Measured on the A/B: x11rb's `DefaultStream::do_write` over its connected X11 socket
4221                // was the only reach, an over-mask, removed here.
4222                && !(crate_name == "rustix" && leaf == "sendmsg")
4223        }
4224        "Exec" => syscall && LIBC_EXEC.contains(&leaf) && !LIBC_EXEC_NO_PROGRAM.contains(&leaf),
4225        "Fs" => syscall && LIBC_FS.contains(&leaf) && !LIBC_FS_NO_PATH.contains(&leaf),
4226        "Db" => {
4227            (matches!(crate_name, "postgres" | "tokio_postgres" | "deadpool_postgres" | "rusqlite")
4228                && PG_DB_VERBS.iter().any(|v| path.ends_with(v))
4229                && !PG_DB_VERBS_NO_SQL.iter().any(|v| path.ends_with(v)))
4230                // `sqlx_core`'s `Executor::prepare_with(sql, params)` — the one SQL-TEXT verb in that
4231                // crate's Db rule that the leaf list lacked (`prepare` is there). The rest of that rule
4232                // (`fetch*`/`execute*` on a `Query`) takes an EXECUTOR at argument 0, so deriving the
4233                // whole rule would mask every `query(lit).fetch_all(&pool)`; it is a named member
4234                // rather than a derivation for that reason.
4235                || (crate_name == "sqlx_core" && leaf == "prepare_with")
4236        }
4237        _ => false,
4238    }
4239}
4240
4241/// Map a cap-std capability *type* to the effect it authorises. Holding one of these
4242/// (e.g. `&Dir`) is the real, unforgeable right to perform that effect — so candor
4243/// treats it as a declared capability, exactly like its own `&Fs` token.
4244pub fn capstd_cap(crate_name: &str, type_name: &str) -> Option<&'static str> {
4245    if !crate_name.starts_with("cap_") {
4246        return None;
4247    }
4248    Some(match type_name {
4249        "Dir" => "Fs",
4250        "TcpListener" | "TcpStream" | "UdpSocket" | "Pool" => "Net",
4251        "UnixListener" | "UnixStream" | "UnixDatagram" => "Ipc",
4252        "SystemClock" | "MonotonicClock" => "Clock",
4253        _ => return None,
4254    })
4255}
4256
4257/// Table names a SQL string literal STATICALLY reaches — the `Db` analog of the `Net` host /
4258/// `Exec` command / `Fs` path literal surface (feeds `allow Db in <scope> <table>…`, AS-EFF-008).
4259/// Conservative by construction, because a wrong capture here would FABRICATE: the string must
4260/// open with a SQL statement keyword, and only identifiers in table position are taken —
4261/// `FROM`/`JOIN` anywhere, `INTO` anywhere, statement-leading `UPDATE`/`TRUNCATE`, and
4262/// `TABLE` (create/drop/alter), skipping `ONLY`/`IF NOT EXISTS`. `UPDATE` mid-statement is
4263/// deliberately ignored (`FOR UPDATE SKIP LOCKED` must not yield a table "skip"). A
4264/// dynamically-built query yields nothing — the gate's opaque case — never a guess.
4265/// Output is lower-cased, quote/backtick-stripped, `schema.table` kept qualified, deduped.
4266/// SPEC §2 pins this algorithm token-for-token across engines; the cross-impl vector battery
4267/// (candor-spec conformance/tables/vectors.json, run.sh Part 4b) enforces the JVM/TS mirrors.
4268pub fn tables_in_sql(sql: &str) -> Vec<String> {
4269    const STMT: &[&str] =
4270        &["select", "insert", "update", "delete", "create", "drop", "alter", "truncate", "merge", "replace", "with"];
4271    // Tokens that can FOLLOW a table-introducing keyword without being a table.
4272    const SKIP: &[&str] = &["only", "if", "not", "exists", "table"];
4273    // Identifier-position tokens that are grammar, not a table (subqueries, locking clauses…).
4274    const STOP: &[&str] = &[
4275        "select", "set", "where", "values", "on", "using", "group", "order", "by", "limit",
4276        "returning", "as", "inner", "outer", "left", "right", "cross", "lateral", "natural",
4277        "union", "all", "distinct", "case", "when", "null", "default", "skip", "nowait", "of",
4278        "from", "join", "into", "update", "delete", "insert",
4279    ];
4280    // `,` survives as its OWN token (not a space): it's what lets `FROM t1, t2` continue the table
4281    // list without fabricating from other comma-ridden positions (column lists, ON clauses).
4282    let cleaned: String = sql
4283        .to_lowercase()
4284        .chars()
4285        .flat_map(|c| match c {
4286            '(' | ')' | ';' => vec![' '],
4287            ',' => vec![' ', ',', ' '],
4288            _ => vec![c],
4289        })
4290        .collect();
4291    let toks: Vec<&str> = cleaned.split_whitespace().collect();
4292    let Some(first) = toks.first() else { return Vec::new() };
4293    if !STMT.contains(first) {
4294        return Vec::new(); // not SQL — nothing to certify, nothing fabricated
4295    }
4296    let ident = |t: &str| -> Option<String> {
4297        let t = t.trim_matches(|c| matches!(c, '"' | '`' | '\''));
4298        let mut chars = t.chars();
4299        let ok_first = chars.next().is_some_and(|c| c.is_ascii_alphabetic() || c == '_');
4300        let ok_rest = t.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '$' | '"' | '`'));
4301        (ok_first && ok_rest && !STOP.contains(&t)).then(|| t.replace(['"', '`'], ""))
4302    };
4303    let mut out: Vec<String> = Vec::new();
4304    let mut push = |t: Option<String>| {
4305        if let Some(t) = t {
4306            if !out.contains(&t) {
4307                out.push(t);
4308            }
4309        }
4310    };
4311    for (i, tok) in toks.iter().enumerate() {
4312        let table_pos = match *tok {
4313            "from" | "join" | "into" | "table" => true,
4314            // statement-leading only (see doc comment): `update t set …`, `truncate [table] t`.
4315            "update" | "truncate" => i == 0,
4316            _ => false,
4317        };
4318        if !table_pos {
4319            continue;
4320        }
4321        let mut j = i + 1;
4322        while j < toks.len() && SKIP.contains(&toks[j]) {
4323            j += 1;
4324        }
4325        let Some(next) = toks.get(j) else { continue };
4326        let Some(first) = ident(next) else { continue };
4327        push(Some(first));
4328        // Comma-ADJACENT continuation only: `FROM t1, t2, t3` takes all three, while an alias breaks
4329        // the chain (`FROM t1 a, t2` keeps just t1 — an under-report, never a guess: skipping an
4330        // alias to chase the comma would fabricate tables out of `INSERT INTO t (a, b)`'s column
4331        // list, whose parens are spaces by the time we tokenize).
4332        while j + 2 < toks.len() && toks[j + 1] == "," {
4333            let Some(more) = ident(toks[j + 2]) else { break };
4334            push(Some(more));
4335            j += 2;
4336        }
4337    }
4338    out
4339}
4340
4341#[cfg(test)]
4342mod tests {
4343    #[test]
4344    fn r1150_getrandom_error_values_draw_nothing_but_the_draws_do() {
4345        for p in ["getrandom::Error::eq", "getrandom::&Error::eq", "getrandom::Error::raw_os_error", "getrandom::Error::fmt",
4346                  "getrandom::error::Error::new_custom", "getrandom::Error::UNSUPPORTED"] {
4347            assert_eq!(classify("getrandom", p), None, "{p}");
4348        }
4349        for p in ["getrandom::fill", "getrandom::fill_uninit", "getrandom::u32", "getrandom::u64", "getrandom::getrandom",
4350                  "getrandom::SysRng::try_fill_bytes", "getrandom::getrandom_uninit"] {
4351            assert_eq!(classify("getrandom", p), Some("Rand"), "{p}");
4352        }
4353    }
4354    #[test]
4355    fn model_host_recognizes_known_providers_and_special_forms() {
4356        use super::is_model_host as m;
4357        // exact known hosts (case-insensitive), with/without a port
4358        assert!(m("api.openai.com"));
4359        assert!(m("API.OpenAI.com"));
4360        assert!(m("api.anthropic.com:443"));
4361        assert!(m("generativelanguage.googleapis.com"));
4362        assert!(m("api.mistral.ai"));
4363        assert!(m("api.cohere.ai"));
4364        assert!(m("api.cohere.com")); // BOTH cohere hosts
4365        assert!(m("api.groq.com"));
4366        assert!(m("api.together.xyz"));
4367        assert!(m("api.perplexity.ai"));
4368        assert!(m("openrouter.ai"));
4369        // a subdomain of a known host counts
4370        assert!(m("eu.api.openai.com"));
4371        // Ollama: :11434 on a LOOPBACK host only (max-review r3 — a remote host on 11434 is not Ollama)
4372        assert!(m("localhost:11434"));
4373        assert!(m("127.0.0.1:11434"));
4374        assert!(!m("ollama.internal:11434")); // a remote/internal service on 11434 is NOT a model host
4375        // Bedrock: the FIRST label is the model-inference service, not the substring "bedrock"
4376        assert!(m("bedrock-runtime.us-east-1.amazonaws.com"));
4377        assert!(m("bedrock-runtime.eu-west-1.amazonaws.com"));
4378        assert!(m("bedrock-agent-runtime.us-east-1.amazonaws.com"));
4379        // NOT model hosts (never guessed)
4380        assert!(!m("example.com"));
4381        assert!(!m("api.stripe.com"));
4382        assert!(!m("localhost:8080")); // a non-Ollama local port
4383        assert!(!m("s3.us-east-1.amazonaws.com")); // amazonaws but not bedrock
4384        assert!(!m("bedrock-backups.s3.amazonaws.com")); // an S3 bucket merely NAMED bedrock — not the runtime
4385        assert!(!m("bedrock.us-east-1.amazonaws.com")); // the Bedrock CONTROL plane — not model inference
4386        assert!(!m("openai.com.evil.com")); // suffix trick — not a subdomain of a known host
4387    }
4388
4389    #[test]
4390    fn model_sdk_crate_is_crate_level_no_method_gating() {
4391        use super::is_model_sdk_crate as s;
4392        assert!(s("async_openai"));
4393        assert!(s("aws_sdk_bedrockruntime"));
4394        assert!(s("ollama_rs"));
4395        assert!(s("langchain_rust"));
4396        assert!(!s("reqwest"));
4397        assert!(!s("aws_sdk_s3"));
4398    }
4399
4400    #[test]
4401    fn sql_table_extraction_is_conservative() {
4402        use super::tables_in_sql as t;
4403        assert_eq!(t("SELECT id FROM users WHERE x = 1"), vec!["users"]);
4404        assert_eq!(t("select * from ledger.entries e join customers c on c.id = e.cid"),
4405                   vec!["ledger.entries", "customers"]);
4406        assert_eq!(t("INSERT INTO audit_log (a) VALUES (?1)"), vec!["audit_log"]);
4407        assert_eq!(t("UPDATE accounts SET v = ?"), vec!["accounts"]);
4408        assert_eq!(t("DELETE FROM sessions WHERE id = ?"), vec!["sessions"]);
4409        assert_eq!(t("CREATE TABLE IF NOT EXISTS cache (k TEXT)"), vec!["cache"]);
4410        assert_eq!(t("TRUNCATE TABLE staging"), vec!["staging"]);
4411        // FOR UPDATE locking clause must not yield a phantom table (mid-statement update ignored)
4412        assert_eq!(t("SELECT * FROM jobs FOR UPDATE SKIP LOCKED"), vec!["jobs"]);
4413        // a subquery in FROM position yields nothing for that position
4414        assert_eq!(t("SELECT * FROM (SELECT 1) q"), Vec::<String>::new());
4415        // not SQL -> nothing (never fabricate)
4416        assert_eq!(t("/tmp/some/path"), Vec::<String>::new());
4417        assert_eq!(t("hello world from nowhere"), Vec::<String>::new());
4418        // comma-ADJACENT continuation: a FROM list takes every table in the chain…
4419        assert_eq!(t("SELECT a FROM t1, t2, s.t3 WHERE x = 1"), vec!["t1", "t2", "s.t3"]);
4420        // …but an alias breaks it (under-report, never a guess)…
4421        assert_eq!(t("SELECT a FROM t1 a1, t2 WHERE x = 1"), vec!["t1"]);
4422        // …which is exactly what keeps a column list from fabricating (parens are spaces by now).
4423        assert_eq!(t("INSERT INTO t (a, b) VALUES (1, 2)"), vec!["t"]);
4424        // a subquery after the comma stops the chain too
4425        assert_eq!(t("SELECT a FROM t1, (SELECT 1) q"), vec!["t1"]);
4426    }
4427
4428    use super::*;
4429
4430    /// The routed-handle list's MEMBERSHIP RULE, enforced rather than merely documented.
4431    ///
4432    /// (a) Every routed type must have a whole-type rule that answers an ARBITRARY method on it.
4433    /// If it did not, routing it would hand the scanner a path the classifier drops — motion with no
4434    /// effect, and the silent under-report would survive the fix that was supposed to close it. The
4435    /// probe leaf is deliberately a name no carve-out lists, so it measures the BASE rule.
4436    ///
4437    /// (b) The named exclusions stay excluded. `ReadDir` cannot have a verb-precise rule written for it
4438    /// (its `next` is a syscall and is spelled like every other iterator's), and `Metadata`/`DirEntry`/
4439    /// `Permissions`/`FileType` are pure DATA under the coarse `std::fs::` prefix — routing any of them
4440    /// charges an effect for reading a field. `OpenOptions`/`DirBuilder` LEFT this list by the route the
4441    /// list's own comment prescribed: their type-keyed setter carve-outs were written first, so the
4442    /// whole-type rule under them now answers only for the terminal verb.
4443    #[test]
4444    fn std_effect_handles_have_a_whole_type_rule_and_exclude_the_pure_surfaces() {
4445        for ty in STD_EFFECT_HANDLES {
4446            let probe = format!("{ty}::__candor_probe_verb");
4447            assert!(
4448                classify("std", &probe).is_some(),
4449                "`{ty}` is routed into the classifier by receiver inference, but an arbitrary method \
4450                 on it classifies to NOTHING — the routing cannot close any under-report"
4451            );
4452            assert!(is_std_effect_handle(ty), "the predicate must agree with the list");
4453        }
4454        for ty in [
4455            "std::fs::ReadDir",
4456            "std::fs::Metadata", "std::fs::DirEntry", "std::fs::Permissions", "std::fs::FileType",
4457            "std::path::Path", "std::path::PathBuf", "std::vec::Vec",
4458        ] {
4459            assert!(!is_std_effect_handle(ty),
4460                    "`{ty}` has a pure surface the coarse prefix rules would charge — it must not be \
4461                     routed as a handle (Path/PathBuf route through their own verb-precise carve-out)");
4462        }
4463    }
4464
4465    /// The pure read-backs on the ROUTED types, which is what makes (a) above safe: a whole-type rule
4466    /// answering every method is only acceptable because the genuinely-pure methods were carved out
4467    /// first. Receiver routing is a second door into these rules, so it must not re-fabricate.
4468    #[test]
4469    fn routed_std_handles_keep_their_pure_accessor_carve_outs() {
4470        for p in [
4471            "std::process::Command::get_program", "std::process::Command::get_args",
4472            "std::process::Command::get_envs", "std::process::Command::get_current_dir",
4473            "std::process::Child::id",
4474            "std::net::TcpStream::local_addr", "std::net::TcpStream::peer_addr",
4475            "std::net::TcpStream::nodelay", "std::net::TcpStream::ttl",
4476            "std::net::UdpSocket::take_error",
4477            "std::fs::File::as_raw_fd", "std::fs::File::into_raw_fd",
4478            "std::os::unix::net::UnixStream::as_raw_fd",
4479            // The OPTION-BUILDER setters (SPEC §1 ⟨0.32⟩): flags in a struct, no file named, nothing
4480            // opened. `create` is here as `OpenOptions`' setter and is a VERB on `DirBuilder` below —
4481            // one leaf, two answers, which is why these carve-outs are keyed on the TYPE.
4482            "std::fs::OpenOptions::new", "std::fs::OpenOptions::read", "std::fs::OpenOptions::write",
4483            "std::fs::OpenOptions::append", "std::fs::OpenOptions::truncate",
4484            "std::fs::OpenOptions::create", "std::fs::OpenOptions::create_new",
4485            "std::fs::OpenOptions::mode", "std::fs::OpenOptions::custom_flags",
4486            "std::fs::DirBuilder::new", "std::fs::DirBuilder::recursive", "std::fs::DirBuilder::mode",
4487        ] {
4488            assert_eq!(classify("std", p), None, "`{p}` is a pure read-back");
4489        }
4490        // …and the verbs on the same types still answer, or the carve-outs would have eaten the rule.
4491        for (p, want) in [
4492            ("std::process::Command::spawn", "Exec"),
4493            ("std::process::Child::wait", "Exec"),
4494            ("std::fs::File::write_all", "Fs"),
4495            ("std::net::TcpStream::write_all", "Net"),
4496            ("std::os::unix::net::UnixStream::send", "Ipc"),
4497            // the TERMINAL VERBS of the two option-builders — the whole point of routing them.
4498            ("std::fs::OpenOptions::open", "Fs"),
4499            ("std::fs::DirBuilder::create", "Fs"),
4500        ] {
4501            assert_eq!(classify("std", p), Some(want), "`{p}` must stay {want}");
4502        }
4503    }
4504
4505    #[test]
4506    fn db_crates_are_calibrated() {
4507        // The calibrated set must cover every DB client the classifier knows, or the receipt's coverage
4508        // check would flag a recognized crate as a blind spot. (Was nightly-lint-only; now runs on stable.)
4509        for c in DB_CRATES {
4510            assert!(
4511                CALIBRATED_CRATES.contains(&c),
4512                "DB crate `{c}` is matched by classify() but missing from CALIBRATED_CRATES"
4513            );
4514        }
4515    }
4516
4517    /// The two coverage lists mean OPPOSITE things and must stay disjoint.
4518    ///
4519    /// `CALIBRATED_CRATES` = "classify has effect rules here". `REVIEWED_PURE_CRATES` = "read it, it
4520    /// performs nothing". A crate in both would be asserting both at once, and the ledger consults them
4521    /// with an OR — so the contradiction would resolve silently to "covered" and nobody would look again.
4522    #[test]
4523    fn reviewed_pure_and_calibrated_are_disjoint() {
4524        for c in REVIEWED_PURE_CRATES {
4525            assert!(!CALIBRATED_CRATES.contains(&c),
4526                    "`{c}` is in BOTH lists — it cannot be rule-covered AND effect-free");
4527            assert!(!PATH_CALIBRATED_CRATES.contains(&c), "`{c}` is in BOTH lists (path-calibrated)");
4528            assert!(!CALIBRATED_PREFIXES.iter().any(|p| c.starts_with(p)),
4529                    "`{c}` is covered by a calibrated PREFIX as well as the pure list");
4530        }
4531    }
4532
4533    /// A reviewed-pure crate must actually classify as pure — the mirror of `calibrated_crates_are_live`.
4534    ///
4535    /// The list makes candor BELIEVE these crates rather than disclose them, so if someone later adds a
4536    /// rule for one, the claim "performs no effect of its own" is dead and the entry has to be re-read,
4537    /// not silently outvoted by the rule. Probed with the same tails the liveness test uses, which is a
4538    /// broad sweep of the effectful verb shapes candor knows.
4539    #[test]
4540    fn reviewed_pure_crates_classify_as_pure() {
4541        for c in REVIEWED_PURE_CRATES {
4542            for t in CALIBRATION_PROBE_TAILS {
4543                assert!(classify(c, &format!("{c}{t}")).is_none(),
4544                        "`{c}` is listed REVIEWED-PURE but classify() gives it an effect on `{c}{t}` — \
4545                         one of the two is wrong, and the list is the claim");
4546            }
4547        }
4548    }
4549
4550    /// ⟨CALIBRATION CEILING — the table must agree with the REVIEW RECORD⟩ SOUNDNESS R328.
4551    ///
4552    /// `CALIBRATED_CEILINGS` is the version each crate's rules were actually written against. Nothing
4553    /// derived it from, or checked it against, the review record — and three separate failures followed
4554    /// in one day: a wholesale table rewrite silently DROPPED nine entries while the commit message
4555    /// claimed four were absent "each with a stated reason"; `git2` was ceilinged ABOVE the only version
4556    /// its rules record reading (the SILENT direction, and 0.21 added `author_from_env` /
4557    /// `committer_from_env` / `Oid::hash_file_ext`, none of them ruled); and `sqlx_core` sat BELOW the
4558    /// version its own comment says was verified, which is also an impossible sibling of `sqlx 0.9.0`'s
4559    /// `=0.9.0` pin. All three were invisible to 410 tests and 29 gates.
4560    ///
4561    /// This asserts the one invariant that catches all of them: **a crate whose rules cite a reviewed
4562    /// version must carry a ceiling, and it must be THAT version.** Citations are read with wrapped
4563    /// comment lines joined and both name spellings tried — R315, where a line-by-line dashed-only
4564    /// sweep silently under-counted the citations by three.
4565    #[test]
4566    fn calibration_ceilings_match_the_recorded_review() {
4567        let src = include_str!("lib.rs");
4568        // join wrapped comment continuations, then collapse whitespace: a citation is prose and prose wraps.
4569        let flat = src
4570            .replace("\n    //", " ")
4571            .replace("\n        //", " ")
4572            .replace("\n            //", " ");
4573        let flat: String = flat.split_whitespace().collect::<Vec<_>>().join(" ");
4574        let ceilings: std::collections::HashMap<&str, &str> =
4575            CALIBRATED_CEILINGS.iter().copied().collect();
4576        // Absences are deliberate and enumerated in the table's own comment; keep the list HERE too so
4577        // dropping one silently is impossible — that is exactly what happened.
4578        let deliberate = ["postgres", "async_fs", "getrandom", "rand_core"];
4579        let mut problems: Vec<String> = Vec::new();
4580        for c in CALIBRATED_CRATES {
4581            if deliberate.contains(&c) {
4582                continue;
4583            }
4584            // EVERY citation, both verbs, both name spellings, and slash-separated lists —
4585            // "verified against sqlx-core 0.8.6/0.9.0" records TWO reviewed versions, and a crate may
4586            // be cited in more than one comment ("validated against rusqlite 0.39" elsewhere). An
4587            // extractor that stops at the first hit under-collects, and under-collecting here makes a
4588            // correct ceiling look like it is above the record — R315's lesson, one level up.
4589            let mut cited: Vec<String> = Vec::new();
4590            for form in [c.to_string(), c.replace('_', "-")] {
4591                for verb in ["verified against ", "validated against "] {
4592                    let pat = format!("{verb}{form} ");
4593                    let mut from = 0usize;
4594                    while let Some(i) = flat[from..].find(&pat) {
4595                        let at = from + i + pat.len();
4596                        let tail: String = flat[at..]
4597                            .chars()
4598                            .take_while(|ch| ch.is_ascii_digit() || *ch == '.' || *ch == '/')
4599                            .collect();
4600                        for v in tail.split('/') {
4601                            let v = v.trim_end_matches('.').to_string();
4602                            if v.split('.').count() >= 2 && !cited.contains(&v) {
4603                                cited.push(v);
4604                            }
4605                        }
4606                        from = at;
4607                    }
4608                }
4609            }
4610            if cited.is_empty() {
4611                continue;
4612            }
4613            match ceilings.get(c) {
4614                None => problems.push(format!(
4615                    "{c}: rules cite {} but there is NO ceiling — the exemption is unconditional",
4616                    cited.join("/")
4617                )),
4618                // A comment may legitimately record MORE THAN ONE reviewed version
4619                // ("verified against sqlx-core 0.8.6/0.9.0"), so matching any of them is fine, and a
4620                // ceiling BELOW the newest review is merely noisy. The failure that matters is a
4621                // ceiling ABOVE EVERY recorded review: that grants reviewed-purity over source nobody
4622                // read, which is the SILENT direction and the whole reason this table exists.
4623                Some(have) => {
4624                    let ok = cited.iter().any(|v| have.starts_with(v) || v.starts_with(*have))
4625                        || cited.iter().any(|v| calibration_exceeded_raw(v, have));
4626                    if !ok {
4627                        problems.push(format!(
4628                            "{c}: ceiling {have} is ABOVE every recorded review ({}) — it grants \
4629                             reviewed-purity over source no comment records anyone reading",
4630                            cited.join("/")
4631                        ));
4632                    }
4633                }
4634            }
4635        }
4636        assert!(
4637            problems.is_empty(),
4638            "CALIBRATED_CEILINGS disagrees with the review record:\n  {}\n\n\
4639             A ceiling ABOVE the recorded review grants reviewed-purity over source nobody read (SILENT); \
4640             a ceiling BELOW it is noisy but safe. Either way the table and the record must agree, or \
4641             neither is evidence.",
4642            problems.join("\n  ")
4643        );
4644    }
4645
4646    #[test]
4647    fn calibrated_crates_are_live() {
4648        // Conversely, every crate advertised as calibrated must actually be matched by classify() for
4649        // some representative path — a dead entry would silently suppress a real coverage warning.
4650        for c in CALIBRATED_CRATES {
4651            assert!(
4652                CALIBRATION_PROBE_TAILS.iter().any(|t| classify(c, &format!("{c}{t}")).is_some()),
4653                "calibrated crate `{c}` is matched by no path in classify() — dead list entry"
4654            );
4655        }
4656    }
4657
4658    #[test]
4659    fn async_http_stack_classifies() {
4660        // The modern async-HTTP/TLS/QUIC/DNS stack (found by the independent-method differential on oha):
4661        // verb-keyed Net/Ipc/Fs/Env, crate-gated so generic verbs never fabricate across crates.
4662        assert_eq!(classify("hyper", "hyper::client::conn::http1::SendRequest::send_request"), Some("Net"));
4663        assert_eq!(classify("hyper", "hyper::client::conn::http1::handshake"), Some("Net"));
4664        assert_eq!(classify("hyper_util", "hyper_util::client::legacy::Client::request"), Some("Net"));
4665        assert_eq!(classify("hickory_resolver", "hickory_resolver::Resolver::lookup_ip"), Some("Net"));
4666        assert_eq!(classify("quinn", "quinn::Endpoint::connect"), Some("Net"));
4667        assert_eq!(classify("quinn", "quinn::RecvStream::read_to_end"), Some("Net")); // stream byte I/O, not just open
4668        assert_eq!(classify("quinn", "quinn::SendStream::write_all"), Some("Net"));
4669        assert_eq!(classify("tokio_rustls", "tokio_rustls::TlsConnector::connect"), Some("Net"));
4670        assert_eq!(classify("native_tls", "native_tls::TlsConnector::connect"), Some("Net"));
4671        assert_eq!(classify("tokio_vsock", "tokio_vsock::VsockStream::connect"), Some("Ipc"));
4672        assert_eq!(classify("rustls_native_certs", "rustls_native_certs::load_native_certs"), Some("Fs"));
4673        assert_eq!(classify("rlimit", "rlimit::setrlimit"), Some("Env"));
4674        // num_cpus is deliberately PURE (consistency with std::thread::available_parallelism; avoids Env spray)
4675        assert_eq!(classify("num_cpus", "num_cpus::get"), None);
4676        assert_eq!(classify("num_cpus", "num_cpus::get_physical"), None);
4677        // pure surface stays None (no fabrication): builder/type/config paths, and other crates' generic verbs
4678        assert_eq!(classify("hyper", "hyper::Request::builder"), None);
4679        assert_eq!(classify("hyper", "hyper::body::Bytes::new"), None);
4680        assert_eq!(classify("native_tls", "native_tls::TlsConnectorBuilder::min_protocol_version"), None);
4681        assert_eq!(classify("serde", "serde::Deserialize::request"), None); // generic verb, wrong crate
4682    }
4683
4684    #[test]
4685    fn coverage_differential_crates_classify() {
4686        // Crates the coverage differential found DISCLOSED-but-unmodeled. Each rule is verb-keyed +
4687        // crate-gated; the EFFECT verbs map to the right bucket and the PURE surface stays None (a
4688        // wrongly-flagged pure crate is a fabrication, so the negatives matter as much as the positives).
4689
4690        // rustls (sync TLS core) — record I/O is Net; config/cert + the buffered-decrypt step are pure.
4691        assert_eq!(classify("rustls", "rustls::ClientConnection::read_tls"), Some("Net"));
4692        assert_eq!(classify("rustls", "rustls::ConnectionCommon::write_tls"), Some("Net"));
4693        assert_eq!(classify("rustls", "rustls::Connection::complete_io"), Some("Net"));
4694        assert_eq!(classify("rustls", "rustls::ConnectionCommon::process_new_packets"), None); // buffered decrypt, no I/O
4695        assert_eq!(classify("rustls", "rustls::ClientConfig::builder"), None); // pure config
4696
4697        // native-tls variants — handshake is Net; builder is pure.
4698        assert_eq!(classify("native_tls_crate", "native_tls_crate::TlsConnector::connect"), Some("Net"));
4699        assert_eq!(classify("tokio_native_tls", "tokio_native_tls::TlsAcceptor::accept"), Some("Net"));
4700        assert_eq!(classify("native_tls_crate", "native_tls_crate::TlsConnectorBuilder::min_protocol_version"), None);
4701
4702        // etcetera — dir resolution reads env; the args data type is pure.
4703        assert_eq!(classify("etcetera", "etcetera::home_dir"), Some("Env"));
4704        assert_eq!(classify("etcetera", "etcetera::base_strategy::choose_base_strategy"), Some("Env"));
4705        assert_eq!(classify("etcetera", "etcetera::base_strategy::Xdg::config_dir"), Some("Env"));
4706        assert_eq!(classify("etcetera", "etcetera::app_strategy::AppStrategyArgs::new"), None); // pure data
4707
4708        // sqlx-core — connect is Net, execute/fetch round-trips are Db; options/builders pure.
4709        assert_eq!(classify("sqlx_core", "sqlx_core::connection::Connection::connect"), Some("Net"));
4710        assert_eq!(classify("sqlx_core", "sqlx_core::executor::Executor::fetch_one"), Some("Db"));
4711        assert_eq!(classify("sqlx_core", "sqlx_core::executor::Executor::execute"), Some("Db"));
4712        assert_eq!(classify("sqlx_core", "sqlx_core::pool::Pool::acquire"), Some("Db"));
4713        assert_eq!(classify("sqlx_core", "sqlx_core::pool::PoolOptions::max_connections"), None); // pure builder
4714
4715        // walkdir — charged at construction (`WalkDir::new`, mirroring `ignore`/`glob`), NOT solely at
4716        // the lazy `next()`/`metadata()` read: candor-scan's receiver-typing blocklist hard-blocks
4717        // `.into_iter()`, so a typed `IntoIter::next` receiver is unreachable from the idiomatic
4718        // `WalkDir::new(p).into_iter()...` chain — `WalkDir::new` is the only point every real usage
4719        // (for-loop, `.count()`, untyped `.next()`) actually reaches. `IntoIter::next`/`DirEntry::metadata`
4720        // stay Some("Fs") as a secondary rule for the narrower explicit-type-annotation case. Builder
4721        // setters (`into_iter` itself, `max_depth`, …) and cached accessors stay pure.
4722        assert_eq!(classify("walkdir", "walkdir::WalkDir::new"), Some("Fs"));
4723        assert_eq!(classify("walkdir", "walkdir::IntoIter::next"), Some("Fs"));
4724        assert_eq!(classify("walkdir", "walkdir::DirEntry::metadata"), Some("Fs"));
4725        assert_eq!(classify("walkdir", "walkdir::WalkDir::into_iter"), None); // no I/O until pulled
4726        assert_eq!(classify("walkdir", "walkdir::WalkDir::max_depth"), None); // builder setter
4727        assert_eq!(classify("walkdir", "walkdir::DirEntry::file_type"), None); // cached, no syscall
4728
4729        // filetime — set_* are utimes (Fs), now is Clock; from_* constructors pure.
4730        assert_eq!(classify("filetime", "filetime::set_file_mtime"), Some("Fs"));
4731        assert_eq!(classify("filetime", "filetime::set_file_handle_times"), Some("Fs"));
4732        assert_eq!(classify("filetime", "filetime::FileTime::now"), Some("Clock"));
4733        assert_eq!(classify("filetime", "filetime::FileTime::from_unix_time"), None);
4734        assert_eq!(classify("filetime", "filetime::FileTime::from_last_modification_time"), None); // reads &Metadata, not disk
4735
4736        // execute — the execute* verbs spawn (Exec); command/shell builders pure.
4737        assert_eq!(classify("execute", "execute::Execute::execute"), Some("Exec"));
4738        assert_eq!(classify("execute", "execute::Execute::execute_output"), Some("Exec"));
4739        assert_eq!(classify("execute", "execute::Execute::execute_multiple_output"), Some("Exec"));
4740        assert_eq!(classify("execute", "execute::command"), None); // only builds a Command
4741        assert_eq!(classify("execute", "execute::shell"), None);
4742
4743        // ctrlc — install signal handler (Ipc).
4744        assert_eq!(classify("ctrlc", "ctrlc::set_handler"), Some("Ipc"));
4745        assert_eq!(classify("ctrlc", "ctrlc::try_set_handler"), Some("Ipc"));
4746
4747        // clap — only the argv-reading terminals are Env; the whole builder + *_from variants pure.
4748        assert_eq!(classify("clap", "clap::Command::get_matches"), Some("Env"));
4749        assert_eq!(classify("clap", "clap::Command::try_get_matches"), Some("Env"));
4750        assert_eq!(classify("clap", "clap::Parser::parse"), Some("Env"));
4751        assert_eq!(classify("clap", "clap::Command::new"), None); // builder
4752        assert_eq!(classify("clap", "clap::Arg::about"), None); // builder
4753        assert_eq!(classify("clap", "clap::Command::get_matches_from"), None); // explicit args, no argv read
4754        // R59-class audit: `Arg::env` calls `env::var_os` DIRECTLY at builder time (verified against
4755        // clap_builder 4.6.6) — unambiguous (the crate's only `::env` method), so classify it rather
4756        // than leave a real effect to fall silently into the CALIBRATED_CRATES purity exemption.
4757        assert_eq!(classify("clap", "clap::Arg::env"), Some("Env"));
4758        assert_eq!(classify("clap", "clap::Arg::env_os"), Some("Env"));
4759
4760        // jiff — now* is Clock; tz lookups read the tzdb (Fs); span/civil math pure.
4761        assert_eq!(classify("jiff", "jiff::Timestamp::now"), Some("Clock"));
4762        assert_eq!(classify("jiff", "jiff::Zoned::now_with"), Some("Clock"));
4763        assert_eq!(classify("jiff", "jiff::tz::TimeZone::system"), Some("Fs"));
4764        assert_eq!(classify("jiff", "jiff::tz::TimeZone::get"), Some("Fs"));
4765        assert_eq!(classify("jiff", "jiff::Span::checked_add"), None); // pure arithmetic
4766
4767        // env_logger — init installs the logger + reads RUST_LOG (Log); config setters pure.
4768        // TUI — the tty is a user dialogue channel (Ipc), the ruling dialoguer/console already carry.
4769        // Each verb below was read off the crate source (crossterm-0.28.1, ratatui-0.29.0), not guessed.
4770        assert_eq!(classify("crossterm", "crossterm::ExecutableCommand::execute"), Some("Ipc"));
4771        assert_eq!(classify("crossterm", "crossterm::QueueableCommand::queue"), Some("Ipc"));
4772        assert_eq!(classify("crossterm", "crossterm::event::read"), Some("Ipc"));
4773        assert_eq!(classify("crossterm", "crossterm::event::poll"), Some("Ipc"));
4774        assert_eq!(classify("crossterm", "crossterm::terminal::enable_raw_mode"), Some("Ipc"));
4775        // a tty IOCTL must not fall through: in a CALIBRATED crate an unmatched path is a purity CLAIM
4776        assert_eq!(classify("crossterm", "crossterm::terminal::size"), Some("Ipc"));
4777        // the Command VALUE types are pure — they describe an action, they do not perform one
4778        assert_eq!(classify("crossterm", "crossterm::style::Print"), None);
4779        assert_eq!(classify("crossterm", "crossterm::cursor::MoveTo"), None);
4780
4781        // ratatui: the backlog said "mark reviewed-pure"; the SOURCE says `Terminal::draw` ends in a
4782        // backend flush, so the write surface is Ipc and only the render surface is pure.
4783        assert_eq!(classify("ratatui", "ratatui::Terminal::draw"), Some("Ipc"));
4784        assert_eq!(classify("ratatui", "ratatui::Terminal::flush"), Some("Ipc"));
4785        assert_eq!(classify("ratatui", "ratatui::Terminal::clear"), Some("Ipc"));
4786        assert_eq!(classify("ratatui", "ratatui::Terminal::hide_cursor"), Some("Ipc"));
4787        // REGRESSION: `widgets::canvas` is an in-memory grid. `Context::draw` ends in `::draw` and was
4788        // FABRICATING Ipc — caught in review, measured on a fixture, and a hot path (per shape, per frame).
4789        assert_eq!(classify("ratatui", "ratatui::widgets::canvas::Context::draw"), None);
4790        assert_eq!(classify("ratatui", "ratatui::widgets::canvas::Context::layer"), None);
4791        // …while the real write surface still classifies, including a DIRECT backend call (which is why
4792        // the carve-out is a denylist on canvas rather than an allowlist on `Terminal::`).
4793        assert_eq!(classify("ratatui", "ratatui::backend::CrosstermBackend::flush"), Some("Ipc"));
4794        // the BULK of the 3,345 disclosed calls — widgets, layout, style — are genuinely pure
4795        assert_eq!(classify("ratatui", "ratatui::widgets::Paragraph::new"), None);
4796        assert_eq!(classify("ratatui", "ratatui::layout::Layout::split"), None);
4797        assert_eq!(classify("ratatui", "ratatui::style::Style::fg"), None);
4798        assert_eq!(classify("ratatui", "ratatui::buffer::Buffer::set_string"), None);
4799
4800        // tracing_subscriber — two effects, both read off 0.3.23. The filing said "Log/Fs"; the Fs half
4801        // is wrong (the crate ACCEPTS a File as a writer, it never opens one).
4802        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::init"), Some("Log"));
4803        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::try_init"), Some("Log"));
4804        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::SubscriberBuilder::init"), Some("Log"));
4805        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::EnvFilter::from_default_env"), Some("Env"));
4806        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::EnvFilter::from_env"), Some("Env"));
4807        // builders DESCRIBE a subscriber; they do not install one
4808        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::layer"), None);
4809        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::SubscriberBuilder::with_target"), None);
4810        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::EnvFilter::new"), None);
4811
4812        assert_eq!(classify("env_logger", "env_logger::init"), Some("Log"));
4813        assert_eq!(classify("env_logger", "env_logger::try_init"), Some("Log"));
4814        assert_eq!(classify("env_logger", "env_logger::Builder::init"), Some("Log"));
4815        assert_eq!(classify("env_logger", "env_logger::Builder::format_timestamp"), None); // config
4816        assert_eq!(classify("env_logger", "env_logger::Builder::build"), None); // pure build
4817
4818        // dialoguer — interact* is tty I/O (Ipc); builders pure.
4819        assert_eq!(classify("dialoguer", "dialoguer::Input::interact_text"), Some("Ipc"));
4820        assert_eq!(classify("dialoguer", "dialoguer::Confirm::interact"), Some("Ipc"));
4821        assert_eq!(classify("dialoguer", "dialoguer::Select::interact_opt"), Some("Ipc"));
4822        assert_eq!(classify("dialoguer", "dialoguer::Input::with_prompt"), None); // builder
4823        // widened-CORE audit: `Editor::new`/`::default` read VISUAL/EDITOR at construction, independent
4824        // of `Editor::edit`'s already-covered Exec (spawning that editor is a separate, later step).
4825        assert_eq!(classify("dialoguer", "dialoguer::Editor::new"), Some("Env"));
4826        assert_eq!(classify("dialoguer", "dialoguer::Editor::default"), Some("Env"));
4827        assert_eq!(classify("dialoguer", "dialoguer::Editor::edit"), Some("Exec"));
4828        assert_eq!(classify("dialoguer", "dialoguer::Editor::extension"), None); // pure setter
4829
4830        // console — Term I/O is Ipc, detection is Env, Style is pure.
4831        assert_eq!(classify("console", "console::Term::write_line"), Some("Ipc"));
4832        assert_eq!(classify("console", "console::Term::read_key"), Some("Ipc"));
4833        assert_eq!(classify("console", "console::colors_enabled"), Some("Env"));
4834        assert_eq!(classify("console", "console::Style::cyan"), None); // pure styling
4835        assert_eq!(classify("console", "console::strip_ansi_codes"), None); // pure text util
4836        // R59-class audit: `Term` also implements raw `io::{Read,Write}` (console 0.15.11) — the same
4837        // tty channel as `write_line`/`read_key`, reached through the generic trait methods instead of
4838        // the crate's own named convenience methods. Crate-gated and `Term::`-scoped, so it cannot spread.
4839        assert_eq!(classify("console", "console::Term::write"), Some("Ipc"));
4840        assert_eq!(classify("console", "console::Term::flush"), Some("Ipc"));
4841        assert_eq!(classify("console", "console::Term::read"), Some("Ipc"));
4842
4843        // terminal_colorsaurus — tty colour query (Ipc).
4844        assert_eq!(classify("terminal_colorsaurus", "terminal_colorsaurus::background_color"), Some("Ipc"));
4845        assert_eq!(classify("terminal_colorsaurus", "terminal_colorsaurus::color_palette"), Some("Ipc"));
4846
4847        // backoff — retry sleeps + reads the clock (Clock); config pure.
4848        assert_eq!(classify("backoff", "backoff::retry"), Some("Clock"));
4849        assert_eq!(classify("backoff", "backoff::retry_notify"), Some("Clock"));
4850        assert_eq!(classify("backoff", "backoff::ExponentialBackoff::default"), None);
4851
4852        // lscolors — ONLY from_env reads the environment; from_string/style_for_path pure.
4853        assert_eq!(classify("lscolors", "lscolors::LsColors::from_env"), Some("Env"));
4854        assert_eq!(classify("lscolors", "lscolors::LsColors::from_string"), None);
4855        assert_eq!(classify("lscolors", "lscolors::LsColors::style_for_path"), None);
4856
4857        // wild — argv readers (Env).
4858        assert_eq!(classify("wild", "wild::args"), Some("Env"));
4859        assert_eq!(classify("wild", "wild::args_os"), Some("Env"));
4860
4861        // grep_cli — only the firm Exec (CommandReader spawn); the isatty probes stay unmodeled.
4862        assert_eq!(classify("grep_cli", "grep_cli::CommandReaderBuilder::build"), Some("Exec"));
4863        assert_eq!(classify("grep_cli", "grep_cli::is_readable_stdin"), None); // isatty/fstat, not modeled
4864        assert_eq!(classify("grep_cli", "grep_cli::is_tty_stdout"), None);
4865
4866        // clircle — same-file detection issues fstat/lseek (Fs); equality is pure.
4867        assert_eq!(classify("clircle", "clircle::Identifier::try_from"), Some("Fs"));
4868        assert_eq!(classify("clircle", "clircle::Clircle::surely_conflicts_with"), Some("Fs"));
4869    }
4870
4871    #[test]
4872    fn log_tracing_emit_macros_classify_pre_expansion() {
4873        // candor-scan is pre-expansion: it sees the raw macro path (`log::info`, `tracing::warn`), not the
4874        // expanded dispatch the deep engine sees. Both the user-facing macro names AND the type surface:
4875        assert_eq!(classify("log", "log::info"), Some("Log"));
4876        assert_eq!(classify("log", "log::error"), Some("Log"));
4877        assert_eq!(classify("tracing", "tracing::warn"), Some("Log"));
4878        assert_eq!(classify("tracing", "tracing::info_span"), Some("Log"));
4879        // pure data-type surface stays None (no fabricated Log)
4880        assert_eq!(classify("log", "log::Level::as_str"), None);
4881        assert_eq!(classify("tracing", "tracing::Level::INFO"), None);
4882    }
4883
4884    #[test]
4885    fn classify_core_effects() {
4886        // A representative smoke test of the classifier's main families, so the published crate is not
4887        // shipped untested (these used to live only in the nightly-only src/lib.rs).
4888        assert_eq!(classify("std", "std::fs::read_to_string"), Some("Fs"));
4889        // std::path stat-family methods are Fs (each is a stat/readdir syscall); the pure
4890        // string-manipulation surface stays unclassified (the blackout screen's gix-dir find).
4891        assert_eq!(classify("std", "std::path::Path::symlink_metadata"), Some("Fs"));
4892        assert_eq!(classify("std", "std::path::PathBuf::read_dir"), Some("Fs"));
4893        assert_eq!(classify("std", "std::path::Path::exists"), Some("Fs"));
4894        assert_eq!(classify("std", "std::path::Path::join"), None); // pure string manipulation
4895        assert_eq!(classify("std", "std::path::PathBuf::file_name"), None);
4896        assert_eq!(classify("std", "std::path::Path::parent"), None);
4897        assert_eq!(classify("std", "std::process::Command::new"), Some("Exec"));
4898        assert_eq!(classify("std", "std::env::var"), Some("Env"));
4899        assert_eq!(classify("reqwest", "reqwest::Client::execute"), Some("Net"));
4900        // one-shot convenience fns send immediately → Net.
4901        assert_eq!(classify("reqwest", "reqwest::get"), Some("Net"));
4902        assert_eq!(classify("reqwest", "reqwest::blocking::get"), Some("Net"));
4903        // the URL-BEARING builder methods classify Net too — the DOMINANT idiom is the builder chain
4904        // `Client::new().post(url).send()`, whose URL literal rides the `.post(url)` step (NOT `.send()`),
4905        // so the endpoint (and the Llm host refinement) only get captured if the URL-naming step is Net.
4906        assert_eq!(classify("reqwest", "reqwest::Client::get"), Some("Net"));
4907        assert_eq!(classify("reqwest", "reqwest::Client::post"), Some("Net"));
4908        assert_eq!(classify("reqwest", "reqwest::Client::put"), Some("Net"));
4909        assert_eq!(classify("reqwest", "reqwest::Client::delete"), Some("Net"));
4910        assert_eq!(classify("reqwest", "reqwest::Client::request"), Some("Net"));
4911        // the PURE builder surface stays None (no URL, no dispatch).
4912        assert_eq!(classify("reqwest", "reqwest::RequestBuilder::header"), None);
4913        assert_eq!(classify("reqwest", "reqwest::RequestBuilder::json"), None);
4914        assert_eq!(classify("reqwest", "reqwest::ClientBuilder::build"), None);
4915        // RAW POSIX SOCKETS — the lowest network tier, pinned as a regression guard (four-way close:
4916        // swift got a raw-socket regression this week from a bare-identifier collision; rust never had
4917        // the gap because it classifies path-QUALIFIED via the syscall-leaf table, but pin it so the
4918        // `socket`/`connect` Net rows can't silently drop). `libc::connect`/`libc::socket` are the direct
4919        // FFI syscalls; `nix::sys::socket::connect` is the safe wrapper; both bottom out in the NET table.
4920        assert_eq!(classify("libc", "libc::connect"), Some("Net"));
4921        assert_eq!(classify("libc", "libc::socket"), Some("Net"));
4922        assert_eq!(classify("libc", "libc::bind"), Some("Net"));
4923        assert_eq!(classify("libc", "libc::accept"), Some("Net"));
4924        // nix routes through the libc syscall table (same leaves): I/O classified, generic fd ops skipped.
4925        assert_eq!(classify("nix", "nix::fcntl::open"), Some("Fs"));
4926        assert_eq!(classify("nix", "nix::sys::socket::connect"), Some("Net"));
4927        assert_eq!(classify("nix", "nix::sys::socket::socket"), Some("Net"));
4928        assert_eq!(classify("nix", "nix::unistd::execvp"), Some("Exec"));
4929        assert_eq!(classify("nix", "nix::unistd::write"), None); // generic fd op — deliberately unclassified
4930        assert_eq!(classify("nix", "nix::unistd::getpid"), None); // not I/O
4931        // rustix does raw syscalls (no libc underneath) → classified directly by leaf, same table.
4932        assert_eq!(classify("rustix", "rustix::time::clock_settime"), Some("Clock"));
4933        assert_eq!(classify("rustix", "rustix::fs::symlink"), Some("Fs"));
4934        assert_eq!(classify("rustix", "rustix::net::connect"), Some("Net"));
4935        assert_eq!(classify("rustix", "rustix::io::read"), None); // generic fd op
4936        // pnet raw packet capture: channel openers are Net, packet construction stays pure.
4937        assert_eq!(classify("pnet", "pnet::datalink::channel"), Some("Net"));
4938        assert_eq!(classify("pnet", "pnet::transport::transport_channel"), Some("Net"));
4939        assert_eq!(classify("pnet_datalink", "pnet_datalink::channel"), Some("Net"));
4940        assert_eq!(classify("pnet", "pnet::packet::ethernet::EthernetPacket::new"), None);
4941        assert_eq!(classify("pnet_base", "pnet_base::MacAddr::new"), None);
4942        // ignore (gitignore-aware walker): walk executors are Fs, config builders stay pure.
4943        assert_eq!(classify("ignore", "ignore::WalkBuilder::build_parallel"), Some("Fs"));
4944        assert_eq!(classify("ignore", "ignore::WalkBuilder::build"), Some("Fs"));
4945        assert_eq!(classify("ignore", "ignore::WalkParallel::run"), Some("Fs"));
4946        assert_eq!(classify("ignore", "ignore::WalkBuilder::add_ignore"), Some("Fs")); // reads the ignore file
4947        assert_eq!(classify("ignore", "ignore::overrides::OverrideBuilder::build"), None); // pure config
4948        assert_eq!(classify("ignore", "ignore::gitignore::GitignoreBuilder::build"), None); // pure config
4949        assert_eq!(classify("ignore", "ignore::DirEntry::path"), None); // pure accessor
4950        // THE FIX: `Walk::new`/`Walk::from_iter` are `WalkBuilder::new(path).build()` /
4951        // `WalkBuilder::from_iter(paths).build()` in ignore's own source — the crate's documented
4952        // convenience constructors, and its own top-level doc example (`for entry in Walk::new(path)`).
4953        // A corpus round caught `deny Fs` exiting 0 over exactly that idiom.
4954        assert_eq!(classify("ignore", "ignore::Walk::new"), Some("Fs"));
4955        assert_eq!(classify("ignore", "ignore::Walk::from_iter"), Some("Fs"));
4956        // NO FABRICATION: a same-named `Walk::new` from an unrelated crate must not gain Fs — crate-gated.
4957        assert_eq!(classify("walkdir", "walkdir::Walk::new"), None);
4958        assert_eq!(classify("some_local_crate", "some_local_crate::Walk::new"), None);
4959        // notify fs-watching: watcher constructors + watch/unwatch are Fs, data types stay pure.
4960        assert_eq!(classify("notify", "notify::RecommendedWatcher::new"), Some("Fs"));
4961        assert_eq!(classify("notify", "notify::PollWatcher::new"), Some("Fs"));
4962        assert_eq!(classify("notify", "notify::recommended_watcher"), Some("Fs"));
4963        assert_eq!(classify("notify", "notify::INotifyWatcher::watch"), Some("Fs"));
4964        assert_eq!(classify("notify", "notify::Config::default"), None); // pure config
4965        assert_eq!(classify("notify", "notify::Event::new"), None); // pure data type
4966        assert_eq!(classify("rusqlite", "rusqlite::Connection::execute"), Some("Db"));
4967        // the rusqlite verb DIALECT (a verb probe found the canonical consumer API classifying pure):
4968        assert_eq!(classify("rusqlite", "rusqlite::Connection::query_row"), Some("Db"));
4969        assert_eq!(classify("rusqlite", "rusqlite::Statement::query_map"), Some("Db"));
4970        assert_eq!(classify("rusqlite", "rusqlite::Connection::execute_batch"), Some("Db"));
4971        assert_eq!(classify("rusqlite", "rusqlite::Connection::prepare_cached"), Some("Db"));
4972        assert_eq!(classify("rusqlite", "rusqlite::Connection::open"), Some("Db"));
4973        assert_eq!(classify("rusqlite", "rusqlite::Connection::open_in_memory"), Some("Db"));
4974        // THE FIX: three more real `Connection::open*` constructors an exact-suffix list missed
4975        // (`open_in_memory_with_flags` doesn't END in `open_with_flags`), plus the documented blob-I/O
4976        // API (`blob_open`/`Blob::reopen`), each calling the real sqlite3 FFI directly.
4977        assert_eq!(classify("rusqlite", "rusqlite::Connection::open_in_memory_with_flags"), Some("Db"));
4978        assert_eq!(classify("rusqlite", "rusqlite::Connection::open_with_flags_and_vfs"), Some("Db"));
4979        assert_eq!(
4980            classify("rusqlite", "rusqlite::Connection::open_in_memory_with_flags_and_vfs"),
4981            Some("Db")
4982        );
4983        assert_eq!(classify("rusqlite", "rusqlite::Connection::blob_open"), Some("Db"));
4984        assert_eq!(classify("rusqlite", "rusqlite::blob::Blob::reopen"), Some("Db"));
4985        // NO FABRICATION: a same-crate, DIFFERENT type's `open`-prefixed method (rusqlite's own private
4986        // `pragma::Sql::open_brace`, which pushes one char to a string buffer) must not gain Db — the
4987        // fix keys on the `Connection::` segment, not a bare leaf prefix.
4988        assert_eq!(classify("rusqlite", "rusqlite::pragma::Sql::open_brace"), None);
4989        // THE COVERAGE-GATE SWEEP FIX: the online-backup API and incremental-BLOB positional I/O,
4990        // verified against rusqlite 0.32.1 (each calls an `ffi::sqlite3_*` leaf already in this file's
4991        // own FFI-leaf DB table, but the `crate_name == "rusqlite"` block above returned before ever
4992        // reaching it — same shape as the git2 fix elsewhere in this file).
4993        assert_eq!(classify("rusqlite", "rusqlite::Backup::new"), Some("Db"));
4994        assert_eq!(classify("rusqlite", "rusqlite::Backup::new_with_names"), Some("Db"));
4995        assert_eq!(classify("rusqlite", "rusqlite::Backup::step"), Some("Db"));
4996        assert_eq!(classify("rusqlite", "rusqlite::Backup::run_to_completion"), Some("Db"));
4997        assert_eq!(classify("rusqlite", "rusqlite::Connection::backup"), Some("Db"));
4998        assert_eq!(classify("rusqlite", "rusqlite::Connection::restore"), Some("Db"));
4999        assert_eq!(classify("rusqlite", "rusqlite::Blob::read_at"), Some("Db"));
5000        assert_eq!(classify("rusqlite", "rusqlite::Blob::read_at_exact"), Some("Db"));
5001        assert_eq!(classify("rusqlite", "rusqlite::Blob::raw_read_at"), Some("Db"));
5002        assert_eq!(classify("rusqlite", "rusqlite::Blob::raw_read_at_exact"), Some("Db"));
5003        assert_eq!(classify("rusqlite", "rusqlite::Blob::write_at"), Some("Db"));
5004        assert_eq!(classify("rusqlite", "rusqlite::Blob::write_all_at"), Some("Db"));
5005        assert_eq!(classify("rusqlite", "rusqlite::Connection::from_handle"), Some("Db"));
5006        assert_eq!(classify("rusqlite", "rusqlite::Connection::from_handle_owned"), Some("Db"));
5007        assert_eq!(classify("rusqlite", "rusqlite::Connection::extension_init2"), Some("Db"));
5008        assert_eq!(classify("rusqlite", "rusqlite::init_auto_extension"), Some("Db"));
5009        // …and the REAL module-qualified spellings (`Backup`/`Blob`/`init_auto_extension` are not
5010        // re-exported at rusqlite's crate root, unlike `Connection` — a real consumer's source, proven
5011        // against a compiling fixture, must use these, not the short forms above).
5012        assert_eq!(classify("rusqlite", "rusqlite::backup::Backup::new"), Some("Db"));
5013        assert_eq!(classify("rusqlite", "rusqlite::blob::Blob::read_at"), Some("Db"));
5014        assert_eq!(classify("rusqlite", "rusqlite::auto_extension::init_auto_extension"), Some("Db"));
5015        // NO FABRICATION: `InnerConnection`/`RawStatement` live in PRIVATE modules (lib.rs `mod
5016        // inner_connection;`/`mod raw_statement;`, no `pub`) — no external consumer can ever name either
5017        // type, so no rule was added despite self-scan flagging them too.
5018        assert_eq!(classify("rusqlite", "rusqlite::InnerConnection::close"), None);
5019        assert_eq!(classify("rusqlite", "rusqlite::RawStatement::step"), None);
5020        // …but `open` stays rusqlite-only (postgres has no open; nothing else may borrow it):
5021        assert_eq!(classify("postgres", "postgres::Client::open"), None);
5022        assert_eq!(classify("tokio_postgres", "tokio_postgres::Client::query_typed"), Some("Db"));
5023        // THE FIX: `Config::connect_raw` does the same protocol handshake as `Config::connect`, over a
5024        // caller-supplied stream instead of one it dials itself.
5025        assert_eq!(classify("tokio_postgres", "tokio_postgres::Config::connect_raw"), Some("Db"));
5026        // diesel's LIMIT-1 + streaming executions; sqlx's multi-result stream:
5027        assert_eq!(classify("diesel", "diesel::RunQueryDsl::first"), Some("Db"));
5028        assert_eq!(classify("diesel", "diesel::RunQueryDsl::load_iter"), Some("Db"));
5029        // THE FIX: `Connection::establish` is diesel's own name for `::connect` — the crate's canonical,
5030        // most-used connection entry point (`SqliteConnection::establish(url)` in every diesel
5031        // quickstart), implemented by really opening the backend handle — but shared no verb spelling
5032        // with `::connect`, so it read pure with zero `coverage.uncovered` disclosure (diesel is
5033        // calibrated, so the miss reads as reviewed-pure, not as a gap).
5034        assert_eq!(classify("diesel", "diesel::sqlite::SqliteConnection::establish"), Some("Db"));
5035        assert_eq!(classify("diesel", "diesel::pg::PgConnection::establish"), Some("Db"));
5036        assert_eq!(classify("diesel", "diesel::mysql::MysqlConnection::establish"), Some("Db"));
5037        assert_eq!(classify("diesel", "diesel::Connection::establish"), Some("Db"));
5038        // NO FABRICATION: diesel's own private plumbing shares the substring but not the exact verb.
5039        assert_eq!(classify("diesel", "diesel::sqlite::SqliteConnection::establish_inner"), None);
5040        assert_eq!(classify("sqlx", "sqlx::query::Query::fetch_many"), Some("Db"));
5041        // sqlx's bare `query()` builder must STAY pure (the original sqlx lesson):
5042        assert_eq!(classify("sqlx", "sqlx::query"), None);
5043        // tracing: the emit/span-lifecycle dispatch is Log; the pure DATA-type accessors are not
5044        // (whole-crate Log fabricated Log on `Level::as_str` / `Span::is_disabled` — the data types are
5045        // pure, same principle as the `log` facade).
5046        assert_eq!(classify("tracing", "tracing::event"), Some("Log"));
5047        assert_eq!(classify("tracing", "tracing::Span::new_span"), Some("Log"));
5048        assert_eq!(classify("tracing", "tracing::Span::record"), Some("Log"));
5049        assert_eq!(classify("tracing", "tracing::Span::enter"), Some("Log"));
5050        assert_eq!(classify("tracing", "tracing::Level::as_str"), None); // pure accessor
5051        assert_eq!(classify("tracing", "tracing::Span::is_disabled"), None); // pure state read
5052        assert_eq!(classify("tracing", "tracing::Span::metadata"), None); // pure accessor
5053        assert_eq!(classify("tracing", "tracing::metadata::Level::TRACE"), None); // pure data type
5054        assert_eq!(classify("tracing", "tracing::field::Field::name"), None); // pure data type
5055        // git2 (high-level Rust API, not the `raw::git_*` FFI tier tested above): remote verbs are Net.
5056        assert_eq!(classify("git2", "git2::Remote::fetch"), Some("Net"));
5057        assert_eq!(classify("git2", "git2::Remote::push"), Some("Net"));
5058        assert_eq!(classify("git2", "git2::Remote::download"), Some("Net"));
5059        assert_eq!(classify("git2", "git2::Remote::connect"), Some("Net"));
5060        assert_eq!(classify("git2", "git2::Remote::connect_auth"), Some("Net"));
5061        assert_eq!(classify("git2", "git2::Remote::ls"), Some("Net"));
5062        assert_eq!(classify("git2", "git2::Remote::upload"), Some("Net"));
5063        // THE COVERAGE-GATE SWEEP FIX: `Repository::open`/`init` (and every other local .git-directory
5064        // operation below) used to read PURE here — the comment this replaced called that "honest, no
5065        // network", but candor-scan self-scanning git2's OWN source (eval/coverage-gate) proved these
5066        // reach a REAL Fs effect (`raw::git_repository_open`/`_init_ext`, already in this file's FFI-tier
5067        // table) that a real consumer's call to the safe wrapper could never surface, because THIS
5068        // block's early `return None` sat in front of that table for every `crate_name == "git2"` call.
5069        // "local, no network" was true and beside the point: Fs was the effect being missed. See MEMORY /
5070        // the commit that added this block for the full sweep (Config/Index/Odb/PackBuilder/Reference/
5071        // Repository/TreeBuilder — every FQN below calls a listed FS FFI leaf; verified against git2
5072        // 0.20.4 source).
5073        assert_eq!(classify("git2", "git2::Repository::open"), Some("Fs"));
5074        assert_eq!(classify("git2", "git2::Repository::init"), Some("Fs"));
5075        assert_eq!(classify("git2", "git2::Repository::open_bare"), Some("Fs"));
5076        assert_eq!(classify("git2", "git2::Repository::open_ext"), Some("Fs"));
5077        assert_eq!(classify("git2", "git2::Repository::open_from_env"), Some("Fs"));
5078        assert_eq!(classify("git2", "git2::Repository::discover"), Some("Fs"));
5079        assert_eq!(classify("git2", "git2::Repository::discover_path"), Some("Fs"));
5080        assert_eq!(classify("git2", "git2::Repository::init_bare"), Some("Fs"));
5081        assert_eq!(classify("git2", "git2::Repository::init_opts"), Some("Fs"));
5082        assert_eq!(classify("git2", "git2::Repository::blob_path"), Some("Fs"));
5083        assert_eq!(classify("git2", "git2::Repository::checkout_head"), Some("Fs"));
5084        assert_eq!(classify("git2", "git2::Repository::checkout_index"), Some("Fs"));
5085        assert_eq!(classify("git2", "git2::Repository::checkout_tree"), Some("Fs"));
5086        assert_eq!(classify("git2", "git2::Repository::commit"), Some("Fs"));
5087        assert_eq!(classify("git2", "git2::Repository::reference"), Some("Fs"));
5088        assert_eq!(classify("git2", "git2::Repository::tag"), Some("Fs"));
5089        assert_eq!(classify("git2", "git2::Config::add_file"), Some("Fs"));
5090        assert_eq!(classify("git2", "git2::Config::open"), Some("Fs"));
5091        assert_eq!(classify("git2", "git2::Config::open_default"), Some("Fs"));
5092        assert_eq!(classify("git2", "git2::Index::add_all"), Some("Fs"));
5093        assert_eq!(classify("git2", "git2::Index::add_path"), Some("Fs"));
5094        assert_eq!(classify("git2", "git2::Index::read"), Some("Fs"));
5095        assert_eq!(classify("git2", "git2::Index::write"), Some("Fs"));
5096        assert_eq!(classify("git2", "git2::Index::write_tree"), Some("Fs"));
5097        assert_eq!(classify("git2", "git2::Index::write_tree_to"), Some("Fs"));
5098        assert_eq!(classify("git2", "git2::Odb::read"), Some("Fs"));
5099        assert_eq!(classify("git2", "git2::Odb::reader"), Some("Fs"));
5100        assert_eq!(classify("git2", "git2::Odb::write"), Some("Fs"));
5101        assert_eq!(classify("git2", "git2::Odb::writer"), Some("Fs"));
5102        assert_eq!(classify("git2", "git2::PackBuilder::write"), Some("Fs"));
5103        assert_eq!(classify("git2", "git2::Reference::delete"), Some("Fs"));
5104        assert_eq!(classify("git2", "git2::Reference::set_target"), Some("Fs"));
5105        assert_eq!(classify("git2", "git2::TreeBuilder::write"), Some("Fs"));
5106        // `Remote::list`/`RemoteConnection::list` call `raw::git_remote_ls` directly — the same
5107        // reference-advertisement Net effect `Remote::ls` was meant to catch, under the name git2 0.20
5108        // actually uses (there is no `ls` method left in the crate at all — that suffix rule is dead
5109        // weight, kept rather than removed since deleting it is a separate, unrelated cleanup).
5110        assert_eq!(classify("git2", "git2::Remote::list"), Some("Net"));
5111        assert_eq!(classify("git2", "git2::RemoteConnection::list"), Some("Net"));
5112        // `Cred::credential_helper` spawns a real `sh -c "<helper> get"` subprocess to resolve
5113        // `credential.helper` config (cred.rs:370-390) — a real consumer's most common way to honor it.
5114        assert_eq!(classify("git2", "git2::Cred::credential_helper"), Some("Exec"));
5115        assert_eq!(classify("git2", "git2::CredentialHelper::execute"), Some("Exec"));
5116        // NO FABRICATION controls: a `write`/`read`/`open` on some OTHER git2 type (not FQN-listed above)
5117        // must stay pure — this fix is FQN-exact, not a suffix re-widen.
5118        assert_eq!(classify("git2", "git2::Repository::state"), None);
5119        assert_eq!(classify("git2", "git2::Blob::content"), None);
5120        // tonic's SERVER half (the coverage-gate sweep found only the client verbs were covered):
5121        // `Router::serve`/`::serve_with_shutdown` bind a real listening socket via `TcpIncoming::new`
5122        // (`StdTcpListener::bind`), verified against tonic 0.12.3 source.
5123        assert_eq!(classify("tonic", "tonic::transport::server::Router::serve"), Some("Net"));
5124        assert_eq!(
5125            classify("tonic", "tonic::transport::server::Router::serve_with_shutdown"),
5126            Some("Net")
5127        );
5128        assert_eq!(classify("tonic", "tonic::TcpIncoming::new"), Some("Net"));
5129        // NO FABRICATION control: `Server<L>::serve_with_shutdown` (mod.rs:530) is a DIFFERENT,
5130        // `pub(crate)` method on a different type — not reachable by any consumer, and this fix does not
5131        // fabricate an effect for it by widening past the `Router::` FQN.
5132        assert_eq!(classify("tonic", "tonic::transport::server::Server::serve_with_shutdown"), None);
5133        // THE FIX: `Repository::clone`/`clone_recurse` and `RepoBuilder::clone` ARE libgit2's real
5134        // network clone — a corpus round found `git2::Repository::clone(url, path)` reporting ZERO
5135        // effects and passing `deny Net` at exit 0, because the bare `::clone` denylist meant to keep
5136        // out `Remote`'s derived `Clone` dup (below) also excluded the one thing the old comment named
5137        // as NOT meant to be excluded.
5138        assert_eq!(classify("git2", "git2::Repository::clone"), Some("Net"));
5139        assert_eq!(classify("git2", "git2::Repository::clone_recurse"), Some("Net"));
5140        assert_eq!(classify("git2", "git2::build::RepoBuilder::clone"), Some("Net"));
5141        // THE CONTROL: `Remote::clone` is the DERIVED `Clone` trait impl (an Arc/handle duplication, no
5142        // libgit2 call) — it must stay pure. Re-fabricating Net here would undo the very over-charge the
5143        // original exclusion existed to prevent. FQN-exact matching (not a bare `::clone` re-widen) keeps
5144        // this pure while catching `Repository::clone` above.
5145        assert_eq!(classify("git2", "git2::Remote::clone"), None);
5146        // THE SWEEP FIX: a fourth+fifth true positive in the SAME gap — `Submodule::clone`/
5147        // `Submodule::update` call `raw::git_submodule_clone`/`git_submodule_update` directly (the exact
5148        // leaves already in this file's FFI-tier NET table), but git2's documented submodule-init idiom
5149        // calls the safe Rust wrapper, which carried no rule of its own.
5150        assert_eq!(classify("git2", "git2::Submodule::clone"), Some("Net"));
5151        assert_eq!(classify("git2", "git2::Submodule::update"), Some("Net"));
5152        // NO FABRICATION: git2's many pure `update_*` setters (CheckoutBuilder/DiffOptions/StatusOptions)
5153        // must not gain Net — FQN-exact, not a bare `::update` substring.
5154        assert_eq!(classify("git2", "git2::build::CheckoutBuilder::update_only"), None);
5155        assert_eq!(classify("git2", "git2::DiffOptions::update_index"), None);
5156        assert_eq!(classify("git2", "git2::Submodule::update_strategy"), None);
5157        // memmap2: only the syscall-issuing map/flush/protect verbs are Fs; reads over an already-mapped
5158        // region (len/as_ptr/is_empty) and the request builder are PURE (whole-crate Fs fabricated Fs).
5159        assert_eq!(classify("memmap2", "memmap2::MmapOptions::map"), Some("Fs"));
5160        assert_eq!(classify("memmap2", "memmap2::MmapOptions::map_mut"), Some("Fs"));
5161        assert_eq!(classify("memmap2", "memmap2::Mmap::flush"), Some("Fs"));
5162        assert_eq!(classify("memmap2", "memmap2::MmapMut::make_read_only"), Some("Fs"));
5163        assert_eq!(classify("memmap2", "memmap2::Mmap::len"), None); // length read — pure
5164        assert_eq!(classify("memmap2", "memmap2::Mmap::is_empty"), None); // pure
5165        assert_eq!(classify("memmap2", "memmap2::Mmap::as_ptr"), None); // pointer — pure
5166        assert_eq!(classify("memmap2", "memmap2::MmapOptions::new"), None); // request builder — pure
5167        // arboard: the Clipboard handle's read/write verbs are Clipboard; `arboard::Error` formatting
5168        // and option data types are PURE (whole-crate Clipboard fabricated Clipboard on `Error::to_string`).
5169        assert_eq!(classify("arboard", "arboard::Clipboard::new"), Some("Clipboard"));
5170        assert_eq!(classify("arboard", "arboard::Clipboard::get_text"), Some("Clipboard"));
5171        assert_eq!(classify("arboard", "arboard::Clipboard::set_text"), Some("Clipboard"));
5172        assert_eq!(classify("arboard", "arboard::Clipboard::clear"), Some("Clipboard"));
5173        assert_eq!(classify("arboard", "arboard::Error::to_string"), None); // error formatting — pure
5174        assert_eq!(classify("arboard", "arboard::Error::fmt"), None); // Display impl — pure
5175        assert_eq!(classify("arboard", "arboard::ImageData::to_owned_img"), None); // pure data type
5176        // R59-class audit: `file_list` is `Get`/`Set`'s sibling terminal beside `text`/`image`/`html`
5177        // (verified against arboard 3.6.1 — the only `file_list` in the crate, so no ambiguity survives
5178        // the crate gate); `Clear::default` is `clear()`'s own alternate entry point.
5179        assert_eq!(classify("arboard", "arboard::Get::file_list"), Some("Clipboard"));
5180        assert_eq!(classify("arboard", "arboard::Set::file_list"), Some("Clipboard"));
5181        assert_eq!(classify("arboard", "arboard::Clear::default"), Some("Clipboard"));
5182        // fastrand: value draws + entropy-seeded entry points are Rand; the DETERMINISTIC seeded ctor
5183        // `with_seed` and state split/copy (`fork`/`clone`) are PURE (whole-crate Rand fabricated Rand).
5184        assert_eq!(classify("fastrand", "fastrand::u32"), Some("Rand")); // top-level draw
5185        assert_eq!(classify("fastrand", "fastrand::Rng::usize"), Some("Rand"));
5186        assert_eq!(classify("fastrand", "fastrand::Rng::shuffle"), Some("Rand"));
5187        assert_eq!(classify("fastrand", "fastrand::Rng::new"), Some("Rand")); // entropy-seeded
5188        assert_eq!(classify("fastrand", "fastrand::Rng::with_seed"), None); // deterministic ctor — pure
5189        assert_eq!(classify("fastrand", "fastrand::Rng::fork"), None); // state split — pure
5190        assert_eq!(classify("fastrand", "fastrand::Rng::clone"), None); // state copy — pure
5191        // portable_pty / async_process: spawn/wait keep Exec; config GETTERS and pure data ctors/setters
5192        // do NOT (base Exec fabricated on `CommandBuilder::get_cwd` / `PtySize::default` / `Stdio::piped`).
5193        assert_eq!(classify("portable_pty", "portable_pty::PtySystem::openpty"), Some("Exec"));
5194        assert_eq!(classify("portable_pty", "portable_pty::SlavePty::spawn_command"), Some("Exec"));
5195        assert_eq!(classify("portable_pty", "portable_pty::CommandBuilder::get_argv"), None); // getter
5196        assert_eq!(classify("portable_pty", "portable_pty::CommandBuilder::get_cwd"), None); // getter
5197        assert_eq!(classify("portable_pty", "portable_pty::PtySize::default"), None); // pure data type
5198        assert_eq!(classify("portable_pty", "portable_pty::CommandBuilder::new"), None); // builder ctor
5199        assert_eq!(classify("async_process", "async_process::Command::spawn"), Some("Exec"));
5200        assert_eq!(classify("async_process", "async_process::Command::output"), Some("Exec"));
5201        assert_eq!(classify("async_process", "async_process::Stdio::piped"), None); // pure data type
5202        assert_eq!(classify("async_process", "async_process::Stdio::null"), None); // pure data type
5203        // FFI tiers (matched by distinctive leaf, alias-independent)
5204        assert_eq!(classify("libc", "libc::open"), Some("Fs"));
5205        assert_eq!(classify("libc", "libc::connect"), Some("Net"));
5206        assert_eq!(classify("libc", "libc::read"), None); // generic fd op — deliberately unclassified
5207        assert_eq!(classify("ffi", "ffi::sqlite3_step"), Some("Db"));
5208        // SOUNDNESS R166 — the PROCESS-GLOBAL extension registry. `rusqlite::register_auto_extension`
5209        // calls `ffi::sqlite3_auto_extension` directly and read `[]` on the 0.34.0 binary: an explicit
5210        // empty effect set over a call that changes what every LATER `sqlite3_open` executes.
5211        assert_eq!(classify("ffi", "ffi::sqlite3_auto_extension"), Some("Db"));
5212        assert_eq!(classify("ffi", "ffi::sqlite3_cancel_auto_extension"), Some("Db"));
5213        assert_eq!(classify("ffi", "ffi::sqlite3_reset_auto_extension"), Some("Db"));
5214        assert_eq!(classify("ffi", "ffi::sqlite3_enable_load_extension"), Some("Db"));
5215        // …and the database-CONTENT I/O the same sweep found unlisted beside it.
5216        assert_eq!(classify("ffi", "ffi::sqlite3_deserialize"), Some("Db"));
5217        assert_eq!(classify("ffi", "ffi::sqlite3_serialize"), Some("Db"));
5218        assert_eq!(classify("ffi", "ffi::sqlite3_db_cacheflush"), Some("Db"));
5219        assert_eq!(classify("ffi", "ffi::sqlite3_file_control"), Some("Db"));
5220        assert_eq!(classify("ffi", "ffi::sqlite3_wal_autocheckpoint"), Some("Db"));
5221        // CONTROLS for the boundary this list deliberately stops at — an in-memory accessor and a
5222        // per-connection callback INSTALLER stay unclassified, so the additions above are not read as
5223        // "every `sqlite3_*` is Db". Both pass before and after R166; recorded as boundary, not coverage.
5224        assert_eq!(classify("ffi", "ffi::sqlite3_column_int64"), None);
5225        assert_eq!(classify("ffi", "ffi::sqlite3_create_function_v2"), None);
5226        assert_eq!(classify("raw", "raw::git_remote_fetch"), Some("Net"));
5227        // libgit2 clone + submodule clone/update fetch over the network (an A/B on git2 0.20 caught
5228        // `Submodule::update`/`clone` and `Repository::clone` reporting no Net — the latter because the
5229        // `src/build.rs` module was being dropped as if it were the Cargo build script).
5230        assert_eq!(classify("raw", "raw::git_clone"), Some("Net"));
5231        assert_eq!(classify("raw", "raw::git_submodule_clone"), Some("Net"));
5232        assert_eq!(classify("raw", "raw::git_submodule_update"), Some("Net"));
5233        assert_eq!(classify("raw", "raw::git_submodule_open"), None); // local subrepo open — not Net
5234        // libcurl: the transfer/raw-socket entry points are Net (an A/B on curl 0.4 caught the whole
5235        // crate reporting ZERO Net); the big setopt/init/getinfo surface — and the readiness-wait
5236        // multi_wait/poll — stay unclassified (the loop's perform is the boundary).
5237        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_perform"), Some("Net"));
5238        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_send"), Some("Net"));
5239        assert_eq!(classify("curl_sys", "curl_sys::curl_multi_perform"), Some("Net"));
5240        assert_eq!(classify("curl_sys", "curl_sys::curl_multi_socket_action"), Some("Net"));
5241        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_setopt"), None); // in-memory option write
5242        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_init"), None); // handle alloc
5243        assert_eq!(classify("curl_sys", "curl_sys::curl_multi_wait"), None); // readiness wait, no payload
5244        // consumer-side `curl` crate rule: the dispatch verbs are Net, the setopt builders pure.
5245        assert_eq!(classify("curl", "curl::easy::Easy::perform"), Some("Net"));
5246        assert_eq!(classify("curl", "curl::multi::Multi::perform"), Some("Net"));
5247        assert_eq!(classify("curl", "curl::easy::Easy::send"), Some("Net"));
5248        assert_eq!(classify("curl", "curl::easy::Easy::url"), None); // CURLOPT setter — pure
5249        assert_eq!(classify("curl", "curl::easy::Easy::timeout"), None); // pure setter; Multi::timeout under-reported by design
5250        assert_eq!(classify("ffi", "ffi::SSL_connect"), Some("Net"));
5251        // pure crates stay pure
5252        assert_eq!(classify("serde", "serde::Serialize::serialize"), None);
5253        assert_eq!(classify("std", "std::vec::Vec::push"), None);
5254
5255        // ── sweep 2026-06-17: fabrication carve-outs + DNS coverage (each fails pre-fix) ──
5256        // [24] std::net socket accessors are pure; the I/O verbs stay Net.
5257        assert_eq!(classify("std", "std::net::TcpStream::connect"), Some("Net"));
5258        assert_eq!(classify("std", "std::net::TcpStream::local_addr"), None);
5259        assert_eq!(classify("std", "std::net::TcpStream::nodelay"), None);
5260        assert_eq!(classify("std", "std::net::TcpStream::ttl"), None);
5261        assert_eq!(classify("std", "std::net::UdpSocket::peer_addr"), None);
5262        // [37] std DNS resolution is Net (was floored).
5263        assert_eq!(classify("std", "std::net::lookup_host"), Some("Net"));
5264        assert_eq!(classify("std", "core::net::ToSocketAddrs::to_socket_addrs"), Some("Net"));
5265        // [23] std::process getters are pure; spawn/new stay Exec.
5266        assert_eq!(classify("std", "std::process::Command::get_program"), None);
5267        assert_eq!(classify("std", "std::process::Command::get_args"), None);
5268        assert_eq!(classify("std", "std::process::Child::id"), None);
5269        assert_eq!(classify("std", "std::process::Command::spawn"), Some("Exec"));
5270        // [27] redis ConnectionManager::clone is an Arc bump (pure); a query round-trips.
5271        assert_eq!(classify("redis", "redis::aio::ConnectionManager::clone"), None);
5272        assert_eq!(classify("redis", "redis::aio::ConnectionManager::send_packed_command"), Some("Db"));
5273        // [5] sea_orm re-exported sea_query builder algebra is pure; execution verbs stay Db.
5274        assert_eq!(classify("sea_orm", "sea_orm::sea_query::Func::count"), None);
5275        assert_eq!(classify("sea_orm", "sea_orm::sea_query::Condition::all"), None);
5276        assert_eq!(classify("sea_orm", "sea_orm::Select::all"), Some("Db"));
5277        // THE FIX: `Database::connect_proxy` (the `proxy`-feature sibling of `Database::connect`) opens
5278        // a live `DatabaseConnection` through a caller-supplied `ProxyDatabaseTrait` — same effect,
5279        // missing from an allowlist keyed on the plain `connect` spelling.
5280        assert_eq!(classify("sea_orm", "sea_orm::Database::connect_proxy"), Some("Db"));
5281        // THE COVERAGE-GATE SWEEP: the transaction and pagination families, verified against sea-orm
5282        // 1.1.20 source.
5283        assert_eq!(classify("sea_orm", "sea_orm::DatabaseConnection::transaction"), Some("Db"));
5284        assert_eq!(
5285            classify("sea_orm", "sea_orm::DatabaseConnection::transaction_with_config"),
5286            Some("Db")
5287        );
5288        // BONUS (found proving the above reachable with a real fixture, not in the original ratchet):
5289        assert_eq!(classify("sea_orm", "sea_orm::DatabaseConnection::ping"), Some("Db"));
5290        assert_eq!(classify("sea_orm", "sea_orm::DatabaseConnection::begin"), Some("Db"));
5291        assert_eq!(
5292            classify("sea_orm", "sea_orm::DatabaseConnection::begin_with_config"),
5293            Some("Db")
5294        );
5295        assert_eq!(classify("sea_orm", "sea_orm::DatabaseTransaction::commit"), Some("Db"));
5296        assert_eq!(classify("sea_orm", "sea_orm::DatabaseTransaction::rollback"), Some("Db"));
5297        assert_eq!(classify("sea_orm", "sea_orm::SqlxMySqlPoolConnection::begin"), Some("Db"));
5298        assert_eq!(classify("sea_orm", "sea_orm::SqlxMySqlPoolConnection::ping"), Some("Db"));
5299        assert_eq!(classify("sea_orm", "sea_orm::SqlxMySqlPoolConnection::transaction"), Some("Db"));
5300        assert_eq!(classify("sea_orm", "sea_orm::SqlxPostgresPoolConnection::begin"), Some("Db"));
5301        assert_eq!(classify("sea_orm", "sea_orm::SqlxSqlitePoolConnection::ping"), Some("Db"));
5302        assert_eq!(classify("sea_orm", "sea_orm::Paginator::fetch"), Some("Db"));
5303        assert_eq!(classify("sea_orm", "sea_orm::Paginator::fetch_and_next"), Some("Db"));
5304        assert_eq!(classify("sea_orm", "sea_orm::Paginator::into_stream"), Some("Db"));
5305        assert_eq!(classify("sea_orm", "sea_orm::Paginator::num_pages"), Some("Db"));
5306        assert_eq!(classify("sea_orm", "sea_orm::Paginator::num_items_and_pages"), Some("Db"));
5307        assert_eq!(classify("sea_orm", "sea_orm::Insert::exec_with_returning_keys"), Some("Db"));
5308        assert_eq!(classify("sea_orm", "sea_orm::Inserter::exec_with_returning_many"), Some("Db"));
5309        assert_eq!(classify("sea_orm", "sea_orm::TryInsert::exec_with_returning_keys"), Some("Db"));
5310        // NO FABRICATION: the mock/proxy backends share every one of these verb names but perform no
5311        // real I/O (mock) or dispatch through a caller-supplied trait (proxy) — FQN-exact, not a bare
5312        // `::ping`/`::begin`/`::transaction`/`::commit`/`::rollback` suffix, keeps them pure/unknown.
5313        assert_eq!(classify("sea_orm", "sea_orm::MockDatabaseConnection::ping"), None);
5314        assert_eq!(classify("sea_orm", "sea_orm::MockDatabaseConnection::begin"), None);
5315        assert_eq!(classify("sea_orm", "sea_orm::ProxyDatabaseConnection::commit"), None);
5316        assert_eq!(classify("sea_orm", "sea_orm::ProxyDatabaseConnection::ping"), None);
5317    }
5318
5319    #[test]
5320    fn lettre_tls_setup_and_connection_family_is_covered() {
5321        // THE COVERAGE-GATE SWEEP, verified against lettre 0.11.23 source. `build_rustls` calls
5322        // `rustls_native_certs::load_native_certs()` (a real OS-trust-store read) + `tracing::debug!`.
5323        assert_eq!(
5324            classify("lettre", "lettre::transport::smtp::client::TlsParametersBuilder::build_rustls"),
5325            Some("Fs")
5326        );
5327        assert_eq!(classify("lettre", "lettre::TlsParametersBuilder::build"), Some("Fs"));
5328        assert_eq!(classify("lettre", "lettre::TlsParameters::new"), Some("Fs"));
5329        assert_eq!(classify("lettre", "lettre::TlsParameters::new_rustls"), Some("Fs"));
5330        assert_eq!(classify("lettre", "lettre::SmtpTransport::from_url"), Some("Fs"));
5331        assert_eq!(classify("lettre", "lettre::SmtpTransport::relay"), Some("Fs"));
5332        assert_eq!(classify("lettre", "lettre::SmtpTransport::starttls_relay"), Some("Fs"));
5333        assert_eq!(classify("lettre", "lettre::AsyncSmtpTransport::from_url"), Some("Fs"));
5334        assert_eq!(classify("lettre", "lettre::AsyncSmtpTransport::relay"), Some("Fs"));
5335        assert_eq!(classify("lettre", "lettre::AsyncSmtpTransport::starttls_relay"), Some("Fs"));
5336        assert_eq!(classify("lettre", "lettre::FileTransport::read"), Some("Fs"));
5337        // The sealed `Executor` trait impl — `#[doc(hidden)]`, a narrower surface, but genuinely
5338        // reachable (both the trait and `AsyncStd1Executor` are `pub`, re-exported at the crate root).
5339        assert_eq!(classify("lettre", "lettre::AsyncStd1Executor::connect"), Some("Net"));
5340        assert_eq!(classify("lettre", "lettre::AsyncStd1Executor::fs_read"), Some("Fs"));
5341        assert_eq!(classify("lettre", "lettre::AsyncStd1Executor::fs_write"), Some("Fs"));
5342        // Only reachable via the module-qualified path — neither type is re-exported at the crate root.
5343        assert_eq!(
5344            classify(
5345                "lettre",
5346                "lettre::transport::smtp::client::AsyncSmtpConnection::connect_asyncstd1"
5347            ),
5348            Some("Net")
5349        );
5350        assert_eq!(
5351            classify(
5352                "lettre",
5353                "lettre::transport::smtp::client::AsyncNetworkStream::connect_asyncstd1"
5354            ),
5355            Some("Net")
5356        );
5357        // NO FABRICATION: `NetworkStream` lives in a PRIVATE module (`mod net;`, never re-exported) — no
5358        // external consumer can ever name it, so no rule was added despite self-scan flagging its
5359        // `shutdown`/`set_read_timeout`/`set_write_timeout` (propagated from the coarse
5360        // `std::net::TcpStream` whole-handle rule).
5361        assert_eq!(classify("lettre", "lettre::NetworkStream::shutdown"), None);
5362        assert_eq!(classify("lettre", "lettre::NetworkStream::set_read_timeout"), None);
5363    }
5364
5365    #[test]
5366    fn rand_osrng_handle_ops_are_pure_but_draws_are_rand() {
5367        // Adversarial-review fabrication: the blanket `contains("OsRng")` tagged `OsRng::clone` Rand,
5368        // but OsRng is a unit struct — clone/fork/default draw no entropy. The real draws still fire.
5369        assert_eq!(classify("rand", "rand::rngs::OsRng::clone"), None);
5370        assert_eq!(classify("rand", "rand::rngs::OsRng::default"), None);
5371        assert_eq!(classify("rand", "rand::rngs::OsRng::fill_bytes"), Some("Rand")); // a real draw
5372        assert_eq!(classify("rand", "rand::rngs::OsRng::next_u32"), Some("Rand"));
5373        assert_eq!(classify("rand", "rand::Rng::gen"), Some("Rand")); // verb path unaffected
5374        assert_eq!(classify("rand", "rand::distributions::Uniform::new"), None); // pure ctor still pure
5375    }
5376
5377    #[test]
5378    fn redis_connection_manager_config_builder_is_pure() {
5379        // Adversarial-review fabrication: `contains("ConnectionManager")` hit the pure *Config* builder.
5380        assert_eq!(classify("redis", "redis::aio::ConnectionManagerConfig::new"), None);
5381        assert_eq!(classify("redis", "redis::aio::ConnectionManagerConfig::set_max_delay"), None);
5382        // the LIVE manager still round-trips (Db).
5383        assert_eq!(classify("redis", "redis::aio::ConnectionManager::new"), Some("Db"));
5384        assert_eq!(classify("redis", "redis::Commands::get"), Some("Db"));
5385    }
5386
5387    #[test]
5388    fn redis_get_connection_info_is_a_pure_accessor_not_swept_by_the_substring() {
5389        // coverage-gate sweep (2026-08-27): `contains("::get_connection")` also matched
5390        // `Client::get_connection_info` (a pure accessor over an already-stored field) because it is a
5391        // literal substring of that name — the real connection-getters stay caught.
5392        assert_eq!(classify("redis", "redis::Client::get_connection_info"), None);
5393        assert_eq!(classify("redis", "redis::Client::get_connection"), Some("Db"));
5394        assert_eq!(classify("redis", "redis::Client::get_async_connection"), Some("Db"));
5395        assert_eq!(
5396            classify("redis", "redis::Client::get_multiplexed_async_connection"),
5397            Some("Db")
5398        );
5399    }
5400
5401    #[test]
5402    fn aws_config_load_from_env_is_loads_own_convenience_wrapper() {
5403        // THE FIX: `load_from_env()` is the crate's OWN "convenience wrapper" (its doc comment's words)
5404        // around `from_env().load().await` — the exact already-modelled effect one call down — but
5405        // "load_from_env".ends_with("::load") is false.
5406        assert_eq!(classify("aws_config", "aws_config::load"), Some("Net"));
5407        assert_eq!(classify("aws_config", "aws_config::load_defaults"), Some("Net"));
5408        assert_eq!(classify("aws_config", "aws_config::load_from_env"), Some("Net"));
5409        assert_eq!(classify("aws_config", "aws_config::from_env"), None); // pure builder
5410    }
5411
5412    #[test]
5413    fn tungstenite_stream_first_handshake_entry_points_are_net() {
5414        // THE FIX: `client`/`client_with_config`/`client_tls`/`client_tls_with_config` (client.rs:176,
5415        // 159; tls.rs:163,179) and `accept`/`accept_with_config`/`accept_hdr`/`accept_hdr_with_config`
5416        // (server.rs:23-63) each run `{Client,Server}Handshake::start(stream, ..).handshake()` — the real
5417        // WS upgrade I/O over an already-open stream. tungstenite's OWN documented way to run over a
5418        // caller-managed TCP/TLS/mio stream, missing from a verb list keyed only on `connect`.
5419        assert_eq!(classify("tungstenite", "tungstenite::client::client"), Some("Net"));
5420        assert_eq!(classify("tungstenite", "tungstenite::client::client_with_config"), Some("Net"));
5421        assert_eq!(classify("tungstenite", "tungstenite::tls::client_tls"), Some("Net"));
5422        assert_eq!(classify("tungstenite", "tungstenite::tls::client_tls_with_config"), Some("Net"));
5423        assert_eq!(classify("tungstenite", "tungstenite::server::accept"), Some("Net"));
5424        assert_eq!(classify("tungstenite", "tungstenite::server::accept_with_config"), Some("Net"));
5425        assert_eq!(classify("tungstenite", "tungstenite::server::accept_hdr"), Some("Net"));
5426        assert_eq!(classify("tungstenite", "tungstenite::server::accept_hdr_with_config"), Some("Net"));
5427        assert_eq!(classify("tungstenite", "tungstenite::client::connect_with_config"), Some("Net"));
5428    }
5429
5430    #[test]
5431    fn mysql_conn_new_is_the_real_connect() {
5432        // THE FIX: `mysql::Conn::new` (conn/mod.rs:342) calls `connect_stream()?; connect()?` directly;
5433        // `mysql_async::Conn::new` (conn/mod.rs:921) is the async equivalent. Each crate's own primary
5434        // connection constructor, the crate's own first doctest example — but `::new` never appeared in
5435        // the verb list.
5436        assert_eq!(classify("mysql", "mysql::Conn::new"), Some("Db"));
5437        assert_eq!(classify("mysql_async", "mysql_async::Conn::new"), Some("Db"));
5438        // NO FABRICATION: the SAME two crates' unrelated pure `new`s (Opts/PoolConstraints/TxOpts/…)
5439        // must not gain Db — scoped to the `Conn::` segment, not a bare `::new` suffix.
5440        assert_eq!(classify("mysql", "mysql::Opts::new"), None);
5441        assert_eq!(classify("mysql", "mysql::PoolConstraints::new"), None);
5442        assert_eq!(classify("mysql_async", "mysql_async::TxOpts::new"), None);
5443    }
5444
5445    #[test]
5446    fn mongodb_with_options_is_the_same_effect_as_with_uri_str() {
5447        // THE FIX: `with_uri_str` (client.rs:179) is `ClientOptions::parse(uri).await?;
5448        // Client::with_options(options)` one call down — `with_options` (client.rs:188) is where the
5449        // topology/monitoring actually spins up, and mongodb's own doc calls it the entry point for a
5450        // caller who already holds parsed `ClientOptions`. Verified against mongodb 3.8.1 (both the
5451        // async `client.rs` and sync `sync/client.rs` `Client`).
5452        assert_eq!(classify("mongodb", "mongodb::Client::with_uri_str"), Some("Db"));
5453        assert_eq!(classify("mongodb", "mongodb::Client::with_options"), Some("Db"));
5454        assert_eq!(classify("mongodb", "mongodb::sync::Client::with_options"), Some("Db"));
5455        assert_eq!(classify("mongodb", "mongodb::Collection::find_one"), Some("Db"));
5456        // NO FABRICATION: an unrelated crate's `with_options` builder must not gain Db — crate-gated.
5457        assert_eq!(classify("some_other_crate", "some_other_crate::Widget::with_options"), None);
5458    }
5459
5460    #[test]
5461    fn pure_fd_transfer_is_not_an_effect() {
5462        // ADOPTING / EXTRACTING / BORROWING an already-open descriptor (or unwrapping an async type back
5463        // to its std type) issues NO syscall — it must be PURE even though it hangs off a std I/O type
5464        // whose prefix rule would otherwise fire Net/Fs/Ipc. (Real tokio sweep: `into_std`, `from_raw_fd`,
5465        // `as_raw_fd` all fabricated effects.)
5466        assert_eq!(classify("std", "std::net::TcpStream::from_raw_fd"), None);
5467        assert_eq!(classify("std", "std::net::TcpStream::into_raw_fd"), None);
5468        assert_eq!(classify("std", "std::net::TcpStream::as_raw_fd"), None);
5469        assert_eq!(classify("std", "std::net::TcpListener::from_raw_fd"), None);
5470        assert_eq!(classify("std", "std::net::UdpSocket::from_raw_socket"), None);
5471        assert_eq!(classify("std", "std::fs::File::from_raw_fd"), None);
5472        assert_eq!(classify("std", "std::fs::File::into_raw_fd"), None);
5473        assert_eq!(classify("std", "std::fs::File::as_raw_handle"), None);
5474        assert_eq!(classify("std", "std::os::unix::net::UnixStream::from_raw_fd"), None);
5475        // `SocketAddr::from_pathname` builds an address struct, opens no socket — pure. (socket2 sweep.)
5476        assert_eq!(classify("std", "std::os::unix::net::SocketAddr::from_pathname"), None);
5477        assert_eq!(classify("tokio", "tokio::net::TcpStream::from_raw_fd"), None);
5478        assert_eq!(classify("tokio", "tokio::net::TcpStream::into_std"), None); // unwrap → std type, pure
5479        assert_eq!(classify("tokio", "tokio::fs::File::into_std"), None);
5480        // …but a REAL open/connect on the SAME types still fires the effect — the carve-out is leaf-precise.
5481        assert_eq!(classify("std", "std::net::TcpStream::connect"), Some("Net"));
5482        assert_eq!(classify("std", "std::fs::File::open"), Some("Fs"));
5483        assert_eq!(classify("std", "std::fs::read"), Some("Fs"));
5484        assert_eq!(classify("std", "std::os::unix::net::UnixStream::connect"), Some("Ipc"));
5485        assert_eq!(classify("tokio", "tokio::net::TcpStream::connect"), Some("Net"));
5486    }
5487
5488    /// THE PLATFORM `fs` MODULES. `std::fs::` was the whole filesystem rule, so every function in
5489    /// `std::os::{unix,windows,wasi}::fs` read PURE — measured with EXECUTED ground truth (a `cargo run`
5490    /// that created a real symlink and stat'd it back), `deny Fs` over a crate whose only filesystem
5491    /// write was `std::os::unix::fs::symlink` exited 0.
5492    ///
5493    /// The controls are the point: the `*Ext` DATA/BUILDER traits must stay pure, or the fix trades a
5494    /// silent under-report for a fabrication on every `m.uid()` — and `FileExt` must NOT, because
5495    /// `read_at`/`write_at` are the positional-I/O syscalls this rule exists to catch.
5496    #[test]
5497    fn the_platform_fs_modules_are_filesystem_io_and_their_data_traits_are_not() {
5498        for p in [
5499            "std::os::unix::fs::symlink", "std::os::unix::fs::chown", "std::os::unix::fs::lchown",
5500            "std::os::unix::fs::fchown", "std::os::unix::fs::chroot",
5501            "std::os::windows::fs::symlink_dir", "std::os::windows::fs::symlink_file",
5502            "std::os::windows::fs::junction_point",
5503            "std::os::unix::fs::FileExt::read_at", "std::os::unix::fs::FileExt::write_at",
5504            "std::os::windows::fs::FileExt::seek_read", "std::os::windows::fs::FileExt::seek_write",
5505        ] {
5506            assert_eq!(classify("std", p), Some("Fs"), "{p} performs filesystem I/O");
5507        }
5508        for p in [
5509            "std::os::unix::fs::MetadataExt::uid", "std::os::unix::fs::MetadataExt::mode",
5510            "std::os::unix::fs::PermissionsExt::mode", "std::os::unix::fs::PermissionsExt::set_mode",
5511            "std::os::unix::fs::OpenOptionsExt::custom_flags",
5512            "std::os::unix::fs::DirBuilderExt::mode",
5513            "std::os::unix::fs::DirEntryExt::ino", "std::os::unix::fs::FileTypeExt::is_fifo",
5514            "std::os::windows::fs::MetadataExt::file_attributes",
5515        ] {
5516            assert_eq!(classify("std", p), None,
5517                       "{p} reads or configures data already in hand — charging it would FABRICATE Fs");
5518        }
5519        // `std::os::unix::net` is Ipc and must be untouched by a rule keyed one segment along.
5520        assert_eq!(classify("std", "std::os::unix::net::UnixStream::connect"), Some("Ipc"));
5521    }
5522
5523    /// SOUNDNESS R141 — the platform `process` modules, the sibling `fs` had a rule and `process` did
5524    /// not. `CommandExt::exec` is `execvp`: it REPLACES the process image, ground-truthed by a
5525    /// `cargo run` that printed a line from the exec'd image and never reached the line after the call.
5526    /// Both directions are driven here: the spawn surface must charge Exec (without the rule every
5527    /// assertion in the first loop returns `None` and `deny Exec` over a library whose only function
5528    /// calls `CommandExt::exec` exits 0), and the already-collected-status traits must NOT, or the fix
5529    /// trades a silent under-report for a fabrication on every `status.signal()` — the same control
5530    /// shape as the `fs` test above.
5531    #[test]
5532    fn the_platform_process_modules_are_exec_and_their_status_traits_are_not() {
5533        for p in [
5534            "std::os::unix::process::CommandExt::exec",
5535            "std::os::unix::process::CommandExt::pre_exec",
5536            "std::os::unix::process::CommandExt::arg0",
5537            "std::os::unix::process::CommandExt::uid",
5538            "std::os::unix::process::CommandExt::gid",
5539            "std::os::unix::process::CommandExt::groups",
5540            "std::os::unix::process::CommandExt::process_group",
5541            "std::os::windows::process::CommandExt::creation_flags",
5542            "std::os::windows::process::CommandExt::raw_arg",
5543            "std::os::windows::process::ChildExt::main_thread_handle",
5544            "std::os::wasi::process::CommandExt::exec",
5545        ] {
5546            assert_eq!(classify("std", p), Some("Exec"), "{p} is subprocess machinery");
5547        }
5548        for p in [
5549            "std::os::unix::process::ExitStatusExt::signal",
5550            "std::os::unix::process::ExitStatusExt::core_dumped",
5551            "std::os::unix::process::ExitStatusExt::from_raw",
5552            "std::os::unix::process::ExitStatusExt::into_raw",
5553            "std::os::unix::process::ExitStatusError::signal",
5554            "std::os::windows::process::ExitStatusExt::from_raw",
5555            "std::os::windows::process::ExitCodeExt::from_raw",
5556            "std::os::unix::process::parent_id",
5557        ] {
5558            assert_eq!(classify("std", p), None,
5559                       "{p} reads a status already collected (or this process's own pid) — charging it \
5560                        would FABRICATE Exec");
5561        }
5562        // Keyed one segment along: `fs` and `net` under the same platform root must be untouched.
5563        assert_eq!(classify("std", "std::os::unix::fs::FileExt::read_at"), Some("Fs"));
5564        assert_eq!(classify("std", "std::os::unix::net::UnixStream::connect"), Some("Ipc"));
5565    }
5566
5567    #[test]
5568    fn command_head_refines_the_exec_cliff() {
5569        use super::classify_command_head as h;
5570        // unambiguous external tools classify by basename (spec §4 ⟨0.5⟩)
5571        assert_eq!(h("curl"), &["Net"]);
5572        assert_eq!(h("telnet"), &["Net"]);
5573        assert_eq!(h("sftp"), &["Net"]);
5574        assert_eq!(h("/usr/local/bin/psql"), &["Db"]); // basename match strips the path
5575        assert_eq!(h("mongo"), &["Db"]);
5576        assert_eq!(h("cqlsh"), &["Db"]);
5577        // a candor engine is Fs/Env — spec-SUPPLIED by §7 item 12, not curation
5578        assert_eq!(h("candor-scan"), &["Env", "Fs"]);
5579        assert_eq!(h("candor-run.sh"), &["Env", "Fs"]);
5580        // an unrecognised head adds nothing — the bare Exec cliff stands (never guess). `make`/`npm`
5581        // run the project's own code; `git`/`rsync` are multi-modal (local vs remote) — all keep the
5582        // cliff rather than fabricate an effect for the common case.
5583        assert_eq!(h("some-unknown-tool"), &[] as &[&str]);
5584        assert_eq!(h("make"), &[] as &[&str]);
5585        assert_eq!(h("npm"), &[] as &[&str]);
5586        assert_eq!(h("git"), &[] as &[&str]);
5587        assert_eq!(h("rsync"), &[] as &[&str]);
5588        // a builder MODIFIER (`.arg`/`.env`) names no program — its literal must NOT refine (a
5589        // whole-crate-Exec crate classifies every method; `.env("psql",..)` must not fabricate Db).
5590        assert!(is_cmd_builder_method("env") && is_cmd_builder_method("arg") && is_cmd_builder_method("current_dir"));
5591        assert!(!is_cmd_builder_method("new")); // Command::new NAMES the program
5592        assert!(!is_cmd_builder_method("cmd")); // duct::cmd NAMES the program
5593        // The gate that ADMITS a literal to classify_command_head is an ALLOWLIST of program-NAMING
5594        // methods, not the builder denylist. Inversion matters: a whole-crate-Exec crate (portable_pty)
5595        // classifies EVERY method as Exec, so a getter like `cmd.get_env("psql")` — absent from the
5596        // builder denylist — would have leaked "psql" to the head and FABRICATED Db. Only `new`/`cmd`
5597        // name a program, so only they may refine.
5598        assert!(is_cmd_naming_method("new") && is_cmd_naming_method("cmd"));
5599        assert!(!is_cmd_naming_method("get_env")); // a GETTER, not a namer — the leak this closes
5600        assert!(!is_cmd_naming_method("arg") && !is_cmd_naming_method("env") && !is_cmd_naming_method("current_dir"));
5601    }
5602
5603    /// SOUNDNESS R379 — THE MASKING GUARD'S ALLOWLIST, AND THE DENYLIST THAT WAS MEASURED AND REJECTED.
5604    ///
5605    /// The verbs here take the HOST as an argument, so a runtime value in that position is invisible to
5606    /// the gate and the surface must be marked incomplete. The DNS resolver verbs were missing, and
5607    /// their absence was a GATE BYPASS, not a missed disclosure: `allow Net good.example.com` exited 0
5608    /// over `r.lookup_ip(caller_host)` sitting beside a benign literal, measured against real
5609    /// hickory-resolver 0.26.2.
5610    /// SOUNDNESS R386 — the `sqlite3_*` C API takes SQL, and its absence let a benign SIBLING literal
5611    /// certify arbitrary caller-supplied SQL.
5612    ///
5613    /// R383 recorded this gap as "REAL BUT NOT LIVE" because a C-string literal never reaches `tables`.
5614    /// That is true of an ISOLATED function and is the WRONG SHAPE: the literal only has to come from
5615    /// the same FUNCTION, not the same call. Measured, calibrated first (`deny Db` exits 1):
5616    /// `conn.execute("INSERT INTO users (id) VALUES (1)", [])` beside `sqlite3_exec(db, caller_sql, …)`
5617    /// gave `tables:['users'] incomplete:NONE` and `allow Db users` exited 0.
5618    #[test]
5619    fn db_query_arg_covers_the_sqlite3_sql_bearing_family() {
5620        // Every spelling that TAKES SQL — the whole family, not the one that was measured (R346).
5621        for f in ["sqlite3_exec", "sqlite3_prepare", "sqlite3_prepare_v2", "sqlite3_prepare_v3",
5622                  "sqlite3_prepare16", "sqlite3_prepare16_v2", "sqlite3_prepare16_v3",
5623                  // R386's own boundary, found by a release panel: SQL is arg 1 here too.
5624                  "sqlite3_get_table"] {
5625            assert!(is_db_query_arg(f), "{f} carries SQL — a runtime query there is invisible (R386)");
5626        }
5627        // THE OVER-MASK CONTROLS, and they carry as much weight as the fix. These take no query, so
5628        // masking them would fail `allow Db` closed over nothing. `sqlite3_open*` is the sharpest: it
5629        // takes a FILENAME, so masking it would claim a Db surface for an Fs locator.
5630        for f in ["sqlite3_step", "sqlite3_close", "sqlite3_open", "sqlite3_open_v2", "sqlite3_open16",
5631                  "sqlite3_serialize", "sqlite3_deserialize", "sqlite3_finalize", "sqlite3_reset",
5632                  // the backup/blob handle verbs carry no query either — the other half of the family
5633                  "sqlite3_backup_init", "sqlite3_backup_step", "sqlite3_blob_open", "sqlite3_blob_read"] {
5634            assert!(!is_db_query_arg(f),
5635                    "{f} carries no SQL — masking it claims an incomplete surface over nothing, and for \
5636                     the open* family it would claim a Db surface for a FILENAME");
5637        }
5638        // The pre-existing high-level verbs must survive.
5639        for f in ["execute", "query", "prepare", "prepare_cached", "simple_query"] {
5640            assert!(is_db_query_arg(f), "{f} was already covered and must stay covered");
5641        }
5642    }
5643
5644    /// SOUNDNESS R383 — the METHOD forms whose path is an ARGUMENT. The guard's `!c.method` gate
5645    /// excluded every method form because the path-STAT methods carry the path as their RECEIVER;
5646    /// `OpenOptions::open(path)` is the counter-example, and `allow Fs <lit>` exited 0 over a
5647    /// caller-supplied path because of it.
5648    #[test]
5649    fn fs_path_arg_methods_are_the_receiver_pairs_not_the_leaf() {
5650        // The path-taking pairs, matched on the TAIL so std/tokio/cap_primitives/fs_err all qualify.
5651        for p in ["std::fs::OpenOptions::open", "tokio::fs::OpenOptions::open",
5652                  "cap_primitives::fs::OpenOptions::open", "fs_err::OpenOptions::open",
5653                  "std::fs::DirBuilder::create", "tokio::fs::DirBuilder::create"] {
5654            assert!(is_fs_path_arg_method(p), "{p} takes its path as an ARGUMENT — R383");
5655        }
5656        // THE CONTROLS, and they are the row: every other method on the SAME receivers is a builder
5657        // modifier or a combinator, and `File`'s methods are use-verbs whose path was fixed at open.
5658        // Masking these is the over-mask a denylist would have caused (R379 measured that cost).
5659        for p in ["std::fs::File::read_to_string", "std::fs::File::write", "std::fs::File::write_all",
5660                  "std::fs::File::read", "std::fs::File::seek", "std::path::Path::exists",
5661                  "std::fs::OpenOptions::read", "std::fs::OpenOptions::truncate",
5662                  "std::fs::OpenOptions::map_err", "tokio::fs::OpenOptions::mode"] {
5663            assert!(!is_fs_path_arg_method(p),
5664                    "{p} hides no path — it is a builder modifier, a combinator, or a use-verb whose \
5665                     path was fixed at open. Masking it is the over-mask this allowlist avoids.");
5666        }
5667    }
5668
5669    #[test]
5670    fn net_establishing_allowlist() {
5671        // Host-bearing verbs establish — a runtime value here is invisible, so the gate must fail closed.
5672        for m in ["connect", "connect_timeout", "get", "post", "put", "patch", "delete", "head",
5673                  "request", "send_to", "lookup_host", "to_socket_addrs"] {
5674            assert!(is_net_establishing(m), "`{m}` takes the host as an argument and must establish");
5675        }
5676        // R379: the DNS resolver verbs `classify` already maps to Net. The WHOLE FAMILY, not the one
5677        // spelling that was found — `_lookup` is a suffix test mirroring `classify`'s own.
5678        for m in ["lookup", "lookup_ip", "resolve", "reverse_lookup", "srv_lookup", "mx_lookup",
5679                  "txt_lookup", "ipv4_lookup", "ipv6_lookup", "ns_lookup", "soa_lookup"] {
5680            assert!(is_net_establishing(m),
5681                    "`{m}` resolves a caller-supplied host — R379. Without it, `allow Net <benign \
5682                     literal>` exits 0 over a DNS lookup of a runtime hostname.");
5683        }
5684        // USE-verbs on an already-established connection: the host was fixed at `connect`, so a missing
5685        // literal here hides nothing and must NOT flag — else `connect("h").write(..)` fails closed.
5686        for m in ["write", "read", "send", "flush", "recv", "peek", "write_all", "read_to_end",
5687                  "write_vectored", "shutdown", "status", "headers", "text", "json"] {
5688            assert!(!is_net_establishing(m), "`{m}` is a use-verb on an established connection");
5689        }
5690    }
5691
5692    /// ⟨0.40⟩ SOUNDNESS R817 — an ACCEPT is not a BIND. The two lists answer different questions and must
5693    /// not share a member: a binding verb's literal is withheld and marks nothing, an accepting verb marks
5694    /// the surface incomplete. `accept`/`incoming` used to be binding verbs, which is the defect.
5695    #[test]
5696    fn r817_accepting_is_not_binding() {
5697        for (path, leaf) in [
5698            ("std::net::TcpListener::accept", "accept"),
5699            ("std::net::TcpListener::incoming", "incoming"),
5700            ("std::net::TcpListener::into_incoming", "into_incoming"),
5701            ("tokio::net::TcpListener::accept", "accept"),
5702            ("tokio::net::TcpListener::poll_accept", "poll_accept"),
5703            ("libc::accept", "accept"),
5704            ("libc::accept4", "accept4"),
5705            ("quinn::Endpoint::accept", "accept"),
5706            ("tonic::transport::server::Router::serve", "serve"),
5707            ("tonic::transport::server::Router::serve_with_shutdown", "serve_with_shutdown"),
5708            ("tonic::transport::server::TcpIncoming::new", "new"),
5709        ] {
5710            assert!(is_net_accepting(path, leaf), "`{path}` accepts connections: its peers are unseen");
5711            assert!(!is_net_binding(leaf), "`{leaf}` must not be a binding verb — binding withholds and marks nothing");
5712        }
5713        // CONTROLS — binds mark nothing; a stream accepted on an ESTABLISHED connection (quinn) has a peer
5714        // fixed at the endpoint's accept; a datagram receive is not an accept; `serve`/`new` elsewhere are
5715        // not accepts.
5716        for (path, leaf) in [
5717            ("std::net::UdpSocket::bind", "bind"),
5718            ("std::net::TcpListener::bind", "bind"),
5719            ("libc::listen", "listen"),
5720            ("quinn::Connection::accept_bi", "accept_bi"),
5721            ("quinn::Connection::accept_uni", "accept_uni"),
5722            ("std::net::UdpSocket::recv_from", "recv_from"),
5723            ("tonic::transport::server::Server::serve_with_shutdown", "serve_with_shutdown"),
5724            ("reqwest::Client::new", "new"),
5725        ] {
5726            assert!(!is_net_accepting(path, leaf), "`{path}` does not accept a connection");
5727        }
5728        for m in ["bind", "listen", "bind_to_device"] {
5729            assert!(is_net_binding(m), "`{m}` names a LOCAL address");
5730        }
5731    }
5732
5733    /// R379 — WHY THIS STAYS AN ALLOWLIST, which is NOT this family's usual direction.
5734    ///
5735    /// `candor-denylist-over-allowlist` says narrow a sound over-approximation with a denylist, and
5736    /// R350 made exactly that inversion one list over. It is wrong HERE, for the reason
5737    /// `is_cmd_naming_method` states two doc-blocks above for Exec: a WHOLE-CRATE-Net crate classifies
5738    /// every method as Net, so a denylist of use-verbs masks essentially everything in one. Measured by
5739    /// building the inversion and A/B-ing all 1,545 registry crates: **544 rows gained `incomplete`,
5740    /// none lost it** — `cap-std` 66, `hickory-net` 44 — and the triggers were conversions, accessors
5741    /// and combinators that hide no host.
5742    ///
5743    /// These are the measured leaks, pinned so the inversion cannot be re-attempted without meeting
5744    /// them. `bind` is the sharpest: this file has `is_net_binding` precisely because a bind address
5745    /// is where the process LISTENS, never a destination it reaches.
5746    #[test]
5747    fn the_rejected_denylist_leaks_are_not_establishing() {
5748        for m in ["bind", "into", "from", "from_std", "as_socket", "setsockopt", "getsockopt",
5749                  "map_err", "map", "ok", "try_clone", "complete_io"] {
5750            assert!(!is_net_establishing(m),
5751                    "`{m}` hides no host and must not mark a surface incomplete. It was a MEASURED \
5752                     trigger of the rejected denylist inversion (544 rows gained `incomplete` over the \
5753                     registry, 0 lost) — a whole-crate-Net crate classifies every method as Net, which \
5754                     is why the allowlist is the precise side here. See R379.");
5755        }
5756    }
5757
5758    #[test]
5759    fn fs_path_arg_allowlist() {
5760        // The Fs masking guard's path-naming-fn allowlist — free fns / constructors take the path as a
5761        // string arg (a runtime path there is invisible to the gate). Stat methods (path on the receiver)
5762        // and handle ops carry no path arg and must NOT flag — but they're caught by the caller's
5763        // `!is_method` gate; the allowlist itself just enumerates the path-NAMING leaves.
5764        assert!(is_fs_path_arg("write") && is_fs_path_arg("read") && is_fs_path_arg("read_to_string"));
5765        assert!(is_fs_path_arg("open") && is_fs_path_arg("create") && is_fs_path_arg("create_new"));
5766        assert!(is_fs_path_arg("remove_file") && is_fs_path_arg("rename") && is_fs_path_arg("copy"));
5767        assert!(is_fs_path_arg("create_dir_all") && is_fs_path_arg("canonicalize") && is_fs_path_arg("metadata"));
5768        // handle ops / pure builders take NO path arg — never path-naming.
5769        assert!(!is_fs_path_arg("write_all") && !is_fs_path_arg("flush") && !is_fs_path_arg("read_exact"));
5770        assert!(!is_fs_path_arg("new") && !is_fs_path_arg("sync_all") && !is_fs_path_arg("set_len"));
5771    }
5772
5773    #[test]
5774    fn db_query_arg_allowlist() {
5775        // The Db masking guard's query-bearing-verb allowlist — these take the raw SQL as a string arg
5776        // (a runtime query there is invisible to the gate). Build-then-execute terminals and non-query
5777        // ops carry no SQL string and must NOT flag.
5778        assert!(is_db_query_arg("execute") && is_db_query_arg("query") && is_db_query_arg("query_one"));
5779        assert!(is_db_query_arg("prepare") && is_db_query_arg("batch_execute") && is_db_query_arg("execute_batch"));
5780        assert!(is_db_query_arg("query_row") && is_db_query_arg("query_map") && is_db_query_arg("exec"));
5781        // build-then-execute terminals (query built structurally, no SQL string) must NOT flag.
5782        assert!(!is_db_query_arg("fetch_all") && !is_db_query_arg("load") && !is_db_query_arg("first"));
5783        assert!(!is_db_query_arg("all") && !is_db_query_arg("one") && !is_db_query_arg("stream"));
5784        // connection / lifecycle ops take no SQL — must NOT flag.
5785        assert!(!is_db_query_arg("connect") && !is_db_query_arg("open") && !is_db_query_arg("begin"));
5786        assert!(!is_db_query_arg("commit") && !is_db_query_arg("ping") && !is_db_query_arg("get_conn"));
5787    }
5788}
5789
5790#[cfg(test)]
5791mod fs_kind_tests {
5792    use super::fs_kind;
5793
5794    /// SPEC §2 `fs`. Most of what these assert is what the classifier REFUSES to say: §2 requires the
5795    /// field be "omitted rather than guessed", because an empty or partial `fs` reads as a positive claim
5796    /// ("reads but never writes") — the §4 trust contract's forbidden direction.
5797    #[test]
5798    fn write_verbs() {
5799        for p in ["std::fs::write", "std::fs::create_dir_all", "std::fs::remove_file",
5800                  "File::create", "std::fs::set_permissions", "f::write_all"] {
5801            assert_eq!(fs_kind(p), &["write"], "{p} mutates the disk");
5802        }
5803    }
5804
5805    #[test]
5806    fn read_verbs() {
5807        for p in ["std::fs::read_to_string", "std::fs::read_dir", "std::fs::metadata",
5808                  "File::open", "std::fs::canonicalize", "f::read_to_end"] {
5809            assert_eq!(fs_kind(p), &["read"], "{p} observes without mutating");
5810        }
5811    }
5812
5813    /// A copy/rename reads the source AND writes the destination — one call, both kinds.
5814    #[test]
5815    fn two_locator_verbs_are_both() {
5816        for p in ["std::fs::copy", "std::fs::rename", "std::fs::hard_link"] {
5817            assert_eq!(fs_kind(p), &["read", "write"], "{p}");
5818        }
5819    }
5820
5821    /// THE LOAD-BEARING CASE. A verb that does not reveal direction must contribute NOTHING — not a
5822    /// default, not a guess. Anything here returning a kind would let a function claim "reads but never
5823    /// writes" on the strength of a verb that said neither.
5824    #[test]
5825    fn unrevealing_verbs_make_no_claim() {
5826        for p in ["std::fs::OpenOptions", "some_crate::do_thing", "std::fs::File", "f::seek"] {
5827            assert!(fs_kind(p).is_empty(), "{p} must not claim a direction it did not reveal");
5828        }
5829    }
5830
5831    /// `OpenOptions::open` is `File::open`'s leaf and NOT its verb: the direction lives in the builder
5832    /// chain (`.read(true)`/`.write(true)`), which `fs_kind` cannot see. A `write(true)` builder claiming
5833    /// `["read"]` is the forbidden direction, so the type wins over the leaf here. `File::open` — where
5834    /// `open` DOES mean read — is unaffected, which is the whole reason this is keyed on the type.
5835    #[test]
5836    fn openoptions_open_claims_no_direction_but_file_open_still_reads() {
5837        for p in ["std::fs::OpenOptions::open", "fs_err::OpenOptions::open",
5838                  "tokio::fs::OpenOptions::open"] {
5839            assert!(fs_kind(p).is_empty(),
5840                    "{p}'s direction was set by the builder chain, which this function cannot see");
5841        }
5842        assert_eq!(fs_kind("std::fs::File::open"), &["read"], "`File::open` is unambiguously a read");
5843    }
5844}
5845
5846#[cfg(test)]
5847mod masks_locator_tests {
5848    use super::*;
5849
5850    /// SOUNDNESS R806 — each no-locator DENYLIST must be a SUBSET of the table it subtracts from. A
5851    /// typo'd or stale entry that is not in the table would subtract nothing and read as a decision;
5852    /// a table entry renamed without its denylist twin would silently start masking (the safe
5853    /// direction) — but only this check says which happened.
5854    #[test]
5855    fn every_no_locator_denylist_is_a_subset_of_its_charging_table() {
5856        for n in LIBC_FS_NO_PATH {
5857            assert!(LIBC_FS.contains(n), "LIBC_FS_NO_PATH names `{n}`, which LIBC_FS does not charge");
5858        }
5859        for n in LIBC_EXEC_NO_PROGRAM {
5860            assert!(LIBC_EXEC.contains(n), "LIBC_EXEC_NO_PROGRAM names `{n}`, absent from LIBC_EXEC");
5861        }
5862        for n in LIBC_NET_NO_DESTINATION {
5863            assert!(LIBC_NET.contains(n), "LIBC_NET_NO_DESTINATION names `{n}`, absent from LIBC_NET");
5864        }
5865        for n in PG_DB_VERBS_NO_SQL {
5866            assert!(PG_DB_VERBS.contains(n), "PG_DB_VERBS_NO_SQL names `{n}`, absent from PG_DB_VERBS");
5867        }
5868    }
5869
5870    /// SOUNDNESS R806 — THE DERIVATION, pinned from the table side: every leaf the table charges that is
5871    /// not on the denylist MASKS. So a leaf added to `LIBC_FS` tomorrow is masked with no second edit,
5872    /// which is the property the hand list lacked.
5873    #[test]
5874    fn every_charged_libc_leaf_off_the_denylist_masks() {
5875        for (eff, table, deny) in [
5876            ("Fs", LIBC_FS, LIBC_FS_NO_PATH),
5877            ("Exec", LIBC_EXEC, LIBC_EXEC_NO_PROGRAM),
5878            ("Net", LIBC_NET, LIBC_NET_NO_DESTINATION),
5879        ] {
5880            for leaf in table.iter().filter(|l| !deny.contains(l)) {
5881                for cr in ["libc", "nix"] {
5882                    let path = format!("{cr}::{leaf}");
5883                    assert_eq!(classify(cr, &path), Some(eff), "{path} must still be charged {eff}");
5884                    assert!(masks_locator(eff, cr, &path, leaf, false), "{path} names a locator — must mask");
5885                }
5886            }
5887            for leaf in deny.iter() {
5888                let path = format!("libc::{leaf}");
5889                assert!(!masks_locator(eff, "libc", &path, leaf, false) || is_net_establishing(leaf),
5890                        "{path} is on the no-locator denylist — must not mask via the table");
5891            }
5892        }
5893        // The named members, from the row: the sweep's EXECUTED arms.
5894        for (eff, leaf) in [("Fs", "unlink"), ("Fs", "unlinkat"), ("Fs", "utimensat"), ("Exec", "system"),
5895                            ("Exec", "popen"), ("Exec", "execvp"), ("Exec", "posix_spawn"), ("Net", "getaddrinfo"),
5896                            ("Net", "sendto")] {
5897            assert!(masks_locator(eff, "libc", &format!("libc::{leaf}"), leaf, false), "libc::{leaf}");
5898        }
5899        // Scoped to the syscall crates: the same leaf on an unrelated crate is not this table's to judge.
5900        assert!(!masks_locator("Fs", "mycrate", "mycrate::unlink", "unlink", false));
5901        // rustix spells `sendmsg` WITHOUT an address; libc and nix carry one.
5902        assert!(!masks_locator("Net", "rustix", "rustix::net::sendmsg", "sendmsg", false));
5903        assert!(masks_locator("Net", "libc", "libc::sendmsg", "sendmsg", false));
5904    }
5905
5906    #[test]
5907    fn pg_verbs_take_sql_except_the_named_three() {
5908        for v in PG_DB_VERBS.iter().filter(|v| !PG_DB_VERBS_NO_SQL.contains(v)) {
5909            let path = format!("deadpool_postgres::Client{v}");
5910            let leaf = &v[2..];
5911            assert!(masks_locator("Db", "deadpool_postgres", &path, leaf, true), "{path} takes SQL — must mask");
5912        }
5913        assert!(masks_locator("Db", "tokio_postgres", "tokio_postgres::Client::prepare_typed_cached",
5914                              "prepare_typed_cached", true));
5915        assert!(!masks_locator("Db", "tokio_postgres", "tokio_postgres::Client::transaction", "transaction", true));
5916        assert!(masks_locator("Db", "sqlx_core", "sqlx_core::executor::Executor::prepare_with", "prepare_with", true));
5917        assert!(!masks_locator("Db", "sqlx_core", "sqlx_core::query::Query::fetch_all", "fetch_all", true),
5918                "a Query terminal takes an EXECUTOR at arg 0 — masking it would swallow every literal query");
5919    }
5920
5921    /// THE COVERAGE-GATE REFRESH (2026-10-08) — each family's rule fires on the spellings a consumer writes
5922    /// and NOT on a sibling type or an accessor (each charge is traced to a body in the rule's comment).
5923    #[test]
5924    fn coverage_gate_refresh_2026_10_08_rules() {
5925        for p in ["rusqlite::Transaction::commit", "rusqlite::transaction::Transaction::new",
5926                  "rusqlite::Savepoint::rollback", "rusqlite::Connection::pragma_update",
5927                  "rusqlite::Connection::unchecked_transaction", "rusqlite::Connection::savepoint_with_name"] {
5928            assert_eq!(classify("rusqlite", p), Some("Db"), "{p}");
5929        }
5930        for p in ["rusqlite::Transaction::drop_behavior", "rusqlite::Savepoint::set_drop_behavior"] {
5931            assert_eq!(classify("rusqlite", p), None, "{p}");
5932        }
5933        for p in ["redis::Connection::send_packed_command", "redis::connection::Connection::recv_response",
5934                  "redis::PubSub::get_message"] {
5935            assert_eq!(classify("redis", p), Some("Net"), "{p}");
5936        }
5937        assert_eq!(classify("redis", "redis::aio::MultiplexedConnection::recv_response"), None);
5938        assert_eq!(classify("redis", "redis::Connection::set_write_timeout"), None);
5939        for p in ["lettre::SmtpConnection::command", "lettre::transport::smtp::client::SmtpConnection::connect",
5940                  "lettre::AsyncSmtpConnection::read_response",
5941                  "lettre::transport::smtp::client::AsyncNetworkStream::connect_tokio1",
5942                  "lettre::Tokio1Executor::connect"] {
5943            assert_eq!(classify("lettre", p), Some("Net"), "{p}");
5944        }
5945        for p in ["lettre::SmtpConnection::server_info", "lettre::NetworkStream::peer_addr",
5946                  "lettre::AsyncSmtpConnection::is_encrypted"] {
5947            assert_eq!(classify("lettre", p), None, "{p}");
5948        }
5949        assert_eq!(classify("rustls", "rustls::KeyLogFile::log"), Some("Fs"));
5950        assert_eq!(classify("rustls", "rustls::NoKeyLog::log"), None);
5951    }
5952}