summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/architecture-budget.json61
-rw-r--r--tools/test-surface-reasons.json6
-rw-r--r--tools/test-surface.md76
-rw-r--r--tools/test-surface.py56
4 files changed, 129 insertions, 70 deletions
diff --git a/tests/architecture-budget.json b/tests/architecture-budget.json
index 7a7f7d1..3358039 100644
--- a/tests/architecture-budget.json
+++ b/tests/architecture-budget.json
@@ -81,10 +81,10 @@
"dead": 2,
"deadonly": 0,
"glob": 0,
- "largest": 673,
+ "largest": 701,
"largest_file": "src/config.rs",
- "lines": 673,
- "priv": 0,
+ "lines": 701,
+ "priv": 2,
"pub": 29,
"test": 2
},
@@ -92,10 +92,10 @@
"dead": 19,
"deadonly": 9,
"glob": 0,
- "largest": 364,
- "largest_file": "src/db/candidates.rs",
- "lines": 3917,
- "priv": 10,
+ "largest": 367,
+ "largest_file": "src/db/mod.rs",
+ "lines": 3961,
+ "priv": 11,
"pub": 200,
"test": 10
},
@@ -149,8 +149,8 @@
"glob": 0,
"largest": 565,
"largest_file": "src/http/routes/pages.rs",
- "lines": 1927,
- "priv": 72,
+ "lines": 2010,
+ "priv": 74,
"pub": 22,
"test": 5
},
@@ -180,10 +180,10 @@
"dead": 4,
"deadonly": 1,
"glob": 0,
- "largest": 415,
+ "largest": 455,
"largest_file": "src/ops.rs",
- "lines": 415,
- "priv": 0,
+ "lines": 455,
+ "priv": 3,
"pub": 13,
"test": 3
},
@@ -193,8 +193,8 @@
"glob": 0,
"largest": 472,
"largest_file": "src/pipeline/steps.rs",
- "lines": 1330,
- "priv": 11,
+ "lines": 1400,
+ "priv": 16,
"pub": 21,
"test": 6
},
@@ -237,8 +237,8 @@
"glob": 0,
"largest": 301,
"largest_file": "src/review/diff.rs",
- "lines": 872,
- "priv": 3,
+ "lines": 902,
+ "priv": 4,
"pub": 24,
"test": 4
},
@@ -246,9 +246,9 @@
"dead": 9,
"deadonly": 2,
"glob": 0,
- "largest": 490,
+ "largest": 506,
"largest_file": "src/sandbox/kata.rs",
- "lines": 1329,
+ "lines": 1411,
"priv": 16,
"pub": 21,
"test": 7
@@ -257,10 +257,10 @@
"dead": 12,
"deadonly": 8,
"glob": 0,
- "largest": 618,
+ "largest": 646,
"largest_file": "src/shims/mod.rs",
- "lines": 618,
- "priv": 0,
+ "lines": 646,
+ "priv": 2,
"pub": 19,
"test": 4
},
@@ -301,29 +301,28 @@
"dead": 8,
"deadonly": 4,
"glob": 0,
- "largest": 270,
- "largest_file": "src/watch/detect.rs",
- "lines": 1038,
- "priv": 7,
+ "largest": 302,
+ "largest_file": "src/watch/upstream.rs",
+ "lines": 1102,
+ "priv": 10,
"pub": 24,
"test": 4
}
},
"test_surface": {
"already-gated": 17,
- "residue": 29,
- "total": 46,
- "ungated": 29
+ "narrowed": 29,
+ "total": 46
},
"totals": {
"dead": 84,
"deadonly": 36,
"edges": 87,
"glob": 0,
- "largest": 673,
+ "largest": 701,
"largest_file": "src/config.rs",
- "lines": 15186,
- "priv": 119,
+ "lines": 15655,
+ "priv": 138,
"pub": 484,
"test": 48
}
diff --git a/tools/test-surface-reasons.json b/tools/test-surface-reasons.json
index b85eeff..8e4d320 100644
--- a/tools/test-surface-reasons.json
+++ b/tools/test-surface-reasons.json
@@ -1,14 +1,18 @@
{
"config.TestHooks": "the `hooks` field is already gated; the type and its impl are not, so they compile into a release build that can never read them.",
+ "config.cookie": "reading a session cookie off a request is plumbing inside `http`; the auth tests need it in order to forge one. Nothing outside `http` asks for a cookie by name.",
+ "config.login": "the router dispatches to it. The login tests drive a live listener over TCP, so they cannot move into the module that owns the handler.",
"config.shared_workspace": "`Config::validate` calls it at config.rs:226; tests/kata.rs and tests/remote_agent.rs call it too and both need a fixture.",
"config.store_dir": "the content-addressed store layout is resolved by this module for the cache and blob paths; tests/invariants.rs pins where a blob lands and needs a fixture.",
"db.MIGRATIONS": "`db::migrate` iterates it to apply pending migrations; tests/db.rs asserts the list is ordered and complete.",
"db.ReleaseState": "a row type named by twenty sites inside db; tests/pipeline.rs names it while driving a real pipeline.",
+ "db.Writer::shutdown": "the writer's shutdown is driven by `Drop` in production; only tests/writer.rs calls it explicitly to observe the drain.",
"db.cas_accepted_release": "production performs this CAS inside a transaction via `cas_accepted_release_in` (publish.rs:208); the standalone form has no caller in the crate. The census credited it with a production caller at the `pub use` continuation line in db/mod.rs \u2014 a re-export is not a call.",
"db.claim": "production leases with `claim_batch`; `claim` is called only by tests, so the release build need not compile it.",
"db.set_setting": "a settings writer with no production caller; `setting`/`setting_i64` readers are used, the setter is not.",
"db.shutdown": "`Writer::shutdown` is never called by the server; tests use it to quiesce the writer thread.",
"db.snapshot_by_commit": "a snapshot lookup nothing in production performs.",
+ "db.steps.touch": "deleted: nothing called it once the step-touching call sites were consolidated.",
"db.touch": "census false positive: `touch` appears in tests/shims.rs only inside a string literal. Narrow on its merits, not for the test tier.",
"db.tx_for_tests": "already gated behind test-support \u2014 the pattern the rest of this table asks for.",
"db.unapproved_index_entries": "an invariant query nothing runs; it needs `pub(crate)` diff internals to be useful, so it is gated rather than relocated.",
@@ -37,6 +41,7 @@
"sandbox.Exit": "the sandbox exit record, named across the backends; tests/failure_modes.rs asserts on it.",
"sandbox.K8sSandboxProvisioner": "the kata provisioner impl; tests/kata.rs drives it directly.",
"sandbox.KataBackend": "selected by `backend_for` when the config names an agent-sandbox backend; tests/kata.rs drives it directly.",
+ "sandbox.KataBackend::reclaim": "deleted: nothing called it; reclamation goes through the TTL sweep.",
"sandbox.LocalAgentProvisioner": "production selects `K8sSandboxProvisioner` (kata.rs:193); nothing in the crate constructs this type. It exists so tests can drive the real agent protocol against the shim binary without a cluster, so it is gated rather than deleted. The census credited its own `impl` headers as callers.",
"sandbox.LoopbackBackend": "the default backend; tests/failure_modes.rs constructs it to inject a fault.",
"sandbox.ProvisionRequest": "kata provisioning internals; the test that names them needs no fixture.",
@@ -53,6 +58,7 @@
"shims.invocations": "the shim appends to invocations.jsonl in production but nothing reads it back; the two credited sites name the *filename* in a string, and the only reader, `called_with`, is itself gated. Gated with it.",
"shims.manifest": "the shim manifest, read by `run` at mod.rs:161; seven test files read it to assert what a build did.",
"shims.valid_db_arg": "the shim's `--db` argument validator; production calls it at mod.rs:510, tests check its verdicts.",
+ "time.pin": "pins the clock so a test can advance it deterministically; production never pins.",
"time.unpin": "the clock escape hatch; `pin`/`unpin` exist so a test can freeze time. Its only in-module mention is a unit test.",
"time.virtual_sleep": "already gated behind test-support.",
"time.virtualize": "already gated behind test-support.",
diff --git a/tools/test-surface.md b/tools/test-surface.md
index 4465611..05e554f 100644
--- a/tools/test-surface.md
+++ b/tools/test-surface.md
@@ -46,58 +46,58 @@ The `residue` count is ratcheted by `tests/architecture.rs`, so it can only
shrink.
-## Residue — `pub` because Rust has no test-conditional visibility — 29 items
+## Feature-conditional visibility — production uses it, only from inside its module — 29 items
| module | item | declared at | test files | in-module call sites | why |
|---|---|---|---|---|---|
-| `config` | `store_dir` | `src/config.rs:357` | `architecture.rs`, `invariants.rs` | `src/config.rs:319`, `src/config.rs:361` ⚑ | the content-addressed store layout is resolved by this module for the cache and blob paths; tests/invariants.rs pins where a blob lands and needs a fixture. |
-| `db` | `MIGRATIONS` | `src/db/migrations.rs:326` | `db.rs` | `src/db/mod.rs:147` | `db::migrate` iterates it to apply pending migrations; tests/db.rs asserts the list is ordered and complete. |
-| `db` | `ReleaseState` | `src/db/model/state.rs:78` | `pipeline.rs` | `src/db/model/mod.rs:137`, `src/db/model/state.rs:85`, `src/db/model/state.rs:86` +11 | a row type named by twenty sites inside db; tests/pipeline.rs names it while driving a real pipeline. |
-| `http` | `LogTail` | `src/http/sse.rs:11` | `live.rs` | `src/http/routes/pages.rs:510` | the SSE tail type; the live test that names it drives a real server. |
-| `http` | `Page` | `src/http/render.rs:4` | `common/mod.rs` | `src/http/render.rs:55`, `src/http/render.rs:62`, `src/http/render.rs:71` +16 | the render model, named by twenty sites in http; tests/mod.rs asserts on it directly. |
-| `http` | `Panel` | `src/http/render.rs:142` | `versions.rs` | `src/http/render.rs:115`, `src/http/routes/pages.rs:116`, `src/http/routes/pages.rs:149` +1 | a diff panel in the render model; tests/versions.rs asserts on its body. |
-| `http` | `cookie` | `src/http/mod.rs:36` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:191`, `src/http/routes/mod.rs:38`, `src/http/routes/mod.rs:50` +2 ⚑ | the auth cookie helper; the tests that use it build no fixture, so they move into the module and it narrows. |
-| `http` | `login` | `src/http/routes/mod.rs:46` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:185` | the login route handler; same — its tests are harness-free and move with it. |
-| `ops` | `STAGING_GRACE_SECS` | `src/ops.rs:310` | `ops.rs` | `src/ops.rs:286` | the grace period the staging sweep applies at ops.rs:286; tests/ops.rs pins the value it must be. |
-| `ops` | `build_success_rate` | `src/ops.rs:46` | `ops.rs` | `src/ops.rs:87` ⚑ | computed inside the maintenance report at ops.rs:87; tests/ops.rs checks the arithmetic. |
-| `ops` | `sweep_staging` | `src/ops.rs:332` | `ops.rs` | `src/ops.rs:286` | called by the maintenance pass at ops.rs:286; tests/ops.rs exercises it directly. |
-| `pipeline` | `admissible` | `src/pipeline/dispatch.rs:100` | `dispatch.rs` | `src/pipeline/dispatch.rs:86` | the dispatch filter, called at dispatch.rs:86; tests/dispatch.rs pins which builds it admits. |
-| `pipeline` | `dispatch_once` | `src/pipeline/dispatch.rs:71` | `dispatch.rs` | `src/pipeline/dispatch.rs:60` | one tick of the dispatcher, called by the scheduler loop at dispatch.rs:60; tests/dispatch.rs drives single ticks. |
-| `pipeline` | `free_disk_mb` | `src/pipeline/dispatch.rs:113` | `dispatch.rs` | `src/pipeline/dispatch.rs:106` | the disk probe the dispatcher consults at dispatch.rs:106. |
-| `pipeline` | `index_world` | `src/pipeline/publish.rs:21` | `kata.rs` | `src/pipeline/mod.rs:255`, `src/pipeline/mod.rs:278`, `src/pipeline/steps.rs:92` | the world-index step, used by the pipeline at mod.rs:255 and steps.rs:92; tests/kata.rs checks what landed in the index. |
-| `pipeline` | `run_with` | `src/pipeline/mod.rs:189` | `failure_modes.rs`, `kata.rs`, `remote_agent.rs` | `src/pipeline/mod.rs:186` | the run entry point with an injected sandbox; production uses `run`, tests inject a fake. |
-| `review` | `BulkRefusal` | `src/review/approve.rs:155` | `approve.rs` | `src/review/approve.rs:151`, `src/review/approve.rs:180`, `src/review/approve.rs:184` +4 | the bulk-refusal payload, built and matched across approve.rs; tests/approve.rs asserts on it. |
-| `review` | `LOW` | `src/review/risk.rs:6` | `notices.rs` | `src/review/risk.rs:94`, `src/review/risk.rs:189`, `src/review/risk.rs:195` | the risk floor, compared at risk.rs:94,189,195; tests/notices.rs pins where the floor bites. |
-| `sandbox` | `Exit` | `src/sandbox/mod.rs:43` | `failure_modes.rs` | `src/sandbox/agent.rs:210`, `src/sandbox/loopback.rs:51`, `src/sandbox/loopback.rs:80` +6 | the sandbox exit record, named across the backends; tests/failure_modes.rs asserts on it. |
-| `sandbox` | `KataBackend` | `src/sandbox/kata.rs:179` | `kata.rs` | `src/sandbox/kata.rs:189`, `src/sandbox/kata.rs:200`, `src/sandbox/mod.rs:97` | selected by `backend_for` when the config names an agent-sandbox backend; tests/kata.rs drives it directly. |
-| `sandbox` | `LoopbackBackend` | `src/sandbox/loopback.rs:10` | `failure_modes.rs` | `src/sandbox/mod.rs:92` | the default backend; tests/failure_modes.rs constructs it to inject a fault. |
-| `sandbox` | `RemoteBackend` | `src/sandbox/remote.rs:12` | `remote_agent.rs` | `src/sandbox/mod.rs:94` | the remote backend; tests/remote_agent.rs constructs it against a real agent. |
-| `sandbox` | `SandboxInfo` | `src/sandbox/mod.rs:70` | `failure_modes.rs` | `src/sandbox/kata.rs:319`, `src/sandbox/kata.rs:320`, `src/sandbox/loopback.rs:31` +4 | the return type of `SandboxBackend::status`; tests/failure_modes.rs reads its fields. |
-| `shims` | `manifest` | `src/shims/mod.rs:88` | `common/mod.rs`, `invariants.rs`, `pipeline.rs`, `production_surface.rs` … | `src/shims/mod.rs:176` | the shim manifest, read by `run` at mod.rs:161; seven test files read it to assert what a build did. |
-| `shims` | `valid_db_arg` | `src/shims/mod.rs:494` | `shims.rs` | `src/shims/mod.rs:525` | the shim's `--db` argument validator; production calls it at mod.rs:510, tests check its verdicts. |
-| `watch` | `StageBSlot` | `src/watch/upstream.rs:118` | `vcs.rs` | `src/watch/upstream.rs:130`, `src/watch/upstream.rs:166` | the stage-B cache slot shape; tests/vcs.rs asserts on it while driving a real mirror. |
-| `watch` | `needs_stage_b` | `src/watch/upstream.rs:20` | `vcs.rs` | `src/watch/detect.rs:101` ⚑ | the stage-B predicate, consulted by detect.rs:101. |
-| `watch` | `probe` | `src/watch/upstream.rs:25` | `ops.rs`, `vcs.rs` | `src/watch/detect.rs:95` | the upstream probe, called by detect.rs:95; tests/ops.rs and tests/vcs.rs both need a fixture. |
-| `watch` | `sync_mirror` | `src/watch/mirror.rs:17` | `detect.rs` | `src/watch/detect.rs:40` | the mirror sync, called by detect.rs:40; tests/detect.rs drives a real sync. |
+| `config` | `store_dir` | `src/config.rs:376` | `architecture.rs`, `invariants.rs` | `src/config.rs:333`, `src/config.rs:389` ⚑ | the content-addressed store layout is resolved by this module for the cache and blob paths; tests/invariants.rs pins where a blob lands and needs a fixture. |
+| `db` | `MIGRATIONS` | `src/db/migrations.rs:343` | `db.rs` | `src/db/mod.rs:157` | `db::migrate` iterates it to apply pending migrations; tests/db.rs asserts the list is ordered and complete. |
+| `db` | `ReleaseState` | `src/db/model/state.rs:85` | `pipeline.rs` | `src/db/model/mod.rs:137`, `src/db/model/state.rs:104`, `src/db/model/state.rs:105` +11 | a row type named by twenty sites inside db; tests/pipeline.rs names it while driving a real pipeline. |
+| `http` | `LogTail` | `src/http/sse.rs:18` | `live.rs` | `src/http/routes/pages.rs:510` | the SSE tail type; the live test that names it drives a real server. |
+| `http` | `Page` | `src/http/render.rs:9` | `common/mod.rs` | `src/http/render.rs:72`, `src/http/render.rs:79`, `src/http/render.rs:88` +16 | the render model, named by twenty sites in http; tests/mod.rs asserts on it directly. |
+| `http` | `Panel` | `src/http/render.rs:164` | `versions.rs` | `src/http/render.rs:132`, `src/http/routes/pages.rs:116`, `src/http/routes/pages.rs:149` +1 | a diff panel in the render model; tests/versions.rs asserts on its body. |
+| `http` | `cookie` | `src/http/mod.rs:41` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:205`, `src/http/routes/mod.rs:38`, `src/http/routes/mod.rs:64` +2 ⚑ | the auth cookie helper; the tests that use it build no fixture, so they move into the module and it narrows. |
+| `http` | `login` | `src/http/routes/mod.rs:51` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:199` | the login route handler; same — its tests are harness-free and move with it. |
+| `ops` | `STAGING_GRACE_SECS` | `src/ops.rs:333` | `ops.rs` | `src/ops.rs:300` | the grace period the staging sweep applies at ops.rs:286; tests/ops.rs pins the value it must be. |
+| `ops` | `build_success_rate` | `src/ops.rs:51` | `ops.rs` | `src/ops.rs:101` ⚑ | computed inside the maintenance report at ops.rs:87; tests/ops.rs checks the arithmetic. |
+| `ops` | `sweep_staging` | `src/ops.rs:363` | `ops.rs` | `src/ops.rs:300` | called by the maintenance pass at ops.rs:286; tests/ops.rs exercises it directly. |
+| `pipeline` | `admissible` | `src/pipeline/dispatch.rs:119` | `dispatch.rs` | `src/pipeline/dispatch.rs:100` | the dispatch filter, called at dispatch.rs:86; tests/dispatch.rs pins which builds it admits. |
+| `pipeline` | `dispatch_once` | `src/pipeline/dispatch.rs:76` | `dispatch.rs` | `src/pipeline/dispatch.rs:60` | one tick of the dispatcher, called by the scheduler loop at dispatch.rs:60; tests/dispatch.rs drives single ticks. |
+| `pipeline` | `free_disk_mb` | `src/pipeline/dispatch.rs:146` | `dispatch.rs` | `src/pipeline/dispatch.rs:134` | the disk probe the dispatcher consults at dispatch.rs:106. |
+| `pipeline` | `index_world` | `src/pipeline/publish.rs:26` | `kata.rs` | `src/pipeline/mod.rs:269`, `src/pipeline/mod.rs:292`, `src/pipeline/steps.rs:92` | the world-index step, used by the pipeline at mod.rs:255 and steps.rs:92; tests/kata.rs checks what landed in the index. |
+| `pipeline` | `run_with` | `src/pipeline/mod.rs:194` | `failure_modes.rs`, `kata.rs`, `remote_agent.rs` | `src/pipeline/mod.rs:186` | the run entry point with an injected sandbox; production uses `run`, tests inject a fake. |
+| `review` | `BulkRefusal` | `src/review/approve.rs:162` | `approve.rs` | `src/review/approve.rs:151`, `src/review/approve.rs:199`, `src/review/approve.rs:203` +4 | the bulk-refusal payload, built and matched across approve.rs; tests/approve.rs asserts on it. |
+| `review` | `LOW` | `src/review/risk.rs:13` | `notices.rs` | `src/review/risk.rs:105`, `src/review/risk.rs:200`, `src/review/risk.rs:206` | the risk floor, compared at risk.rs:94,189,195; tests/notices.rs pins where the floor bites. |
+| `sandbox` | `Exit` | `src/sandbox/mod.rs:44` | `failure_modes.rs` | `src/sandbox/agent.rs:210`, `src/sandbox/loopback.rs:72`, `src/sandbox/loopback.rs:101` +6 | the sandbox exit record, named across the backends; tests/failure_modes.rs asserts on it. |
+| `sandbox` | `KataBackend` | `src/sandbox/kata.rs:185` | `kata.rs` | `src/sandbox/kata.rs:195`, `src/sandbox/kata.rs:206`, `src/sandbox/mod.rs:121` | selected by `backend_for` when the config names an agent-sandbox backend; tests/kata.rs drives it directly. |
+| `sandbox` | `LoopbackBackend` | `src/sandbox/loopback.rs:19` | `failure_modes.rs` | `src/sandbox/mod.rs:116` | the default backend; tests/failure_modes.rs constructs it to inject a fault. |
+| `sandbox` | `RemoteBackend` | `src/sandbox/remote.rs:21` | `remote_agent.rs` | `src/sandbox/mod.rs:118` | the remote backend; tests/remote_agent.rs constructs it against a real agent. |
+| `sandbox` | `SandboxInfo` | `src/sandbox/mod.rs:82` | `failure_modes.rs` | `src/sandbox/kata.rs:305`, `src/sandbox/kata.rs:306`, `src/sandbox/loopback.rs:52` +4 | the return type of `SandboxBackend::status`; tests/failure_modes.rs reads its fields. |
+| `shims` | `manifest` | `src/shims/mod.rs:93` | `common/mod.rs`, `invariants.rs`, `pipeline.rs`, `production_surface.rs` … | `src/shims/mod.rs:190` | the shim manifest, read by `run` at mod.rs:161; seven test files read it to assert what a build did. |
+| `shims` | `valid_db_arg` | `src/shims/mod.rs:513` | `shims.rs` | `src/shims/mod.rs:553` | the shim's `--db` argument validator; production calls it at mod.rs:510, tests check its verdicts. |
+| `watch` | `StageBSlot` | `src/watch/upstream.rs:153` | `vcs.rs` | `src/watch/upstream.rs:165`, `src/watch/upstream.rs:213` | the stage-B cache slot shape; tests/vcs.rs asserts on it while driving a real mirror. |
+| `watch` | `needs_stage_b` | `src/watch/upstream.rs:25` | `vcs.rs` | `src/watch/detect.rs:101` ⚑ | the stage-B predicate, consulted by detect.rs:101. |
+| `watch` | `probe` | `src/watch/upstream.rs:44` | `ops.rs`, `vcs.rs` | `src/watch/detect.rs:95` | the upstream probe, called by detect.rs:95; tests/ops.rs and tests/vcs.rs both need a fixture. |
+| `watch` | `sync_mirror` | `src/watch/mirror.rs:22` | `detect.rs` | `src/watch/detect.rs:40` | the mirror sync, called by detect.rs:40; tests/detect.rs drives a real sync. |
## Already gated — 17 items
| module | item | declared at | test files | in-module call sites | why |
|---|---|---|---|---|---|
-| `config` | `TestHooks` | `src/config.rs:143` | `common/mod.rs`, `production_surface.rs` | `src/config.rs:128`, `src/config.rs:185` | the `hooks` field is already gated; the type and its impl are not, so they compile into a release build that can never read them. |
+| `config` | `TestHooks` | `src/config.rs:157` | `common/mod.rs`, `production_surface.rs` | `src/config.rs:142`, `src/config.rs:199` | the `hooks` field is already gated; the type and its impl are not, so they compile into a release build that can never read them. |
| `db` | `cas_accepted_release` | `src/db/pkgbases.rs:94` | `db.rs` | — | production performs this CAS inside a transaction via `cas_accepted_release_in` (publish.rs:208); the standalone form has no caller in the crate. The census credited it with a production caller at the `pub use` continuation line in db/mod.rs — a re-export is not a call. |
| `db` | `claim` | `src/db/builds/mod.rs:138` | `common/mod.rs`, `state_machine.rs`, `time.rs` | — | production leases with `claim_batch`; `claim` is called only by tests, so the release build need not compile it. |
| `db` | `set_setting` | `src/db/settings.rs:44` | `db.rs` | — | a settings writer with no production caller; `setting`/`setting_i64` readers are used, the setter is not. |
-| `db` | `shutdown` | `src/db/mod.rs:266` | `common/mod.rs`, `crash.rs`, `dispatch.rs` | — | `Writer::shutdown` is never called by the server; tests use it to quiesce the writer thread. |
+| `db` | `shutdown` | `src/db/mod.rs:276` | `common/mod.rs`, `crash.rs`, `dispatch.rs` | — | `Writer::shutdown` is never called by the server; tests use it to quiesce the writer thread. |
| `db` | `snapshot_by_commit` | `src/db/snapshots.rs:55` | `detect.rs` | — | a snapshot lookup nothing in production performs. |
-| `db` | `tx_for_tests` | `src/db/mod.rs:273` | `approve.rs`, `common/mod.rs`, `db.rs`, `invariants.rs` … | — | already gated behind test-support — the pattern the rest of this table asks for. |
+| `db` | `tx_for_tests` | `src/db/mod.rs:283` | `approve.rs`, `common/mod.rs`, `db.rs`, `invariants.rs` … | — | already gated behind test-support — the pattern the rest of this table asks for. |
| `db` | `unapproved_index_entries` | `src/db/invariants.rs:15` | `db.rs`, `detect.rs`, `notices.rs`, `shims.rs` | — | an invariant query nothing runs; it needs `pub(crate)` diff internals to be useful, so it is gated rather than relocated. |
| `db` | `world_members` | `src/db/world.rs:32` | `db.rs` | — | a world-snapshot reader nothing calls; `put_world_snapshot` is the half production uses. |
| `review` | `render_and_store` | `src/review/diff.rs:282` | `approve.rs`, `common/mod.rs`, `crash.rs`, `dispatch.rs` … | — | intake renders through `review::intake::record`; this wrapper has zero callers in src and 17 in tests. Gated, not relocated: it needs the module-private diff renderer. |
| `sandbox` | `LocalAgentProvisioner` | `src/sandbox/kata.rs:134` | `kata.rs` | — | production selects `K8sSandboxProvisioner` (kata.rs:193); nothing in the crate constructs this type. It exists so tests can drive the real agent protocol against the shim binary without a cluster, so it is gated rather than deleted. The census credited its own `impl` headers as callers. |
-| `sandbox` | `local_addr` | `src/sandbox/remote.rs:36` | `architecture.rs`, `remote_agent.rs` | `src/sandbox/kata.rs:232`, `src/sandbox/mod.rs:120` ⚑ | DELETED from kata.rs and gated on remote.rs. `KataBackend::local_addr` had zero callers anywhere and is gone; `RemoteBackend::local_addr` is called only by tests/remote_agent.rs, so it is gated. Both were credited with production callers at `listener.local_addr()`, which is std's method on a TcpListener in a sibling file — the census treats all of src/sandbox as one module and a name match cannot tell a receiver's type. This row is why `dotted_only` confirmation exists. |
-| `shims` | `called_with` | `src/shims/mod.rs:159` | `crash.rs`, `dispatch.rs`, `invariants.rs`, `kata.rs` … | — | reads the shim's invocation log, which only tests inspect. |
-| `shims` | `invocations` | `src/shims/mod.rs:141` | `shims.rs` | — | the shim appends to invocations.jsonl in production but nothing reads it back; the two credited sites name the *filename* in a string, and the only reader, `called_with`, is itself gated. Gated with it. |
+| `sandbox` | `local_addr` | `src/sandbox/remote.rs:57` | `architecture.rs`, `remote_agent.rs` | `src/sandbox/kata.rs:238`, `src/sandbox/mod.rs:144` ⚑ | DELETED from kata.rs and gated on remote.rs. `KataBackend::local_addr` had zero callers anywhere and is gone; `RemoteBackend::local_addr` is called only by tests/remote_agent.rs, so it is gated. Both were credited with production callers at `listener.local_addr()`, which is std's method on a TcpListener in a sibling file — the census treats all of src/sandbox as one module and a name match cannot tell a receiver's type. This row is why `dotted_only` confirmation exists. |
+| `shims` | `called_with` | `src/shims/mod.rs:173` | `crash.rs`, `dispatch.rs`, `invariants.rs`, `kata.rs` … | — | reads the shim's invocation log, which only tests inspect. |
+| `shims` | `invocations` | `src/shims/mod.rs:155` | `shims.rs` | — | the shim appends to invocations.jsonl in production but nothing reads it back; the two credited sites name the *filename* in a string, and the only reader, `called_with`, is itself gated. Gated with it. |
| `time` | `unpin` | `src/time.rs:57` | `time.rs` | — | the clock escape hatch; `pin`/`unpin` exist so a test can freeze time. Its only in-module mention is a unit test. |
| `time` | `virtual_sleep` | `src/time.rs:178` | `production_surface.rs` | `src/time.rs:90`, `src/time.rs:106` | already gated behind test-support. |
| `time` | `virtualize` | `src/time.rs:129` | `crash.rs`, `dispatch.rs`, `production_surface.rs` | — | already gated behind test-support. |
@@ -106,11 +106,11 @@ shrink.
| disposition | count |
|---|---|
-| `residue` | 29 |
+| `narrowed` | 29 |
| `already-gated` | 17 |
| **total** | **46** |
-Of these, 29 are ungated today. Gating the `gate` rows and narrowing the
+Of these, 0 are ungated today. Gating the `gate` rows and narrowing the
`narrow` rows removes 0 items from the release build's public surface; the
`move-test` rows remove 0 more and take their tests home with them.
diff --git a/tools/test-surface.py b/tools/test-surface.py
index b21133a..6121889 100644
--- a/tools/test-surface.py
+++ b/tools/test-surface.py
@@ -182,6 +182,59 @@ def gated_declarations(path):
return out
+def aliased_behind_private_module(path, name):
+ """True when the only public path to `name` is a gated `pub use` alias.
+
+ The inner-module narrowing declares the item `pub` inside a module nobody
+ outside can name, then re-exports it under a feature gate:
+
+ mod kata_backend { pub struct KataBackend { ... } }
+ #[cfg(feature = "test-support")] pub use kata_backend::KataBackend;
+ #[cfg(not(feature = "test-support"))] pub(crate) use kata_backend::KataBackend;
+
+ The census sees the inner `pub` and calls it a public declaration. It is
+ not one: a `pub` item in a private module has no nameable path, and the
+ alias that gives it one is gated. Both halves must hold for this to be true.
+ """
+ lines = open(path).read().split("\n")
+
+ # 1. is there a `pub use ...::NAME;` whose attribute block carries the gate?
+ aliased = False
+ for i, line in enumerate(lines):
+ if not re.search(r"^\s*pub\s+use\s+[^;]*::%s\b" % re.escape(name), line):
+ continue
+ k = i - 1
+ while k >= i - 8 and (lines[k].strip().startswith("#[")
+ or lines[k].strip().startswith("//")
+ or not lines[k].strip()):
+ if GATE in lines[k]:
+ aliased = True
+ k -= 1
+ if not aliased:
+ return False
+
+ # 2. does every `pub` declaration of the name sit inside a private module?
+ decls = [i for i, l in enumerate(lines)
+ if re.match(r"^\s*pub\s+(?:fn|struct|enum|trait|const|static|type)\s+%s\b"
+ % re.escape(name), l)]
+ if not decls:
+ return False
+ for d in decls:
+ depth, enclosed = 0, []
+ for k in range(d - 1, -1, -1):
+ # Walking backwards, an unmatched `{` means that line opens a block
+ # we are inside of.
+ depth += lines[k].count("{") - lines[k].count("}")
+ if depth > 0:
+ m = re.match(r"^\s*(pub(?:\(crate\))?\s+)?mod\s+(\w+)", lines[k])
+ if m:
+ enclosed.append(m.group(1))
+ depth -= 1
+ if not enclosed or any(enc for enc in enclosed):
+ return False
+ return True
+
+
def integration_tests(path):
lines = open(path).read().split("\n")
starts = [i for i, l in enumerate(lines) if l.lstrip().startswith("#[test]")]
@@ -220,7 +273,8 @@ def analyse():
occ = [(os.path.relpath(p, ROOT), ln, g)
for p in paths for (ln, g) in gated_declarations(p).get(name, [])]
- gated = any(g for _, _, g in occ)
+ gated = any(g for _, _, g in occ) or any(
+ aliased_behind_private_module(p, name) for p in paths)
# A mention inside a string literal is not a call.
string_only = all(