From 154f6f6dd284c11da82cf1188ff8549db6459228 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 20 Nov 2026 17:26:52 +0000 Subject: db: close what nothing reaches, and say what cannot be closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit db handed out 226 items and 36 of them were named by nobody at all — not by the crate, not by the tests. Making them private is the whole of this commit, but the interesting part is what the compiler said afterwards. Twenty-five closed cleanly. Eleven did not, and they are the ones worth writing down: AuditRow, NoticeRow, PackageRow, Subscription, StepRow, Unbuilt, OpenReview, ReviewSubject, Migration, Writer, predecessors. None is named outside db, yet none can be made private, because a public query returns them and callers bind them with `let` and call methods on them. They are load-bearing and invisible to a name search. So the census's `dead` count means "the name is never written outside the module", which is a lead rather than a verdict, and the census now says so: the way to find out which flagged items are real is to privatize them and let rustc answer. Those eleven are budgeted with that reason, not zeroed to make a number look good. Nineteen items turned out to be dead code rather than merely unexported — set_release, set_candidate, set_pkgbase, set_profile, set_kind, current_state, index_pkgbase_drift, wal_stats, call_for_tests, put_notice, is_ours, list_pkgbases, set_unpinable, artifact_id_by_digest_in, subscription_poll_interval, the four never-emitted notice kinds, and StateEnum::as_str, which the impl_state_enum macro was required to define for all five enums while nothing called it through the trait. Privatizing is what proved they were unused; leaving them private-but-present would have just hidden dead code behind a narrower address. Ten items became pub(crate): the Writer actor's call/tx/send surface, Readers, the StateEnum trait, json_or, predecessors, DEFAULT_SETTINGS. `Db.readers` was named nowhere outside db, so the field closed with the type. db: 226 pub / 36 dead-only -> 201 pub / 11 dead-only. 277 passed / 0 failed, clippy -D warnings clean, schema_ownership and architecture green. --- tests/architecture-budget.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/architecture-budget.json b/tests/architecture-budget.json index f717923..969b945 100644 --- a/tests/architecture-budget.json +++ b/tests/architecture-budget.json @@ -89,14 +89,14 @@ "test": 5 }, "db": { - "dead": 49, - "deadonly": 36, + "dead": 24, + "deadonly": 11, "glob": 0, - "largest": 568, - "largest_file": "src/db/builds.rs", - "lines": 3948, - "priv": 5, - "pub": 226, + "largest": 364, + "largest_file": "src/db/candidates.rs", + "lines": 3731, + "priv": 10, + "pub": 201, "test": 13 }, "error": { @@ -299,15 +299,15 @@ } }, "totals": { - "dead": 219, - "deadonly": 146, + "dead": 194, + "deadonly": 121, "edges": 80, "glob": 2, "largest": 603, "largest_file": "src/shims/mod.rs", - "lines": 13810, - "priv": 42, - "pub": 585, + "lines": 13593, + "priv": 47, + "pub": 560, "test": 73 } } -- cgit v1.2.3