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. --- src/review/approve.rs | 4 ---- src/review/candidates.rs | 7 ------- src/review/diff.rs | 7 ------- src/review/risk.rs | 5 +---- 4 files changed, 1 insertion(+), 22 deletions(-) (limited to 'src/review') diff --git a/src/review/approve.rs b/src/review/approve.rs index adc81c0..82812fb 100644 --- a/src/review/approve.rs +++ b/src/review/approve.rs @@ -220,7 +220,3 @@ pub fn withdraw(db: &Db, actor: &str, release_id: i64, reason: &str) -> Result<( Ok(()) }) } - -pub fn current_accepted(db: &Db, pkgbase: &str) -> Result> { - db::accepted_release(db, pkgbase) -} diff --git a/src/review/candidates.rs b/src/review/candidates.rs index b220013..59db99b 100644 --- a/src/review/candidates.rs +++ b/src/review/candidates.rs @@ -6,13 +6,6 @@ pub use crate::db::candidates::{ reopen_rejected, set_diff_digest, NewCandidate, }; -/// The risk columns are review's to write, from `intake::record` and nowhere -/// else. A fixture that needs a particular score says so through this. -#[cfg(feature = "test-support")] -pub fn set_risk_for_tests(db: &Db, id: i64, level: &str, signals: &[String]) -> Result<()> { - db::candidates::set_risk(db, id, level, signals) -} - #[derive(Debug, Clone, PartialEq, Eq)] pub enum Upsert { Created { id: i64, kind: String }, diff --git a/src/review/diff.rs b/src/review/diff.rs index 42467f0..4a8a3ef 100644 --- a/src/review/diff.rs +++ b/src/review/diff.rs @@ -266,13 +266,6 @@ pub fn diff_digest(ps: &[Panel]) -> String { crate::hash::hex_str(&render_text(ps)) } -pub fn full_recipe_text(db: &Db, c: &CandidateRow) -> Result { - let snap = db::snapshot_by_id(db, c.snapshot_id)?; - let snap = snap.ok_or_else(|| crate::error::Error::not_found("snapshot missing"))?; - let r: Recipe = serde_json::from_str(&snap.srcinfo_json).unwrap_or_default(); - Ok(r.pkgbuild) -} - pub fn render_and_store(db: &Db, cfg: &Config, c: &CandidateRow) -> Result { let base = match c.base_release_id { Some(id) => db::release_by_id(db, id)?, diff --git a/src/review/risk.rs b/src/review/risk.rs index 9c59bfa..9a7145d 100644 --- a/src/review/risk.rs +++ b/src/review/risk.rs @@ -16,15 +16,12 @@ const BUILD_SYSTEM_FILES: &[&str] = &[ ]; #[derive(Debug, Clone, Default)] -pub struct Assessment { +pub(crate) struct Assessment { pub level: String, pub signals: Vec, } impl Assessment { - pub fn is_high(&self) -> bool { - self.level == level::HIGH - } } pub(crate) fn assess( -- cgit v1.2.3