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    // SOUNDNESS R1288 — THIRD-PARTY CLOCK WRAPPERS. `tokio::time::Instant::now()` reads the monotonic clock (through
2579    // tokio's mockable time source) exactly as `std::time::Instant::now()` does, and read PURE: tokio-util's
2580    // `DelayQueue::insert`/`reset` and tokio-stream's `throttle` were covered only by a false `ambiguous:` hedge in
2581    // v0.40.13. The same `now` accessor on the dedicated clock crates' instant types: `quanta` (`Instant::now`,
2582    // `Clock::now`), `minstant`, `web_time`, `instant`, `coarsetime` (`Instant::now`). `now` only — their arithmetic and
2583    // conversions are pure.
2584    if path.ends_with("::now")
2585        && (path.starts_with("tokio::time::Instant::")
2586            || matches!(crate_name, "quanta" | "minstant" | "web_time" | "instant" | "coarsetime"))
2587    {
2588        return Some("Clock");
2589    }
2590    // `tracing`: same principle as the `log` facade below — the crate's TYPES are pure data, so match
2591    // the emit, not the whole crate. The actual program output is the macro-expanded
2592    // `Subscriber::event`/`event!`/`Span::*enter*` dispatch and the `Span::new*`/`Span::record`
2593    // recording path that drives the subscriber. The data-type accessors — `Level::as_str`,
2594    // `Span::is_disabled`/`metadata`/`id`, and constructing/reading `Level`/`LevelFilter`/`Span`/
2595    // `Event`/`Metadata`/`Field`/`FieldSet`/`Id` — are PURE (no output is produced), so whole-crate Log
2596    // fabricated Log on them. Match the emit verbs; everything else returns None.
2597    if crate_name == "tracing" {
2598        let m = path.rsplit("::").next().unwrap_or(path);
2599        // The user-facing emit MACROS (`tracing::info!`/`warn!`/…) — candor-scan is pre-expansion, so it
2600        // sees the raw macro path `tracing::info`, not the expanded `__tracing`/`Subscriber::event` the
2601        // deep (post-expansion) engine sees. Only the macro names; the pure DATA types (Level/Span/Event)
2602        // have other tails and stay None.
2603        if m == "trace" || m == "debug" || m == "info" || m == "warn" || m == "error"
2604            || m == "trace_span" || m == "debug_span" || m == "info_span" || m == "warn_span"
2605            || m == "error_span" || m == "span"
2606            || m == "event"
2607            || m == "new_span"
2608            || m == "record"
2609            || m == "record_follows_from"
2610            || m == "enter"
2611            || m == "exit"
2612            || m == "in_scope"
2613            || m == "entered"
2614            || path.contains("::__macro_support")
2615            || path.contains("::__tracing")
2616            || path.contains("Subscriber::event")
2617            || path.contains("Subscriber::new_span")
2618            || path.contains("Subscriber::enter")
2619            || path.contains("Subscriber::exit")
2620        {
2621            return Some("Log");
2622        }
2623        return None;
2624    }
2625    // The `log` facade: its macros route through `log::__private_api`; the crate's types
2626    // (`Level`, `LevelFilter`) are pure, so match the logging entry, not the whole crate.
2627    if crate_name == "log" {
2628        // Expanded macro form (deep engine) OR the raw user-facing macro names (candor-scan, pre-expansion).
2629        // `log::Level`/`LevelFilter`/`Record`/`Metadata` have other tails, so the type surface stays pure.
2630        let m = path.rsplit("::").next().unwrap_or(path);
2631        if path.contains("::__private_api")
2632            || m == "error" || m == "warn" || m == "info" || m == "debug" || m == "trace" || m == "log"
2633        {
2634            return Some("Log");
2635        }
2636    }
2637    // Compiler diagnostic emission — the ONE genuinely effectful operation in the otherwise-pure
2638    // rustc_* surface (a dylint lint's actual OUTPUT: it writes warnings/errors to the compiler's
2639    // diagnostic sink). Classified `Log` (same family as `tracing`/`log` — program output). Match the
2640    // emission verbs precisely; rustc_lint/rustc_errors are mostly pure types (Lint, LintId, the Diag
2641    // BUILDERS), and only the terminal `emit`/`emit_span_lint` actually produces output.
2642    if crate_name == "rustc_lint"
2643        && (path.ends_with("::emit_span_lint")
2644            || path.ends_with("::span_lint")
2645            || path.ends_with("::span_lint_hir"))
2646    {
2647        return Some("Log");
2648    }
2649    if crate_name == "rustc_errors"
2650        && (path.ends_with("::emit")
2651            || path.ends_with("::emit_diagnostic")
2652            || path.ends_with("::emit_now"))
2653    {
2654        return Some("Log");
2655    }
2656    // arboard: the effectful surface is the `Clipboard` handle's read/write verbs (each talks to the
2657    // OS clipboard / X11/Wayland/Win32/NSPasteboard server). The data types — chiefly `arboard::Error`
2658    // (whose `Display`/`to_string` formatting is pure) and the `ImageData`/`GetExtLinux`/`SetExtLinux`
2659    // option types — are PURE, so whole-crate Clipboard fabricated Clipboard on e.g. an error
2660    // `to_string()`. Match the handle verbs; everything else returns None. `Clipboard::new` opens the
2661    // connection to the clipboard server, so it's an effect too; `get`/`set` return the
2662    // builder-then-read `Get`/`Set` cursors whose `text`/`image`/`html` terminals do the I/O.
2663    //
2664    // THE ~79-CRATE R59-CLASS AUDIT (2026-08-28), verified against arboard 3.6.1: `file_list`
2665    // (lib.rs:205,251, `Get::file_list`/`Set::file_list`) is the SAME builder-then-terminal shape as
2666    // `text`/`image`/`html` two lines up — reading/writing the clipboard's file-path list — but was
2667    // missing, not because it's ambiguous (it's the only `file_list` in the crate) but because
2668    // `eval/coverage-gate/generate.py`'s own generator only triggers on a self-scan `inferred` set
2669    // containing Fs/Net/Db/Exec; Clipboard isn't in that trigger set, so a missing Clipboard verb is
2670    // structurally invisible to the completeness gate regardless of phrasing. `Clear::default`
2671    // (lib.rs:265) is `Clipboard::clear`'s own documented alternate entry point
2672    // (`clear() { self.clear_with().default() }`, lib.rs:156-158) — the SAME "sibling constructor"
2673    // shape as `ignore::Walk::new` beside `WalkBuilder::build`; `clear_with()` itself doesn't share
2674    // `clear`'s leaf, so neither the constructor nor its terminal was covered. `default` is otherwise
2675    // unused in this crate (no derived `Default` impls), so the bare leaf carries no fabrication risk
2676    // once crate-gated.
2677    if crate_name == "arboard" {
2678        let m = path.rsplit("::").next().unwrap_or(path);
2679        if m == "new"
2680            || m == "get"
2681            || m == "set"
2682            || m == "clear"
2683            || m == "get_text"
2684            || m == "set_text"
2685            || m == "set_html"
2686            || m == "get_image"
2687            || m == "set_image"
2688            || m == "text"
2689            || m == "image"
2690            || m == "html"
2691            || m == "file_list"
2692            || m == "default"
2693        {
2694            return Some("Clipboard");
2695        }
2696        return None;
2697    }
2698    // ── Coverage-differential additions (calibrated against each crate's real API; see the per-crate
2699    //    notes). All verb-keyed + crate-gated, with the pure builder/config/data surface returning None.
2700
2701    // `etcetera` — XDG/known-folder base+app directory resolution. Each dir ACCESSOR reads the
2702    // environment at call time (`$HOME`/`$XDG_*` on Unix, `%APPDATA%`/`%LOCALAPPDATA%` on Windows), and
2703    // the `choose_*`/`home_dir` entry points read `$HOME`. The `AppStrategyArgs` data struct and the
2704    // strategy types themselves are PURE. (Found DISCLOSED-but-unmodeled in 3/4 differential projects.)
2705    if crate_name == "etcetera" {
2706        let m = path.rsplit("::").next().unwrap_or(path);
2707        if m == "home_dir"
2708            || m == "choose_base_strategy" || m == "choose_native_strategy" || m == "choose_app_strategy"
2709            || m == "config_dir" || m == "data_dir" || m == "cache_dir"
2710            || m == "state_dir" || m == "runtime_dir" || m == "data_local_dir"
2711        {
2712            return Some("Env");
2713        }
2714        return None;
2715    }
2716    // `sqlx-core` (crate `sqlx_core`) — the execution terminals under the sqlx core (the `sqlx` builder
2717    // table maps `sqlx::query*`; here it's the core `Executor`/`Connection`/`Pool` round-trips). Opening
2718    // the connection is the network boundary (Net); the query/transaction round-trips are Db. The
2719    // `*Options`/query-builder/row data types are PURE. Crate-gated so the generic verbs never spread.
2720    if crate_name == "sqlx_core" {
2721        if path.ends_with("::connect") || path.ends_with("::connect_with") {
2722            return Some("Net");
2723        }
2724        if path.ends_with("::fetch") || path.ends_with("::fetch_all") || path.ends_with("::fetch_one")
2725            || path.ends_with("::fetch_optional") || path.ends_with("::fetch_many")
2726            || path.ends_with("::execute") || path.ends_with("::execute_many")
2727            || path.ends_with("::prepare") || path.ends_with("::prepare_with")
2728            || path.ends_with("::acquire") || path.ends_with("::begin") || path.ends_with("::ping")
2729        {
2730            return Some("Db");
2731        }
2732        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against sqlx-core 0.8.6/0.9.0 (identical
2733        // shape in both) — the free-function surface under `pub mod fs`/`pub mod net::tls`/
2734        // `pub mod migrate`, none of which end in the connect/fetch/execute verbs above:
2735        //
2736        // `fs::{read,read_to_string,create_dir_all,remove_file,remove_dir,remove_dir_all,read_dir}`
2737        // (fs.rs) are direct `std::fs::*` calls off-loaded to `spawn_blocking` — sqlx's OWN async
2738        // filesystem shim, used by the migrator to read `.sql` files and by SQLite to manage on-disk
2739        // databases. `net::tls::handshake` (net/tls/mod.rs:69) is the real TLS handshake dispatch
2740        // reqwest/ureq-style crates already model — sqlx has its OWN copy because it drives the
2741        // handshake over its own `Socket` trait rather than a `TcpStream` directly.
2742        // `migrate::resolve_blocking`/`resolve_blocking_with_config` (migrate/source.rs:151,156) are
2743        // `#[doc(hidden)]` but still `pub use`-exported at `sqlx_core::migrate` (mod.rs:16) — real,
2744        // callable, and reads the migrations directory off disk (`fs::read_dir` + per-file `canonicalize`).
2745        //
2746        // NOT included: `net::tls::tls_rustls::RustlsSocket::poll_{flush,read_ready,write_ready,
2747        // shutdown}` — `RustlsSocket` is declared inside `mod tls_rustls;` (net/tls/mod.rs), which is
2748        // PRIVATE with no re-export, so no external consumer can ever name it (the same private-module
2749        // shape as tempfile's `imp::` functions above). Removed from open.tsv rather than guessed.
2750        if path == "sqlx_core::fs::read"
2751            || path == "sqlx_core::fs::read_to_string"
2752            || path == "sqlx_core::fs::create_dir_all"
2753            || path == "sqlx_core::fs::remove_file"
2754            || path == "sqlx_core::fs::remove_dir"
2755            || path == "sqlx_core::fs::remove_dir_all"
2756            || path == "sqlx_core::fs::read_dir"
2757            || path.ends_with("::migrate::resolve_blocking")
2758            || path.ends_with("::migrate::resolve_blocking_with_config")
2759            || path == "sqlx_core::config::Config::try_from_path"
2760            || path == "sqlx_core::Config::try_from_path"
2761            || path == "sqlx_core::config::Config::try_from_path_or_default"
2762            || path == "sqlx_core::Config::try_from_path_or_default"
2763            || path == "sqlx_core::config::Config::try_from_crate_or_default"
2764            || path == "sqlx_core::Config::try_from_crate_or_default"
2765        {
2766            return Some("Fs");
2767        }
2768        if path.ends_with("::net::tls::handshake") {
2769            return Some("Net");
2770        }
2771        return None;
2772    }
2773    // `walkdir` — recursive directory traversal. Charged at `WalkDir::new` (construction), the SAME
2774    // point `ignore::WalkBuilder::build`/`glob::glob` are charged, and NOT at `IntoIter::next` (driving
2775    // the iterator) as this rule originally read. The disk read (`read_dir`+`stat`) is technically lazy
2776    // — nothing happens until the value is iterated — but `.next()` is reached ONLY through a receiver
2777    // typed as `walkdir::IntoIter`, and candor-scan's receiver-typing (`ctor_type`/`resolve_recv_type`)
2778    // hard-blocks the `.into_iter()` verb (a guard against fabricating onto a DIFFERENT std type, e.g.
2779    // `Vec::into_iter()` -> `std::vec::IntoIter`) with no per-crate exception for the SAME-crate case.
2780    // `WalkDir::into_iter()` returns `walkdir::IntoIter` (same crate as `WalkDir` itself, exactly the
2781    // shape the blocklist exists to protect, not the shape it should be blocking) — so every idiomatic
2782    // form (`for e in WalkDir::new(p)`, `.into_iter().count()`, `.into_iter().filter_map(..)`, an
2783    // untyped `let it = ...into_iter(); it.next()`) never reaches a typed `IntoIter::next` receiver and
2784    // read silent-pure under the OLD rule, with `deny Fs` exiting 0 over code that walks the filesystem.
2785    // Charging at `WalkDir::new` needs no receiver typing at all — it's a plain `Expr::Call`, robust to
2786    // however the iterator is later consumed. `max_depth`/`follow_links`/`sort_by`/`into_iter` (the
2787    // BUILDER chain, no I/O until pulled) and the cached `DirEntry::path`/`file_name`/`file_type`/`depth`
2788    // accessors (`file_type` makes NO syscall) stay PURE — matched by nothing here, so they fall through.
2789    // The `IntoIter::next`/`DirEntry::metadata` rule is KEPT, not dead: it still fires whenever the
2790    // concrete `walkdir::IntoIter` type reaches `.next()` by a route the blocklist doesn't gate — an
2791    // EXPLICIT type annotation (`let it: walkdir::IntoIter = ...`), a struct field declared with that
2792    // type, or a local fn's declared return type — real, if rarer, shapes than the inline-chain idiom.
2793    // (Companion to the already-modeled `ignore`.)
2794    if crate_name == "walkdir" {
2795        if path.ends_with("::WalkDir::new")
2796            || path.ends_with("::IntoIter::next")
2797            || path.ends_with("::DirEntry::metadata")
2798        {
2799            return Some("Fs");
2800        }
2801        return None;
2802    }
2803    // `filetime` — file-timestamp mutation. The `set_*` free fns issue utimes/utimensat/futimens (Fs).
2804    // `FileTime::now` reads the system clock (Clock). The `FileTime::from_*`/`zero` value constructors
2805    // (incl. `from_last_modification_time(&Metadata)` etc., which read an ALREADY-loaded `&Metadata`, not
2806    // the disk) and the `seconds`/`nanoseconds` accessors are PURE.
2807    if crate_name == "filetime" {
2808        if path.ends_with("::set_file_mtime") || path.ends_with("::set_file_atime")
2809            || path.ends_with("::set_file_times") || path.ends_with("::set_symlink_file_times")
2810            || path.ends_with("::set_file_handle_times")
2811        {
2812            return Some("Fs");
2813        }
2814        if path.ends_with("::FileTime::now") {
2815            return Some("Clock");
2816        }
2817        return None;
2818    }
2819    // `execute` — the `Execute` trait that extends `std::process::Command` with run helpers. The
2820    // `execute*` verbs SPAWN a child process (Exec). The `execute::command`/`shell` free fns and the
2821    // `command!`/`command_args!` macros only BUILD a Command (no spawn) and stay PURE.
2822    if crate_name == "execute" {
2823        if path.contains("::execute") {
2824            return Some("Exec");
2825        }
2826        return None;
2827    }
2828    // `ctrlc` — installs an OS signal handler (Unix SIGINT/SIGTERM/SIGHUP, Windows CTRL_C_EVENT) and
2829    // spawns its handler thread. Signals are an inter-process control channel, so the closest bucket is
2830    // Ipc (candor has no dedicated Signal effect; same judgment as routing SysV/pipe IPC to Ipc).
2831    if crate_name == "ctrlc" {
2832        if path.ends_with("::set_handler") || path.ends_with("::try_set_handler") {
2833            return Some("Ipc");
2834        }
2835        return None;
2836    }
2837    // `clap` — argument parsing. ONLY the terminals that read `std::env::args_os` at call time are an
2838    // effect (Env): `get_matches`/`get_matches_mut`/`try_get_matches` and the derive `parse`/`try_parse`.
2839    // clap is MOSTLY PURE: the ENTIRE builder surface (`Command::new`/`arg`/`about`/`Arg::new`) stays
2840    // None, and crucially the `*_from`/`*_parse_from` variants take an EXPLICIT iterator (they do NOT
2841    // read argv) so they stay pure too.
2842    //
2843    // THE ~79-CRATE R59-CLASS AUDIT (2026-08-28): this file used to leave `Arg::env` unmodeled, calling
2844    // bare `::env` "too generic to gate safely" — the same words used for libc's genuinely ambiguous fd
2845    // verbs. It isn't the same shape: `Arg::env(name)` calls `env::var_os(&name)` DIRECTLY at builder
2846    // time (verified against clap_builder 4.6.6, builder/arg.rs:2205-2213 — real, immediate, not
2847    // deferred to `get_matches()`), and — unlike a bare fd, which could be Fs/Net/Ipc — `clap_builder`
2848    // has exactly ONE `pub fn` ending `::env` in its entire source (`Arg::env`; the deprecated
2849    // `Arg::env_os` is a one-line delegate to it). This whole match arm is already crate-gated on
2850    // `crate_name == "clap"`, so no ambiguity survives to fabricate on: a fixture proved the untreated
2851    // gap silently vanishes the function ("functions": [] — the exact R59 shape, worse than an
2852    // uncalibrated dependency, since `clap` is fully `CALIBRATED_CRATES` and the miss reads as
2853    // reviewed-pure rather than disclosed). Classified, not carved into
2854    // `CALIBRATED_BUT_PARTIAL_CRATES`, because the effect IS unambiguous once actually checked.
2855    if crate_name == "clap" {
2856        if path.ends_with("::get_matches") || path.ends_with("::get_matches_mut")
2857            || path.ends_with("::try_get_matches")
2858            || path.ends_with("::parse") || path.ends_with("::try_parse")
2859            || path.ends_with("::env") || path.ends_with("::env_os")
2860        {
2861            return Some("Env");
2862        }
2863        return None;
2864    }
2865    // `jiff` — date/time. `Timestamp::now`/`Zoned::now`/`Zoned::now_with` read the wall clock (Clock).
2866    // `tz::TimeZone::system`/`get` and `tz::db().get` read the system tzdb files from disk
2867    // (`/etc/localtime`, `/usr/share/zoneinfo`; `system` is also `$TZ`-overridable — Fs is the dominant
2868    // op, modeled as Fs). The `Span`/`civil` date math and `Timestamp`/`Zoned` arithmetic are PURE.
2869    if crate_name == "jiff" {
2870        if path.ends_with("::now") || path.ends_with("::now_with") {
2871            return Some("Clock");
2872        }
2873        if path.ends_with("::TimeZone::system") || path.ends_with("::TimeZone::get")
2874            || path.ends_with("::TimeZoneDatabase::get")
2875            // `TimeZone::try_system` (tz/timezone.rs:391) is `TimeZone::system`'s fallible sibling —
2876            // same `crate::tz::system::get(crate::tz::db())` call, real localtime/zoneinfo disk read.
2877            || path.ends_with("::TimeZone::try_system")
2878        {
2879            return Some("Fs");
2880        }
2881        return None;
2882    }
2883    // `env_logger` — installs the global logger and emits to stderr; reads `RUST_LOG`/`RUST_LOG_STYLE`.
2884    // The init terminals are the effect (Log — program output, same family as `log`/`tracing`). The
2885    // `Builder::new`/`build` and the format/filter/target config setters are PURE.
2886    if crate_name == "env_logger" {
2887        if path.ends_with("::init") || path.ends_with("::try_init")
2888            || path.ends_with("::init_from_env") || path.ends_with("::try_init_from_env")
2889        {
2890            return Some("Log");
2891        }
2892        return None;
2893    }
2894    // `dialoguer` — interactive terminal prompts. The `interact*` verbs read stdin + write the tty (a
2895    // console dialogue with the user — Ipc, like the other local-channel effects). The
2896    // `with_prompt`/`default`/`items`/`validate_with` BUILDERS are PURE.
2897    if crate_name == "dialoguer" {
2898        if path.ends_with("::interact") || path.ends_with("::interact_on")
2899            || path.ends_with("::interact_text") || path.ends_with("::interact_text_on")
2900            || path.ends_with("::interact_opt") || path.ends_with("::interact_on_opt")
2901        {
2902            return Some("Ipc");
2903        }
2904        // `Editor::edit` (edit.rs:93) writes the caller's string to a real tempfile, spawns
2905        // `$VISUAL`/`$EDITOR` on it via `process::Command::spawn().wait()`, then reads the result back
2906        // — a real subprocess launch, not a terminal-dialogue read/write like the verbs above.
2907        if path.ends_with("Editor::edit") {
2908            return Some("Exec");
2909        }
2910        // WIDENED-CORE AUDIT (2026-08-28): `Editor::new`/`Editor::default` (edit.rs:54,44) call
2911        // `get_default_editor()` (edit.rs:31), which reads `env::var_os("VISUAL")` then `("EDITOR")`
2912        // IMMEDIATELY at construction — a real, independent Env read a consumer triggers just by
2913        // building an `Editor`, whether or not `.edit()` is ever called (the SAME "builder-time env
2914        // read, separate from the terminal verb" shape as `clap::Arg::env`, R59-class). Verified against
2915        // dialoguer 0.12.0: `get_default_editor` is the ONLY caller of either `env::var_os`, so there is
2916        // no ambiguity gating this to just these two constructors.
2917        if path.ends_with("Editor::new") || path.ends_with("Editor::default") {
2918            return Some("Env");
2919        }
2920        return None;
2921    }
2922    // `tracing_subscriber` — the subscriber that gives `tracing` somewhere to go. TWO effects, and the
2923    // filing said "Log/Fs": VERIFIED against 0.3.23, the Fs half is WRONG.
2924    //
2925    //   Log — `fmt/fmt_layer.rs:749` defaults `make_writer: io::stdout`, so the fmt INIT terminals install
2926    //         a subscriber that writes program output. Same family as `log`/`tracing`/`env_logger`.
2927    //   Env — `fmt/mod.rs:1219` reads `RUST_LOG` on the `init()` path, `fmt_layer.rs` reads `NO_COLOR`,
2928    //         and `filter/env/builder.rs:189,203` read `env::var(self.env_var_name())`.
2929    //
2930    // NOT Fs. The only `std::fs` in the crate is `impl MakeWriter for std::fs::File` — the crate ACCEPTING
2931    // a caller-supplied File, not opening one. The caller's `File::create` is classified on the caller, so
2932    // charging Fs here would double-count, exactly the `serde_json::from_reader` caveat one crate over.
2933    //
2934    // The builders (`fmt()`, `layer()`, `with_writer`, `with_target`, `EnvFilter::new`) are PURE: they
2935    // describe a subscriber. Only the INIT terminals install one, and only the from-env constructors read.
2936    if crate_name == "tracing_subscriber" {
2937        if path.ends_with("::init") || path.ends_with("::try_init") {
2938            return Some("Log");
2939        }
2940        if path.ends_with("::from_default_env") || path.ends_with("::try_from_default_env")
2941            || path.ends_with("::from_env") || path.ends_with("::from_env_lossy")
2942            || path.ends_with("::try_from_env")
2943        {
2944            return Some("Env");
2945        }
2946        return None;
2947    }
2948    // `crossterm` — the terminal driver. The tty is a USER DIALOGUE CHANNEL, so this is Ipc, matching the
2949    // ruling `dialoguer`/`console`/`terminal_colorsaurus` already carry rather than a new one.
2950    //
2951    // VERIFIED against crossterm-0.28.1 rather than assumed: `command.rs` `execute`/`queue` end in
2952    // `self.flush()?` on the writer (real code, not a doc example), `event::read`/`poll` read tty input,
2953    // and `terminal::{enable,disable}_raw_mode` + `size`/`window_size` talk to the device.
2954    //
2955    // `size`/`window_size`/`is_raw_mode_enabled` ARE classified, and that is deliberate: once a crate is
2956    // CALIBRATED every unmatched path becomes a PURITY CLAIM rather than a disclosed blind spot, so a tty
2957    // ioctl left to fall through would be claimed pure. The genuinely pure surface — the Command VALUE
2958    // types (`Print`, `MoveTo`, `SetForegroundColor`), the style/event data types — carries none of these
2959    // tails and stays pure correctly.
2960    if crate_name == "crossterm" {
2961        if path.ends_with("::execute") || path.ends_with("::queue")
2962            || path.ends_with("::event::read") || path.ends_with("::event::poll")
2963            || path.ends_with("::enable_raw_mode") || path.ends_with("::disable_raw_mode")
2964            || path.ends_with("::size") || path.ends_with("::window_size")
2965            || path.ends_with("::is_raw_mode_enabled")
2966        {
2967            return Some("Ipc");
2968        }
2969        // `terminal::supports_keyboard_enhancement` (terminal/sys/unix.rs:188, re-exported `pub use
2970        // sys::supports_keyboard_enhancement` in terminal.rs) drives the SAME channel as
2971        // `event::read`/`enable_raw_mode` above (it toggles raw mode, then reads/polls terminal events
2972        // to detect the kitty keyboard protocol) — bucketed `Ipc` for consistency with the rest of this
2973        // tty-dialogue family rather than the `Fs` self-scan's raw signal reports (that signal traces
2974        // through the crate's internal event source opening `/dev/tty` as a fallback fd, the same
2975        // primitive `tty_fd` below wraps — not a distinct effect from the terminal channel itself).
2976        //
2977        // NOT modelled: `tty_fd` (terminal/sys/file_descriptor.rs:124) — declared inside `pub(crate) mod
2978        // sys;` (terminal.rs:99), so despite being `pub fn` it is unreachable from outside the crate
2979        // (only used internally by the event source). Removed from open.tsv rather than guessed.
2980        if path.ends_with("::supports_keyboard_enhancement") {
2981            return Some("Ipc");
2982        }
2983        return None;
2984    }
2985    // `ratatui` — the TUI renderer, and the single loudest source of disclosed-blind calls measured in the
2986    // 2026-07-14 four-ecosystem sweep (3,345 across three real repos). The backlog filed it as
2987    // "mark reviewed-pure"; VERIFYING against ratatui-0.29.0 REFUTES that for part of the surface:
2988    // `terminal/terminal.rs` `draw`/`flush`/`clear`/`autoresize`/`hide_cursor`/`show_cursor` end in a
2989    // backend flush, and `backend/` writes to the terminal. Marking the whole crate pure would have
2990    // claimed purity over the one API that actually writes.
2991    //
2992    // So the split is where the sweep's noise actually is: the BULK of those 3,345 calls are widget,
2993    // layout, buffer, style and text constructors — genuinely pure, and now covered rather than disclosed.
2994    // The Terminal/backend verbs are Ipc, same channel as crossterm underneath them.
2995    if crate_name == "ratatui" {
2996        // CARVE-OUT FIRST: `widgets::canvas` is an IN-MEMORY grid. `Context::draw(&shape)` sets
2997        // `self.dirty` and paints into a `Painter` — no terminal, no writer, provably pure — but it ends
2998        // in `::draw` and the tails below would have charged it `Ipc`. MEASURED as a live fabrication on a
2999        // fixture (`plot(ctx) -> ['Ipc']`) before this line existed, and it is a HOT path: a TUI drawing
3000        // charts or maps calls it per shape per frame.
3001        //
3002        // A DENYLIST (carve out the proven-pure module) rather than an allowlist of `Terminal::`, per the
3003        // family rule: an allowlist silently under-reports whatever it forgot, and the write surface here
3004        // is Terminal AND the backends (`CrosstermBackend::flush`), so pinning to `Terminal::` would drop
3005        // a direct backend call. Reading the crate, canvas is the only module whose methods collide with
3006        // these tails.
3007        if path.contains("::canvas::") {
3008            return None;
3009        }
3010        if path.ends_with("::draw") || path.ends_with("::try_draw") || path.ends_with("::flush")
3011            || path.ends_with("::autoresize") || path.ends_with("::clear")
3012            || path.ends_with("::hide_cursor") || path.ends_with("::show_cursor")
3013            || path.ends_with("::insert_before")
3014            || path.ends_with("::set_cursor_position") || path.ends_with("::get_cursor_position")
3015        {
3016            return Some("Ipc");
3017        }
3018        return None;
3019    }
3020    // `console` — terminal handle + styling. The `Term` read/write verbs do tty I/O (Ipc, the user
3021    // dialogue channel; note there is NO `write_str` — `Term` impls `io::Write`). The free-fn terminal
3022    // detection (`colors_enabled`/`user_attended`) reads `CLICOLOR`/`CLICOLOR_FORCE` (Env). The `Style`
3023    // color/format methods and the text utils (`strip_ansi_codes`/`pad_str`/`measure_text_width`) are PURE.
3024    //
3025    // THE ~79-CRATE R59-CLASS AUDIT (2026-08-28): the note above ("no `write_str` — `Term` impls
3026    // `io::Write`") RECORDED the trait impl without covering it. `Term::write`/`Term::flush` (console
3027    // 0.15.11, term.rs:622-633) call `self.write_through(buf)` — the SAME primitive `write_line` already
3028    // charges Ipc for — and `Term::read` (term.rs:650-654) calls `io::stdin().read(buf)` directly. These
3029    // are a second, real entry point to the identical tty channel, missed because `read`/`write`/`flush`
3030    // are the names every I/O type shares — but crate-gated on `crate_name == "console"`, term.rs
3031    // defines exactly one of each (verified against the real source; no ambiguity survives the gate,
3032    // same shape as `clap::Arg::env`). Left unclassified, a fn calling only `term.write_all(..)` (no
3033    // `write_line`) read as reviewed-pure, since `console` is fully `CALIBRATED_CRATES`.
3034    if crate_name == "console" {
3035        if path.ends_with("::write_line") || path.ends_with("::read_line")
3036            || path.ends_with("::read_line_initial_text") || path.ends_with("::read_char")
3037            || path.ends_with("::read_key") || path.ends_with("::read_key_raw")
3038            || path.ends_with("::read_secure_line")
3039            || path.ends_with("Term::write") || path.ends_with("Term::flush")
3040            || path.ends_with("Term::read")
3041        {
3042            return Some("Ipc");
3043        }
3044        if path.ends_with("::colors_enabled") || path.ends_with("::colors_enabled_stderr")
3045            || path.ends_with("::user_attended") || path.ends_with("::user_attended_stderr")
3046        {
3047            return Some("Env");
3048        }
3049        return None;
3050    }
3051    // `terminal_colorsaurus` — queries the terminal's colours by writing OSC 10/11 escapes and reading the
3052    // reply (bidirectional tty dialogue — Ipc, consistent with dialoguer/console). Nothing else is I/O.
3053    if crate_name == "terminal_colorsaurus" {
3054        if path.ends_with("::background_color") || path.ends_with("::foreground_color")
3055            || path.ends_with("::color_palette")
3056            // SOUNDNESS R321 — FQN-exact, not a suffix. `1.0.3` added
3057            // `ColorPalette::theme_mode(&self)` (src/lib.rs:112), a PURE derived accessor
3058            // comparing `perceived_lightness()` on two already-fetched colours, alongside the
3059            // effectful free `theme_mode(options)` (src/lib.rs:157). A `::theme_mode` suffix
3060            // charges `Ipc` to both. Counterpart to R319: the same upstream mechanism — a
3061            // release ADDING a name — under-reports in one crate and fabricates in another,
3062            // depending only on whether the new name is effectful.
3063            || path == "terminal_colorsaurus::theme_mode"
3064        {
3065            return Some("Ipc");
3066        }
3067        return None;
3068    }
3069    // `backoff` — retry-with-backoff. `retry`/`retry_notify` consult the clock and `thread::sleep`
3070    // between attempts (Clock). The `ExponentialBackoff`/builder config is PURE. (The user closure's own
3071    // effects are out of scope here — we model only backoff's own Clock effect.)
3072    if crate_name == "backoff" {
3073        if path.ends_with("::retry") || path.ends_with("::retry_notify") {
3074            return Some("Clock");
3075        }
3076        return None;
3077    }
3078    // `lscolors` — LS_COLORS parsing. ONLY `from_env` reads the environment (Env). `from_string`/
3079    // `style_for_path`/`style_for*` and the `Style` type take explicit input and are PURE.
3080    if crate_name == "lscolors" {
3081        if path.ends_with("::from_env") {
3082            return Some("Env");
3083        }
3084        return None;
3085    }
3086    // `wild` — argv with glob expansion. `args`/`args_os` read `std::env::args(_os)` (Env). Nothing else.
3087    if crate_name == "wild" {
3088        if path.ends_with("::args") || path.ends_with("::args_os") {
3089            return Some("Env");
3090        }
3091        return None;
3092    }
3093    // `grep_cli` — only the firm effect is modeled: `CommandReaderBuilder::build` spawns a child process
3094    // (Exec). The `is_readable_stdin`/`is_tty_*` fd probes (isatty/fstat on the std descriptors) are
3095    // deliberately NOT modeled — candor doesn't classify `IsTerminal`/isatty as an effect anywhere, and
3096    // they read no data; flagging them would be an inconsistent over-report.
3097    if crate_name == "grep_cli" {
3098        if path.ends_with("::build") {
3099            return Some("Exec");
3100        }
3101        // THE COVERAGE-GATE SWEEP (2026-08-27), verified against grep-cli 0.1.12 — the sibling entry
3102        // points to `::build` above, none of which end in that suffix:
3103        //
3104        // `CommandReader::new` (process.rs:195) is `CommandReaderBuilder::new().build(cmd)` — the same
3105        // spawn, reached through the type's own one-call constructor instead of the builder.
3106        // `CommandReader::close` (process.rs:218) drops the child's stdout handle then calls
3107        // `self.child.wait()` — `std::process::Child::wait` is ALREADY classified `Exec` elsewhere in
3108        // this file (reaping/blocking on a spawned child is part of the subprocess lifecycle this
3109        // project tracks), and self-scan resolves `self.child`'s concrete `process::Child` type to
3110        // confirm it, not a guess.
3111        // `DecompressionMatcher::command` (decompress.rs:179) builds a REAL `Command::new(&decomp_cmd.bin)`
3112        // naming an actual decompressor binary (gzip/xz/bzip2/…) and returns it un-spawned — the same
3113        // "constructs a real argv, caller spawns it" shape `Cred::credential_helper` was classified for
3114        // in git2 (see the FQN-exact rule near this file's top).
3115        // `DecompressionReader::new` (decompress.rs:352) is `DecompressionReaderBuilder::new().build(path)`,
3116        // which calls the already-covered `CommandReaderBuilder::build` two hops down.
3117        // `patterns_from_path` (pattern.rs:82) opens and reads the given file directly (`std::fs::File::
3118        // open`) — unrelated to the Exec family above, genuinely Fs.
3119        // SOUNDNESS R342 — `DecompressionReader::close` was the sibling this enumeration missed. It is
3120        // `match self.rdr { Ok(ref mut rdr) => rdr.close(), Err(_) => Ok(()) }` (`decompress.rs:383`),
3121        // i.e. the already-listed `CommandReader::close` one level up, so it reaps the same child. Its
3122        // `CommandReader` counterpart was listed and it was not — measured on a consumer fixture:
3123        // `CommandReader::close` charged `Exec` and `DecompressionReader::close` read ABSENT.
3124        //
3125        // The `read` pair is listed for the same reason one hop over: reading a `DecompressionReader`
3126        // or a `CommandReader` pulls bytes from the child's stdout, which is the point of having
3127        // spawned it. FQN-exact rather than a `::read`/`::close` suffix, because both are far too
3128        // common a leaf to match crate-wide — the R321 lesson.
3129        //
3130        // Found because R185 taught the scanner to see through `match self.rdr { Ok(..) }`, which made
3131        // grep-cli's own self-scan nominate it. The rule is what a CONSUMER needs; the self-scan only
3132        // pointed at it.
3133        if path == "grep_cli::CommandReader::new"
3134            || path == "grep_cli::CommandReader::close"
3135            || path == "grep_cli::CommandReader::read"
3136            || path == "grep_cli::DecompressionMatcher::command"
3137            || path == "grep_cli::DecompressionReader::new"
3138            || path == "grep_cli::DecompressionReader::close"
3139            || path == "grep_cli::DecompressionReader::read"
3140            || path == "grep_cli::decompress::DecompressionReader::close"
3141            || path == "grep_cli::decompress::DecompressionReader::read"
3142            || path == "grep_cli::process::CommandReader::close"
3143            || path == "grep_cli::process::CommandReader::read"
3144        {
3145            return Some("Exec");
3146        }
3147        if path == "grep_cli::patterns_from_path" {
3148            return Some("Fs");
3149        }
3150        return None;
3151    }
3152    // `clircle` — detects whether two handles are the same file (cycle protection). `Identifier::try_from`
3153    // (File/Stdio) issues an `fstat`, and `surely_conflicts_with` does an `lseek` (`stream_position`) — both
3154    // Fs. The `PartialEq`/`Hash` comparisons read stored dev/ino and are PURE. (The named methods
3155    // `are_identical`/`same_file` do NOT exist in the crate — not modeled.)
3156    if crate_name == "clircle" {
3157        if path.ends_with("::try_from") || path.ends_with("::surely_conflicts_with") {
3158            return Some("Fs");
3159        }
3160        return None;
3161    }
3162    None
3163}
3164
3165pub fn cap_from_name(name: &str) -> Option<&'static str> {
3166    EFFECTS.iter().copied().find(|e| *e == name)
3167}
3168
3169/// Refine the `Exec` cliff (spec §4 ⟨0.5⟩): the effects a *literal, statically-known* subprocess
3170/// head implies, matched by basename (`/usr/bin/curl` → `curl`). The head's effects are ADDED to a
3171/// caller that already carries `Exec` (a subprocess is still spawned — `Exec` is never dropped); an
3172/// unrecognised or dynamically-built head returns `&[]` and keeps the bare cliff (never guess). A
3173/// **candor engine** reads `Fs`/`Env` only — spec §7 item 12 (the analyzer self-boundary) guarantees
3174/// that, so that case is spec-supplied, not curation. The rest is a small curated table under the
3175/// same under-report rule as the crate classifier. INVARIANT: every head here is an external tool
3176/// that does NOT run the analysed project's own code (so `make`/`npm`/`cargo` are deliberately
3177/// absent — they stay the cliff). The reference engines share this table so the `Exec` boundary —
3178/// the one boundary every engine hits — refines identically (the §4-consistency argument).
3179/// SPEC §2 `fs` — for a call ALREADY classified `Fs`, the read/write direction its path implies.
3180/// `["read"]`, `["write"]`, `["read","write"]`, or `[]` when the verb does not say.
3181///
3182/// THE EMPTY CASE IS THE DISCIPLINE. §2: *"when `Fs` is reached but its kind is unknown … the field MUST
3183/// be omitted rather than guessed. An empty or partial `fs` would be read as a positive claim ('reads but
3184/// never writes'), which is the §4 trust contract's forbidden direction."* So an unrecognised verb
3185/// contributes nothing and the field stays absent; absence means "kind undetermined", never "read-only".
3186///
3187/// A syntactic refinement of an effect already proved, NOT a soundness claim. Deliberately the same
3188/// vocabulary as candor-java's `fsKind`, candor-swift's and candor-ts's — the surface is spec'd four-way,
3189/// and four engines inventing four verb tables for one field is how a shared field stops meaning one thing.
3190pub fn fs_kind(path: &str) -> &'static [&'static str] {
3191    // the terminal segment is the verb (`std::fs::write`, `File::create`, `f.read_to_string`)
3192    let leaf = path.rsplit("::").next().unwrap_or(path);
3193    // `OpenOptions::open` is the one verb that does NOT carry its own direction — the direction was set
3194    // by the BUILDER chain (`.read(true)`/`.write(true)`), which this function cannot see. The READ list
3195    // below holds a bare `open` for `File::open`, unambiguously a read; letting an `OpenOptions` receiver
3196    // reach it publishes `fs: ["read"]` for a builder configured `write(true)`, and §2 reads that as the
3197    // positive claim "reads but never writes" — the forbidden direction. The paragraph under the READ
3198    // list has always SAID this; nothing implemented it, and it only became REACHABLE when
3199    // `OpenOptions::open` started classifying on its own — before, the `Fs` came from the
3200    // `OpenOptions::new` constructor, whose leaf claims nothing, so the field was simply absent.
3201    // MEASURED on this commit's own fix before this guard: `OpenOptions::new().read(true).open(p)` went
3202    // from `fs` ABSENT to `fs: ["read"]`, i.e. the fix minted a claim the engine cannot support. Keyed on
3203    // the TYPE segment, so it holds for the `fs_err`/`tokio::fs`/`async_std::fs` spellings too.
3204    if path.rsplit("::").nth(1) == Some("OpenOptions") {
3205        return &[];
3206    }
3207    // Reads the source AND writes the destination in one call.
3208    if matches!(leaf, "copy" | "rename" | "hard_link" | "soft_link" | "symlink") {
3209        return &["read", "write"];
3210    }
3211    const WRITE: &[&str] = &[
3212        "write", "write_all", "write_fmt", "write_vectored", "create", "create_new", "create_dir",
3213        "create_dir_all", "remove_file", "remove_dir", "remove_dir_all", "set_permissions",
3214        "set_len", "set_modified", "set_times", "append", "flush", "sync_all", "sync_data",
3215        "write_at", "truncate",
3216    ];
3217    const READ: &[&str] = &[
3218        "read", "read_to_string", "read_to_end", "read_exact", "read_dir", "read_link",
3219        "metadata", "symlink_metadata", "exists", "try_exists", "canonicalize", "open",
3220        "read_at", "file_type", "permissions", "modified", "accessed", "created", "len",
3221    ];
3222    if WRITE.contains(&leaf) { return &["write"]; }
3223    if READ.contains(&leaf) { return &["read"]; }
3224    // `OpenOptions` carries the direction in its BUILDER chain, not its terminal verb, so `.open()` on one
3225    // says nothing here and is deliberately left to the READ arm above only when it is `File::open`
3226    // (unambiguously a read). Anything else: no claim.
3227    if leaf.starts_with("write") || leaf.starts_with("append") { return &["write"]; }
3228    if leaf.starts_with("read") { return &["read"]; }
3229    &[]
3230}
3231
3232pub fn classify_command_head(cmd: &str) -> &'static [&'static str] {
3233    // Only UNAMBIGUOUS single-effect tools belong here. A multi-modal head (`git status` is local,
3234    // `git push` is Net; `rsync` local-vs-remote) would FABRICATE the effect for its common case —
3235    // the under-report rule forbids it, so such heads keep the bare cliff.
3236    match cmd.rsplit(['/', '\\']).next().unwrap_or(cmd) {
3237        "curl" | "wget" | "http" | "ssh" | "scp" | "sftp" | "ftp" | "telnet" => &["Net"],
3238        "psql" | "mysql" | "sqlite3" | "mongosh" | "mongo" | "redis-cli" | "cqlsh" | "influx" => &["Db"],
3239        // candor engines — Fs/Env only, guaranteed by spec §7 item 12 (the analyzer self-boundary)
3240        "candor" | "candor-run.sh" | "candor-scan" | "candor-query" | "candor-java"
3241        | "candor-classify" | "candor-report" | "cargo-candor" => &["Env", "Fs"],
3242        _ => &[],
3243    }
3244}
3245
3246/// Known machine-learning MODEL-provider hosts — the SPEC §1 ⟨0.13⟩ `Llm` host-literal refinement:
3247/// a statically-known `Net` request to one of these classifies `Llm` IN ADDITION to `Net` (Net is
3248/// never dropped — a model call IS network I/O, exactly as an `Exec`-refined subprocess keeps `Exec`),
3249/// just as a jdbc URL classifies `Db`. Matched by host, case-insensitive; a SUBDOMAIN of a listed host
3250/// counts. The reference engines share this table VERBATIM with candor-java's `Literals.MODEL_HOSTS`
3251/// (the analog of `classify_command_head`) so the `Net` boundary refines to `Llm` identically. An
3252/// UNKNOWN host stays bare `Net` — never guessed. Curated STARTER set; the §7 coverage ledger
3253/// discloses an uncovered provider like any other.
3254pub const MODEL_HOSTS: &[&str] = &[
3255    "api.openai.com",
3256    "api.anthropic.com",
3257    "generativelanguage.googleapis.com",
3258    "api.mistral.ai",
3259    "api.cohere.ai",
3260    "api.cohere.com",
3261    "api.groq.com",
3262    "api.together.xyz",
3263    "api.perplexity.ai",
3264    "openrouter.ai",
3265];
3266
3267/// Whether an endpoint HOST literal is a known model provider (case-insensitive; a subdomain of a
3268/// `MODEL_HOSTS` entry counts). Strips a `:port` suffix first. Two special forms carry their own rule,
3269/// matching candor-java's `Literals.isModelHost` exactly: any host whose port is `11434` is a local
3270/// Ollama endpoint (a LOOPBACK host — `localhost`/`127.0.0.1`/`::1` — on port 11434); and an AWS Bedrock
3271/// runtime host (the model-inference service label `bedrock-runtime`/`bedrock-agent-runtime`).
3272pub fn is_model_host(host_literal: &str) -> bool {
3273    // Strip any `:port` (via the shared host_part) and lowercase for the name comparisons.
3274    let host = policy::host_part(host_literal).to_ascii_lowercase();
3275    // Ollama is a LOCAL endpoint: :11434 → Llm ONLY on a loopback host (max-review r3 parity fix — "any
3276    // host on :11434" fabricated Llm on unrelated internal services on that port).
3277    if let Some((_, port)) = host_literal.rsplit_once(':') {
3278        if port == "11434" {
3279            return matches!(host.as_str(), "localhost" | "127.0.0.1" | "::1");
3280        }
3281    }
3282    if MODEL_HOSTS.contains(&host.as_str()) {
3283        return true;
3284    }
3285    // A subdomain of a known model host counts (`eu.api.openai.com` → api.openai.com).
3286    if MODEL_HOSTS.iter().any(|m| host.ends_with(&format!(".{m}"))) {
3287        return true;
3288    }
3289    // AWS Bedrock runtime: the FIRST label is the model-inference service (`bedrock-runtime.<region>.
3290    // amazonaws.com`), NOT the substring "bedrock" (which caught `bedrock-backups.s3.amazonaws.com`, an
3291    // S3 bucket) and NOT the control-plane `bedrock.<region>.amazonaws.com`.
3292    host.ends_with(".amazonaws.com")
3293        && matches!(host.split('.').next(), Some("bedrock-runtime") | Some("bedrock-agent-runtime"))
3294}
3295
3296/// ⟨0.20⟩ Curated telemetry / analytics / APM hosts — the `Net` destination-class `known-telemetry` set
3297/// (NET-DESTINATION-CLASS-DESIGN.md), shared VERBATIM with candor-java's `Literals.TELEMETRY_HOSTS` (like
3298/// `MODEL_HOSTS`). A benign observability endpoint. Matched by host, case-insensitive; a SUBDOMAIN of a
3299/// listed host counts. Tight, high-precision STARTER set — mis-including an exfil-capable host would
3300/// under-gate `deny Net[unknown-host]`.
3301pub const TELEMETRY_HOSTS: &[&str] = &[
3302    "sentry.io",
3303    "bugsnag.com",
3304    "rollbar.com",
3305    "segment.io",
3306    "segment.com",
3307    "mixpanel.com",
3308    "amplitude.com",
3309    "google-analytics.com",
3310    "analytics.google.com",
3311    "datadoghq.com",
3312    "datadoghq.eu",
3313    "newrelic.com",
3314    "nr-data.net",
3315    "honeycomb.io",
3316    "logtail.com",
3317    // ⟨0.20.1⟩ corpus-grown (a real-repo dogfood): more single-purpose analytics / session-replay / RUM
3318    // providers — vendor-specific product domains only (no general-purpose host), so no under-gate risk.
3319    "posthog.com",
3320    "plausible.io",
3321    "usefathom.com",
3322    "heapanalytics.com",
3323    "fullstory.com",
3324    "hotjar.com",
3325    "logrocket.com",
3326    "cloudflareinsights.com",
3327];
3328
3329/// Whether an endpoint HOST literal is in `set` (case-insensitive; a subdomain of a listed host counts).
3330/// Strips a `:port` suffix first via `host_part`. The shared membership test for `TELEMETRY_HOSTS` and the
3331/// config-declared partner set (mirrors candor-java's `Literals.hostInSet`).
3332pub fn host_in_set(host_literal: &str, set: &[&str]) -> bool {
3333    let host = policy::host_part(host_literal).to_ascii_lowercase();
3334    set.contains(&host.as_str()) || set.iter().any(|e| host.ends_with(&format!(".{e}")))
3335}
3336
3337/// Whether an endpoint HOST literal is a known telemetry/analytics/APM host (`TELEMETRY_HOSTS`).
3338pub fn is_telemetry_host(host_literal: &str) -> bool {
3339    host_in_set(host_literal, TELEMETRY_HOSTS)
3340}
3341
3342/// ⟨0.20⟩ The `Net` DESTINATION CLASS of a host literal (NET-DESTINATION-CLASS-DESIGN.md): `known-telemetry`
3343/// (curated), `known-partner` (config `net-partner` OR a model host — a declared-ish external API), else
3344/// `unknown-host` — the HONEST default (candor makes no claim; the security gate bites this). A partner set
3345/// is per-project (config-declared). Never fabricated onto a safe class: an unresolved host is unknown-host.
3346/// Mirrors candor-java's `Literals.netDestClass`.
3347pub fn net_dest_class(host_literal: &str, partners: &std::collections::BTreeSet<String>) -> &'static str {
3348    if is_telemetry_host(host_literal) {
3349        return "known-telemetry";
3350    }
3351    if partner_for(host_literal, partners).is_some() || is_model_host(host_literal) {
3352        return "known-partner";
3353    }
3354    "unknown-host"
3355}
3356
3357/// ⟨0.31⟩ WHICH declared partner a host matched, or `None` — the SAME match `net_dest_class` decides on,
3358/// extracted so the DISCLOSURE and the DECISION cannot use different rules.
3359///
3360/// That is not a stylistic preference. The reverted first attempt at the `net-partner` disclosure
3361/// re-implemented this match against a normaliser that KEEPS the port, so an observed
3362/// `partner.example:443` never equalled a declared `partner.example` and the disclosure came back
3363/// SILENTLY EMPTY on every real run — while the verdicts it was reporting on had flipped. A disclosure
3364/// normalised differently from the decision it reports can only be wrong, and one function with two
3365/// callers is what makes writing one impossible.
3366pub fn partner_for(
3367    host_literal: &str,
3368    partners: &std::collections::BTreeSet<String>,
3369) -> Option<String> {
3370    if partners.is_empty() {
3371        return None;
3372    }
3373    let host = policy::host_part(host_literal).to_ascii_lowercase();
3374    if partners.contains(&host) {
3375        return Some(host);
3376    }
3377    partners
3378        .iter()
3379        .find(|p| host.ends_with(&format!(".{p}")))
3380        .cloned()
3381}
3382
3383/// ⟨0.20⟩ The closed `Net` destination-class vocabulary, for the `deny Net[<dest…>]` policy filter.
3384pub const NET_DEST_CLASSES: &[&str] = &["known-telemetry", "known-partner", "unknown-host"];
3385
3386/// Curated Rust model-provider SDK crates — the SPEC §1 ⟨0.13⟩ `Llm` model-SDK surface, the Rust analog
3387/// of candor-java's `Rules.MODEL_SDK_PACKAGES`. A resolved call into one of these crates classifies
3388/// `Llm` + `Net` (the caller adds both — a model dispatch IS network I/O). NO method-name gating: these
3389/// are single-purpose provider clients, so ANY call into the crate is a model dispatch (matches the java
3390/// reference's judgment call). Curated STARTER list; the §7 coverage ledger discloses the rest.
3391pub const MODEL_SDK_CRATES: &[&str] = &[
3392    "async_openai",           // async-openai — the de-facto OpenAI client
3393    "anthropic_sdk",          // anthropic-sdk
3394    "anthropic",              // anthropic (community client crate)
3395    "aws_sdk_bedrockruntime", // AWS Bedrock runtime (invoke/converse) — the model surface of the aws-sdk family
3396    "ollama_rs",              // ollama-rs — local Ollama client
3397    "langchain_rust",         // langchain-rust — the LangChain invoke surfaces
3398    "mistralai",              // mistralai (Mistral client)
3399    "genai",                  // genai — a multi-provider model client
3400];
3401
3402/// Whether a resolved call's CRATE is a curated model-provider SDK (`MODEL_SDK_CRATES`) → the SPEC §1
3403/// ⟨0.13⟩ `Llm` model-SDK classification (the caller adds both `Llm` and `Net`). Crate-level, no
3404/// method gating — a single-purpose client, matching candor-java's `isModelSdkOwner`.
3405pub fn is_model_sdk_crate(crate_name: &str) -> bool {
3406    MODEL_SDK_CRATES.contains(&crate_name)
3407}
3408
3409/// The libc / nix / rustix PATH-and-directory syscall leaves `classify` charges `Fs` (incl. `*64` and
3410/// `*at` variants). Module-level, not local to `classify`, because it is ONE of the two answers to one
3411/// question: the AS-EFF-008 masking guard (`masks_locator`) reads this same table, so a leaf added here
3412/// is masked by default — see `LIBC_FS_NO_PATH` for the direction. SOUNDNESS R806.
3413pub const LIBC_FS: &[&str] = &[
3414            "open", "open64", "openat", "openat2", "creat", "creat64", "stat", "stat64", "lstat",
3415            "lstat64", "fstatat", "fstatat64", "newfstatat", "statx", "access", "faccessat",
3416            "faccessat2", "mkdir", "mkdirat", "rmdir", "unlink", "unlinkat", "rename", "renameat",
3417            "renameat2", "link", "linkat", "symlink", "symlinkat", "readlink", "readlinkat", "chmod",
3418            "fchmodat", "chown", "lchown", "fchownat", "truncate", "truncate64", "ftruncate",
3419            "ftruncate64", "opendir", "fdopendir", "readdir", "readdir64", "readdir_r", "closedir",
3420            "rewinddir", "seekdir", "telldir", "scandir", "mkstemp", "mkstemps", "mkostemp", "mkdtemp",
3421            "mknod", "mknodat", "chdir", "fchdir", "getcwd", "get_current_dir_name", "chroot",
3422            "pivot_root", "statfs", "statfs64", "fstatfs", "fstatfs64", "statvfs", "fstatvfs", "mount",
3423            "umount", "umount2", "fsync", "fdatasync", "sync", "syncfs", "sync_file_range", "fallocate",
3424            "posix_fallocate", "posix_fadvise", "sendfile", "sendfile64", "copy_file_range", "flock",
3425            "getdents", "getdents64", "utime", "utimes", "lutimes", "futimens", "utimensat", "futimesat",
3426            "realpath",
3427        ];
3428
3429/// The libc / nix / rustix socket-family leaves `classify` charges `Net`. See `LIBC_NET_NO_DESTINATION`.
3430pub const LIBC_NET: &[&str] = &[
3431            "socket", "setsockopt", "getsockopt", "bind", "listen", "accept", "accept4", "connect",
3432            "shutdown", "send", "sendto", "sendmsg", "sendmmsg", "recv", "recvfrom", "recvmsg",
3433            "recvmmsg", "getpeername", "getsockname", "getaddrinfo", "freeaddrinfo", "getnameinfo",
3434        ];
3435
3436/// The libc / nix / rustix process creation / replacement / reaping leaves `classify` charges `Exec`.
3437/// See `LIBC_EXEC_NO_PROGRAM`.
3438pub const LIBC_EXEC: &[&str] = &[
3439            "fork", "vfork", "clone", "clone3", "execl", "execlp", "execle", "execv", "execvp",
3440            "execvpe", "execve", "execveat", "fexecve", "posix_spawn", "posix_spawnp", "system",
3441            "popen", "pclose", "wait", "waitpid", "wait3", "wait4", "waitid",
3442        ];
3443
3444/// The Postgres / SQLite-family client verbs `classify` charges `Db` for `postgres`, `tokio_postgres`,
3445/// `deadpool_postgres` and `rusqlite` — the round-trips themselves. Module-level because the masking
3446/// guard reads it too (`masks_locator`, SOUNDNESS R806): every verb here takes the SQL text at
3447/// argument 0 except the three in `PG_DB_VERBS_NO_SQL`, so a verb added here is masked by default.
3448/// `(type, method)` of a `crate::[modules::]Type::method` path whose modules are exactly one of `mods`
3449/// (the crate-root re-export when `mods` holds `""`). Used by the coverage-gate rules below that name a
3450/// method on ONE type: comparing the type SEGMENT, not a suffix, so `MultiplexedConnection::recv_response`
3451/// can never satisfy a rule written for `Connection::recv_response`.
3452fn type_method<'a>(path: &'a str, krate: &str, mods: &[&str]) -> Option<(&'a str, &'a str)> {
3453    let rest = path.strip_prefix(krate)?.strip_prefix("::")?;
3454    let (head, method) = rest.rsplit_once("::")?;
3455    let (module, ty) = head.rsplit_once("::").unwrap_or(("", head));
3456    mods.contains(&module).then_some((ty, method))
3457}
3458
3459pub const PG_DB_VERBS: &[&str] = &[
3460                "::query", "::query_one", "::query_opt", "::query_raw", "::execute",
3461                "::batch_execute", "::simple_query", "::prepare", "::prepare_typed",
3462                "::copy_in", "::copy_out", "::transaction", "::connect",
3463                // `Config::connect_raw` (tokio-postgres config.rs:739) does the SAME protocol handshake
3464                // as `Config::connect` over a caller-supplied stream (a Unix socket, a TLS-terminated
3465                // proxy) instead of dialing one itself — real Db/Net I/O, missing because the verb
3466                // doesn't end in the plain `connect` spelling.
3467                "::connect_raw",
3468                // rusqlite's dialect of the same verbs (a verb-probe found the CANONICAL rusqlite
3469                // consumer API classifying pure): `query_row` is the one-row read, `query_map`/
3470                // `query_and_then` the many-row reads, `execute_batch` is rusqlite's name for
3471                // batch_execute, `prepare_cached` round-trips like prepare. `query_typed` is
3472                // tokio_postgres 0.7.10+.
3473                "::query_row", "::query_map", "::query_and_then", "::execute_batch",
3474                "::prepare_cached", "::query_typed",
3475                "::prepare_typed_cached",
3476];
3477
3478/// The members of `PG_DB_VERBS` that take NO SQL text, each checked against its signature:
3479/// `Client::transaction(&mut self)`, `connect(params, tls)` / `Config::connect_raw(stream, tls)` —
3480/// a connection string or a stream, never a query. A name wrongly listed here is a silent bypass;
3481/// a name missing from here is an over-mask that fails closed. SOUNDNESS R806.
3482pub const PG_DB_VERBS_NO_SQL: &[&str] = &["::transaction", "::connect", "::connect_raw"];
3483
3484/// The members of `LIBC_FS` that take NO path — every one operates on a file DESCRIPTOR, a `DIR*`
3485/// stream, or nothing — so a missing literal there hides no locator. **CHECKED AGAINST EACH SIGNATURE,
3486/// because this is a denylist on a masking guard: a path-taking name wrongly listed here is the
3487/// benign-sibling-literal bypass (R399), while a no-path name missing from here only over-masks.**
3488/// Everything else in `LIBC_FS` names a path, at argument 0 or — for the `*at` family — argument 1.
3489pub const LIBC_FS_NO_PATH: &[&str] = &[
3490    "ftruncate", "ftruncate64", "fdopendir", "readdir", "readdir64", "readdir_r", "closedir",
3491    "rewinddir", "seekdir", "telldir", "fchdir", "getcwd", "get_current_dir_name", "fstatfs",
3492    "fstatfs64", "fstatvfs", "fsync", "fdatasync", "sync", "syncfs", "sync_file_range", "fallocate",
3493    "posix_fallocate", "posix_fadvise", "sendfile", "sendfile64", "copy_file_range", "flock",
3494    "getdents", "getdents64", "futimens",
3495];
3496
3497/// The members of `LIBC_EXEC` that name NO program: process duplication (`fork`/`vfork`/`clone*`,
3498/// which run THIS image) and reaping (`wait*`, `pclose`). Every other member names what runs —
3499/// `system`/`popen` a shell command line, `exec*`/`posix_spawn*` a path or file name, `fexecve` an fd
3500/// whose program is invisible at the call. Same direction rule as `LIBC_FS_NO_PATH`.
3501pub const LIBC_EXEC_NO_PROGRAM: &[&str] = &[
3502    "fork", "vfork", "clone", "clone3", "wait", "waitpid", "wait3", "wait4", "waitid", "pclose",
3503];
3504
3505/// The members of `LIBC_NET` that name NO destination: socket setup and options, the LOCAL side
3506/// (`bind`/`listen`/`accept*` — where the process listens, never a place it reaches; ⟨0.29⟩
3507/// `is_net_binding`), use-verbs on an already-connected or already-bound socket (`send`/`recv*`),
3508/// teardown and read-backs. The destination-naming remainder is `connect`, `sendto`, `sendmsg`,
3509/// `sendmmsg`, and the resolver pair `getaddrinfo`/`getnameinfo`.
3510pub const LIBC_NET_NO_DESTINATION: &[&str] = &[
3511    "socket", "setsockopt", "getsockopt", "bind", "listen", "accept", "accept4", "shutdown", "send",
3512    "recv", "recvfrom", "recvmsg", "recvmmsg", "getpeername", "getsockname", "freeaddrinfo",
3513];
3514
3515/// Whether `crate_name` is one of the three crates `classify` routes through the libc syscall tables.
3516fn is_syscall_crate(crate_name: &str) -> bool {
3517    matches!(crate_name, "libc" | "nix" | "rustix")
3518}
3519
3520/// Whether a subprocess-builder method only MODIFIES the command (`.arg`, `.env`, `.current_dir`)
3521/// rather than NAMING the program (`Command::new`, `duct::cmd`). A WHOLE-CRATE-Exec crate
3522/// (`portable_pty`, `duct`, `async_process`) classifies *every* method as `Exec`, so the
3523/// head-refinement must skip these: an arg or env-var-name literal that happened to match a head
3524/// (`.env("psql", …)`, `.arg("curl")`) would FABRICATE that effect — the §1 under-report rule. The
3525/// method is the call path's last segment.
3526pub fn is_cmd_builder_method(method: &str) -> bool {
3527    matches!(
3528        method,
3529        "arg" | "args" | "arg0" | "env" | "envs" | "env_clear" | "env_remove" | "current_dir"
3530            | "cwd" | "stdin" | "stdout" | "stderr" | "pre_exec" | "creation_flags" | "uid" | "gid"
3531            | "groups" | "process_group"
3532    )
3533}
3534
3535/// Whether a subprocess method NAMES the program (so its first string literal IS the command head to
3536/// refine): `Command::new("curl")`, `duct::cmd("curl", …)`. The head-refinement must fire ONLY here —
3537/// an ALLOWLIST, not "any method except known modifiers". A whole-crate-Exec crate classifies EVERY
3538/// method as `Exec`, so a denylist leaked NON-naming methods that aren't modifiers — a getter like
3539/// `CommandBuilder::get_env("psql")` (reading back an env-var KEY, not a program) fed `"psql"` to the
3540/// head classifier and FABRICATED `Db` (review find). Only `new`/`cmd` name a program; everything else
3541/// (modifiers, getters `get_*`, custom builder methods) keeps the bare `Exec` cliff — under-refine
3542/// (safe) rather than fabricate. `std::process::Command` is verb-precise so getters never fire `Exec`
3543/// there anyway; the allowlist makes the whole-crate-Exec crates safe too.
3544pub fn is_cmd_naming_method(method: &str) -> bool {
3545    matches!(method, "new" | "cmd")
3546}
3547
3548/// The masking guard (AS-EFF-008): a Net call whose method takes the HOST/URL as an argument is
3549/// "establishing" — a classified Net call here with no captured host literal leaves the endpoint
3550/// structurally INVISIBLE (a runtime-built host), so the surface is incomplete and the gate must fail
3551/// closed (else a benign sibling literal masks the runtime endpoint). An ALLOWLIST of connection-
3552/// establishing verbs — the SAFE direction: a USE-verb on an already-connected socket
3553/// (`stream.write`/`read`/`flush`, `socket.send`/`recv`) is NOT here, so a missing literal there (the
3554/// host was fixed at `connect`) never false-positives. **THAT LAST CLAIM WAS FALSE AND IS WITHDRAWN —
3555/// see R379 in the body: under-catching an establishing verb IS a broken gate whenever a benign sibling
3556/// literal sits in the same function, which is the exact scenario the first sentence names.** The list is
3557/// now an ALLOWLIST still — see the R379 body below: the denylist inversion was BUILT, A/B'd over
3558/// 1,545 crates and REFUSED (544 rows over-masked). An earlier draft of this line said "now a
3559/// DENYLIST", which was a leftover from the rejected cut and asserted the opposite of the code it
3560/// sits on — the comment-asserting-safety shape this register records. The arg is the method (path's
3561/// last segment).
3562pub fn is_net_establishing(method: &str) -> bool {
3563    // SOUNDNESS R379 — the DNS RESOLVER verbs were missing, and their absence was a GATE BYPASS.
3564    //
3565    // `classify` (see the `hickory_resolver` arm) already maps `::lookup_ip`, `::lookup` and any
3566    // `*_lookup` to `Net`, and asserts it. This list did not, so a `Net` call whose host is a runtime
3567    // value was never marked `incomplete` and a benign sibling literal certified it. Measured against
3568    // real hickory-resolver 0.26.2, on a fixture that builds clean:
3569    //
3570    //     pub async fn masked(r: &Resolver<TokioRuntimeProvider>, host: &str) {
3571    //         let _ = r.lookup_ip("good.example.com").await;   // the benign literal
3572    //         let _ = r.lookup_ip(host).await;                 // the runtime target
3573    //     }
3574    //
3575    // reported `hosts:['good.example.com'] incomplete:NONE`, and `allow Net good.example.com` exited
3576    // **0** over a DNS resolution of a caller-controlled hostname. `TcpStream::connect(host)` — one
3577    // verb over, same fixture — marked `incomplete:['Net']` and failed closed. The mechanism was
3578    // sound; only the enumeration was short.
3579    //
3580    // THE DOC ABOVE USED TO CLAIM under-catching here is "a missed mask (sound-with-disclosure), never
3581    // a broken gate". That is false and is withdrawn: it is a broken gate whenever a benign sibling
3582    // literal shares the function, which is the scenario the guard's own first sentence names.
3583    //
3584    // **AND IT STAYS AN ALLOWLIST, WHICH IS NOT THE FAMILY'S USUAL DIRECTION — the exception is
3585    // measured and it is the same one `is_cmd_naming_method` states two doc-blocks up.** Inverting to
3586    // a denylist of use-verbs was built and A/B'd over all 1,545 registry crates: **544 rows gained
3587    // `incomplete` and none lost it**, because a WHOLE-CRATE-Net crate classifies EVERY method as Net,
3588    // so a denylist masks essentially everything in one — `cap-std` 66 rows, `hickory-net` 44. The
3589    // triggers it added were conversions, accessors and combinators (`into` 24, `from_std` 20,
3590    // `as_socket` 15, `setsockopt` 32, `map_err` 7, `ok` 5, `try_clone` 4) — none of which hides a
3591    // host. Worse, it masked **`bind` (31)**, which this very file has `is_net_binding` to exclude
3592    // because a bind address is where the process LISTENS, never a destination it reaches. So here the
3593    // allowlist is the precise side and the denylist is the leaky one, exactly as recorded for Exec.
3594    //
3595    // The resolver family is written out rather than the one spelling in hand (R346): `_lookup`
3596    // catches `reverse_lookup`/`srv_lookup`/`mx_lookup`/`txt_lookup`/`ipv4_lookup`/`ipv6_lookup` and
3597    // the rest of the record-type verbs in one test, mirroring `classify`'s own `ends_with("_lookup")`.
3598    method.ends_with("_lookup")
3599        || matches!(
3600            method,
3601            "connect"
3602                | "connect_timeout"
3603                | "get"
3604                | "post"
3605                | "put"
3606                | "patch"
3607                | "delete"
3608                | "head"
3609                | "request"
3610                | "send_to"
3611                | "lookup_host"
3612                | "to_socket_addrs"
3613                // R379 — the DNS resolver verbs `classify` already calls Net.
3614                | "lookup"
3615                | "lookup_ip"
3616                | "resolve"
3617        )
3618}
3619
3620/// ⟨0.29⟩ The Net verbs whose LOCATOR is at argument **1**, not 0 — the rust analogue of candor-ts's
3621/// `NET_URL_ARG1_MEMBERS`.
3622///
3623/// **A REGRESSION FOUND IN REVIEW, and the direction matters.** The positional-literal rung replaced
3624/// `first_str_lit` ("the first string literal ANYWHERE in the call") with `positional_str_lit(args, 0)`
3625/// as the UNIVERSAL default. That is right for `Fs`/`Db`/`Exec`, whose locator is always argument 0 —
3626/// but `is_net_establishing` already listed two verbs whose locator is not: `reqwest::Client::request`
3627/// takes `(Method, url)` and `UdpSocket::send_to` takes `(buf, addr)`. MEASURED after the swap:
3628/// `c.request(Method::GET, "https://api.example.com/v1")` published NO `hosts` at all and could not be
3629/// certified, while `c.get("https://api.example.com/v1")` certified normally.
3630///
3631/// ⟨0.29⟩ MEASURED FOR `request` ONLY. `send_to` is a METHOD on a receiver the STABLE syntactic backend
3632/// does not type, so `s.send_to(buf, "203.0.113.9:53")` is not classified at all there and its arg-1
3633/// literal is still uncaptured on the floor; the position is right and the deep engine can use it. Said
3634/// plainly because the first version of this fix's changelog listed both verbs as measured.
3635///
3636/// The direction is SAFE — an uncaptured locator fails closed, it never certifies something invisible —
3637/// which is exactly why it needed a review to find: the gate stayed sound and quietly stopped being
3638/// USABLE for a common shape. candor-ts avoided this by making its resolver verb-aware in the same rung;
3639/// this is that discipline arriving one engine late.
3640pub fn is_net_host_arg1(method: &str) -> bool {
3641    matches!(method, "request" | "send_to")
3642}
3643
3644/// ⟨0.29⟩ / ⟨0.40⟩ A LOCAL BIND/LISTEN VERB — the address it names is where the process LISTENS, never a
3645/// destination it reaches (SPEC §2 ⟨0.40⟩ *A BIND OR LISTEN ADDRESS IS WHERE THE PROCESS LISTENS*, PART 96
3646/// `a_litbind`). Its literal never enters `hosts`.
3647///
3648/// **MEASURED, and it is a false all-clear rather than a naming quibble.** `UdpSocket::bind("0.0.0.0:0")`
3649/// put `0.0.0.0:0` into `hosts`, the DESTINATION surface `allow Net` gates on (§2), and — because a
3650/// literal had been captured — nothing marked the surface incomplete. So:
3651///
3652/// ```text
3653/// let s = UdpSocket::bind("0.0.0.0:0")?;   // local
3654/// s.send_to(b"secrets", dst);              // destination is a RUNTIME value
3655/// allow Net 0.0.0.0   ->   policy ✓, exit 0
3656/// ```
3657///
3658/// A local listen address certified a send to an endpoint nobody can see. That is the masking evasion
3659/// AS-EFF-008 exists to close, reached through a verb whose literal is not a destination at all.
3660///
3661/// **A BIND MARKS NOTHING** (⟨0.40⟩). This doc used to say *"A BIND CANNOT BE CERTIFIED, EVER, which is
3662/// why this marks the surface incomplete"*, and that has been false since `16fb46f` dropped the hedge:
3663/// neither rust engine marks a bind, and both only withhold its literal. ⟨0.40⟩ makes the withholding the
3664/// rule — an ephemeral client's own `send_to`/`connect` carries its locator under `is_net_establishing`,
3665/// so hedging the bind as well made every UDP client uncertifiable while adding nothing a gate could use;
3666/// and a bind with nothing beside it still fails `allow Net` closed on its EMPTY literal surface. The
3667/// half of the old sentence that WAS right — *a server that binds and accepts talks to whoever connects*
3668/// — belongs to the ACCEPT, not the bind, and lives in `is_net_accepting`, which is why `accept` and
3669/// `incoming` are no longer members here.
3670pub fn is_net_binding(method: &str) -> bool {
3671    matches!(method, "bind" | "listen" | "bind_to_device")
3672}
3673
3674/// ⟨0.40⟩ A CALL THAT ACCEPTS CONNECTIONS — its peers are chosen by whoever connects, so no literal can name
3675/// them, and the unit's `Net` surface is INCOMPLETE (SPEC §2 ⟨0.40⟩ *A UNIT THAT ACCEPTS A CONNECTION …*,
3676/// AS-EFF-008, SEMANTICS §6 `masked_Net`; PART 96 `c_accept`). Both rust engines mark `incomplete` on a
3677/// `Net`-classified call this answers, WHETHER OR NOT a literal was captured (a server bootstrap's literal is
3678/// a LISTEN address, withheld like a bind's), and contribute no `hosts` entry for it.
3679///
3680/// **SOUNDNESS R817 — `accept`/`incoming` WERE MEMBERS OF `is_net_binding`, WHICH WITHHOLDS AND NEVER
3681/// MARKS**, so they were read exactly like a use-verb. `pub fn f(l: &TcpListener) { let _ =
3682/// TcpStream::connect("ok.example:80"); if let Ok((mut s, _)) = l.accept() { s.write_all(b"hi") } }`
3683/// reported `hosts: ["ok.example:80"]`, no `incomplete`, and `allow Net in f ok.example` exited **0** over a
3684/// server writing to whoever connected — EXECUTED: a client on 127.0.0.1 received the bytes.
3685///
3686/// The membership, by spelling (`path` is the resolved call path, `leaf` its last segment):
3687///   * `accept`, `accept4` (libc/nix/rustix), `poll_accept` (tokio's poll form), `incoming` and
3688///     `into_incoming` (std's iterator forms) — exact LEAF. `accept_bi`/`accept_uni` (quinn) are NOT here:
3689///     they accept a STREAM on a connection whose peer was already fixed by the endpoint's `accept`.
3690///   * tonic's `Router::serve`/`Router::serve_with_shutdown` and `TcpIncoming::new`, the server bootstraps
3691///     `classify` already charges `Net` — each binds a listener and begins accepting on it (classify's own
3692///     tonic arm cites the source lines). By PATH, because `serve`/`new` are not accept verbs anywhere else.
3693///
3694/// A wrong `true` over-masks and fails CLOSED, saying so; a wrong `false` is the benign-sibling-literal
3695/// bypass this row closed. An exact `accept` leaf also matches a TLS/WebSocket acceptor wrapping a stream
3696/// that was already accepted (`TlsAcceptor::accept(stream)`, `tungstenite::accept`) — whose peer is likewise
3697/// whoever connected, so the mark is redundant there, never false.
3698pub fn is_net_accepting(path: &str, leaf: &str) -> bool {
3699    matches!(leaf, "accept" | "accept4" | "poll_accept" | "incoming" | "into_incoming")
3700        || (path.starts_with("tonic::")
3701            && (path.ends_with("::Router::serve")
3702                || path.ends_with("::Router::serve_with_shutdown")
3703                || path.ends_with("::TcpIncoming::new")))
3704}
3705
3706/// The masking guard (AS-EFF-008), the `Fs` analog of `is_net_establishing`: whether an `Fs`-classified
3707/// call takes the filesystem PATH as a string argument (so a missing literal leaves the path
3708/// structurally INVISIBLE — a runtime-built path — and the surface is incomplete, fail-closed). An
3709/// ALLOWLIST of the path-NAMING free functions / constructors (`fs::write`/`read`/`File::open`/…), the
3710/// SAFE direction: a path-stat METHOD whose path is the RECEIVER (`p.metadata()`, `p.exists()`) is
3711/// invoked method-form and the caller gates on `!is_method`, so this never sees it; an op on an
3712/// already-opened handle (`file.write_all`, `mmap.flush`, `tempfile()` — a random name, no path arg)
3713/// is not here, so a missing literal there never false-positives. Under-catching an unusual
3714/// path-naming fn is a missed mask (sound-with-disclosure), ~~never a broken gate~~ — **AND THAT LAST
3715/// CLAUSE IS FALSE. SOUNDNESS R399.** R379 withdrew this exact sentence from `is_net_establishing` after
3716/// MEASURING it wrong, and R383 and R386 are counter-examples on this guard and its Db sibling: an
3717/// unlisted path-taking call contributes no locator, nothing marks the surface incomplete, and a benign
3718/// sibling literal then CERTIFIES the invisible destination — `allow Fs /etc/hostname` exit 0 over
3719/// `unixfs::chown(caller, …)`, with the control (`OpenOptions::open(caller)`) exiting 1. The sentence
3720/// survived here only because nobody re-read it after R379, and it is what licenses leaving the list
3721/// short. Under-catching is a BROKEN GATE, not a missed mask. The arg is the
3722/// method/fn leaf (the path's last segment).
3723pub fn is_fs_path_arg(leaf: &str) -> bool {
3724    matches!(
3725        leaf,
3726        // SOUNDNESS R399 — the POSIX ownership/root verbs take a path as argument 0 and were absent, so a
3727        // benign sibling literal certified them: `allow Fs /etc/hostname` exit 0 over
3728        // `unixfs::chown(caller, …)`, control `OpenOptions::open(caller)` exit 1. `std::os::unix::fs`.
3729        "chown"
3730            | "lchown"
3731            | "chroot"
3732        // std::fs / tokio::fs / async_std::fs / fs_err free functions taking a path argument
3733            | "write"
3734            | "read"
3735            | "read_to_string"
3736            | "read_dir"
3737            | "read_link"
3738            | "copy"
3739            | "rename"
3740            | "remove_file"
3741            | "remove_dir"
3742            | "remove_dir_all"
3743            | "create_dir"
3744            | "create_dir_all"
3745            | "hard_link"
3746            | "soft_link"
3747            | "symlink"
3748            | "symlink_file"
3749            | "symlink_dir"
3750            | "symlink_metadata"
3751            | "canonicalize"
3752            | "metadata"
3753            | "set_permissions"
3754            | "exists"
3755            | "try_exists"
3756            // File / OpenOptions constructors taking a path argument
3757            | "open"
3758            | "create"
3759            | "create_new"
3760    )
3761}
3762
3763/// SOUNDNESS R334 — IS THIS PATH SEGMENT THE OS ENTROPY SOURCE ITSELF (as a VALUE, not a verb)?
3764///
3765/// **THE DEFECT THIS EXISTS FOR.** Every entropy rule in the `rand` block keys on the CALLEE — a verb
3766/// (`from_os_rng`, `next_u32`, `fill_bytes`) or the source type in RECEIVER position
3767/// (`contains("OsRng")`/`contains("SysRng")`, R320). The idiomatic way to seed a userspace CSPRNG from
3768/// the OS puts the source in ARGUMENT position, where neither key can see it. Executed, one fixture,
3769/// four rows:
3770///
3771/// ```text
3772/// StdRng::try_from_rng(&mut SysRng)   ABSENT   quinn-proto-0.11.17 endpoint.rs:81
3773/// StdRng::from_rng(&mut OsRng)        ABSENT   the same hole in the OLD spelling
3774/// StdRng::from_seed([0u8; 32])        ABSENT   correct — deterministic, and the control
3775/// StdRng::from_os_rng()               ['Rand'] the verb form
3776/// ```
3777///
3778/// Both spellings, so this is NOT a rename residual and predates R320 — whose "stale `OsRng` clause"
3779/// framing would have sent the audit straight past it.
3780///
3781/// **WHY THE ARGUMENT AND NOT THE VERB.** `from_rng`/`try_from_rng` cannot simply be charged: their
3782/// effect is decided by what is passed to them, `from_rng(&mut pcg)` is deterministic, and there are
3783/// 802 `from_seed`/`seed_from_u64` call sites in this machine's registry cache — the deterministic
3784/// population is the larger one. Charging the verb is R330's mistake one crate over. The discriminator
3785/// is the ARGUMENT, so that is what is read.
3786///
3787/// **THE OVER-APPROXIMATION IS DELIBERATE AND STATED.** Naming one of these types as a VALUE is charged
3788/// wherever it appears in an argument list, including moves that do not themselves draw (`Some(OsRng)`,
3789/// `Box::new(SysRng)`). That is sound and it is also the ONLY place candor can see it: a source handed
3790/// off into a struct field is drawn from in some later function whose own call list never mentions it.
3791/// A user type coincidentally named `OsRng` would be charged too — an over-report, the safe direction,
3792/// and cheaper than the silence it replaces.
3793pub fn is_entropy_source_ident(seg: &str) -> bool {
3794    matches!(seg, "OsRng" | "SysRng")
3795}
3796
3797/// SOUNDNESS R338 — DOES THIS CALL ALSO READ THE SYSTEM TRUST STORE? A SECOND effect, not a
3798/// replacement for the one `classify` returns.
3799///
3800/// **THE DEFECT.** candor charges `native_tls::TlsConnector::new` `Fs` because on the openssl backend
3801/// it loads the probed cert file/dir from disk. Several calibrated crates construct that connector
3802/// INSIDE a public entry point, so the consumer's call discloses the transport effect and drops the
3803/// `Fs` — `tungstenite::client_tls` reports `['Net']`, and `deny Fs` passes over a real trust-store
3804/// read. `wrap_stream` does `tls_connector.map_or_else(TlsConnector::new, Ok)`
3805/// (`tungstenite-0.30.0/src/tls.rs:54`), so a caller supplying no connector gets `TlsConnector::new()`.
3806/// (The row the coverage gate nominated — `tungstenite::tls::encryption::native_tls::wrap_stream` — is
3807/// unreachable from outside: `mod tls;` is private at `lib.rs:32`. The reachable form is one level up.)
3808///
3809/// **WHY THIS IS SO SHORT: the sweep found four more crates and every one was PRICED AND REJECTED,
3810/// which is the deliverable rather than a gap.** Callers of `native_tls::TlsConnector::new` in the
3811/// local registry are redis, tungstenite, ureq, minreq and tokio-websockets.
3812///   - `minreq`, `tokio_websockets` — NOT calibrated, so their calls already disclose rather than
3813///     claim purity. No rule can improve them.
3814///   - `redis` — `ActualConnection::new` (`redis-1.6.0/src/connection.rs:932`) constructs it only for a
3815///     `rediss://` address, and the consumer-visible verb is `Client::get_connection`. Charging that
3816///     `Fs` would fabricate on every PLAIN redis user, which is the majority. Rejected on the trade.
3817///   - `ureq` — `agent.rs:265` takes `crate::default_tls_config()`, and ureq's default features are
3818///     `["tls", "gzip"]`: `native-certs` is OFF, so the default build resolves to
3819///     `rtls::root_certs()`'s `#[cfg(not(feature = "native-certs"))]` arm, which is
3820///     `webpki_roots::TLS_SERVER_ROOTS` — COMPILED IN, no disk read (`ureq-2.12.1/src/rtls.rs:82`).
3821///     Charging it would fabricate on the default build. Rejected on the evidence.
3822///
3823/// What is left is tungstenite's two explicitly-TLS-named entry points, where no caller is
3824/// over-charged: `client_tls` passes `None` for the connector unconditionally, and
3825/// `client_tls_with_config`'s callers are by definition doing TLS. **`tungstenite::connect` is a stated
3826/// residual, not an oversight** — it serves `ws://` and `wss://` alike, so charging it would hit real
3827/// plain-WebSocket users; the scheme is often a string literal candor already captures in `str_arg`,
3828/// which is the shape a future fix should use rather than a blanket charge.
3829pub fn reads_trust_store(crate_name: &str, path: &str) -> bool {
3830    crate_name == "tungstenite"
3831        && (path.ends_with("::client_tls") || path.ends_with("::client_tls_with_config"))
3832}
3833
3834/// SOUNDNESS R330 — IS THIS `hash_password` CALL PROVABLY THE EXPLICIT-SALT ONE (password-hash 0.5.x)?
3835///
3836/// **THE DEFECT THIS EXISTS FOR, and it was mine, introduced by R318's fix the previous day.** R318
3837/// correctly found that `hash_password` mints OS entropy — at password-hash **0.6.x**, where
3838/// `fn hash_password(&self, password)` (`lib.rs:107`) has the body `let salt = try_generate_salt()?;`.
3839/// At **0.5.0** (`traits.rs:33`) and argon2 **0.5.3** (`lib.rs:572`) the identical name is
3840/// `fn hash_password(&self, password, salt)`: the caller supplies the salt and the call is deterministic
3841/// recomputation — PURE. So the `ends_with`-not-`contains` guard R318 relied on was keyed on the 0.6.x
3842/// name, and at 0.5.x the explicit-salt call IS named `hash_password`. Measured: two calls with the same
3843/// stored salt produce byte-identical hashes, and all four 0.5.x spellings were charged `Rand`.
3844///
3845/// **Why arity and not the resolved version.** R330's remedy offered both. The version is only knowable
3846/// where a lockfile resolves, and `calibration_exceeded` is ONE-SIDED — it fires when resolved > ceiling,
3847/// so it can never see a rule that mis-describes an OLDER release, which is exactly this direction. The
3848/// arity is written at the call site, needs no lockfile, and distinguishes the two signatures exactly.
3849///
3850/// **The direction is stated so it cannot drift:** this returns true only for the shape it can PROVE is
3851/// explicit-salt. An unrecorded arity (`argc == 0`, every synthesized edge and every pre-R330 cache
3852/// entry) returns false and the call stays charged. Narrowing a sound over-approximation by DENYLIST,
3853/// never by allowlist — the family rule.
3854pub fn password_hash_explicit_salt(crate_name: &str, path: &str, argc: u8, method: bool) -> bool {
3855    if !matches!(crate_name, "argon2" | "scrypt" | "pbkdf2" | "password_hash")
3856        || !path.ends_with("::hash_password")
3857    {
3858        return false;
3859    }
3860    if argc == 0 {
3861        return false; // NOT RECORDED — see `Call::argc`. Unknown charges.
3862    }
3863    // `syn` hands a method call its args WITHOUT the receiver and a UFCS `Trait::method(&recv, ..)`
3864    // WITH it, so normalize to the non-receiver count before comparing: 0.5.x is `(password, salt)` = 2,
3865    // 0.6.x is `(password)` = 1.
3866    let non_receiver = if method { argc } else { argc - 1 };
3867    let hit = non_receiver == 2;
3868    // §E1 HIT COUNTER, the `CANDOR_ALIAS_DEBUG` pattern. A refinement that narrows a charge must be
3869    // able to prove it REACHED real code, because "nothing moved" and "the branch never ran" print the
3870    // same corpus A/B. This is what `bin/corpus-ab.py --mark` counts.
3871    if hit && std::env::var("CANDOR_ALIAS_DEBUG").is_ok() {
3872        eprintln!("R330EXPLICITSALT {path} argc={argc} method={method}");
3873    }
3874    hit
3875}
3876
3877/// ⟨0.29⟩ HOW MANY LEADING ARGUMENTS OF AN `Fs` PATH-TAKING CALL ARE PATHS.
3878///
3879/// **THE DEFECT THIS EXISTS FOR.** The literal harvester took the first string literal found ANYWHERE in
3880/// the argument list, so `fs::write(user_path, "/tmp/lit")` published `paths: ["/tmp/lit"]` — the BYTES
3881/// BEING WRITTEN — as the destination surface, and `allow Fs /tmp/lit` certified a write to an
3882/// attacker-controlled path at exit 0. Measured on candor-scan and candor-ts; candor-java and
3883/// candor-swift read the path POSITION and fail closed correctly. Removing the sibling literal made the
3884/// same call fail closed, which is what identified the mechanism: any literal in the call, in any
3885/// position, defeated the runtime-path incompleteness marker.
3886///
3887/// So the surface is read from the PATH POSITIONS and nowhere else, and every one of them must be a
3888/// literal for the surface to be complete. Two-path operations are the reason this is an arity and not a
3889/// boolean: `fs::copy("/safe", user_path)` has a literal at position 0 and still writes somewhere
3890/// nobody can see, so requiring only position 0 would leave the identical hole one argument along.
3891pub fn fs_path_arity(leaf: &str) -> usize {
3892    match leaf {
3893        "copy" | "rename" | "hard_link" | "soft_link" | "symlink" | "symlink_file" | "symlink_dir" => 2,
3894        _ => 1,
3895    }
3896}
3897
3898/// SOUNDNESS R383 — THE METHOD FORMS WHOSE PATH IS AN ARGUMENT, not the receiver.
3899///
3900/// `scan.rs`'s Fs masking arm reads `!c.method && is_fs_path_arg(leaf)`. The `!c.method` gate exists for
3901/// a real reason — the path-STAT methods (`p.metadata()`, `p.exists()`) carry the path as the RECEIVER,
3902/// so masking them would be wrong — but it excluded EVERY method form, and `OpenOptions::open(path)` is
3903/// a method whose path IS the argument. Measured, with the instrument calibrated first: a function doing
3904/// `File::open("/etc/hostname")` beside `OpenOptions::new().read(true).open(caller_path)` reported
3905/// `paths:['/etc/hostname'] incomplete:NONE`; `deny Fs` exited 1 and **`allow Fs /etc/hostname` exited
3906/// 0** — a policy saying "only /etc/hostname" going green over a caller-supplied path. The FREE-fn
3907/// spelling of the same call is the isolating control: it marks incomplete and fails closed.
3908///
3909/// **`argc` does not discriminate; the RECEIVER TYPE does.** Instrumented, the four shapes are
3910/// `OpenOptions::open` (argc 1, path IS the arg), `File::read_to_string` and `File::write` (argc 1,
3911/// BUFFER arg) and `Path::exists` (argc 0, path is the receiver).
3912///
3913/// **The family is from a 1,545-crate sweep, not from the one spelling that was found (R346):** the only
3914/// path-taking METHOD pairs in the registry are `OpenOptions::open` (69 std + 2 tokio + 9
3915/// `cap_primitives`) and `DirBuilder::create` (5 std + tokio). Every other method on those same receivers
3916/// is a builder modifier (`read`/`write`/`truncate`/`mode`) or a combinator (`map`/`map_err`/`or_else`/
3917/// `with_context`), and `std::fs::File`'s 267 method hits are all use-verbs whose path was fixed at open.
3918///
3919/// Matched on the TAIL of the resolved call path, so std, tokio, `cap_primitives` and `fs_err` are all
3920/// covered by one rule without naming a crate. **Stays an ALLOWLIST:** R379 built the denylist inversion
3921/// for the Net twin and the corpus refused it, and here a denylist over method forms would mask all 267
3922/// `File` use-verbs and every combinator on a whole-crate-Fs receiver.
3923///
3924/// **SOUNDNESS R417 — THE CAPABILITY-`Dir` FAMILY WAS ABSENT, AND IT IS A LIVE GATE BYPASS.**
3925/// `cap_std::fs::Dir` (and its `fs_utf8`/`cap_async_std` twins, and `openat::Dir`) is a whole second
3926/// filesystem API whose path is an ARGUMENT to a METHOD on a directory handle — `d.write(caller, …)`,
3927/// `d.open(caller)`, `d.remove_file(caller)`. MEASURED, with the free-fn spelling as the isolating
3928/// control in the same fixture:
3929///
3930/// ```text
3931/// control(caller)  std::fs::write("/tmp/benign",…); std::fs::write(caller,…)
3932///                  → paths:['/tmp/benign'] incomplete:['Fs']   allow Fs /tmp/benign → exit 1  ✔
3933/// mixed(d,caller)  std::fs::write("/tmp/benign",…); d.write(caller,…)
3934///                  → paths:['/tmp/benign'] incomplete:NONE     allow Fs /tmp/benign → exit 0  ✘
3935/// ```
3936///
3937/// The call path resolves in full (`cap_std::fs::Dir::write`), so this is not a resolution gap — the
3938/// guard simply had two names in it. `alone(d,caller)` confirms the call IS classified `Fs`: the
3939/// effect was seen, the locator was not, and nothing said so.
3940///
3941/// **WHY THIS HALF IS A DENYLIST WHILE THE REST OF THE GUARD IS AN ALLOWLIST**, which is not a
3942/// contradiction but the point: the allowlist above exists because the receiver is UNKNOWN, so masking
3943/// by default would swallow `File`'s 267 use-verbs. Here the receiver is KNOWN to be a directory
3944/// capability, and on that receiver essentially every method names a path — 24 of the 49 declared on
3945/// `cap_std::fs::Dir` are already `is_fs_path_arg` leaves, and most of the remaining 25 (`open_with`,
3946/// `open_dir`, `is_file`, `is_dir`, `symlink_contents`, `read_link_contents`, `create_dir_with`,
3947/// the `bind_unix_*`/`connect_unix_*` socket-path verbs) take one too. An allowlist here would be the
3948/// R346→R348 hand-list vein by construction: every name I failed to write down is a silent bypass, and
3949/// R399 settled that an under-catch on this guard is a BROKEN GATE, not a missed mask.
3950///
3951/// So the default on a `Dir` receiver is MASK, and the exceptions are the handful of methods that
3952/// provably take no path: handle-to-handle conversions and the iterator/`self`-only verbs. Being wrong
3953/// about one of those costs an over-mask on a rare API (fails CLOSED, disclosed); being wrong the other
3954/// way is the exit-0 above. [[candor-denylist-over-allowlist]] — say which direction it fails in first.
3955///
3956/// Scoped on the RECEIVER SEGMENT being exactly `Dir`, so `cap_std`, `cap_std::fs_utf8`,
3957/// `cap_async_std` and `openat` are covered by one rule without naming a crate — the same tail-matching
3958/// discipline as the two names above. A non-filesystem type that happens to be called `Dir` would be
3959/// over-masked, which fails closed.
3960/// SOUNDNESS R414 / SPEC ⟨0.37⟩ — **a RECEIVER-form path stat names its destination, and every engine
3961/// in this family was silent on it.** `p.exists()`, `p.metadata()`, `p.canonicalize()` reach the
3962/// filesystem against the path they are invoked ON; the locator is the RECEIVER, not an argument.
3963/// MEASURED before the clause was written, one variable, a benign allowed literal beside a
3964/// caller-chosen path:
3965///
3966/// ```text
3967/// fn f(p: &Path) { fs::write("/tmp/benign", b"x"); p.exists(); }
3968///   -> paths:['/tmp/benign'] incomplete:NONE   allow Fs /tmp/benign -> exit 0, "nothing hidden"
3969/// ```
3970///
3971/// The ARGUMENT spelling of the identical reach (`fs::metadata(p)`) was already marked, which is what
3972/// makes this a drift rather than a policy: `is_fs_path_arg` deliberately excluded the method form
3973/// because its receiver was assumed to be an OPEN HANDLE. That assumption holds for `File` and is
3974/// false for `Path` — a `Path` is a path VALUE, and a stat on it is `Fs` reaching that value.
3975///
3976/// **NO CARVE-OUT LIST, and that is structural rather than lucky.** The pure `Path` algebra —
3977/// `join`, `parent`, `file_name`, `extension`, `to_str`, `display`, `starts_with`, `to_path_buf`,
3978/// `as_path` — is NOT classified `Fs` (measured: a function calling all nine reports `fs:['write']`
3979/// from an unrelated sibling call and nothing else), so it never reaches the branch that consults
3980/// this predicate. The carve-out falls out of the classification, exactly as it does on the java
3981/// side, instead of being a list that must be kept in sync with `std`.
3982///
3983/// Matched on the RECEIVER SEGMENT so `std::path` and the `camino` mirrors are covered by one rule
3984/// without naming a crate. Being generous here is the SAFE direction: the predicate is only ever
3985/// consulted for a call the classifier ALREADY resolved to `Fs`, so an extra receiver name can at
3986/// worst over-mask (fails closed, disclosed), while a missing one is the exit-0 above — R399's
3987/// ruling that an under-catch on a masking guard is a broken gate, not a missed mask.
3988pub fn is_fs_receiver_locator(call_path: &str) -> bool {
3989    let mut segs = call_path.rsplit("::");
3990    let (Some(_leaf), Some(recv)) = (segs.next(), segs.next()) else { return false };
3991    matches!(recv, "Path" | "PathBuf" | "Utf8Path" | "Utf8PathBuf")
3992}
3993
3994/// SOUNDNESS R460 / SPEC ⟨0.37⟩ — **the Exec twin of `is_fs_receiver_locator`: a spawn's locator is
3995/// its RECEIVER, and rust was silent on it.** `is_cmd_naming_method` marks the surface incomplete at
3996/// `Command::new(<runtime value>)`, which covers every spelling that NAMES the program inside the
3997/// function. It cannot cover the spelling that names it somewhere else:
3998///
3999/// ```text
4000/// fn masked(cmd: &mut Command) { Command::new("git").status(); cmd.spawn(); }
4001///   -> cmds:['git'] incomplete:NONE   allow Exec git -> exit 0, "nothing hidden"
4002/// ```
4003///
4004/// MEASURED on the pre-fix binary, one variable — deleting the benign `Command::new("git")` line, and
4005/// nothing else, turns the same gate to exit 1. The real instance is tokio's own
4006/// `process::unix::spawn_child(cmd: &mut std::process::Command) { cmd.spawn()? }`, production source,
4007/// charged `Exec` with no `cmds` and no `incomplete`.
4008///
4009/// **A DENYLIST, and the direction is the point.** On a `Command` receiver essentially every method
4010/// that is not a documented BUILDER modifier reaches the boundary (`spawn`, `status`, `output`, `exec`,
4011/// and every async / pty mirror of them), so an allowlist of terminal names would be the R346→R348
4012/// hand-list vein by construction: each name not written down is a silent bypass. The carve-out is
4013/// `is_cmd_builder_method` — the SAME list the head-refinement already trusts, not a second copy of it
4014/// (§G, ask the authority) — plus the `get_*` getters that list's own doc-block names. Being wrong
4015/// about a carve-out costs an over-mask on a configure-only call (fails closed, disclosed); being
4016/// wrong the other way is the exit-0 above.
4017///
4018/// Scoped on the RECEIVER SEGMENT being exactly `Command`, so `std::process`, `tokio::process`,
4019/// `async_process` and the `std::os::unix` extension trait are one rule without naming a crate — the
4020/// same tail-matching discipline as `is_fs_receiver_locator`. The predicate is only ever consulted for
4021/// a call the classifier ALREADY resolved to `Exec`, so a non-spawning type that happens to be called
4022/// `Command` (clap's builder) is unreachable unless something already charged it Exec.
4023///
4024/// The DETERMINED receiver does not arrive here: the collector resolves a builder chain rooted at
4025/// `Command::new("git")` — inline or through a `let` binding — into `str_arg`, so only a receiver whose
4026/// program was never named in this function reaches the mask. That split is this fix's over-charge
4027/// control, and it is what keeps the dominant spelling certifiable.
4028pub fn is_exec_receiver_locator(call_path: &str) -> bool {
4029    let mut segs = call_path.rsplit("::");
4030    let (Some(leaf), Some(recv)) = (segs.next(), segs.next()) else { return false };
4031    // SOUNDNESS R808 — AND ITS EXTENSION TRAIT. The deep engine resolves `cmd.exec()` to the TRAIT method
4032    // `std::os::unix::process::CommandExt::exec`, not to `Command::exec`, so a receiver test on the
4033    // literal segment `Command` let the deep engine certify a caller-supplied `exec` while `candor-scan`
4034    // (which forms `Command::exec` from the typed receiver) flagged it — the R808 port's own boundary,
4035    // measured on the port's fixture one method over. `CommandExt`'s other members (`uid`, `gid`,
4036    // `groups`, `pre_exec`, `arg0`, `process_group`) are already `is_cmd_builder_method` carve-outs.
4037    matches!(recv, "Command" | "CommandExt") && !is_cmd_builder_method(leaf) && !leaf.starts_with("get_")
4038}
4039
4040pub fn is_fs_path_arg_method(call_path: &str) -> bool {
4041    if call_path.ends_with("OpenOptions::open") || call_path.ends_with("DirBuilder::create") {
4042        return true;
4043    }
4044    let mut segs = call_path.rsplit("::");
4045    let (Some(leaf), Some(recv)) = (segs.next(), segs.next()) else { return false };
4046    if recv != "Dir" {
4047        return false;
4048    }
4049    // The no-path exceptions on a directory capability: handle↔handle conversions, the entry
4050    // iterators, and the verbs whose only operand is `self`. Everything else on a `Dir` names a path.
4051    //
4052    // EVERY NAME HERE WAS CHECKED AGAINST ITS SIGNATURE, because a wrong entry here is not a precision
4053    // loss, it is the exit-0 above. `read_dir` was in this list on the first cut on the reasonable-
4054    // sounding grounds that `entries()` is the self-only form — and `cap_std::fs::Dir::read_dir` is
4055    // `fn read_dir<P: AsRef<Path>>(&self, path: P)`, so that entry was a bypass I had just written.
4056    // Adding a name here requires reading its signature, not recognising it.
4057    !matches!(
4058        leaf,
4059        "try_clone"
4060            | "into_std_file"
4061            | "from_std_file"
4062            | "into_std"
4063            | "from_std"
4064            | "entries"
4065            | "entries_utf8"
4066            | "dir_metadata"
4067            | "reopen_dir"
4068            | "remove_open_dir"
4069            | "remove_open_dir_all"
4070            | "open_parent_dir"
4071            | "rewind"
4072            | "as_raw_fd"
4073            | "as_fd"
4074    )
4075}
4076
4077/// The masking guard (AS-EFF-008), the `Db` analog of `is_net_establishing`: whether a `Db`-classified
4078/// call takes the raw SQL QUERY as a string argument (so a missing literal leaves the table
4079/// structurally INVISIBLE — a runtime-built query — and the surface is incomplete, fail-closed). An
4080/// ALLOWLIST of the SQL-string-bearing execution/prepare verbs, the SAFE direction: a
4081/// build-then-execute terminal that takes NO SQL string (sqlx/diesel/sea_orm `fetch*`/`load*`/`first`/
4082/// `all`/`one`/`stream`, the document-store `find*`/`insert*`/…), and a non-query op (`connect`/
4083/// `open`/`acquire`/`begin`/`commit`/`ping`/`get_conn`), are NOT here — their query is built
4084/// structurally (never a maskable string literal) so a missing literal must not false-positive.
4085/// Under-catching an unusual query verb is a missed mask (sound-with-disclosure), ~~never a broken
4086/// gate~~ — **FALSE, SOUNDNESS R399**, and R386 three lines below is this guard's own counter-example.
4087/// `mysql`'s `query_drop`/`query_iter` are that crate's PRIMARY API, take `Q: AsRef<str>`, and were
4088/// absent: `allow Db users` exited 0 over `c.query_drop(caller_sql)` beside one literal query, with the
4089/// verb-only control exiting 1. The arg is the method leaf (the path's last segment).
4090pub fn is_db_query_arg(leaf: &str) -> bool {
4091    // SOUNDNESS R386 — THE `sqlite3_*` C API TAKES SQL AND WAS ABSENT, so a benign sibling literal
4092    // certified arbitrary caller-supplied SQL. `classify` in this same crate maps `sqlite3_exec`/
4093    // `sqlite3_step`/`sqlite3_prepare*` to `Db`; this list had none of them, while candor-swift covers
4094    // the whole family by prefix — a cross-engine divergence, which is how it was found.
4095    //
4096    // MEASURED, calibrated first (`deny Db` exits 1): `conn.execute("INSERT INTO users (id) VALUES (1)",
4097    // [])` beside `sqlite3_exec(db, caller_sql, …)` reported `tables:['users'] incomplete:NONE` and
4098    // **`allow Db users` exited 0**. R383 recorded this gap as "REAL BUT NOT LIVE" on the grounds that a
4099    // C-string literal never reaches `tables` — true of an ISOLATED function, and the wrong shape: the
4100    // literal does not have to come from the masked call, only from the same FUNCTION.
4101    //
4102    // ONLY THE SQL-BEARING SPELLINGS. `sqlite3_step`/`_close`/`_serialize`/`_deserialize` carry no query,
4103    // and `sqlite3_open*` takes a FILENAME — masking that would claim a Db surface for an Fs locator,
4104    // which is the over-mask this allowlist exists to avoid. Direction stays an ALLOWLIST for the reason
4105    // R379 measured: a denylist over a whole-crate-Db crate masks every lifecycle verb in it.
4106    if matches!(
4107        leaf,
4108        "sqlite3_exec"
4109            | "sqlite3_prepare"
4110            | "sqlite3_prepare_v2"
4111            | "sqlite3_prepare_v3"
4112            | "sqlite3_prepare16"
4113            | "sqlite3_prepare16_v2"
4114            | "sqlite3_prepare16_v3"
4115            // R386's OWN BOUNDARY DEFECT, found by a release panel: `sqlite3_get_table(db, zSql, …)`
4116            // takes SQL as its second argument and `classify` maps it to `Db`, and the first cut of
4117            // this list — which cites R346 — omitted it. Two of the family's SQL-bearing spellings
4118            // written down out of three. Reach on the local registry is ZERO call sites (only
4119            // declarations in `libsqlite3-sys` and `sqlite-wasm-rs`), so this is latent, not live.
4120            | "sqlite3_get_table"
4121    ) {
4122        return true;
4123    }
4124    matches!(
4125        leaf,
4126        "execute"
4127            | "execute_batch"
4128            | "execute_unprepared"
4129            | "batch_execute"
4130            | "simple_query"
4131            | "query"
4132            | "query_one"
4133            | "query_opt"
4134            | "query_raw"
4135            | "query_row"
4136            | "query_map"
4137            // SOUNDNESS R399 — `mysql`'s OWN PRIMARY API was absent, and this is a live gate bypass rather
4138            // than the "missed mask" the struck sentence above promised. All four take `Q: AsRef<str>`
4139            // (`mysql-28.0.2/src/conn/queryable.rs:29,50,126`), so the SQL is a maskable string argument of
4140            // THIS call, which is the exact condition this list encodes. Measured: `allow Db users` exits 0
4141            // over `c.query_drop(caller_sql)` beside one literal query; the control, the same fixture with
4142            // the verb changed to `query`, exits 1.
4143            | "query_drop"
4144            | "query_iter"
4145            | "query_first"
4146            | "query_fold"
4147            // postgres COPY: the statement is a SQL string argument (`postgres-0.19.14/src/client.rs:492,520`).
4148            | "copy_in"
4149            | "copy_out"
4150            | "query_and_then"
4151            | "query_typed"
4152            | "query_all"
4153            | "prepare"
4154            | "prepare_typed"
4155            | "prepare_cached"
4156            | "exec"
4157            | "exec_first"
4158            | "exec_iter"
4159            | "exec_map"
4160            | "exec_fold"
4161            | "exec_drop"
4162            | "exec_batch"
4163            | "prep"
4164            | "run_command"
4165    )
4166}
4167
4168/// THE AS-EFF-008 MASKING GUARD, ONE AUTHORITY FOR BOTH RUST ENGINES. SOUNDNESS R806 / R808.
4169///
4170/// The question: this call carries a surface effect `eff` and NO literal locator was captured for it —
4171/// is its locator (host, program, path, SQL) therefore a RUNTIME value the gate cannot see? If so the
4172/// caller marks the surface `incomplete`, so a benign sibling literal cannot certify it.
4173///
4174/// **WHY ONE FUNCTION.** Both rust engines asked this question, each with its own copy of the
4175/// disjunction over the `is_*` predicates below, and the copies drifted: R460's receiver-locator arm and
4176/// R383's `OpenOptions::open` arm reached `candor-scan` and never the deep engine (R808). A rule added
4177/// here now reaches both, which is the only way this class stops recurring one crate over.
4178///
4179/// `leaf` is the call's own method/function name; `path` the resolved call path; `method` whether the
4180/// call is written in method form on a receiver (so a path-stat `p.exists()` is not mistaken for an
4181/// argument-form `fs::metadata(p)`, and the receiver-locator arms can fire). `crate_name` is the
4182/// resolved crate, used only to scope the table-derived FFI arms.
4183///
4184/// **THE DIRECTION, stated so it cannot drift:** a wrong `true` over-masks — the gate fails CLOSED and
4185/// says so; a wrong `false` is the benign-sibling-literal bypass, a broken gate (R399). Every arm that
4186/// reads a `classify` table below reads it with a NO-LOCATOR DENYLIST, so a leaf added to that table is
4187/// masked until someone reads its signature and says otherwise.
4188pub fn masks_locator(eff: &str, crate_name: &str, path: &str, leaf: &str, method: bool) -> bool {
4189    let by_list = match eff {
4190        "Net" => is_net_establishing(leaf),
4191        // SOUNDNESS R808 — the receiver arm is NOT gated on method form. `Command::spawn(cmd)` (UFCS)
4192        // runs the same caller-supplied program as `cmd.spawn()`, and with the gate BOTH engines
4193        // certified it at exit 0 on the unit and its caller. In call form the receiver is argument 0;
4194        // neither engine resolves a determined argument-0 command, so a UFCS spawn on a command built
4195        // in the same function over-masks (fails closed) — the rare spelling paying for the silent one.
4196        "Exec" => is_cmd_naming_method(leaf) || is_exec_receiver_locator(path),
4197        "Fs" => {
4198            (!method && is_fs_path_arg(leaf))
4199                || (method && is_fs_path_arg_method(path))
4200                || (method && is_fs_receiver_locator(path))
4201        }
4202        "Db" => is_db_query_arg(leaf),
4203        _ => false,
4204    };
4205    by_list || masks_locator_by_table(eff, crate_name, path, leaf)
4206}
4207
4208/// SOUNDNESS R806 — THE TABLE-DERIVED HALF OF `masks_locator`, separate only so a reach probe can ask
4209/// the very function the guard asks (`R806MASK` in candor-scan) rather than a copy of it.
4210///
4211/// Each hand list in `masks_locator` was SHORT against the `classify` table that charges the effect:
4212/// `is_fs_path_arg` held 28 names while `LIBC_FS` charges 92, `is_cmd_naming_method` held `new`/`cmd`
4213/// while `LIBC_EXEC` names `system`/`popen`/`exec*`/`posix_spawn*`, `is_net_establishing` lacked
4214/// `getaddrinfo`, and `is_db_query_arg` lacked `prepare_typed_cached` from `PG_DB_VERBS`. EXECUTED on
4215/// each: a caller's file really unlinked, a caller's shell command really run, a real resolver lookup,
4216/// all under `allow <E> in <unit> <benign literal>` at exit 0 on the unit AND its caller.
4217///
4218/// Adding the missing names would leave two tables to drift again the next time one grows — the shape
4219/// swift closed as R787 and java as R794, both by derivation. So these arms READ the charging table and
4220/// subtract a signature-checked NO-LOCATOR denylist: a leaf added to the table is masked by default.
4221pub fn masks_locator_by_table(eff: &str, crate_name: &str, path: &str, leaf: &str) -> bool {
4222    let syscall = is_syscall_crate(crate_name);
4223    match eff {
4224        "Net" => {
4225            syscall
4226                && LIBC_NET.contains(&leaf)
4227                && !LIBC_NET_NO_DESTINATION.contains(&leaf)
4228                // `rustix::net::sendmsg(socket, iov, control, flags)` takes NO address — rustix spells
4229                // the addressed forms `sendmsg_addr`/`sendmsg_v4`/`sendmsg_v6`/`sendmsg_unix` (not in
4230                // `LIBC_NET`, so unclassified). libc's and nix's `sendmsg` DO carry one (`msg_name` /
4231                // `addr: Option<&S>`), which is why this is scoped to the crate rather than the leaf.
4232                // Measured on the A/B: x11rb's `DefaultStream::do_write` over its connected X11 socket
4233                // was the only reach, an over-mask, removed here.
4234                && !(crate_name == "rustix" && leaf == "sendmsg")
4235        }
4236        "Exec" => syscall && LIBC_EXEC.contains(&leaf) && !LIBC_EXEC_NO_PROGRAM.contains(&leaf),
4237        "Fs" => syscall && LIBC_FS.contains(&leaf) && !LIBC_FS_NO_PATH.contains(&leaf),
4238        "Db" => {
4239            (matches!(crate_name, "postgres" | "tokio_postgres" | "deadpool_postgres" | "rusqlite")
4240                && PG_DB_VERBS.iter().any(|v| path.ends_with(v))
4241                && !PG_DB_VERBS_NO_SQL.iter().any(|v| path.ends_with(v)))
4242                // `sqlx_core`'s `Executor::prepare_with(sql, params)` — the one SQL-TEXT verb in that
4243                // crate's Db rule that the leaf list lacked (`prepare` is there). The rest of that rule
4244                // (`fetch*`/`execute*` on a `Query`) takes an EXECUTOR at argument 0, so deriving the
4245                // whole rule would mask every `query(lit).fetch_all(&pool)`; it is a named member
4246                // rather than a derivation for that reason.
4247                || (crate_name == "sqlx_core" && leaf == "prepare_with")
4248        }
4249        _ => false,
4250    }
4251}
4252
4253/// Map a cap-std capability *type* to the effect it authorises. Holding one of these
4254/// (e.g. `&Dir`) is the real, unforgeable right to perform that effect — so candor
4255/// treats it as a declared capability, exactly like its own `&Fs` token.
4256pub fn capstd_cap(crate_name: &str, type_name: &str) -> Option<&'static str> {
4257    if !crate_name.starts_with("cap_") {
4258        return None;
4259    }
4260    Some(match type_name {
4261        "Dir" => "Fs",
4262        "TcpListener" | "TcpStream" | "UdpSocket" | "Pool" => "Net",
4263        "UnixListener" | "UnixStream" | "UnixDatagram" => "Ipc",
4264        "SystemClock" | "MonotonicClock" => "Clock",
4265        _ => return None,
4266    })
4267}
4268
4269/// Table names a SQL string literal STATICALLY reaches — the `Db` analog of the `Net` host /
4270/// `Exec` command / `Fs` path literal surface (feeds `allow Db in <scope> <table>…`, AS-EFF-008).
4271/// Conservative by construction, because a wrong capture here would FABRICATE: the string must
4272/// open with a SQL statement keyword, and only identifiers in table position are taken —
4273/// `FROM`/`JOIN` anywhere, `INTO` anywhere, statement-leading `UPDATE`/`TRUNCATE`, and
4274/// `TABLE` (create/drop/alter), skipping `ONLY`/`IF NOT EXISTS`. `UPDATE` mid-statement is
4275/// deliberately ignored (`FOR UPDATE SKIP LOCKED` must not yield a table "skip"). A
4276/// dynamically-built query yields nothing — the gate's opaque case — never a guess.
4277/// Output is lower-cased, quote/backtick-stripped, `schema.table` kept qualified, deduped.
4278/// SPEC §2 pins this algorithm token-for-token across engines; the cross-impl vector battery
4279/// (candor-spec conformance/tables/vectors.json, run.sh Part 4b) enforces the JVM/TS mirrors.
4280pub fn tables_in_sql(sql: &str) -> Vec<String> {
4281    const STMT: &[&str] =
4282        &["select", "insert", "update", "delete", "create", "drop", "alter", "truncate", "merge", "replace", "with"];
4283    // Tokens that can FOLLOW a table-introducing keyword without being a table.
4284    const SKIP: &[&str] = &["only", "if", "not", "exists", "table"];
4285    // Identifier-position tokens that are grammar, not a table (subqueries, locking clauses…).
4286    const STOP: &[&str] = &[
4287        "select", "set", "where", "values", "on", "using", "group", "order", "by", "limit",
4288        "returning", "as", "inner", "outer", "left", "right", "cross", "lateral", "natural",
4289        "union", "all", "distinct", "case", "when", "null", "default", "skip", "nowait", "of",
4290        "from", "join", "into", "update", "delete", "insert",
4291    ];
4292    // `,` survives as its OWN token (not a space): it's what lets `FROM t1, t2` continue the table
4293    // list without fabricating from other comma-ridden positions (column lists, ON clauses).
4294    let cleaned: String = sql
4295        .to_lowercase()
4296        .chars()
4297        .flat_map(|c| match c {
4298            '(' | ')' | ';' => vec![' '],
4299            ',' => vec![' ', ',', ' '],
4300            _ => vec![c],
4301        })
4302        .collect();
4303    let toks: Vec<&str> = cleaned.split_whitespace().collect();
4304    let Some(first) = toks.first() else { return Vec::new() };
4305    if !STMT.contains(first) {
4306        return Vec::new(); // not SQL — nothing to certify, nothing fabricated
4307    }
4308    let ident = |t: &str| -> Option<String> {
4309        let t = t.trim_matches(|c| matches!(c, '"' | '`' | '\''));
4310        let mut chars = t.chars();
4311        let ok_first = chars.next().is_some_and(|c| c.is_ascii_alphabetic() || c == '_');
4312        let ok_rest = t.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '$' | '"' | '`'));
4313        (ok_first && ok_rest && !STOP.contains(&t)).then(|| t.replace(['"', '`'], ""))
4314    };
4315    let mut out: Vec<String> = Vec::new();
4316    let mut push = |t: Option<String>| {
4317        if let Some(t) = t {
4318            if !out.contains(&t) {
4319                out.push(t);
4320            }
4321        }
4322    };
4323    for (i, tok) in toks.iter().enumerate() {
4324        let table_pos = match *tok {
4325            "from" | "join" | "into" | "table" => true,
4326            // statement-leading only (see doc comment): `update t set …`, `truncate [table] t`.
4327            "update" | "truncate" => i == 0,
4328            _ => false,
4329        };
4330        if !table_pos {
4331            continue;
4332        }
4333        let mut j = i + 1;
4334        while j < toks.len() && SKIP.contains(&toks[j]) {
4335            j += 1;
4336        }
4337        let Some(next) = toks.get(j) else { continue };
4338        let Some(first) = ident(next) else { continue };
4339        push(Some(first));
4340        // Comma-ADJACENT continuation only: `FROM t1, t2, t3` takes all three, while an alias breaks
4341        // the chain (`FROM t1 a, t2` keeps just t1 — an under-report, never a guess: skipping an
4342        // alias to chase the comma would fabricate tables out of `INSERT INTO t (a, b)`'s column
4343        // list, whose parens are spaces by the time we tokenize).
4344        while j + 2 < toks.len() && toks[j + 1] == "," {
4345            let Some(more) = ident(toks[j + 2]) else { break };
4346            push(Some(more));
4347            j += 2;
4348        }
4349    }
4350    out
4351}
4352
4353#[cfg(test)]
4354mod tests {
4355    #[test]
4356    fn r1150_getrandom_error_values_draw_nothing_but_the_draws_do() {
4357        for p in ["getrandom::Error::eq", "getrandom::&Error::eq", "getrandom::Error::raw_os_error", "getrandom::Error::fmt",
4358                  "getrandom::error::Error::new_custom", "getrandom::Error::UNSUPPORTED"] {
4359            assert_eq!(classify("getrandom", p), None, "{p}");
4360        }
4361        for p in ["getrandom::fill", "getrandom::fill_uninit", "getrandom::u32", "getrandom::u64", "getrandom::getrandom",
4362                  "getrandom::SysRng::try_fill_bytes", "getrandom::getrandom_uninit"] {
4363            assert_eq!(classify("getrandom", p), Some("Rand"), "{p}");
4364        }
4365    }
4366    #[test]
4367    fn model_host_recognizes_known_providers_and_special_forms() {
4368        use super::is_model_host as m;
4369        // exact known hosts (case-insensitive), with/without a port
4370        assert!(m("api.openai.com"));
4371        assert!(m("API.OpenAI.com"));
4372        assert!(m("api.anthropic.com:443"));
4373        assert!(m("generativelanguage.googleapis.com"));
4374        assert!(m("api.mistral.ai"));
4375        assert!(m("api.cohere.ai"));
4376        assert!(m("api.cohere.com")); // BOTH cohere hosts
4377        assert!(m("api.groq.com"));
4378        assert!(m("api.together.xyz"));
4379        assert!(m("api.perplexity.ai"));
4380        assert!(m("openrouter.ai"));
4381        // a subdomain of a known host counts
4382        assert!(m("eu.api.openai.com"));
4383        // Ollama: :11434 on a LOOPBACK host only (max-review r3 — a remote host on 11434 is not Ollama)
4384        assert!(m("localhost:11434"));
4385        assert!(m("127.0.0.1:11434"));
4386        assert!(!m("ollama.internal:11434")); // a remote/internal service on 11434 is NOT a model host
4387        // Bedrock: the FIRST label is the model-inference service, not the substring "bedrock"
4388        assert!(m("bedrock-runtime.us-east-1.amazonaws.com"));
4389        assert!(m("bedrock-runtime.eu-west-1.amazonaws.com"));
4390        assert!(m("bedrock-agent-runtime.us-east-1.amazonaws.com"));
4391        // NOT model hosts (never guessed)
4392        assert!(!m("example.com"));
4393        assert!(!m("api.stripe.com"));
4394        assert!(!m("localhost:8080")); // a non-Ollama local port
4395        assert!(!m("s3.us-east-1.amazonaws.com")); // amazonaws but not bedrock
4396        assert!(!m("bedrock-backups.s3.amazonaws.com")); // an S3 bucket merely NAMED bedrock — not the runtime
4397        assert!(!m("bedrock.us-east-1.amazonaws.com")); // the Bedrock CONTROL plane — not model inference
4398        assert!(!m("openai.com.evil.com")); // suffix trick — not a subdomain of a known host
4399    }
4400
4401    #[test]
4402    fn model_sdk_crate_is_crate_level_no_method_gating() {
4403        use super::is_model_sdk_crate as s;
4404        assert!(s("async_openai"));
4405        assert!(s("aws_sdk_bedrockruntime"));
4406        assert!(s("ollama_rs"));
4407        assert!(s("langchain_rust"));
4408        assert!(!s("reqwest"));
4409        assert!(!s("aws_sdk_s3"));
4410    }
4411
4412    #[test]
4413    fn sql_table_extraction_is_conservative() {
4414        use super::tables_in_sql as t;
4415        assert_eq!(t("SELECT id FROM users WHERE x = 1"), vec!["users"]);
4416        assert_eq!(t("select * from ledger.entries e join customers c on c.id = e.cid"),
4417                   vec!["ledger.entries", "customers"]);
4418        assert_eq!(t("INSERT INTO audit_log (a) VALUES (?1)"), vec!["audit_log"]);
4419        assert_eq!(t("UPDATE accounts SET v = ?"), vec!["accounts"]);
4420        assert_eq!(t("DELETE FROM sessions WHERE id = ?"), vec!["sessions"]);
4421        assert_eq!(t("CREATE TABLE IF NOT EXISTS cache (k TEXT)"), vec!["cache"]);
4422        assert_eq!(t("TRUNCATE TABLE staging"), vec!["staging"]);
4423        // FOR UPDATE locking clause must not yield a phantom table (mid-statement update ignored)
4424        assert_eq!(t("SELECT * FROM jobs FOR UPDATE SKIP LOCKED"), vec!["jobs"]);
4425        // a subquery in FROM position yields nothing for that position
4426        assert_eq!(t("SELECT * FROM (SELECT 1) q"), Vec::<String>::new());
4427        // not SQL -> nothing (never fabricate)
4428        assert_eq!(t("/tmp/some/path"), Vec::<String>::new());
4429        assert_eq!(t("hello world from nowhere"), Vec::<String>::new());
4430        // comma-ADJACENT continuation: a FROM list takes every table in the chain…
4431        assert_eq!(t("SELECT a FROM t1, t2, s.t3 WHERE x = 1"), vec!["t1", "t2", "s.t3"]);
4432        // …but an alias breaks it (under-report, never a guess)…
4433        assert_eq!(t("SELECT a FROM t1 a1, t2 WHERE x = 1"), vec!["t1"]);
4434        // …which is exactly what keeps a column list from fabricating (parens are spaces by now).
4435        assert_eq!(t("INSERT INTO t (a, b) VALUES (1, 2)"), vec!["t"]);
4436        // a subquery after the comma stops the chain too
4437        assert_eq!(t("SELECT a FROM t1, (SELECT 1) q"), vec!["t1"]);
4438    }
4439
4440    use super::*;
4441
4442    /// The routed-handle list's MEMBERSHIP RULE, enforced rather than merely documented.
4443    ///
4444    /// (a) Every routed type must have a whole-type rule that answers an ARBITRARY method on it.
4445    /// If it did not, routing it would hand the scanner a path the classifier drops — motion with no
4446    /// effect, and the silent under-report would survive the fix that was supposed to close it. The
4447    /// probe leaf is deliberately a name no carve-out lists, so it measures the BASE rule.
4448    ///
4449    /// (b) The named exclusions stay excluded. `ReadDir` cannot have a verb-precise rule written for it
4450    /// (its `next` is a syscall and is spelled like every other iterator's), and `Metadata`/`DirEntry`/
4451    /// `Permissions`/`FileType` are pure DATA under the coarse `std::fs::` prefix — routing any of them
4452    /// charges an effect for reading a field. `OpenOptions`/`DirBuilder` LEFT this list by the route the
4453    /// list's own comment prescribed: their type-keyed setter carve-outs were written first, so the
4454    /// whole-type rule under them now answers only for the terminal verb.
4455    #[test]
4456    fn std_effect_handles_have_a_whole_type_rule_and_exclude_the_pure_surfaces() {
4457        for ty in STD_EFFECT_HANDLES {
4458            let probe = format!("{ty}::__candor_probe_verb");
4459            assert!(
4460                classify("std", &probe).is_some(),
4461                "`{ty}` is routed into the classifier by receiver inference, but an arbitrary method \
4462                 on it classifies to NOTHING — the routing cannot close any under-report"
4463            );
4464            assert!(is_std_effect_handle(ty), "the predicate must agree with the list");
4465        }
4466        for ty in [
4467            "std::fs::ReadDir",
4468            "std::fs::Metadata", "std::fs::DirEntry", "std::fs::Permissions", "std::fs::FileType",
4469            "std::path::Path", "std::path::PathBuf", "std::vec::Vec",
4470        ] {
4471            assert!(!is_std_effect_handle(ty),
4472                    "`{ty}` has a pure surface the coarse prefix rules would charge — it must not be \
4473                     routed as a handle (Path/PathBuf route through their own verb-precise carve-out)");
4474        }
4475    }
4476
4477    /// The pure read-backs on the ROUTED types, which is what makes (a) above safe: a whole-type rule
4478    /// answering every method is only acceptable because the genuinely-pure methods were carved out
4479    /// first. Receiver routing is a second door into these rules, so it must not re-fabricate.
4480    #[test]
4481    fn routed_std_handles_keep_their_pure_accessor_carve_outs() {
4482        for p in [
4483            "std::process::Command::get_program", "std::process::Command::get_args",
4484            "std::process::Command::get_envs", "std::process::Command::get_current_dir",
4485            "std::process::Child::id",
4486            "std::net::TcpStream::local_addr", "std::net::TcpStream::peer_addr",
4487            "std::net::TcpStream::nodelay", "std::net::TcpStream::ttl",
4488            "std::net::UdpSocket::take_error",
4489            "std::fs::File::as_raw_fd", "std::fs::File::into_raw_fd",
4490            "std::os::unix::net::UnixStream::as_raw_fd",
4491            // The OPTION-BUILDER setters (SPEC §1 ⟨0.32⟩): flags in a struct, no file named, nothing
4492            // opened. `create` is here as `OpenOptions`' setter and is a VERB on `DirBuilder` below —
4493            // one leaf, two answers, which is why these carve-outs are keyed on the TYPE.
4494            "std::fs::OpenOptions::new", "std::fs::OpenOptions::read", "std::fs::OpenOptions::write",
4495            "std::fs::OpenOptions::append", "std::fs::OpenOptions::truncate",
4496            "std::fs::OpenOptions::create", "std::fs::OpenOptions::create_new",
4497            "std::fs::OpenOptions::mode", "std::fs::OpenOptions::custom_flags",
4498            "std::fs::DirBuilder::new", "std::fs::DirBuilder::recursive", "std::fs::DirBuilder::mode",
4499        ] {
4500            assert_eq!(classify("std", p), None, "`{p}` is a pure read-back");
4501        }
4502        // …and the verbs on the same types still answer, or the carve-outs would have eaten the rule.
4503        for (p, want) in [
4504            ("std::process::Command::spawn", "Exec"),
4505            ("std::process::Child::wait", "Exec"),
4506            ("std::fs::File::write_all", "Fs"),
4507            ("std::net::TcpStream::write_all", "Net"),
4508            ("std::os::unix::net::UnixStream::send", "Ipc"),
4509            // the TERMINAL VERBS of the two option-builders — the whole point of routing them.
4510            ("std::fs::OpenOptions::open", "Fs"),
4511            ("std::fs::DirBuilder::create", "Fs"),
4512        ] {
4513            assert_eq!(classify("std", p), Some(want), "`{p}` must stay {want}");
4514        }
4515    }
4516
4517    #[test]
4518    fn db_crates_are_calibrated() {
4519        // The calibrated set must cover every DB client the classifier knows, or the receipt's coverage
4520        // check would flag a recognized crate as a blind spot. (Was nightly-lint-only; now runs on stable.)
4521        for c in DB_CRATES {
4522            assert!(
4523                CALIBRATED_CRATES.contains(&c),
4524                "DB crate `{c}` is matched by classify() but missing from CALIBRATED_CRATES"
4525            );
4526        }
4527    }
4528
4529    /// The two coverage lists mean OPPOSITE things and must stay disjoint.
4530    ///
4531    /// `CALIBRATED_CRATES` = "classify has effect rules here". `REVIEWED_PURE_CRATES` = "read it, it
4532    /// performs nothing". A crate in both would be asserting both at once, and the ledger consults them
4533    /// with an OR — so the contradiction would resolve silently to "covered" and nobody would look again.
4534    #[test]
4535    fn reviewed_pure_and_calibrated_are_disjoint() {
4536        for c in REVIEWED_PURE_CRATES {
4537            assert!(!CALIBRATED_CRATES.contains(&c),
4538                    "`{c}` is in BOTH lists — it cannot be rule-covered AND effect-free");
4539            assert!(!PATH_CALIBRATED_CRATES.contains(&c), "`{c}` is in BOTH lists (path-calibrated)");
4540            assert!(!CALIBRATED_PREFIXES.iter().any(|p| c.starts_with(p)),
4541                    "`{c}` is covered by a calibrated PREFIX as well as the pure list");
4542        }
4543    }
4544
4545    /// A reviewed-pure crate must actually classify as pure — the mirror of `calibrated_crates_are_live`.
4546    ///
4547    /// The list makes candor BELIEVE these crates rather than disclose them, so if someone later adds a
4548    /// rule for one, the claim "performs no effect of its own" is dead and the entry has to be re-read,
4549    /// not silently outvoted by the rule. Probed with the same tails the liveness test uses, which is a
4550    /// broad sweep of the effectful verb shapes candor knows.
4551    #[test]
4552    fn reviewed_pure_crates_classify_as_pure() {
4553        for c in REVIEWED_PURE_CRATES {
4554            for t in CALIBRATION_PROBE_TAILS {
4555                assert!(classify(c, &format!("{c}{t}")).is_none(),
4556                        "`{c}` is listed REVIEWED-PURE but classify() gives it an effect on `{c}{t}` — \
4557                         one of the two is wrong, and the list is the claim");
4558            }
4559        }
4560    }
4561
4562    /// ⟨CALIBRATION CEILING — the table must agree with the REVIEW RECORD⟩ SOUNDNESS R328.
4563    ///
4564    /// `CALIBRATED_CEILINGS` is the version each crate's rules were actually written against. Nothing
4565    /// derived it from, or checked it against, the review record — and three separate failures followed
4566    /// in one day: a wholesale table rewrite silently DROPPED nine entries while the commit message
4567    /// claimed four were absent "each with a stated reason"; `git2` was ceilinged ABOVE the only version
4568    /// its rules record reading (the SILENT direction, and 0.21 added `author_from_env` /
4569    /// `committer_from_env` / `Oid::hash_file_ext`, none of them ruled); and `sqlx_core` sat BELOW the
4570    /// version its own comment says was verified, which is also an impossible sibling of `sqlx 0.9.0`'s
4571    /// `=0.9.0` pin. All three were invisible to 410 tests and 29 gates.
4572    ///
4573    /// This asserts the one invariant that catches all of them: **a crate whose rules cite a reviewed
4574    /// version must carry a ceiling, and it must be THAT version.** Citations are read with wrapped
4575    /// comment lines joined and both name spellings tried — R315, where a line-by-line dashed-only
4576    /// sweep silently under-counted the citations by three.
4577    #[test]
4578    fn calibration_ceilings_match_the_recorded_review() {
4579        let src = include_str!("lib.rs");
4580        // join wrapped comment continuations, then collapse whitespace: a citation is prose and prose wraps.
4581        let flat = src
4582            .replace("\n    //", " ")
4583            .replace("\n        //", " ")
4584            .replace("\n            //", " ");
4585        let flat: String = flat.split_whitespace().collect::<Vec<_>>().join(" ");
4586        let ceilings: std::collections::HashMap<&str, &str> =
4587            CALIBRATED_CEILINGS.iter().copied().collect();
4588        // Absences are deliberate and enumerated in the table's own comment; keep the list HERE too so
4589        // dropping one silently is impossible — that is exactly what happened.
4590        let deliberate = ["postgres", "async_fs", "getrandom", "rand_core"];
4591        let mut problems: Vec<String> = Vec::new();
4592        for c in CALIBRATED_CRATES {
4593            if deliberate.contains(&c) {
4594                continue;
4595            }
4596            // EVERY citation, both verbs, both name spellings, and slash-separated lists —
4597            // "verified against sqlx-core 0.8.6/0.9.0" records TWO reviewed versions, and a crate may
4598            // be cited in more than one comment ("validated against rusqlite 0.39" elsewhere). An
4599            // extractor that stops at the first hit under-collects, and under-collecting here makes a
4600            // correct ceiling look like it is above the record — R315's lesson, one level up.
4601            let mut cited: Vec<String> = Vec::new();
4602            for form in [c.to_string(), c.replace('_', "-")] {
4603                for verb in ["verified against ", "validated against "] {
4604                    let pat = format!("{verb}{form} ");
4605                    let mut from = 0usize;
4606                    while let Some(i) = flat[from..].find(&pat) {
4607                        let at = from + i + pat.len();
4608                        let tail: String = flat[at..]
4609                            .chars()
4610                            .take_while(|ch| ch.is_ascii_digit() || *ch == '.' || *ch == '/')
4611                            .collect();
4612                        for v in tail.split('/') {
4613                            let v = v.trim_end_matches('.').to_string();
4614                            if v.split('.').count() >= 2 && !cited.contains(&v) {
4615                                cited.push(v);
4616                            }
4617                        }
4618                        from = at;
4619                    }
4620                }
4621            }
4622            if cited.is_empty() {
4623                continue;
4624            }
4625            match ceilings.get(c) {
4626                None => problems.push(format!(
4627                    "{c}: rules cite {} but there is NO ceiling — the exemption is unconditional",
4628                    cited.join("/")
4629                )),
4630                // A comment may legitimately record MORE THAN ONE reviewed version
4631                // ("verified against sqlx-core 0.8.6/0.9.0"), so matching any of them is fine, and a
4632                // ceiling BELOW the newest review is merely noisy. The failure that matters is a
4633                // ceiling ABOVE EVERY recorded review: that grants reviewed-purity over source nobody
4634                // read, which is the SILENT direction and the whole reason this table exists.
4635                Some(have) => {
4636                    let ok = cited.iter().any(|v| have.starts_with(v) || v.starts_with(*have))
4637                        || cited.iter().any(|v| calibration_exceeded_raw(v, have));
4638                    if !ok {
4639                        problems.push(format!(
4640                            "{c}: ceiling {have} is ABOVE every recorded review ({}) — it grants \
4641                             reviewed-purity over source no comment records anyone reading",
4642                            cited.join("/")
4643                        ));
4644                    }
4645                }
4646            }
4647        }
4648        assert!(
4649            problems.is_empty(),
4650            "CALIBRATED_CEILINGS disagrees with the review record:\n  {}\n\n\
4651             A ceiling ABOVE the recorded review grants reviewed-purity over source nobody read (SILENT); \
4652             a ceiling BELOW it is noisy but safe. Either way the table and the record must agree, or \
4653             neither is evidence.",
4654            problems.join("\n  ")
4655        );
4656    }
4657
4658    #[test]
4659    fn calibrated_crates_are_live() {
4660        // Conversely, every crate advertised as calibrated must actually be matched by classify() for
4661        // some representative path — a dead entry would silently suppress a real coverage warning.
4662        for c in CALIBRATED_CRATES {
4663            assert!(
4664                CALIBRATION_PROBE_TAILS.iter().any(|t| classify(c, &format!("{c}{t}")).is_some()),
4665                "calibrated crate `{c}` is matched by no path in classify() — dead list entry"
4666            );
4667        }
4668    }
4669
4670    #[test]
4671    fn async_http_stack_classifies() {
4672        // The modern async-HTTP/TLS/QUIC/DNS stack (found by the independent-method differential on oha):
4673        // verb-keyed Net/Ipc/Fs/Env, crate-gated so generic verbs never fabricate across crates.
4674        assert_eq!(classify("hyper", "hyper::client::conn::http1::SendRequest::send_request"), Some("Net"));
4675        assert_eq!(classify("hyper", "hyper::client::conn::http1::handshake"), Some("Net"));
4676        assert_eq!(classify("hyper_util", "hyper_util::client::legacy::Client::request"), Some("Net"));
4677        assert_eq!(classify("hickory_resolver", "hickory_resolver::Resolver::lookup_ip"), Some("Net"));
4678        assert_eq!(classify("quinn", "quinn::Endpoint::connect"), Some("Net"));
4679        assert_eq!(classify("quinn", "quinn::RecvStream::read_to_end"), Some("Net")); // stream byte I/O, not just open
4680        assert_eq!(classify("quinn", "quinn::SendStream::write_all"), Some("Net"));
4681        assert_eq!(classify("tokio_rustls", "tokio_rustls::TlsConnector::connect"), Some("Net"));
4682        assert_eq!(classify("native_tls", "native_tls::TlsConnector::connect"), Some("Net"));
4683        assert_eq!(classify("tokio_vsock", "tokio_vsock::VsockStream::connect"), Some("Ipc"));
4684        assert_eq!(classify("rustls_native_certs", "rustls_native_certs::load_native_certs"), Some("Fs"));
4685        assert_eq!(classify("rlimit", "rlimit::setrlimit"), Some("Env"));
4686        // num_cpus is deliberately PURE (consistency with std::thread::available_parallelism; avoids Env spray)
4687        assert_eq!(classify("num_cpus", "num_cpus::get"), None);
4688        assert_eq!(classify("num_cpus", "num_cpus::get_physical"), None);
4689        // pure surface stays None (no fabrication): builder/type/config paths, and other crates' generic verbs
4690        assert_eq!(classify("hyper", "hyper::Request::builder"), None);
4691        assert_eq!(classify("hyper", "hyper::body::Bytes::new"), None);
4692        assert_eq!(classify("native_tls", "native_tls::TlsConnectorBuilder::min_protocol_version"), None);
4693        assert_eq!(classify("serde", "serde::Deserialize::request"), None); // generic verb, wrong crate
4694    }
4695
4696    #[test]
4697    fn coverage_differential_crates_classify() {
4698        // Crates the coverage differential found DISCLOSED-but-unmodeled. Each rule is verb-keyed +
4699        // crate-gated; the EFFECT verbs map to the right bucket and the PURE surface stays None (a
4700        // wrongly-flagged pure crate is a fabrication, so the negatives matter as much as the positives).
4701
4702        // rustls (sync TLS core) — record I/O is Net; config/cert + the buffered-decrypt step are pure.
4703        assert_eq!(classify("rustls", "rustls::ClientConnection::read_tls"), Some("Net"));
4704        assert_eq!(classify("rustls", "rustls::ConnectionCommon::write_tls"), Some("Net"));
4705        assert_eq!(classify("rustls", "rustls::Connection::complete_io"), Some("Net"));
4706        assert_eq!(classify("rustls", "rustls::ConnectionCommon::process_new_packets"), None); // buffered decrypt, no I/O
4707        assert_eq!(classify("rustls", "rustls::ClientConfig::builder"), None); // pure config
4708
4709        // native-tls variants — handshake is Net; builder is pure.
4710        assert_eq!(classify("native_tls_crate", "native_tls_crate::TlsConnector::connect"), Some("Net"));
4711        assert_eq!(classify("tokio_native_tls", "tokio_native_tls::TlsAcceptor::accept"), Some("Net"));
4712        assert_eq!(classify("native_tls_crate", "native_tls_crate::TlsConnectorBuilder::min_protocol_version"), None);
4713
4714        // etcetera — dir resolution reads env; the args data type is pure.
4715        assert_eq!(classify("etcetera", "etcetera::home_dir"), Some("Env"));
4716        assert_eq!(classify("etcetera", "etcetera::base_strategy::choose_base_strategy"), Some("Env"));
4717        assert_eq!(classify("etcetera", "etcetera::base_strategy::Xdg::config_dir"), Some("Env"));
4718        assert_eq!(classify("etcetera", "etcetera::app_strategy::AppStrategyArgs::new"), None); // pure data
4719
4720        // sqlx-core — connect is Net, execute/fetch round-trips are Db; options/builders pure.
4721        assert_eq!(classify("sqlx_core", "sqlx_core::connection::Connection::connect"), Some("Net"));
4722        assert_eq!(classify("sqlx_core", "sqlx_core::executor::Executor::fetch_one"), Some("Db"));
4723        assert_eq!(classify("sqlx_core", "sqlx_core::executor::Executor::execute"), Some("Db"));
4724        assert_eq!(classify("sqlx_core", "sqlx_core::pool::Pool::acquire"), Some("Db"));
4725        assert_eq!(classify("sqlx_core", "sqlx_core::pool::PoolOptions::max_connections"), None); // pure builder
4726
4727        // walkdir — charged at construction (`WalkDir::new`, mirroring `ignore`/`glob`), NOT solely at
4728        // the lazy `next()`/`metadata()` read: candor-scan's receiver-typing blocklist hard-blocks
4729        // `.into_iter()`, so a typed `IntoIter::next` receiver is unreachable from the idiomatic
4730        // `WalkDir::new(p).into_iter()...` chain — `WalkDir::new` is the only point every real usage
4731        // (for-loop, `.count()`, untyped `.next()`) actually reaches. `IntoIter::next`/`DirEntry::metadata`
4732        // stay Some("Fs") as a secondary rule for the narrower explicit-type-annotation case. Builder
4733        // setters (`into_iter` itself, `max_depth`, …) and cached accessors stay pure.
4734        assert_eq!(classify("walkdir", "walkdir::WalkDir::new"), Some("Fs"));
4735        assert_eq!(classify("walkdir", "walkdir::IntoIter::next"), Some("Fs"));
4736        assert_eq!(classify("walkdir", "walkdir::DirEntry::metadata"), Some("Fs"));
4737        assert_eq!(classify("walkdir", "walkdir::WalkDir::into_iter"), None); // no I/O until pulled
4738        assert_eq!(classify("walkdir", "walkdir::WalkDir::max_depth"), None); // builder setter
4739        assert_eq!(classify("walkdir", "walkdir::DirEntry::file_type"), None); // cached, no syscall
4740
4741        // filetime — set_* are utimes (Fs), now is Clock; from_* constructors pure.
4742        assert_eq!(classify("filetime", "filetime::set_file_mtime"), Some("Fs"));
4743        assert_eq!(classify("filetime", "filetime::set_file_handle_times"), Some("Fs"));
4744        assert_eq!(classify("filetime", "filetime::FileTime::now"), Some("Clock"));
4745        assert_eq!(classify("filetime", "filetime::FileTime::from_unix_time"), None);
4746        assert_eq!(classify("filetime", "filetime::FileTime::from_last_modification_time"), None); // reads &Metadata, not disk
4747
4748        // execute — the execute* verbs spawn (Exec); command/shell builders pure.
4749        assert_eq!(classify("execute", "execute::Execute::execute"), Some("Exec"));
4750        assert_eq!(classify("execute", "execute::Execute::execute_output"), Some("Exec"));
4751        assert_eq!(classify("execute", "execute::Execute::execute_multiple_output"), Some("Exec"));
4752        assert_eq!(classify("execute", "execute::command"), None); // only builds a Command
4753        assert_eq!(classify("execute", "execute::shell"), None);
4754
4755        // ctrlc — install signal handler (Ipc).
4756        assert_eq!(classify("ctrlc", "ctrlc::set_handler"), Some("Ipc"));
4757        assert_eq!(classify("ctrlc", "ctrlc::try_set_handler"), Some("Ipc"));
4758
4759        // clap — only the argv-reading terminals are Env; the whole builder + *_from variants pure.
4760        assert_eq!(classify("clap", "clap::Command::get_matches"), Some("Env"));
4761        assert_eq!(classify("clap", "clap::Command::try_get_matches"), Some("Env"));
4762        assert_eq!(classify("clap", "clap::Parser::parse"), Some("Env"));
4763        assert_eq!(classify("clap", "clap::Command::new"), None); // builder
4764        assert_eq!(classify("clap", "clap::Arg::about"), None); // builder
4765        assert_eq!(classify("clap", "clap::Command::get_matches_from"), None); // explicit args, no argv read
4766        // R59-class audit: `Arg::env` calls `env::var_os` DIRECTLY at builder time (verified against
4767        // clap_builder 4.6.6) — unambiguous (the crate's only `::env` method), so classify it rather
4768        // than leave a real effect to fall silently into the CALIBRATED_CRATES purity exemption.
4769        assert_eq!(classify("clap", "clap::Arg::env"), Some("Env"));
4770        assert_eq!(classify("clap", "clap::Arg::env_os"), Some("Env"));
4771
4772        // jiff — now* is Clock; tz lookups read the tzdb (Fs); span/civil math pure.
4773        assert_eq!(classify("jiff", "jiff::Timestamp::now"), Some("Clock"));
4774        assert_eq!(classify("jiff", "jiff::Zoned::now_with"), Some("Clock"));
4775        assert_eq!(classify("jiff", "jiff::tz::TimeZone::system"), Some("Fs"));
4776        assert_eq!(classify("jiff", "jiff::tz::TimeZone::get"), Some("Fs"));
4777        assert_eq!(classify("jiff", "jiff::Span::checked_add"), None); // pure arithmetic
4778
4779        // env_logger — init installs the logger + reads RUST_LOG (Log); config setters pure.
4780        // TUI — the tty is a user dialogue channel (Ipc), the ruling dialoguer/console already carry.
4781        // Each verb below was read off the crate source (crossterm-0.28.1, ratatui-0.29.0), not guessed.
4782        assert_eq!(classify("crossterm", "crossterm::ExecutableCommand::execute"), Some("Ipc"));
4783        assert_eq!(classify("crossterm", "crossterm::QueueableCommand::queue"), Some("Ipc"));
4784        assert_eq!(classify("crossterm", "crossterm::event::read"), Some("Ipc"));
4785        assert_eq!(classify("crossterm", "crossterm::event::poll"), Some("Ipc"));
4786        assert_eq!(classify("crossterm", "crossterm::terminal::enable_raw_mode"), Some("Ipc"));
4787        // a tty IOCTL must not fall through: in a CALIBRATED crate an unmatched path is a purity CLAIM
4788        assert_eq!(classify("crossterm", "crossterm::terminal::size"), Some("Ipc"));
4789        // the Command VALUE types are pure — they describe an action, they do not perform one
4790        assert_eq!(classify("crossterm", "crossterm::style::Print"), None);
4791        assert_eq!(classify("crossterm", "crossterm::cursor::MoveTo"), None);
4792
4793        // ratatui: the backlog said "mark reviewed-pure"; the SOURCE says `Terminal::draw` ends in a
4794        // backend flush, so the write surface is Ipc and only the render surface is pure.
4795        assert_eq!(classify("ratatui", "ratatui::Terminal::draw"), Some("Ipc"));
4796        assert_eq!(classify("ratatui", "ratatui::Terminal::flush"), Some("Ipc"));
4797        assert_eq!(classify("ratatui", "ratatui::Terminal::clear"), Some("Ipc"));
4798        assert_eq!(classify("ratatui", "ratatui::Terminal::hide_cursor"), Some("Ipc"));
4799        // REGRESSION: `widgets::canvas` is an in-memory grid. `Context::draw` ends in `::draw` and was
4800        // FABRICATING Ipc — caught in review, measured on a fixture, and a hot path (per shape, per frame).
4801        assert_eq!(classify("ratatui", "ratatui::widgets::canvas::Context::draw"), None);
4802        assert_eq!(classify("ratatui", "ratatui::widgets::canvas::Context::layer"), None);
4803        // …while the real write surface still classifies, including a DIRECT backend call (which is why
4804        // the carve-out is a denylist on canvas rather than an allowlist on `Terminal::`).
4805        assert_eq!(classify("ratatui", "ratatui::backend::CrosstermBackend::flush"), Some("Ipc"));
4806        // the BULK of the 3,345 disclosed calls — widgets, layout, style — are genuinely pure
4807        assert_eq!(classify("ratatui", "ratatui::widgets::Paragraph::new"), None);
4808        assert_eq!(classify("ratatui", "ratatui::layout::Layout::split"), None);
4809        assert_eq!(classify("ratatui", "ratatui::style::Style::fg"), None);
4810        assert_eq!(classify("ratatui", "ratatui::buffer::Buffer::set_string"), None);
4811
4812        // tracing_subscriber — two effects, both read off 0.3.23. The filing said "Log/Fs"; the Fs half
4813        // is wrong (the crate ACCEPTS a File as a writer, it never opens one).
4814        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::init"), Some("Log"));
4815        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::try_init"), Some("Log"));
4816        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::SubscriberBuilder::init"), Some("Log"));
4817        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::EnvFilter::from_default_env"), Some("Env"));
4818        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::EnvFilter::from_env"), Some("Env"));
4819        // builders DESCRIBE a subscriber; they do not install one
4820        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::layer"), None);
4821        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::fmt::SubscriberBuilder::with_target"), None);
4822        assert_eq!(classify("tracing_subscriber", "tracing_subscriber::EnvFilter::new"), None);
4823
4824        assert_eq!(classify("env_logger", "env_logger::init"), Some("Log"));
4825        assert_eq!(classify("env_logger", "env_logger::try_init"), Some("Log"));
4826        assert_eq!(classify("env_logger", "env_logger::Builder::init"), Some("Log"));
4827        assert_eq!(classify("env_logger", "env_logger::Builder::format_timestamp"), None); // config
4828        assert_eq!(classify("env_logger", "env_logger::Builder::build"), None); // pure build
4829
4830        // dialoguer — interact* is tty I/O (Ipc); builders pure.
4831        assert_eq!(classify("dialoguer", "dialoguer::Input::interact_text"), Some("Ipc"));
4832        assert_eq!(classify("dialoguer", "dialoguer::Confirm::interact"), Some("Ipc"));
4833        assert_eq!(classify("dialoguer", "dialoguer::Select::interact_opt"), Some("Ipc"));
4834        assert_eq!(classify("dialoguer", "dialoguer::Input::with_prompt"), None); // builder
4835        // widened-CORE audit: `Editor::new`/`::default` read VISUAL/EDITOR at construction, independent
4836        // of `Editor::edit`'s already-covered Exec (spawning that editor is a separate, later step).
4837        assert_eq!(classify("dialoguer", "dialoguer::Editor::new"), Some("Env"));
4838        assert_eq!(classify("dialoguer", "dialoguer::Editor::default"), Some("Env"));
4839        assert_eq!(classify("dialoguer", "dialoguer::Editor::edit"), Some("Exec"));
4840        assert_eq!(classify("dialoguer", "dialoguer::Editor::extension"), None); // pure setter
4841
4842        // console — Term I/O is Ipc, detection is Env, Style is pure.
4843        assert_eq!(classify("console", "console::Term::write_line"), Some("Ipc"));
4844        assert_eq!(classify("console", "console::Term::read_key"), Some("Ipc"));
4845        assert_eq!(classify("console", "console::colors_enabled"), Some("Env"));
4846        assert_eq!(classify("console", "console::Style::cyan"), None); // pure styling
4847        assert_eq!(classify("console", "console::strip_ansi_codes"), None); // pure text util
4848        // R59-class audit: `Term` also implements raw `io::{Read,Write}` (console 0.15.11) — the same
4849        // tty channel as `write_line`/`read_key`, reached through the generic trait methods instead of
4850        // the crate's own named convenience methods. Crate-gated and `Term::`-scoped, so it cannot spread.
4851        assert_eq!(classify("console", "console::Term::write"), Some("Ipc"));
4852        assert_eq!(classify("console", "console::Term::flush"), Some("Ipc"));
4853        assert_eq!(classify("console", "console::Term::read"), Some("Ipc"));
4854
4855        // terminal_colorsaurus — tty colour query (Ipc).
4856        assert_eq!(classify("terminal_colorsaurus", "terminal_colorsaurus::background_color"), Some("Ipc"));
4857        assert_eq!(classify("terminal_colorsaurus", "terminal_colorsaurus::color_palette"), Some("Ipc"));
4858
4859        // backoff — retry sleeps + reads the clock (Clock); config pure.
4860        assert_eq!(classify("backoff", "backoff::retry"), Some("Clock"));
4861        assert_eq!(classify("backoff", "backoff::retry_notify"), Some("Clock"));
4862        assert_eq!(classify("backoff", "backoff::ExponentialBackoff::default"), None);
4863
4864        // lscolors — ONLY from_env reads the environment; from_string/style_for_path pure.
4865        assert_eq!(classify("lscolors", "lscolors::LsColors::from_env"), Some("Env"));
4866        assert_eq!(classify("lscolors", "lscolors::LsColors::from_string"), None);
4867        assert_eq!(classify("lscolors", "lscolors::LsColors::style_for_path"), None);
4868
4869        // wild — argv readers (Env).
4870        assert_eq!(classify("wild", "wild::args"), Some("Env"));
4871        assert_eq!(classify("wild", "wild::args_os"), Some("Env"));
4872
4873        // grep_cli — only the firm Exec (CommandReader spawn); the isatty probes stay unmodeled.
4874        assert_eq!(classify("grep_cli", "grep_cli::CommandReaderBuilder::build"), Some("Exec"));
4875        assert_eq!(classify("grep_cli", "grep_cli::is_readable_stdin"), None); // isatty/fstat, not modeled
4876        assert_eq!(classify("grep_cli", "grep_cli::is_tty_stdout"), None);
4877
4878        // clircle — same-file detection issues fstat/lseek (Fs); equality is pure.
4879        assert_eq!(classify("clircle", "clircle::Identifier::try_from"), Some("Fs"));
4880        assert_eq!(classify("clircle", "clircle::Clircle::surely_conflicts_with"), Some("Fs"));
4881    }
4882
4883    #[test]
4884    fn log_tracing_emit_macros_classify_pre_expansion() {
4885        // candor-scan is pre-expansion: it sees the raw macro path (`log::info`, `tracing::warn`), not the
4886        // expanded dispatch the deep engine sees. Both the user-facing macro names AND the type surface:
4887        assert_eq!(classify("log", "log::info"), Some("Log"));
4888        assert_eq!(classify("log", "log::error"), Some("Log"));
4889        assert_eq!(classify("tracing", "tracing::warn"), Some("Log"));
4890        assert_eq!(classify("tracing", "tracing::info_span"), Some("Log"));
4891        // pure data-type surface stays None (no fabricated Log)
4892        assert_eq!(classify("log", "log::Level::as_str"), None);
4893        assert_eq!(classify("tracing", "tracing::Level::INFO"), None);
4894    }
4895
4896    #[test]
4897    fn classify_core_effects() {
4898        // A representative smoke test of the classifier's main families, so the published crate is not
4899        // shipped untested (these used to live only in the nightly-only src/lib.rs).
4900        assert_eq!(classify("std", "std::fs::read_to_string"), Some("Fs"));
4901        // std::path stat-family methods are Fs (each is a stat/readdir syscall); the pure
4902        // string-manipulation surface stays unclassified (the blackout screen's gix-dir find).
4903        assert_eq!(classify("std", "std::path::Path::symlink_metadata"), Some("Fs"));
4904        assert_eq!(classify("std", "std::path::PathBuf::read_dir"), Some("Fs"));
4905        assert_eq!(classify("std", "std::path::Path::exists"), Some("Fs"));
4906        assert_eq!(classify("std", "std::path::Path::join"), None); // pure string manipulation
4907        assert_eq!(classify("std", "std::path::PathBuf::file_name"), None);
4908        assert_eq!(classify("std", "std::path::Path::parent"), None);
4909        assert_eq!(classify("std", "std::process::Command::new"), Some("Exec"));
4910        assert_eq!(classify("std", "std::env::var"), Some("Env"));
4911        assert_eq!(classify("reqwest", "reqwest::Client::execute"), Some("Net"));
4912        // one-shot convenience fns send immediately → Net.
4913        assert_eq!(classify("reqwest", "reqwest::get"), Some("Net"));
4914        assert_eq!(classify("reqwest", "reqwest::blocking::get"), Some("Net"));
4915        // the URL-BEARING builder methods classify Net too — the DOMINANT idiom is the builder chain
4916        // `Client::new().post(url).send()`, whose URL literal rides the `.post(url)` step (NOT `.send()`),
4917        // so the endpoint (and the Llm host refinement) only get captured if the URL-naming step is Net.
4918        assert_eq!(classify("reqwest", "reqwest::Client::get"), Some("Net"));
4919        assert_eq!(classify("reqwest", "reqwest::Client::post"), Some("Net"));
4920        assert_eq!(classify("reqwest", "reqwest::Client::put"), Some("Net"));
4921        assert_eq!(classify("reqwest", "reqwest::Client::delete"), Some("Net"));
4922        assert_eq!(classify("reqwest", "reqwest::Client::request"), Some("Net"));
4923        // the PURE builder surface stays None (no URL, no dispatch).
4924        assert_eq!(classify("reqwest", "reqwest::RequestBuilder::header"), None);
4925        assert_eq!(classify("reqwest", "reqwest::RequestBuilder::json"), None);
4926        assert_eq!(classify("reqwest", "reqwest::ClientBuilder::build"), None);
4927        // RAW POSIX SOCKETS — the lowest network tier, pinned as a regression guard (four-way close:
4928        // swift got a raw-socket regression this week from a bare-identifier collision; rust never had
4929        // the gap because it classifies path-QUALIFIED via the syscall-leaf table, but pin it so the
4930        // `socket`/`connect` Net rows can't silently drop). `libc::connect`/`libc::socket` are the direct
4931        // FFI syscalls; `nix::sys::socket::connect` is the safe wrapper; both bottom out in the NET table.
4932        assert_eq!(classify("libc", "libc::connect"), Some("Net"));
4933        assert_eq!(classify("libc", "libc::socket"), Some("Net"));
4934        assert_eq!(classify("libc", "libc::bind"), Some("Net"));
4935        assert_eq!(classify("libc", "libc::accept"), Some("Net"));
4936        // nix routes through the libc syscall table (same leaves): I/O classified, generic fd ops skipped.
4937        assert_eq!(classify("nix", "nix::fcntl::open"), Some("Fs"));
4938        assert_eq!(classify("nix", "nix::sys::socket::connect"), Some("Net"));
4939        assert_eq!(classify("nix", "nix::sys::socket::socket"), Some("Net"));
4940        assert_eq!(classify("nix", "nix::unistd::execvp"), Some("Exec"));
4941        assert_eq!(classify("nix", "nix::unistd::write"), None); // generic fd op — deliberately unclassified
4942        assert_eq!(classify("nix", "nix::unistd::getpid"), None); // not I/O
4943        // rustix does raw syscalls (no libc underneath) → classified directly by leaf, same table.
4944        assert_eq!(classify("rustix", "rustix::time::clock_settime"), Some("Clock"));
4945        assert_eq!(classify("rustix", "rustix::fs::symlink"), Some("Fs"));
4946        assert_eq!(classify("rustix", "rustix::net::connect"), Some("Net"));
4947        assert_eq!(classify("rustix", "rustix::io::read"), None); // generic fd op
4948        // pnet raw packet capture: channel openers are Net, packet construction stays pure.
4949        assert_eq!(classify("pnet", "pnet::datalink::channel"), Some("Net"));
4950        assert_eq!(classify("pnet", "pnet::transport::transport_channel"), Some("Net"));
4951        assert_eq!(classify("pnet_datalink", "pnet_datalink::channel"), Some("Net"));
4952        assert_eq!(classify("pnet", "pnet::packet::ethernet::EthernetPacket::new"), None);
4953        assert_eq!(classify("pnet_base", "pnet_base::MacAddr::new"), None);
4954        // ignore (gitignore-aware walker): walk executors are Fs, config builders stay pure.
4955        assert_eq!(classify("ignore", "ignore::WalkBuilder::build_parallel"), Some("Fs"));
4956        assert_eq!(classify("ignore", "ignore::WalkBuilder::build"), Some("Fs"));
4957        assert_eq!(classify("ignore", "ignore::WalkParallel::run"), Some("Fs"));
4958        assert_eq!(classify("ignore", "ignore::WalkBuilder::add_ignore"), Some("Fs")); // reads the ignore file
4959        assert_eq!(classify("ignore", "ignore::overrides::OverrideBuilder::build"), None); // pure config
4960        assert_eq!(classify("ignore", "ignore::gitignore::GitignoreBuilder::build"), None); // pure config
4961        assert_eq!(classify("ignore", "ignore::DirEntry::path"), None); // pure accessor
4962        // THE FIX: `Walk::new`/`Walk::from_iter` are `WalkBuilder::new(path).build()` /
4963        // `WalkBuilder::from_iter(paths).build()` in ignore's own source — the crate's documented
4964        // convenience constructors, and its own top-level doc example (`for entry in Walk::new(path)`).
4965        // A corpus round caught `deny Fs` exiting 0 over exactly that idiom.
4966        assert_eq!(classify("ignore", "ignore::Walk::new"), Some("Fs"));
4967        assert_eq!(classify("ignore", "ignore::Walk::from_iter"), Some("Fs"));
4968        // NO FABRICATION: a same-named `Walk::new` from an unrelated crate must not gain Fs — crate-gated.
4969        assert_eq!(classify("walkdir", "walkdir::Walk::new"), None);
4970        assert_eq!(classify("some_local_crate", "some_local_crate::Walk::new"), None);
4971        // notify fs-watching: watcher constructors + watch/unwatch are Fs, data types stay pure.
4972        assert_eq!(classify("notify", "notify::RecommendedWatcher::new"), Some("Fs"));
4973        assert_eq!(classify("notify", "notify::PollWatcher::new"), Some("Fs"));
4974        assert_eq!(classify("notify", "notify::recommended_watcher"), Some("Fs"));
4975        assert_eq!(classify("notify", "notify::INotifyWatcher::watch"), Some("Fs"));
4976        assert_eq!(classify("notify", "notify::Config::default"), None); // pure config
4977        assert_eq!(classify("notify", "notify::Event::new"), None); // pure data type
4978        assert_eq!(classify("rusqlite", "rusqlite::Connection::execute"), Some("Db"));
4979        // the rusqlite verb DIALECT (a verb probe found the canonical consumer API classifying pure):
4980        assert_eq!(classify("rusqlite", "rusqlite::Connection::query_row"), Some("Db"));
4981        assert_eq!(classify("rusqlite", "rusqlite::Statement::query_map"), Some("Db"));
4982        assert_eq!(classify("rusqlite", "rusqlite::Connection::execute_batch"), Some("Db"));
4983        assert_eq!(classify("rusqlite", "rusqlite::Connection::prepare_cached"), Some("Db"));
4984        assert_eq!(classify("rusqlite", "rusqlite::Connection::open"), Some("Db"));
4985        assert_eq!(classify("rusqlite", "rusqlite::Connection::open_in_memory"), Some("Db"));
4986        // THE FIX: three more real `Connection::open*` constructors an exact-suffix list missed
4987        // (`open_in_memory_with_flags` doesn't END in `open_with_flags`), plus the documented blob-I/O
4988        // API (`blob_open`/`Blob::reopen`), each calling the real sqlite3 FFI directly.
4989        assert_eq!(classify("rusqlite", "rusqlite::Connection::open_in_memory_with_flags"), Some("Db"));
4990        assert_eq!(classify("rusqlite", "rusqlite::Connection::open_with_flags_and_vfs"), Some("Db"));
4991        assert_eq!(
4992            classify("rusqlite", "rusqlite::Connection::open_in_memory_with_flags_and_vfs"),
4993            Some("Db")
4994        );
4995        assert_eq!(classify("rusqlite", "rusqlite::Connection::blob_open"), Some("Db"));
4996        assert_eq!(classify("rusqlite", "rusqlite::blob::Blob::reopen"), Some("Db"));
4997        // NO FABRICATION: a same-crate, DIFFERENT type's `open`-prefixed method (rusqlite's own private
4998        // `pragma::Sql::open_brace`, which pushes one char to a string buffer) must not gain Db — the
4999        // fix keys on the `Connection::` segment, not a bare leaf prefix.
5000        assert_eq!(classify("rusqlite", "rusqlite::pragma::Sql::open_brace"), None);
5001        // THE COVERAGE-GATE SWEEP FIX: the online-backup API and incremental-BLOB positional I/O,
5002        // verified against rusqlite 0.32.1 (each calls an `ffi::sqlite3_*` leaf already in this file's
5003        // own FFI-leaf DB table, but the `crate_name == "rusqlite"` block above returned before ever
5004        // reaching it — same shape as the git2 fix elsewhere in this file).
5005        assert_eq!(classify("rusqlite", "rusqlite::Backup::new"), Some("Db"));
5006        assert_eq!(classify("rusqlite", "rusqlite::Backup::new_with_names"), Some("Db"));
5007        assert_eq!(classify("rusqlite", "rusqlite::Backup::step"), Some("Db"));
5008        assert_eq!(classify("rusqlite", "rusqlite::Backup::run_to_completion"), Some("Db"));
5009        assert_eq!(classify("rusqlite", "rusqlite::Connection::backup"), Some("Db"));
5010        assert_eq!(classify("rusqlite", "rusqlite::Connection::restore"), Some("Db"));
5011        assert_eq!(classify("rusqlite", "rusqlite::Blob::read_at"), Some("Db"));
5012        assert_eq!(classify("rusqlite", "rusqlite::Blob::read_at_exact"), Some("Db"));
5013        assert_eq!(classify("rusqlite", "rusqlite::Blob::raw_read_at"), Some("Db"));
5014        assert_eq!(classify("rusqlite", "rusqlite::Blob::raw_read_at_exact"), Some("Db"));
5015        assert_eq!(classify("rusqlite", "rusqlite::Blob::write_at"), Some("Db"));
5016        assert_eq!(classify("rusqlite", "rusqlite::Blob::write_all_at"), Some("Db"));
5017        assert_eq!(classify("rusqlite", "rusqlite::Connection::from_handle"), Some("Db"));
5018        assert_eq!(classify("rusqlite", "rusqlite::Connection::from_handle_owned"), Some("Db"));
5019        assert_eq!(classify("rusqlite", "rusqlite::Connection::extension_init2"), Some("Db"));
5020        assert_eq!(classify("rusqlite", "rusqlite::init_auto_extension"), Some("Db"));
5021        // …and the REAL module-qualified spellings (`Backup`/`Blob`/`init_auto_extension` are not
5022        // re-exported at rusqlite's crate root, unlike `Connection` — a real consumer's source, proven
5023        // against a compiling fixture, must use these, not the short forms above).
5024        assert_eq!(classify("rusqlite", "rusqlite::backup::Backup::new"), Some("Db"));
5025        assert_eq!(classify("rusqlite", "rusqlite::blob::Blob::read_at"), Some("Db"));
5026        assert_eq!(classify("rusqlite", "rusqlite::auto_extension::init_auto_extension"), Some("Db"));
5027        // NO FABRICATION: `InnerConnection`/`RawStatement` live in PRIVATE modules (lib.rs `mod
5028        // inner_connection;`/`mod raw_statement;`, no `pub`) — no external consumer can ever name either
5029        // type, so no rule was added despite self-scan flagging them too.
5030        assert_eq!(classify("rusqlite", "rusqlite::InnerConnection::close"), None);
5031        assert_eq!(classify("rusqlite", "rusqlite::RawStatement::step"), None);
5032        // …but `open` stays rusqlite-only (postgres has no open; nothing else may borrow it):
5033        assert_eq!(classify("postgres", "postgres::Client::open"), None);
5034        assert_eq!(classify("tokio_postgres", "tokio_postgres::Client::query_typed"), Some("Db"));
5035        // THE FIX: `Config::connect_raw` does the same protocol handshake as `Config::connect`, over a
5036        // caller-supplied stream instead of one it dials itself.
5037        assert_eq!(classify("tokio_postgres", "tokio_postgres::Config::connect_raw"), Some("Db"));
5038        // diesel's LIMIT-1 + streaming executions; sqlx's multi-result stream:
5039        assert_eq!(classify("diesel", "diesel::RunQueryDsl::first"), Some("Db"));
5040        assert_eq!(classify("diesel", "diesel::RunQueryDsl::load_iter"), Some("Db"));
5041        // THE FIX: `Connection::establish` is diesel's own name for `::connect` — the crate's canonical,
5042        // most-used connection entry point (`SqliteConnection::establish(url)` in every diesel
5043        // quickstart), implemented by really opening the backend handle — but shared no verb spelling
5044        // with `::connect`, so it read pure with zero `coverage.uncovered` disclosure (diesel is
5045        // calibrated, so the miss reads as reviewed-pure, not as a gap).
5046        assert_eq!(classify("diesel", "diesel::sqlite::SqliteConnection::establish"), Some("Db"));
5047        assert_eq!(classify("diesel", "diesel::pg::PgConnection::establish"), Some("Db"));
5048        assert_eq!(classify("diesel", "diesel::mysql::MysqlConnection::establish"), Some("Db"));
5049        assert_eq!(classify("diesel", "diesel::Connection::establish"), Some("Db"));
5050        // NO FABRICATION: diesel's own private plumbing shares the substring but not the exact verb.
5051        assert_eq!(classify("diesel", "diesel::sqlite::SqliteConnection::establish_inner"), None);
5052        assert_eq!(classify("sqlx", "sqlx::query::Query::fetch_many"), Some("Db"));
5053        // sqlx's bare `query()` builder must STAY pure (the original sqlx lesson):
5054        assert_eq!(classify("sqlx", "sqlx::query"), None);
5055        // tracing: the emit/span-lifecycle dispatch is Log; the pure DATA-type accessors are not
5056        // (whole-crate Log fabricated Log on `Level::as_str` / `Span::is_disabled` — the data types are
5057        // pure, same principle as the `log` facade).
5058        assert_eq!(classify("tracing", "tracing::event"), Some("Log"));
5059        assert_eq!(classify("tracing", "tracing::Span::new_span"), Some("Log"));
5060        assert_eq!(classify("tracing", "tracing::Span::record"), Some("Log"));
5061        assert_eq!(classify("tracing", "tracing::Span::enter"), Some("Log"));
5062        assert_eq!(classify("tracing", "tracing::Level::as_str"), None); // pure accessor
5063        assert_eq!(classify("tracing", "tracing::Span::is_disabled"), None); // pure state read
5064        assert_eq!(classify("tracing", "tracing::Span::metadata"), None); // pure accessor
5065        assert_eq!(classify("tracing", "tracing::metadata::Level::TRACE"), None); // pure data type
5066        assert_eq!(classify("tracing", "tracing::field::Field::name"), None); // pure data type
5067        // git2 (high-level Rust API, not the `raw::git_*` FFI tier tested above): remote verbs are Net.
5068        assert_eq!(classify("git2", "git2::Remote::fetch"), Some("Net"));
5069        assert_eq!(classify("git2", "git2::Remote::push"), Some("Net"));
5070        assert_eq!(classify("git2", "git2::Remote::download"), Some("Net"));
5071        assert_eq!(classify("git2", "git2::Remote::connect"), Some("Net"));
5072        assert_eq!(classify("git2", "git2::Remote::connect_auth"), Some("Net"));
5073        assert_eq!(classify("git2", "git2::Remote::ls"), Some("Net"));
5074        assert_eq!(classify("git2", "git2::Remote::upload"), Some("Net"));
5075        // THE COVERAGE-GATE SWEEP FIX: `Repository::open`/`init` (and every other local .git-directory
5076        // operation below) used to read PURE here — the comment this replaced called that "honest, no
5077        // network", but candor-scan self-scanning git2's OWN source (eval/coverage-gate) proved these
5078        // reach a REAL Fs effect (`raw::git_repository_open`/`_init_ext`, already in this file's FFI-tier
5079        // table) that a real consumer's call to the safe wrapper could never surface, because THIS
5080        // block's early `return None` sat in front of that table for every `crate_name == "git2"` call.
5081        // "local, no network" was true and beside the point: Fs was the effect being missed. See MEMORY /
5082        // the commit that added this block for the full sweep (Config/Index/Odb/PackBuilder/Reference/
5083        // Repository/TreeBuilder — every FQN below calls a listed FS FFI leaf; verified against git2
5084        // 0.20.4 source).
5085        assert_eq!(classify("git2", "git2::Repository::open"), Some("Fs"));
5086        assert_eq!(classify("git2", "git2::Repository::init"), Some("Fs"));
5087        assert_eq!(classify("git2", "git2::Repository::open_bare"), Some("Fs"));
5088        assert_eq!(classify("git2", "git2::Repository::open_ext"), Some("Fs"));
5089        assert_eq!(classify("git2", "git2::Repository::open_from_env"), Some("Fs"));
5090        assert_eq!(classify("git2", "git2::Repository::discover"), Some("Fs"));
5091        assert_eq!(classify("git2", "git2::Repository::discover_path"), Some("Fs"));
5092        assert_eq!(classify("git2", "git2::Repository::init_bare"), Some("Fs"));
5093        assert_eq!(classify("git2", "git2::Repository::init_opts"), Some("Fs"));
5094        assert_eq!(classify("git2", "git2::Repository::blob_path"), Some("Fs"));
5095        assert_eq!(classify("git2", "git2::Repository::checkout_head"), Some("Fs"));
5096        assert_eq!(classify("git2", "git2::Repository::checkout_index"), Some("Fs"));
5097        assert_eq!(classify("git2", "git2::Repository::checkout_tree"), Some("Fs"));
5098        assert_eq!(classify("git2", "git2::Repository::commit"), Some("Fs"));
5099        assert_eq!(classify("git2", "git2::Repository::reference"), Some("Fs"));
5100        assert_eq!(classify("git2", "git2::Repository::tag"), Some("Fs"));
5101        assert_eq!(classify("git2", "git2::Config::add_file"), Some("Fs"));
5102        assert_eq!(classify("git2", "git2::Config::open"), Some("Fs"));
5103        assert_eq!(classify("git2", "git2::Config::open_default"), Some("Fs"));
5104        assert_eq!(classify("git2", "git2::Index::add_all"), Some("Fs"));
5105        assert_eq!(classify("git2", "git2::Index::add_path"), Some("Fs"));
5106        assert_eq!(classify("git2", "git2::Index::read"), Some("Fs"));
5107        assert_eq!(classify("git2", "git2::Index::write"), Some("Fs"));
5108        assert_eq!(classify("git2", "git2::Index::write_tree"), Some("Fs"));
5109        assert_eq!(classify("git2", "git2::Index::write_tree_to"), Some("Fs"));
5110        assert_eq!(classify("git2", "git2::Odb::read"), Some("Fs"));
5111        assert_eq!(classify("git2", "git2::Odb::reader"), Some("Fs"));
5112        assert_eq!(classify("git2", "git2::Odb::write"), Some("Fs"));
5113        assert_eq!(classify("git2", "git2::Odb::writer"), Some("Fs"));
5114        assert_eq!(classify("git2", "git2::PackBuilder::write"), Some("Fs"));
5115        assert_eq!(classify("git2", "git2::Reference::delete"), Some("Fs"));
5116        assert_eq!(classify("git2", "git2::Reference::set_target"), Some("Fs"));
5117        assert_eq!(classify("git2", "git2::TreeBuilder::write"), Some("Fs"));
5118        // `Remote::list`/`RemoteConnection::list` call `raw::git_remote_ls` directly — the same
5119        // reference-advertisement Net effect `Remote::ls` was meant to catch, under the name git2 0.20
5120        // actually uses (there is no `ls` method left in the crate at all — that suffix rule is dead
5121        // weight, kept rather than removed since deleting it is a separate, unrelated cleanup).
5122        assert_eq!(classify("git2", "git2::Remote::list"), Some("Net"));
5123        assert_eq!(classify("git2", "git2::RemoteConnection::list"), Some("Net"));
5124        // `Cred::credential_helper` spawns a real `sh -c "<helper> get"` subprocess to resolve
5125        // `credential.helper` config (cred.rs:370-390) — a real consumer's most common way to honor it.
5126        assert_eq!(classify("git2", "git2::Cred::credential_helper"), Some("Exec"));
5127        assert_eq!(classify("git2", "git2::CredentialHelper::execute"), Some("Exec"));
5128        // NO FABRICATION controls: a `write`/`read`/`open` on some OTHER git2 type (not FQN-listed above)
5129        // must stay pure — this fix is FQN-exact, not a suffix re-widen.
5130        assert_eq!(classify("git2", "git2::Repository::state"), None);
5131        assert_eq!(classify("git2", "git2::Blob::content"), None);
5132        // tonic's SERVER half (the coverage-gate sweep found only the client verbs were covered):
5133        // `Router::serve`/`::serve_with_shutdown` bind a real listening socket via `TcpIncoming::new`
5134        // (`StdTcpListener::bind`), verified against tonic 0.12.3 source.
5135        assert_eq!(classify("tonic", "tonic::transport::server::Router::serve"), Some("Net"));
5136        assert_eq!(
5137            classify("tonic", "tonic::transport::server::Router::serve_with_shutdown"),
5138            Some("Net")
5139        );
5140        assert_eq!(classify("tonic", "tonic::TcpIncoming::new"), Some("Net"));
5141        // NO FABRICATION control: `Server<L>::serve_with_shutdown` (mod.rs:530) is a DIFFERENT,
5142        // `pub(crate)` method on a different type — not reachable by any consumer, and this fix does not
5143        // fabricate an effect for it by widening past the `Router::` FQN.
5144        assert_eq!(classify("tonic", "tonic::transport::server::Server::serve_with_shutdown"), None);
5145        // THE FIX: `Repository::clone`/`clone_recurse` and `RepoBuilder::clone` ARE libgit2's real
5146        // network clone — a corpus round found `git2::Repository::clone(url, path)` reporting ZERO
5147        // effects and passing `deny Net` at exit 0, because the bare `::clone` denylist meant to keep
5148        // out `Remote`'s derived `Clone` dup (below) also excluded the one thing the old comment named
5149        // as NOT meant to be excluded.
5150        assert_eq!(classify("git2", "git2::Repository::clone"), Some("Net"));
5151        assert_eq!(classify("git2", "git2::Repository::clone_recurse"), Some("Net"));
5152        assert_eq!(classify("git2", "git2::build::RepoBuilder::clone"), Some("Net"));
5153        // THE CONTROL: `Remote::clone` is the DERIVED `Clone` trait impl (an Arc/handle duplication, no
5154        // libgit2 call) — it must stay pure. Re-fabricating Net here would undo the very over-charge the
5155        // original exclusion existed to prevent. FQN-exact matching (not a bare `::clone` re-widen) keeps
5156        // this pure while catching `Repository::clone` above.
5157        assert_eq!(classify("git2", "git2::Remote::clone"), None);
5158        // THE SWEEP FIX: a fourth+fifth true positive in the SAME gap — `Submodule::clone`/
5159        // `Submodule::update` call `raw::git_submodule_clone`/`git_submodule_update` directly (the exact
5160        // leaves already in this file's FFI-tier NET table), but git2's documented submodule-init idiom
5161        // calls the safe Rust wrapper, which carried no rule of its own.
5162        assert_eq!(classify("git2", "git2::Submodule::clone"), Some("Net"));
5163        assert_eq!(classify("git2", "git2::Submodule::update"), Some("Net"));
5164        // NO FABRICATION: git2's many pure `update_*` setters (CheckoutBuilder/DiffOptions/StatusOptions)
5165        // must not gain Net — FQN-exact, not a bare `::update` substring.
5166        assert_eq!(classify("git2", "git2::build::CheckoutBuilder::update_only"), None);
5167        assert_eq!(classify("git2", "git2::DiffOptions::update_index"), None);
5168        assert_eq!(classify("git2", "git2::Submodule::update_strategy"), None);
5169        // memmap2: only the syscall-issuing map/flush/protect verbs are Fs; reads over an already-mapped
5170        // region (len/as_ptr/is_empty) and the request builder are PURE (whole-crate Fs fabricated Fs).
5171        assert_eq!(classify("memmap2", "memmap2::MmapOptions::map"), Some("Fs"));
5172        assert_eq!(classify("memmap2", "memmap2::MmapOptions::map_mut"), Some("Fs"));
5173        assert_eq!(classify("memmap2", "memmap2::Mmap::flush"), Some("Fs"));
5174        assert_eq!(classify("memmap2", "memmap2::MmapMut::make_read_only"), Some("Fs"));
5175        assert_eq!(classify("memmap2", "memmap2::Mmap::len"), None); // length read — pure
5176        assert_eq!(classify("memmap2", "memmap2::Mmap::is_empty"), None); // pure
5177        assert_eq!(classify("memmap2", "memmap2::Mmap::as_ptr"), None); // pointer — pure
5178        assert_eq!(classify("memmap2", "memmap2::MmapOptions::new"), None); // request builder — pure
5179        // arboard: the Clipboard handle's read/write verbs are Clipboard; `arboard::Error` formatting
5180        // and option data types are PURE (whole-crate Clipboard fabricated Clipboard on `Error::to_string`).
5181        assert_eq!(classify("arboard", "arboard::Clipboard::new"), Some("Clipboard"));
5182        assert_eq!(classify("arboard", "arboard::Clipboard::get_text"), Some("Clipboard"));
5183        assert_eq!(classify("arboard", "arboard::Clipboard::set_text"), Some("Clipboard"));
5184        assert_eq!(classify("arboard", "arboard::Clipboard::clear"), Some("Clipboard"));
5185        assert_eq!(classify("arboard", "arboard::Error::to_string"), None); // error formatting — pure
5186        assert_eq!(classify("arboard", "arboard::Error::fmt"), None); // Display impl — pure
5187        assert_eq!(classify("arboard", "arboard::ImageData::to_owned_img"), None); // pure data type
5188        // R59-class audit: `file_list` is `Get`/`Set`'s sibling terminal beside `text`/`image`/`html`
5189        // (verified against arboard 3.6.1 — the only `file_list` in the crate, so no ambiguity survives
5190        // the crate gate); `Clear::default` is `clear()`'s own alternate entry point.
5191        assert_eq!(classify("arboard", "arboard::Get::file_list"), Some("Clipboard"));
5192        assert_eq!(classify("arboard", "arboard::Set::file_list"), Some("Clipboard"));
5193        assert_eq!(classify("arboard", "arboard::Clear::default"), Some("Clipboard"));
5194        // fastrand: value draws + entropy-seeded entry points are Rand; the DETERMINISTIC seeded ctor
5195        // `with_seed` and state split/copy (`fork`/`clone`) are PURE (whole-crate Rand fabricated Rand).
5196        assert_eq!(classify("fastrand", "fastrand::u32"), Some("Rand")); // top-level draw
5197        assert_eq!(classify("fastrand", "fastrand::Rng::usize"), Some("Rand"));
5198        assert_eq!(classify("fastrand", "fastrand::Rng::shuffle"), Some("Rand"));
5199        assert_eq!(classify("fastrand", "fastrand::Rng::new"), Some("Rand")); // entropy-seeded
5200        assert_eq!(classify("fastrand", "fastrand::Rng::with_seed"), None); // deterministic ctor — pure
5201        assert_eq!(classify("fastrand", "fastrand::Rng::fork"), None); // state split — pure
5202        assert_eq!(classify("fastrand", "fastrand::Rng::clone"), None); // state copy — pure
5203        // portable_pty / async_process: spawn/wait keep Exec; config GETTERS and pure data ctors/setters
5204        // do NOT (base Exec fabricated on `CommandBuilder::get_cwd` / `PtySize::default` / `Stdio::piped`).
5205        assert_eq!(classify("portable_pty", "portable_pty::PtySystem::openpty"), Some("Exec"));
5206        assert_eq!(classify("portable_pty", "portable_pty::SlavePty::spawn_command"), Some("Exec"));
5207        assert_eq!(classify("portable_pty", "portable_pty::CommandBuilder::get_argv"), None); // getter
5208        assert_eq!(classify("portable_pty", "portable_pty::CommandBuilder::get_cwd"), None); // getter
5209        assert_eq!(classify("portable_pty", "portable_pty::PtySize::default"), None); // pure data type
5210        assert_eq!(classify("portable_pty", "portable_pty::CommandBuilder::new"), None); // builder ctor
5211        assert_eq!(classify("async_process", "async_process::Command::spawn"), Some("Exec"));
5212        assert_eq!(classify("async_process", "async_process::Command::output"), Some("Exec"));
5213        assert_eq!(classify("async_process", "async_process::Stdio::piped"), None); // pure data type
5214        assert_eq!(classify("async_process", "async_process::Stdio::null"), None); // pure data type
5215        // FFI tiers (matched by distinctive leaf, alias-independent)
5216        assert_eq!(classify("libc", "libc::open"), Some("Fs"));
5217        assert_eq!(classify("libc", "libc::connect"), Some("Net"));
5218        assert_eq!(classify("libc", "libc::read"), None); // generic fd op — deliberately unclassified
5219        assert_eq!(classify("ffi", "ffi::sqlite3_step"), Some("Db"));
5220        // SOUNDNESS R166 — the PROCESS-GLOBAL extension registry. `rusqlite::register_auto_extension`
5221        // calls `ffi::sqlite3_auto_extension` directly and read `[]` on the 0.34.0 binary: an explicit
5222        // empty effect set over a call that changes what every LATER `sqlite3_open` executes.
5223        assert_eq!(classify("ffi", "ffi::sqlite3_auto_extension"), Some("Db"));
5224        assert_eq!(classify("ffi", "ffi::sqlite3_cancel_auto_extension"), Some("Db"));
5225        assert_eq!(classify("ffi", "ffi::sqlite3_reset_auto_extension"), Some("Db"));
5226        assert_eq!(classify("ffi", "ffi::sqlite3_enable_load_extension"), Some("Db"));
5227        // …and the database-CONTENT I/O the same sweep found unlisted beside it.
5228        assert_eq!(classify("ffi", "ffi::sqlite3_deserialize"), Some("Db"));
5229        assert_eq!(classify("ffi", "ffi::sqlite3_serialize"), Some("Db"));
5230        assert_eq!(classify("ffi", "ffi::sqlite3_db_cacheflush"), Some("Db"));
5231        assert_eq!(classify("ffi", "ffi::sqlite3_file_control"), Some("Db"));
5232        assert_eq!(classify("ffi", "ffi::sqlite3_wal_autocheckpoint"), Some("Db"));
5233        // CONTROLS for the boundary this list deliberately stops at — an in-memory accessor and a
5234        // per-connection callback INSTALLER stay unclassified, so the additions above are not read as
5235        // "every `sqlite3_*` is Db". Both pass before and after R166; recorded as boundary, not coverage.
5236        assert_eq!(classify("ffi", "ffi::sqlite3_column_int64"), None);
5237        assert_eq!(classify("ffi", "ffi::sqlite3_create_function_v2"), None);
5238        assert_eq!(classify("raw", "raw::git_remote_fetch"), Some("Net"));
5239        // libgit2 clone + submodule clone/update fetch over the network (an A/B on git2 0.20 caught
5240        // `Submodule::update`/`clone` and `Repository::clone` reporting no Net — the latter because the
5241        // `src/build.rs` module was being dropped as if it were the Cargo build script).
5242        assert_eq!(classify("raw", "raw::git_clone"), Some("Net"));
5243        assert_eq!(classify("raw", "raw::git_submodule_clone"), Some("Net"));
5244        assert_eq!(classify("raw", "raw::git_submodule_update"), Some("Net"));
5245        assert_eq!(classify("raw", "raw::git_submodule_open"), None); // local subrepo open — not Net
5246        // libcurl: the transfer/raw-socket entry points are Net (an A/B on curl 0.4 caught the whole
5247        // crate reporting ZERO Net); the big setopt/init/getinfo surface — and the readiness-wait
5248        // multi_wait/poll — stay unclassified (the loop's perform is the boundary).
5249        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_perform"), Some("Net"));
5250        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_send"), Some("Net"));
5251        assert_eq!(classify("curl_sys", "curl_sys::curl_multi_perform"), Some("Net"));
5252        assert_eq!(classify("curl_sys", "curl_sys::curl_multi_socket_action"), Some("Net"));
5253        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_setopt"), None); // in-memory option write
5254        assert_eq!(classify("curl_sys", "curl_sys::curl_easy_init"), None); // handle alloc
5255        assert_eq!(classify("curl_sys", "curl_sys::curl_multi_wait"), None); // readiness wait, no payload
5256        // consumer-side `curl` crate rule: the dispatch verbs are Net, the setopt builders pure.
5257        assert_eq!(classify("curl", "curl::easy::Easy::perform"), Some("Net"));
5258        assert_eq!(classify("curl", "curl::multi::Multi::perform"), Some("Net"));
5259        assert_eq!(classify("curl", "curl::easy::Easy::send"), Some("Net"));
5260        assert_eq!(classify("curl", "curl::easy::Easy::url"), None); // CURLOPT setter — pure
5261        assert_eq!(classify("curl", "curl::easy::Easy::timeout"), None); // pure setter; Multi::timeout under-reported by design
5262        assert_eq!(classify("ffi", "ffi::SSL_connect"), Some("Net"));
5263        // pure crates stay pure
5264        assert_eq!(classify("serde", "serde::Serialize::serialize"), None);
5265        assert_eq!(classify("std", "std::vec::Vec::push"), None);
5266
5267        // ── sweep 2026-06-17: fabrication carve-outs + DNS coverage (each fails pre-fix) ──
5268        // [24] std::net socket accessors are pure; the I/O verbs stay Net.
5269        assert_eq!(classify("std", "std::net::TcpStream::connect"), Some("Net"));
5270        assert_eq!(classify("std", "std::net::TcpStream::local_addr"), None);
5271        assert_eq!(classify("std", "std::net::TcpStream::nodelay"), None);
5272        assert_eq!(classify("std", "std::net::TcpStream::ttl"), None);
5273        assert_eq!(classify("std", "std::net::UdpSocket::peer_addr"), None);
5274        // [37] std DNS resolution is Net (was floored).
5275        assert_eq!(classify("std", "std::net::lookup_host"), Some("Net"));
5276        assert_eq!(classify("std", "core::net::ToSocketAddrs::to_socket_addrs"), Some("Net"));
5277        // [23] std::process getters are pure; spawn/new stay Exec.
5278        assert_eq!(classify("std", "std::process::Command::get_program"), None);
5279        assert_eq!(classify("std", "std::process::Command::get_args"), None);
5280        assert_eq!(classify("std", "std::process::Child::id"), None);
5281        assert_eq!(classify("std", "std::process::Command::spawn"), Some("Exec"));
5282        // [27] redis ConnectionManager::clone is an Arc bump (pure); a query round-trips.
5283        assert_eq!(classify("redis", "redis::aio::ConnectionManager::clone"), None);
5284        assert_eq!(classify("redis", "redis::aio::ConnectionManager::send_packed_command"), Some("Db"));
5285        // [5] sea_orm re-exported sea_query builder algebra is pure; execution verbs stay Db.
5286        assert_eq!(classify("sea_orm", "sea_orm::sea_query::Func::count"), None);
5287        assert_eq!(classify("sea_orm", "sea_orm::sea_query::Condition::all"), None);
5288        assert_eq!(classify("sea_orm", "sea_orm::Select::all"), Some("Db"));
5289        // THE FIX: `Database::connect_proxy` (the `proxy`-feature sibling of `Database::connect`) opens
5290        // a live `DatabaseConnection` through a caller-supplied `ProxyDatabaseTrait` — same effect,
5291        // missing from an allowlist keyed on the plain `connect` spelling.
5292        assert_eq!(classify("sea_orm", "sea_orm::Database::connect_proxy"), Some("Db"));
5293        // THE COVERAGE-GATE SWEEP: the transaction and pagination families, verified against sea-orm
5294        // 1.1.20 source.
5295        assert_eq!(classify("sea_orm", "sea_orm::DatabaseConnection::transaction"), Some("Db"));
5296        assert_eq!(
5297            classify("sea_orm", "sea_orm::DatabaseConnection::transaction_with_config"),
5298            Some("Db")
5299        );
5300        // BONUS (found proving the above reachable with a real fixture, not in the original ratchet):
5301        assert_eq!(classify("sea_orm", "sea_orm::DatabaseConnection::ping"), Some("Db"));
5302        assert_eq!(classify("sea_orm", "sea_orm::DatabaseConnection::begin"), Some("Db"));
5303        assert_eq!(
5304            classify("sea_orm", "sea_orm::DatabaseConnection::begin_with_config"),
5305            Some("Db")
5306        );
5307        assert_eq!(classify("sea_orm", "sea_orm::DatabaseTransaction::commit"), Some("Db"));
5308        assert_eq!(classify("sea_orm", "sea_orm::DatabaseTransaction::rollback"), Some("Db"));
5309        assert_eq!(classify("sea_orm", "sea_orm::SqlxMySqlPoolConnection::begin"), Some("Db"));
5310        assert_eq!(classify("sea_orm", "sea_orm::SqlxMySqlPoolConnection::ping"), Some("Db"));
5311        assert_eq!(classify("sea_orm", "sea_orm::SqlxMySqlPoolConnection::transaction"), Some("Db"));
5312        assert_eq!(classify("sea_orm", "sea_orm::SqlxPostgresPoolConnection::begin"), Some("Db"));
5313        assert_eq!(classify("sea_orm", "sea_orm::SqlxSqlitePoolConnection::ping"), Some("Db"));
5314        assert_eq!(classify("sea_orm", "sea_orm::Paginator::fetch"), Some("Db"));
5315        assert_eq!(classify("sea_orm", "sea_orm::Paginator::fetch_and_next"), Some("Db"));
5316        assert_eq!(classify("sea_orm", "sea_orm::Paginator::into_stream"), Some("Db"));
5317        assert_eq!(classify("sea_orm", "sea_orm::Paginator::num_pages"), Some("Db"));
5318        assert_eq!(classify("sea_orm", "sea_orm::Paginator::num_items_and_pages"), Some("Db"));
5319        assert_eq!(classify("sea_orm", "sea_orm::Insert::exec_with_returning_keys"), Some("Db"));
5320        assert_eq!(classify("sea_orm", "sea_orm::Inserter::exec_with_returning_many"), Some("Db"));
5321        assert_eq!(classify("sea_orm", "sea_orm::TryInsert::exec_with_returning_keys"), Some("Db"));
5322        // NO FABRICATION: the mock/proxy backends share every one of these verb names but perform no
5323        // real I/O (mock) or dispatch through a caller-supplied trait (proxy) — FQN-exact, not a bare
5324        // `::ping`/`::begin`/`::transaction`/`::commit`/`::rollback` suffix, keeps them pure/unknown.
5325        assert_eq!(classify("sea_orm", "sea_orm::MockDatabaseConnection::ping"), None);
5326        assert_eq!(classify("sea_orm", "sea_orm::MockDatabaseConnection::begin"), None);
5327        assert_eq!(classify("sea_orm", "sea_orm::ProxyDatabaseConnection::commit"), None);
5328        assert_eq!(classify("sea_orm", "sea_orm::ProxyDatabaseConnection::ping"), None);
5329    }
5330
5331    #[test]
5332    fn lettre_tls_setup_and_connection_family_is_covered() {
5333        // THE COVERAGE-GATE SWEEP, verified against lettre 0.11.23 source. `build_rustls` calls
5334        // `rustls_native_certs::load_native_certs()` (a real OS-trust-store read) + `tracing::debug!`.
5335        assert_eq!(
5336            classify("lettre", "lettre::transport::smtp::client::TlsParametersBuilder::build_rustls"),
5337            Some("Fs")
5338        );
5339        assert_eq!(classify("lettre", "lettre::TlsParametersBuilder::build"), Some("Fs"));
5340        assert_eq!(classify("lettre", "lettre::TlsParameters::new"), Some("Fs"));
5341        assert_eq!(classify("lettre", "lettre::TlsParameters::new_rustls"), Some("Fs"));
5342        assert_eq!(classify("lettre", "lettre::SmtpTransport::from_url"), Some("Fs"));
5343        assert_eq!(classify("lettre", "lettre::SmtpTransport::relay"), Some("Fs"));
5344        assert_eq!(classify("lettre", "lettre::SmtpTransport::starttls_relay"), Some("Fs"));
5345        assert_eq!(classify("lettre", "lettre::AsyncSmtpTransport::from_url"), Some("Fs"));
5346        assert_eq!(classify("lettre", "lettre::AsyncSmtpTransport::relay"), Some("Fs"));
5347        assert_eq!(classify("lettre", "lettre::AsyncSmtpTransport::starttls_relay"), Some("Fs"));
5348        assert_eq!(classify("lettre", "lettre::FileTransport::read"), Some("Fs"));
5349        // The sealed `Executor` trait impl — `#[doc(hidden)]`, a narrower surface, but genuinely
5350        // reachable (both the trait and `AsyncStd1Executor` are `pub`, re-exported at the crate root).
5351        assert_eq!(classify("lettre", "lettre::AsyncStd1Executor::connect"), Some("Net"));
5352        assert_eq!(classify("lettre", "lettre::AsyncStd1Executor::fs_read"), Some("Fs"));
5353        assert_eq!(classify("lettre", "lettre::AsyncStd1Executor::fs_write"), Some("Fs"));
5354        // Only reachable via the module-qualified path — neither type is re-exported at the crate root.
5355        assert_eq!(
5356            classify(
5357                "lettre",
5358                "lettre::transport::smtp::client::AsyncSmtpConnection::connect_asyncstd1"
5359            ),
5360            Some("Net")
5361        );
5362        assert_eq!(
5363            classify(
5364                "lettre",
5365                "lettre::transport::smtp::client::AsyncNetworkStream::connect_asyncstd1"
5366            ),
5367            Some("Net")
5368        );
5369        // NO FABRICATION: `NetworkStream` lives in a PRIVATE module (`mod net;`, never re-exported) — no
5370        // external consumer can ever name it, so no rule was added despite self-scan flagging its
5371        // `shutdown`/`set_read_timeout`/`set_write_timeout` (propagated from the coarse
5372        // `std::net::TcpStream` whole-handle rule).
5373        assert_eq!(classify("lettre", "lettre::NetworkStream::shutdown"), None);
5374        assert_eq!(classify("lettre", "lettre::NetworkStream::set_read_timeout"), None);
5375    }
5376
5377    #[test]
5378    fn rand_osrng_handle_ops_are_pure_but_draws_are_rand() {
5379        // Adversarial-review fabrication: the blanket `contains("OsRng")` tagged `OsRng::clone` Rand,
5380        // but OsRng is a unit struct — clone/fork/default draw no entropy. The real draws still fire.
5381        assert_eq!(classify("rand", "rand::rngs::OsRng::clone"), None);
5382        assert_eq!(classify("rand", "rand::rngs::OsRng::default"), None);
5383        assert_eq!(classify("rand", "rand::rngs::OsRng::fill_bytes"), Some("Rand")); // a real draw
5384        assert_eq!(classify("rand", "rand::rngs::OsRng::next_u32"), Some("Rand"));
5385        assert_eq!(classify("rand", "rand::Rng::gen"), Some("Rand")); // verb path unaffected
5386        assert_eq!(classify("rand", "rand::distributions::Uniform::new"), None); // pure ctor still pure
5387    }
5388
5389    #[test]
5390    fn redis_connection_manager_config_builder_is_pure() {
5391        // Adversarial-review fabrication: `contains("ConnectionManager")` hit the pure *Config* builder.
5392        assert_eq!(classify("redis", "redis::aio::ConnectionManagerConfig::new"), None);
5393        assert_eq!(classify("redis", "redis::aio::ConnectionManagerConfig::set_max_delay"), None);
5394        // the LIVE manager still round-trips (Db).
5395        assert_eq!(classify("redis", "redis::aio::ConnectionManager::new"), Some("Db"));
5396        assert_eq!(classify("redis", "redis::Commands::get"), Some("Db"));
5397    }
5398
5399    #[test]
5400    fn redis_get_connection_info_is_a_pure_accessor_not_swept_by_the_substring() {
5401        // coverage-gate sweep (2026-08-27): `contains("::get_connection")` also matched
5402        // `Client::get_connection_info` (a pure accessor over an already-stored field) because it is a
5403        // literal substring of that name — the real connection-getters stay caught.
5404        assert_eq!(classify("redis", "redis::Client::get_connection_info"), None);
5405        assert_eq!(classify("redis", "redis::Client::get_connection"), Some("Db"));
5406        assert_eq!(classify("redis", "redis::Client::get_async_connection"), Some("Db"));
5407        assert_eq!(
5408            classify("redis", "redis::Client::get_multiplexed_async_connection"),
5409            Some("Db")
5410        );
5411    }
5412
5413    #[test]
5414    fn aws_config_load_from_env_is_loads_own_convenience_wrapper() {
5415        // THE FIX: `load_from_env()` is the crate's OWN "convenience wrapper" (its doc comment's words)
5416        // around `from_env().load().await` — the exact already-modelled effect one call down — but
5417        // "load_from_env".ends_with("::load") is false.
5418        assert_eq!(classify("aws_config", "aws_config::load"), Some("Net"));
5419        assert_eq!(classify("aws_config", "aws_config::load_defaults"), Some("Net"));
5420        assert_eq!(classify("aws_config", "aws_config::load_from_env"), Some("Net"));
5421        assert_eq!(classify("aws_config", "aws_config::from_env"), None); // pure builder
5422    }
5423
5424    #[test]
5425    fn tungstenite_stream_first_handshake_entry_points_are_net() {
5426        // THE FIX: `client`/`client_with_config`/`client_tls`/`client_tls_with_config` (client.rs:176,
5427        // 159; tls.rs:163,179) and `accept`/`accept_with_config`/`accept_hdr`/`accept_hdr_with_config`
5428        // (server.rs:23-63) each run `{Client,Server}Handshake::start(stream, ..).handshake()` — the real
5429        // WS upgrade I/O over an already-open stream. tungstenite's OWN documented way to run over a
5430        // caller-managed TCP/TLS/mio stream, missing from a verb list keyed only on `connect`.
5431        assert_eq!(classify("tungstenite", "tungstenite::client::client"), Some("Net"));
5432        assert_eq!(classify("tungstenite", "tungstenite::client::client_with_config"), Some("Net"));
5433        assert_eq!(classify("tungstenite", "tungstenite::tls::client_tls"), Some("Net"));
5434        assert_eq!(classify("tungstenite", "tungstenite::tls::client_tls_with_config"), Some("Net"));
5435        assert_eq!(classify("tungstenite", "tungstenite::server::accept"), Some("Net"));
5436        assert_eq!(classify("tungstenite", "tungstenite::server::accept_with_config"), Some("Net"));
5437        assert_eq!(classify("tungstenite", "tungstenite::server::accept_hdr"), Some("Net"));
5438        assert_eq!(classify("tungstenite", "tungstenite::server::accept_hdr_with_config"), Some("Net"));
5439        assert_eq!(classify("tungstenite", "tungstenite::client::connect_with_config"), Some("Net"));
5440    }
5441
5442    #[test]
5443    fn mysql_conn_new_is_the_real_connect() {
5444        // THE FIX: `mysql::Conn::new` (conn/mod.rs:342) calls `connect_stream()?; connect()?` directly;
5445        // `mysql_async::Conn::new` (conn/mod.rs:921) is the async equivalent. Each crate's own primary
5446        // connection constructor, the crate's own first doctest example — but `::new` never appeared in
5447        // the verb list.
5448        assert_eq!(classify("mysql", "mysql::Conn::new"), Some("Db"));
5449        assert_eq!(classify("mysql_async", "mysql_async::Conn::new"), Some("Db"));
5450        // NO FABRICATION: the SAME two crates' unrelated pure `new`s (Opts/PoolConstraints/TxOpts/…)
5451        // must not gain Db — scoped to the `Conn::` segment, not a bare `::new` suffix.
5452        assert_eq!(classify("mysql", "mysql::Opts::new"), None);
5453        assert_eq!(classify("mysql", "mysql::PoolConstraints::new"), None);
5454        assert_eq!(classify("mysql_async", "mysql_async::TxOpts::new"), None);
5455    }
5456
5457    #[test]
5458    fn mongodb_with_options_is_the_same_effect_as_with_uri_str() {
5459        // THE FIX: `with_uri_str` (client.rs:179) is `ClientOptions::parse(uri).await?;
5460        // Client::with_options(options)` one call down — `with_options` (client.rs:188) is where the
5461        // topology/monitoring actually spins up, and mongodb's own doc calls it the entry point for a
5462        // caller who already holds parsed `ClientOptions`. Verified against mongodb 3.8.1 (both the
5463        // async `client.rs` and sync `sync/client.rs` `Client`).
5464        assert_eq!(classify("mongodb", "mongodb::Client::with_uri_str"), Some("Db"));
5465        assert_eq!(classify("mongodb", "mongodb::Client::with_options"), Some("Db"));
5466        assert_eq!(classify("mongodb", "mongodb::sync::Client::with_options"), Some("Db"));
5467        assert_eq!(classify("mongodb", "mongodb::Collection::find_one"), Some("Db"));
5468        // NO FABRICATION: an unrelated crate's `with_options` builder must not gain Db — crate-gated.
5469        assert_eq!(classify("some_other_crate", "some_other_crate::Widget::with_options"), None);
5470    }
5471
5472    #[test]
5473    fn pure_fd_transfer_is_not_an_effect() {
5474        // ADOPTING / EXTRACTING / BORROWING an already-open descriptor (or unwrapping an async type back
5475        // to its std type) issues NO syscall — it must be PURE even though it hangs off a std I/O type
5476        // whose prefix rule would otherwise fire Net/Fs/Ipc. (Real tokio sweep: `into_std`, `from_raw_fd`,
5477        // `as_raw_fd` all fabricated effects.)
5478        assert_eq!(classify("std", "std::net::TcpStream::from_raw_fd"), None);
5479        assert_eq!(classify("std", "std::net::TcpStream::into_raw_fd"), None);
5480        assert_eq!(classify("std", "std::net::TcpStream::as_raw_fd"), None);
5481        assert_eq!(classify("std", "std::net::TcpListener::from_raw_fd"), None);
5482        assert_eq!(classify("std", "std::net::UdpSocket::from_raw_socket"), None);
5483        assert_eq!(classify("std", "std::fs::File::from_raw_fd"), None);
5484        assert_eq!(classify("std", "std::fs::File::into_raw_fd"), None);
5485        assert_eq!(classify("std", "std::fs::File::as_raw_handle"), None);
5486        assert_eq!(classify("std", "std::os::unix::net::UnixStream::from_raw_fd"), None);
5487        // `SocketAddr::from_pathname` builds an address struct, opens no socket — pure. (socket2 sweep.)
5488        assert_eq!(classify("std", "std::os::unix::net::SocketAddr::from_pathname"), None);
5489        assert_eq!(classify("tokio", "tokio::net::TcpStream::from_raw_fd"), None);
5490        assert_eq!(classify("tokio", "tokio::net::TcpStream::into_std"), None); // unwrap → std type, pure
5491        assert_eq!(classify("tokio", "tokio::fs::File::into_std"), None);
5492        // …but a REAL open/connect on the SAME types still fires the effect — the carve-out is leaf-precise.
5493        assert_eq!(classify("std", "std::net::TcpStream::connect"), Some("Net"));
5494        assert_eq!(classify("std", "std::fs::File::open"), Some("Fs"));
5495        assert_eq!(classify("std", "std::fs::read"), Some("Fs"));
5496        assert_eq!(classify("std", "std::os::unix::net::UnixStream::connect"), Some("Ipc"));
5497        assert_eq!(classify("tokio", "tokio::net::TcpStream::connect"), Some("Net"));
5498        // R1288 — tokio's clock, and only its `now`.
5499        assert_eq!(classify("tokio", "tokio::time::Instant::now"), Some("Clock"));
5500        assert_eq!(classify("tokio", "tokio::time::Instant::from_std"), None);
5501        assert_eq!(classify("quanta", "quanta::Instant::now"), Some("Clock"));
5502        assert_eq!(classify("web_time", "web_time::Instant::now"), Some("Clock"));
5503    }
5504
5505    /// THE PLATFORM `fs` MODULES. `std::fs::` was the whole filesystem rule, so every function in
5506    /// `std::os::{unix,windows,wasi}::fs` read PURE — measured with EXECUTED ground truth (a `cargo run`
5507    /// that created a real symlink and stat'd it back), `deny Fs` over a crate whose only filesystem
5508    /// write was `std::os::unix::fs::symlink` exited 0.
5509    ///
5510    /// The controls are the point: the `*Ext` DATA/BUILDER traits must stay pure, or the fix trades a
5511    /// silent under-report for a fabrication on every `m.uid()` — and `FileExt` must NOT, because
5512    /// `read_at`/`write_at` are the positional-I/O syscalls this rule exists to catch.
5513    #[test]
5514    fn the_platform_fs_modules_are_filesystem_io_and_their_data_traits_are_not() {
5515        for p in [
5516            "std::os::unix::fs::symlink", "std::os::unix::fs::chown", "std::os::unix::fs::lchown",
5517            "std::os::unix::fs::fchown", "std::os::unix::fs::chroot",
5518            "std::os::windows::fs::symlink_dir", "std::os::windows::fs::symlink_file",
5519            "std::os::windows::fs::junction_point",
5520            "std::os::unix::fs::FileExt::read_at", "std::os::unix::fs::FileExt::write_at",
5521            "std::os::windows::fs::FileExt::seek_read", "std::os::windows::fs::FileExt::seek_write",
5522        ] {
5523            assert_eq!(classify("std", p), Some("Fs"), "{p} performs filesystem I/O");
5524        }
5525        for p in [
5526            "std::os::unix::fs::MetadataExt::uid", "std::os::unix::fs::MetadataExt::mode",
5527            "std::os::unix::fs::PermissionsExt::mode", "std::os::unix::fs::PermissionsExt::set_mode",
5528            "std::os::unix::fs::OpenOptionsExt::custom_flags",
5529            "std::os::unix::fs::DirBuilderExt::mode",
5530            "std::os::unix::fs::DirEntryExt::ino", "std::os::unix::fs::FileTypeExt::is_fifo",
5531            "std::os::windows::fs::MetadataExt::file_attributes",
5532        ] {
5533            assert_eq!(classify("std", p), None,
5534                       "{p} reads or configures data already in hand — charging it would FABRICATE Fs");
5535        }
5536        // `std::os::unix::net` is Ipc and must be untouched by a rule keyed one segment along.
5537        assert_eq!(classify("std", "std::os::unix::net::UnixStream::connect"), Some("Ipc"));
5538    }
5539
5540    /// SOUNDNESS R141 — the platform `process` modules, the sibling `fs` had a rule and `process` did
5541    /// not. `CommandExt::exec` is `execvp`: it REPLACES the process image, ground-truthed by a
5542    /// `cargo run` that printed a line from the exec'd image and never reached the line after the call.
5543    /// Both directions are driven here: the spawn surface must charge Exec (without the rule every
5544    /// assertion in the first loop returns `None` and `deny Exec` over a library whose only function
5545    /// calls `CommandExt::exec` exits 0), and the already-collected-status traits must NOT, or the fix
5546    /// trades a silent under-report for a fabrication on every `status.signal()` — the same control
5547    /// shape as the `fs` test above.
5548    #[test]
5549    fn the_platform_process_modules_are_exec_and_their_status_traits_are_not() {
5550        for p in [
5551            "std::os::unix::process::CommandExt::exec",
5552            "std::os::unix::process::CommandExt::pre_exec",
5553            "std::os::unix::process::CommandExt::arg0",
5554            "std::os::unix::process::CommandExt::uid",
5555            "std::os::unix::process::CommandExt::gid",
5556            "std::os::unix::process::CommandExt::groups",
5557            "std::os::unix::process::CommandExt::process_group",
5558            "std::os::windows::process::CommandExt::creation_flags",
5559            "std::os::windows::process::CommandExt::raw_arg",
5560            "std::os::windows::process::ChildExt::main_thread_handle",
5561            "std::os::wasi::process::CommandExt::exec",
5562        ] {
5563            assert_eq!(classify("std", p), Some("Exec"), "{p} is subprocess machinery");
5564        }
5565        for p in [
5566            "std::os::unix::process::ExitStatusExt::signal",
5567            "std::os::unix::process::ExitStatusExt::core_dumped",
5568            "std::os::unix::process::ExitStatusExt::from_raw",
5569            "std::os::unix::process::ExitStatusExt::into_raw",
5570            "std::os::unix::process::ExitStatusError::signal",
5571            "std::os::windows::process::ExitStatusExt::from_raw",
5572            "std::os::windows::process::ExitCodeExt::from_raw",
5573            "std::os::unix::process::parent_id",
5574        ] {
5575            assert_eq!(classify("std", p), None,
5576                       "{p} reads a status already collected (or this process's own pid) — charging it \
5577                        would FABRICATE Exec");
5578        }
5579        // Keyed one segment along: `fs` and `net` under the same platform root must be untouched.
5580        assert_eq!(classify("std", "std::os::unix::fs::FileExt::read_at"), Some("Fs"));
5581        assert_eq!(classify("std", "std::os::unix::net::UnixStream::connect"), Some("Ipc"));
5582    }
5583
5584    #[test]
5585    fn command_head_refines_the_exec_cliff() {
5586        use super::classify_command_head as h;
5587        // unambiguous external tools classify by basename (spec §4 ⟨0.5⟩)
5588        assert_eq!(h("curl"), &["Net"]);
5589        assert_eq!(h("telnet"), &["Net"]);
5590        assert_eq!(h("sftp"), &["Net"]);
5591        assert_eq!(h("/usr/local/bin/psql"), &["Db"]); // basename match strips the path
5592        assert_eq!(h("mongo"), &["Db"]);
5593        assert_eq!(h("cqlsh"), &["Db"]);
5594        // a candor engine is Fs/Env — spec-SUPPLIED by §7 item 12, not curation
5595        assert_eq!(h("candor-scan"), &["Env", "Fs"]);
5596        assert_eq!(h("candor-run.sh"), &["Env", "Fs"]);
5597        // an unrecognised head adds nothing — the bare Exec cliff stands (never guess). `make`/`npm`
5598        // run the project's own code; `git`/`rsync` are multi-modal (local vs remote) — all keep the
5599        // cliff rather than fabricate an effect for the common case.
5600        assert_eq!(h("some-unknown-tool"), &[] as &[&str]);
5601        assert_eq!(h("make"), &[] as &[&str]);
5602        assert_eq!(h("npm"), &[] as &[&str]);
5603        assert_eq!(h("git"), &[] as &[&str]);
5604        assert_eq!(h("rsync"), &[] as &[&str]);
5605        // a builder MODIFIER (`.arg`/`.env`) names no program — its literal must NOT refine (a
5606        // whole-crate-Exec crate classifies every method; `.env("psql",..)` must not fabricate Db).
5607        assert!(is_cmd_builder_method("env") && is_cmd_builder_method("arg") && is_cmd_builder_method("current_dir"));
5608        assert!(!is_cmd_builder_method("new")); // Command::new NAMES the program
5609        assert!(!is_cmd_builder_method("cmd")); // duct::cmd NAMES the program
5610        // The gate that ADMITS a literal to classify_command_head is an ALLOWLIST of program-NAMING
5611        // methods, not the builder denylist. Inversion matters: a whole-crate-Exec crate (portable_pty)
5612        // classifies EVERY method as Exec, so a getter like `cmd.get_env("psql")` — absent from the
5613        // builder denylist — would have leaked "psql" to the head and FABRICATED Db. Only `new`/`cmd`
5614        // name a program, so only they may refine.
5615        assert!(is_cmd_naming_method("new") && is_cmd_naming_method("cmd"));
5616        assert!(!is_cmd_naming_method("get_env")); // a GETTER, not a namer — the leak this closes
5617        assert!(!is_cmd_naming_method("arg") && !is_cmd_naming_method("env") && !is_cmd_naming_method("current_dir"));
5618    }
5619
5620    /// SOUNDNESS R379 — THE MASKING GUARD'S ALLOWLIST, AND THE DENYLIST THAT WAS MEASURED AND REJECTED.
5621    ///
5622    /// The verbs here take the HOST as an argument, so a runtime value in that position is invisible to
5623    /// the gate and the surface must be marked incomplete. The DNS resolver verbs were missing, and
5624    /// their absence was a GATE BYPASS, not a missed disclosure: `allow Net good.example.com` exited 0
5625    /// over `r.lookup_ip(caller_host)` sitting beside a benign literal, measured against real
5626    /// hickory-resolver 0.26.2.
5627    /// SOUNDNESS R386 — the `sqlite3_*` C API takes SQL, and its absence let a benign SIBLING literal
5628    /// certify arbitrary caller-supplied SQL.
5629    ///
5630    /// R383 recorded this gap as "REAL BUT NOT LIVE" because a C-string literal never reaches `tables`.
5631    /// That is true of an ISOLATED function and is the WRONG SHAPE: the literal only has to come from
5632    /// the same FUNCTION, not the same call. Measured, calibrated first (`deny Db` exits 1):
5633    /// `conn.execute("INSERT INTO users (id) VALUES (1)", [])` beside `sqlite3_exec(db, caller_sql, …)`
5634    /// gave `tables:['users'] incomplete:NONE` and `allow Db users` exited 0.
5635    #[test]
5636    fn db_query_arg_covers_the_sqlite3_sql_bearing_family() {
5637        // Every spelling that TAKES SQL — the whole family, not the one that was measured (R346).
5638        for f in ["sqlite3_exec", "sqlite3_prepare", "sqlite3_prepare_v2", "sqlite3_prepare_v3",
5639                  "sqlite3_prepare16", "sqlite3_prepare16_v2", "sqlite3_prepare16_v3",
5640                  // R386's own boundary, found by a release panel: SQL is arg 1 here too.
5641                  "sqlite3_get_table"] {
5642            assert!(is_db_query_arg(f), "{f} carries SQL — a runtime query there is invisible (R386)");
5643        }
5644        // THE OVER-MASK CONTROLS, and they carry as much weight as the fix. These take no query, so
5645        // masking them would fail `allow Db` closed over nothing. `sqlite3_open*` is the sharpest: it
5646        // takes a FILENAME, so masking it would claim a Db surface for an Fs locator.
5647        for f in ["sqlite3_step", "sqlite3_close", "sqlite3_open", "sqlite3_open_v2", "sqlite3_open16",
5648                  "sqlite3_serialize", "sqlite3_deserialize", "sqlite3_finalize", "sqlite3_reset",
5649                  // the backup/blob handle verbs carry no query either — the other half of the family
5650                  "sqlite3_backup_init", "sqlite3_backup_step", "sqlite3_blob_open", "sqlite3_blob_read"] {
5651            assert!(!is_db_query_arg(f),
5652                    "{f} carries no SQL — masking it claims an incomplete surface over nothing, and for \
5653                     the open* family it would claim a Db surface for a FILENAME");
5654        }
5655        // The pre-existing high-level verbs must survive.
5656        for f in ["execute", "query", "prepare", "prepare_cached", "simple_query"] {
5657            assert!(is_db_query_arg(f), "{f} was already covered and must stay covered");
5658        }
5659    }
5660
5661    /// SOUNDNESS R383 — the METHOD forms whose path is an ARGUMENT. The guard's `!c.method` gate
5662    /// excluded every method form because the path-STAT methods carry the path as their RECEIVER;
5663    /// `OpenOptions::open(path)` is the counter-example, and `allow Fs <lit>` exited 0 over a
5664    /// caller-supplied path because of it.
5665    #[test]
5666    fn fs_path_arg_methods_are_the_receiver_pairs_not_the_leaf() {
5667        // The path-taking pairs, matched on the TAIL so std/tokio/cap_primitives/fs_err all qualify.
5668        for p in ["std::fs::OpenOptions::open", "tokio::fs::OpenOptions::open",
5669                  "cap_primitives::fs::OpenOptions::open", "fs_err::OpenOptions::open",
5670                  "std::fs::DirBuilder::create", "tokio::fs::DirBuilder::create"] {
5671            assert!(is_fs_path_arg_method(p), "{p} takes its path as an ARGUMENT — R383");
5672        }
5673        // THE CONTROLS, and they are the row: every other method on the SAME receivers is a builder
5674        // modifier or a combinator, and `File`'s methods are use-verbs whose path was fixed at open.
5675        // Masking these is the over-mask a denylist would have caused (R379 measured that cost).
5676        for p in ["std::fs::File::read_to_string", "std::fs::File::write", "std::fs::File::write_all",
5677                  "std::fs::File::read", "std::fs::File::seek", "std::path::Path::exists",
5678                  "std::fs::OpenOptions::read", "std::fs::OpenOptions::truncate",
5679                  "std::fs::OpenOptions::map_err", "tokio::fs::OpenOptions::mode"] {
5680            assert!(!is_fs_path_arg_method(p),
5681                    "{p} hides no path — it is a builder modifier, a combinator, or a use-verb whose \
5682                     path was fixed at open. Masking it is the over-mask this allowlist avoids.");
5683        }
5684    }
5685
5686    #[test]
5687    fn net_establishing_allowlist() {
5688        // Host-bearing verbs establish — a runtime value here is invisible, so the gate must fail closed.
5689        for m in ["connect", "connect_timeout", "get", "post", "put", "patch", "delete", "head",
5690                  "request", "send_to", "lookup_host", "to_socket_addrs"] {
5691            assert!(is_net_establishing(m), "`{m}` takes the host as an argument and must establish");
5692        }
5693        // R379: the DNS resolver verbs `classify` already maps to Net. The WHOLE FAMILY, not the one
5694        // spelling that was found — `_lookup` is a suffix test mirroring `classify`'s own.
5695        for m in ["lookup", "lookup_ip", "resolve", "reverse_lookup", "srv_lookup", "mx_lookup",
5696                  "txt_lookup", "ipv4_lookup", "ipv6_lookup", "ns_lookup", "soa_lookup"] {
5697            assert!(is_net_establishing(m),
5698                    "`{m}` resolves a caller-supplied host — R379. Without it, `allow Net <benign \
5699                     literal>` exits 0 over a DNS lookup of a runtime hostname.");
5700        }
5701        // USE-verbs on an already-established connection: the host was fixed at `connect`, so a missing
5702        // literal here hides nothing and must NOT flag — else `connect("h").write(..)` fails closed.
5703        for m in ["write", "read", "send", "flush", "recv", "peek", "write_all", "read_to_end",
5704                  "write_vectored", "shutdown", "status", "headers", "text", "json"] {
5705            assert!(!is_net_establishing(m), "`{m}` is a use-verb on an established connection");
5706        }
5707    }
5708
5709    /// ⟨0.40⟩ SOUNDNESS R817 — an ACCEPT is not a BIND. The two lists answer different questions and must
5710    /// not share a member: a binding verb's literal is withheld and marks nothing, an accepting verb marks
5711    /// the surface incomplete. `accept`/`incoming` used to be binding verbs, which is the defect.
5712    #[test]
5713    fn r817_accepting_is_not_binding() {
5714        for (path, leaf) in [
5715            ("std::net::TcpListener::accept", "accept"),
5716            ("std::net::TcpListener::incoming", "incoming"),
5717            ("std::net::TcpListener::into_incoming", "into_incoming"),
5718            ("tokio::net::TcpListener::accept", "accept"),
5719            ("tokio::net::TcpListener::poll_accept", "poll_accept"),
5720            ("libc::accept", "accept"),
5721            ("libc::accept4", "accept4"),
5722            ("quinn::Endpoint::accept", "accept"),
5723            ("tonic::transport::server::Router::serve", "serve"),
5724            ("tonic::transport::server::Router::serve_with_shutdown", "serve_with_shutdown"),
5725            ("tonic::transport::server::TcpIncoming::new", "new"),
5726        ] {
5727            assert!(is_net_accepting(path, leaf), "`{path}` accepts connections: its peers are unseen");
5728            assert!(!is_net_binding(leaf), "`{leaf}` must not be a binding verb — binding withholds and marks nothing");
5729        }
5730        // CONTROLS — binds mark nothing; a stream accepted on an ESTABLISHED connection (quinn) has a peer
5731        // fixed at the endpoint's accept; a datagram receive is not an accept; `serve`/`new` elsewhere are
5732        // not accepts.
5733        for (path, leaf) in [
5734            ("std::net::UdpSocket::bind", "bind"),
5735            ("std::net::TcpListener::bind", "bind"),
5736            ("libc::listen", "listen"),
5737            ("quinn::Connection::accept_bi", "accept_bi"),
5738            ("quinn::Connection::accept_uni", "accept_uni"),
5739            ("std::net::UdpSocket::recv_from", "recv_from"),
5740            ("tonic::transport::server::Server::serve_with_shutdown", "serve_with_shutdown"),
5741            ("reqwest::Client::new", "new"),
5742        ] {
5743            assert!(!is_net_accepting(path, leaf), "`{path}` does not accept a connection");
5744        }
5745        for m in ["bind", "listen", "bind_to_device"] {
5746            assert!(is_net_binding(m), "`{m}` names a LOCAL address");
5747        }
5748    }
5749
5750    /// R379 — WHY THIS STAYS AN ALLOWLIST, which is NOT this family's usual direction.
5751    ///
5752    /// `candor-denylist-over-allowlist` says narrow a sound over-approximation with a denylist, and
5753    /// R350 made exactly that inversion one list over. It is wrong HERE, for the reason
5754    /// `is_cmd_naming_method` states two doc-blocks above for Exec: a WHOLE-CRATE-Net crate classifies
5755    /// every method as Net, so a denylist of use-verbs masks essentially everything in one. Measured by
5756    /// building the inversion and A/B-ing all 1,545 registry crates: **544 rows gained `incomplete`,
5757    /// none lost it** — `cap-std` 66, `hickory-net` 44 — and the triggers were conversions, accessors
5758    /// and combinators that hide no host.
5759    ///
5760    /// These are the measured leaks, pinned so the inversion cannot be re-attempted without meeting
5761    /// them. `bind` is the sharpest: this file has `is_net_binding` precisely because a bind address
5762    /// is where the process LISTENS, never a destination it reaches.
5763    #[test]
5764    fn the_rejected_denylist_leaks_are_not_establishing() {
5765        for m in ["bind", "into", "from", "from_std", "as_socket", "setsockopt", "getsockopt",
5766                  "map_err", "map", "ok", "try_clone", "complete_io"] {
5767            assert!(!is_net_establishing(m),
5768                    "`{m}` hides no host and must not mark a surface incomplete. It was a MEASURED \
5769                     trigger of the rejected denylist inversion (544 rows gained `incomplete` over the \
5770                     registry, 0 lost) — a whole-crate-Net crate classifies every method as Net, which \
5771                     is why the allowlist is the precise side here. See R379.");
5772        }
5773    }
5774
5775    #[test]
5776    fn fs_path_arg_allowlist() {
5777        // The Fs masking guard's path-naming-fn allowlist — free fns / constructors take the path as a
5778        // string arg (a runtime path there is invisible to the gate). Stat methods (path on the receiver)
5779        // and handle ops carry no path arg and must NOT flag — but they're caught by the caller's
5780        // `!is_method` gate; the allowlist itself just enumerates the path-NAMING leaves.
5781        assert!(is_fs_path_arg("write") && is_fs_path_arg("read") && is_fs_path_arg("read_to_string"));
5782        assert!(is_fs_path_arg("open") && is_fs_path_arg("create") && is_fs_path_arg("create_new"));
5783        assert!(is_fs_path_arg("remove_file") && is_fs_path_arg("rename") && is_fs_path_arg("copy"));
5784        assert!(is_fs_path_arg("create_dir_all") && is_fs_path_arg("canonicalize") && is_fs_path_arg("metadata"));
5785        // handle ops / pure builders take NO path arg — never path-naming.
5786        assert!(!is_fs_path_arg("write_all") && !is_fs_path_arg("flush") && !is_fs_path_arg("read_exact"));
5787        assert!(!is_fs_path_arg("new") && !is_fs_path_arg("sync_all") && !is_fs_path_arg("set_len"));
5788    }
5789
5790    #[test]
5791    fn db_query_arg_allowlist() {
5792        // The Db masking guard's query-bearing-verb allowlist — these take the raw SQL as a string arg
5793        // (a runtime query there is invisible to the gate). Build-then-execute terminals and non-query
5794        // ops carry no SQL string and must NOT flag.
5795        assert!(is_db_query_arg("execute") && is_db_query_arg("query") && is_db_query_arg("query_one"));
5796        assert!(is_db_query_arg("prepare") && is_db_query_arg("batch_execute") && is_db_query_arg("execute_batch"));
5797        assert!(is_db_query_arg("query_row") && is_db_query_arg("query_map") && is_db_query_arg("exec"));
5798        // build-then-execute terminals (query built structurally, no SQL string) must NOT flag.
5799        assert!(!is_db_query_arg("fetch_all") && !is_db_query_arg("load") && !is_db_query_arg("first"));
5800        assert!(!is_db_query_arg("all") && !is_db_query_arg("one") && !is_db_query_arg("stream"));
5801        // connection / lifecycle ops take no SQL — must NOT flag.
5802        assert!(!is_db_query_arg("connect") && !is_db_query_arg("open") && !is_db_query_arg("begin"));
5803        assert!(!is_db_query_arg("commit") && !is_db_query_arg("ping") && !is_db_query_arg("get_conn"));
5804    }
5805}
5806
5807#[cfg(test)]
5808mod fs_kind_tests {
5809    use super::fs_kind;
5810
5811    /// SPEC §2 `fs`. Most of what these assert is what the classifier REFUSES to say: §2 requires the
5812    /// field be "omitted rather than guessed", because an empty or partial `fs` reads as a positive claim
5813    /// ("reads but never writes") — the §4 trust contract's forbidden direction.
5814    #[test]
5815    fn write_verbs() {
5816        for p in ["std::fs::write", "std::fs::create_dir_all", "std::fs::remove_file",
5817                  "File::create", "std::fs::set_permissions", "f::write_all"] {
5818            assert_eq!(fs_kind(p), &["write"], "{p} mutates the disk");
5819        }
5820    }
5821
5822    #[test]
5823    fn read_verbs() {
5824        for p in ["std::fs::read_to_string", "std::fs::read_dir", "std::fs::metadata",
5825                  "File::open", "std::fs::canonicalize", "f::read_to_end"] {
5826            assert_eq!(fs_kind(p), &["read"], "{p} observes without mutating");
5827        }
5828    }
5829
5830    /// A copy/rename reads the source AND writes the destination — one call, both kinds.
5831    #[test]
5832    fn two_locator_verbs_are_both() {
5833        for p in ["std::fs::copy", "std::fs::rename", "std::fs::hard_link"] {
5834            assert_eq!(fs_kind(p), &["read", "write"], "{p}");
5835        }
5836    }
5837
5838    /// THE LOAD-BEARING CASE. A verb that does not reveal direction must contribute NOTHING — not a
5839    /// default, not a guess. Anything here returning a kind would let a function claim "reads but never
5840    /// writes" on the strength of a verb that said neither.
5841    #[test]
5842    fn unrevealing_verbs_make_no_claim() {
5843        for p in ["std::fs::OpenOptions", "some_crate::do_thing", "std::fs::File", "f::seek"] {
5844            assert!(fs_kind(p).is_empty(), "{p} must not claim a direction it did not reveal");
5845        }
5846    }
5847
5848    /// `OpenOptions::open` is `File::open`'s leaf and NOT its verb: the direction lives in the builder
5849    /// chain (`.read(true)`/`.write(true)`), which `fs_kind` cannot see. A `write(true)` builder claiming
5850    /// `["read"]` is the forbidden direction, so the type wins over the leaf here. `File::open` — where
5851    /// `open` DOES mean read — is unaffected, which is the whole reason this is keyed on the type.
5852    #[test]
5853    fn openoptions_open_claims_no_direction_but_file_open_still_reads() {
5854        for p in ["std::fs::OpenOptions::open", "fs_err::OpenOptions::open",
5855                  "tokio::fs::OpenOptions::open"] {
5856            assert!(fs_kind(p).is_empty(),
5857                    "{p}'s direction was set by the builder chain, which this function cannot see");
5858        }
5859        assert_eq!(fs_kind("std::fs::File::open"), &["read"], "`File::open` is unambiguously a read");
5860    }
5861}
5862
5863#[cfg(test)]
5864mod masks_locator_tests {
5865    use super::*;
5866
5867    /// SOUNDNESS R806 — each no-locator DENYLIST must be a SUBSET of the table it subtracts from. A
5868    /// typo'd or stale entry that is not in the table would subtract nothing and read as a decision;
5869    /// a table entry renamed without its denylist twin would silently start masking (the safe
5870    /// direction) — but only this check says which happened.
5871    #[test]
5872    fn every_no_locator_denylist_is_a_subset_of_its_charging_table() {
5873        for n in LIBC_FS_NO_PATH {
5874            assert!(LIBC_FS.contains(n), "LIBC_FS_NO_PATH names `{n}`, which LIBC_FS does not charge");
5875        }
5876        for n in LIBC_EXEC_NO_PROGRAM {
5877            assert!(LIBC_EXEC.contains(n), "LIBC_EXEC_NO_PROGRAM names `{n}`, absent from LIBC_EXEC");
5878        }
5879        for n in LIBC_NET_NO_DESTINATION {
5880            assert!(LIBC_NET.contains(n), "LIBC_NET_NO_DESTINATION names `{n}`, absent from LIBC_NET");
5881        }
5882        for n in PG_DB_VERBS_NO_SQL {
5883            assert!(PG_DB_VERBS.contains(n), "PG_DB_VERBS_NO_SQL names `{n}`, absent from PG_DB_VERBS");
5884        }
5885    }
5886
5887    /// SOUNDNESS R806 — THE DERIVATION, pinned from the table side: every leaf the table charges that is
5888    /// not on the denylist MASKS. So a leaf added to `LIBC_FS` tomorrow is masked with no second edit,
5889    /// which is the property the hand list lacked.
5890    #[test]
5891    fn every_charged_libc_leaf_off_the_denylist_masks() {
5892        for (eff, table, deny) in [
5893            ("Fs", LIBC_FS, LIBC_FS_NO_PATH),
5894            ("Exec", LIBC_EXEC, LIBC_EXEC_NO_PROGRAM),
5895            ("Net", LIBC_NET, LIBC_NET_NO_DESTINATION),
5896        ] {
5897            for leaf in table.iter().filter(|l| !deny.contains(l)) {
5898                for cr in ["libc", "nix"] {
5899                    let path = format!("{cr}::{leaf}");
5900                    assert_eq!(classify(cr, &path), Some(eff), "{path} must still be charged {eff}");
5901                    assert!(masks_locator(eff, cr, &path, leaf, false), "{path} names a locator — must mask");
5902                }
5903            }
5904            for leaf in deny.iter() {
5905                let path = format!("libc::{leaf}");
5906                assert!(!masks_locator(eff, "libc", &path, leaf, false) || is_net_establishing(leaf),
5907                        "{path} is on the no-locator denylist — must not mask via the table");
5908            }
5909        }
5910        // The named members, from the row: the sweep's EXECUTED arms.
5911        for (eff, leaf) in [("Fs", "unlink"), ("Fs", "unlinkat"), ("Fs", "utimensat"), ("Exec", "system"),
5912                            ("Exec", "popen"), ("Exec", "execvp"), ("Exec", "posix_spawn"), ("Net", "getaddrinfo"),
5913                            ("Net", "sendto")] {
5914            assert!(masks_locator(eff, "libc", &format!("libc::{leaf}"), leaf, false), "libc::{leaf}");
5915        }
5916        // Scoped to the syscall crates: the same leaf on an unrelated crate is not this table's to judge.
5917        assert!(!masks_locator("Fs", "mycrate", "mycrate::unlink", "unlink", false));
5918        // rustix spells `sendmsg` WITHOUT an address; libc and nix carry one.
5919        assert!(!masks_locator("Net", "rustix", "rustix::net::sendmsg", "sendmsg", false));
5920        assert!(masks_locator("Net", "libc", "libc::sendmsg", "sendmsg", false));
5921    }
5922
5923    #[test]
5924    fn pg_verbs_take_sql_except_the_named_three() {
5925        for v in PG_DB_VERBS.iter().filter(|v| !PG_DB_VERBS_NO_SQL.contains(v)) {
5926            let path = format!("deadpool_postgres::Client{v}");
5927            let leaf = &v[2..];
5928            assert!(masks_locator("Db", "deadpool_postgres", &path, leaf, true), "{path} takes SQL — must mask");
5929        }
5930        assert!(masks_locator("Db", "tokio_postgres", "tokio_postgres::Client::prepare_typed_cached",
5931                              "prepare_typed_cached", true));
5932        assert!(!masks_locator("Db", "tokio_postgres", "tokio_postgres::Client::transaction", "transaction", true));
5933        assert!(masks_locator("Db", "sqlx_core", "sqlx_core::executor::Executor::prepare_with", "prepare_with", true));
5934        assert!(!masks_locator("Db", "sqlx_core", "sqlx_core::query::Query::fetch_all", "fetch_all", true),
5935                "a Query terminal takes an EXECUTOR at arg 0 — masking it would swallow every literal query");
5936    }
5937
5938    /// THE COVERAGE-GATE REFRESH (2026-10-08) — each family's rule fires on the spellings a consumer writes
5939    /// and NOT on a sibling type or an accessor (each charge is traced to a body in the rule's comment).
5940    #[test]
5941    fn coverage_gate_refresh_2026_10_08_rules() {
5942        for p in ["rusqlite::Transaction::commit", "rusqlite::transaction::Transaction::new",
5943                  "rusqlite::Savepoint::rollback", "rusqlite::Connection::pragma_update",
5944                  "rusqlite::Connection::unchecked_transaction", "rusqlite::Connection::savepoint_with_name"] {
5945            assert_eq!(classify("rusqlite", p), Some("Db"), "{p}");
5946        }
5947        for p in ["rusqlite::Transaction::drop_behavior", "rusqlite::Savepoint::set_drop_behavior"] {
5948            assert_eq!(classify("rusqlite", p), None, "{p}");
5949        }
5950        for p in ["redis::Connection::send_packed_command", "redis::connection::Connection::recv_response",
5951                  "redis::PubSub::get_message"] {
5952            assert_eq!(classify("redis", p), Some("Net"), "{p}");
5953        }
5954        assert_eq!(classify("redis", "redis::aio::MultiplexedConnection::recv_response"), None);
5955        assert_eq!(classify("redis", "redis::Connection::set_write_timeout"), None);
5956        for p in ["lettre::SmtpConnection::command", "lettre::transport::smtp::client::SmtpConnection::connect",
5957                  "lettre::AsyncSmtpConnection::read_response",
5958                  "lettre::transport::smtp::client::AsyncNetworkStream::connect_tokio1",
5959                  "lettre::Tokio1Executor::connect"] {
5960            assert_eq!(classify("lettre", p), Some("Net"), "{p}");
5961        }
5962        for p in ["lettre::SmtpConnection::server_info", "lettre::NetworkStream::peer_addr",
5963                  "lettre::AsyncSmtpConnection::is_encrypted"] {
5964            assert_eq!(classify("lettre", p), None, "{p}");
5965        }
5966        assert_eq!(classify("rustls", "rustls::KeyLogFile::log"), Some("Fs"));
5967        assert_eq!(classify("rustls", "rustls::NoKeyLog::log"), None);
5968    }
5969}