From e6c3a02229994a9e007d8e6618add778e1ec021c Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 20 Nov 2026 19:03:01 +0000 Subject: docs: record the census, and make the README describe the tree that exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The census report gets its after-table, and the README's Layout gets rewritten — it had drifted into fiction, listing `db/queries.rs`'s successors as "queries" and omitting `usecase`, `error`, `hash`, `time`, `urlutil`, `git`, `fetch` and `recipe` entirely. It now states the ranks and says plainly that they are enforced by `tests/architecture.rs`, not kept in hope, and names the two commands that keep it true. This commit also carries the last of the narrowing that fell out of writing the report, because writing it meant actually reading the numbers: - `watch::upstream::resolve` looked test-only and was not — the tests contain an unrelated local function of the same name, which the census matches as a word. It is crate-internal and now says so. - `read_tree` closed with it. Its two integration tests were testing the module's own batching behaviour from outside, so they moved inside as unit tests with a throwaway git repo, which is where a test about one `ls-tree` and one `cat-file --batch` belongs. They lost nothing: the empty-blob and NUL-byte assertions came across verbatim, plus one the old test never made — binary blobs are still listed, just not read. - `Assessment::is_high`, `Tree::get`, `approve::current_accepted` and `diff::full_recipe_text` were dead once their callers closed, and are gone. - `set_risk_for_tests` is gone too. The bulk-refusal test needed a candidate marked high-risk, and the honest way to get one was for the fixture to write the row — `Env::execute` — rather than the library growing a public setter that exists only so a test can pass. That was the last budget above baseline apart from `error.pub`. `error.pub` stays at 21 against a baseline of 15, and the report says why: the six payload enums are constructed in four modules and matched in `error`, so they are interface. `error.dead` is 0. Final: 281 passed / 0 failed across 36 binaries (baseline 273), clippy -D warnings clean, release clean, census within budget. --- tests/common/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/common/mod.rs') diff --git a/tests/common/mod.rs b/tests/common/mod.rs index d1c07a4..5c48923 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -128,6 +128,23 @@ impl Env { self.cfg.hooks.shim_fail = Some(tool.to_string()); } + /// Run a statement the library deliberately does not expose. + /// + /// Fixtures use this to put a row in a state production would take a long + /// way to reach — forcing a risk level, say — rather than the library + /// growing a public setter that exists only for tests. + pub fn execute(&self, sql: &str, params: &[P]) { + let c = rusqlite::Connection::open(self.cfg.db_path()).unwrap(); + let refs: Vec<&dyn rusqlite::ToSql> = params + .iter() + .map(|p| match p { + P::I(i) => i as &dyn rusqlite::ToSql, + P::S(s) => s as &dyn rusqlite::ToSql, + }) + .collect(); + c.execute(sql, rusqlite::params_from_iter(refs)).unwrap(); + } + pub fn query_i64(&self, sql: &str, params: &[P]) -> Option { let sql = sql.to_string(); let params: Vec

= params.to_vec(); -- cgit v1.2.3