summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/release-surface-probe.py1
-rw-r--r--tools/test-surface.md10
-rw-r--r--tools/test-surface.py21
3 files changed, 13 insertions, 19 deletions
diff --git a/tools/release-surface-probe.py b/tools/release-surface-probe.py
index ad87e1d..34c598d 100644
--- a/tools/release-surface-probe.py
+++ b/tools/release-surface-probe.py
@@ -267,7 +267,6 @@ def main():
pat = re.compile(r"\b%s\b" % re.escape(d["name"]))
if pat.search(tests_text):
return True
- decl_line = d["file"], d["where"].rsplit(":", 1)[1]
for p, text in anywhere.items():
if p != d["file"]:
if pat.search(text):
diff --git a/tools/test-surface.md b/tools/test-surface.md
index 37fba97..4535104 100644
--- a/tools/test-surface.md
+++ b/tools/test-surface.md
@@ -77,16 +77,16 @@ reaches the test tier also reaches a release build.
| `config` | `shared_workspace` | `src/config.rs:98` | `config.rs`, `kata.rs`, `remote_agent.rs` | `src/config.rs:19`, `src/config.rs:30`, `src/config.rs:40` +8 | `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` | `src/config.rs:374` | `architecture.rs`, `invariants.rs` | `src/config.rs:331`, `src/config.rs:387` ⚑ | 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:344` | `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. |
-| `http` | `cookie` | `src/http/mod.rs:42` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:223`, `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:217` | the login route handler; same — its tests are harness-free and move with it. |
+| `http` | `cookie` | `src/http/mod.rs:42` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:224`, `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:218` | 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:130` | `dispatch.rs` | `src/pipeline/dispatch.rs:111` | the dispatch filter, called at dispatch.rs:86; tests/dispatch.rs pins which builds it admits. |
| `pipeline` | `dispatch_once` | `src/pipeline/dispatch.rs:87` | `dispatch.rs` | `src/pipeline/dispatch.rs:71` | 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:157` | `dispatch.rs` | `src/pipeline/dispatch.rs:145` | 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. |
+| `pipeline` | `index_world` | `src/pipeline/publish.rs:26` | `kata.rs` | `src/pipeline/mod.rs:268`, `src/pipeline/mod.rs:291`, `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:193` | `failure_modes.rs`, `kata.rs`, `remote_agent.rs` | `src/pipeline/mod.rs:185` | the run entry point with an injected sandbox; production uses `run`, tests inject a fake. |
| `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. |
| `shims` | `manifest` | `src/shims/mod.rs:96` | `common/mod.rs`, `invariants.rs`, `pipeline.rs`, `production_surface.rs` … | `src/shims/mod.rs:194` | 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:521` | `shims.rs` | `src/shims/mod.rs:561` | the shim's `--db` argument validator; production calls it at mod.rs:510, tests check its verdicts. |
@@ -109,7 +109,7 @@ reaches the test tier also reaches a release build.
| `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. |
| `review` | `withdraw` | `src/review/approve.rs:235` | `architecture.rs`, `pipeline.rs`, `production_surface.rs` | — | Single-release withdraw. The CLI and the web UI both go through `usecase::withdraw_package` -> `pipeline::publish::withdraw_package`; nothing invokes this. tests/pipeline.rs pins its invariants (a second withdraw is refused, an unknown release is refused), so it is gated rather than deleted: the test is the cover for the operation production has not grown yet. |
| `sandbox` | `LocalAgentProvisioner` | `src/sandbox/kata.rs:136` | `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:57` | `architecture.rs`, `remote_agent.rs` | `src/sandbox/kata.rs:240`, `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. |
+| `sandbox` | `local_addr` | `src/sandbox/remote.rs:57` | `architecture.rs`, `remote_agent.rs` | `src/sandbox/kata.rs:240`, `src/sandbox/mod.rs:142` ⚑ | 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:177` | `crash.rs`, `dispatch.rs`, `invariants.rs`, `kata.rs` … | — | reads the shim's invocation log, which only tests inspect. |
| `shims` | `invocations` | `src/shims/mod.rs:159` | `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. |
diff --git a/tools/test-surface.py b/tools/test-surface.py
index ae5a78f..4110c06 100644
--- a/tools/test-surface.py
+++ b/tools/test-surface.py
@@ -333,7 +333,7 @@ def use_prefixes(path):
if item == "self":
out.setdefault(base.split("::")[-1], top)
elif " as " in item:
- a, b = item.split(" as ", 1)
+ _, b = item.split(" as ", 1)
out.setdefault(b.strip(), top)
else:
out.setdefault(item, top)
@@ -432,17 +432,6 @@ def analyse():
# to the module that published it: `notice_kind` routes to `db`.
ALIAS_TOP = {(m, n): m for (m, n) in REEXPORTS}
- # A bare mention in another module cannot be resolved to one item when the
- # same name is declared in several modules — `new`, `parse` and `open` are
- # declared all over the crate, and a line saying `Foo::new()` in `http` says
- # nothing about `db::open`. For a colliding name a mention counts only if
- # the line actually routes through the declaring module: a qualified path
- # (`db::open`, `crate::db::open`) or a `use` that imports from it. A
- # colliding name with unqualified mentions is kept and flagged, because the
- # honest answer is "a line-based tool cannot tell" and a human should.
- collisions = {name for (mod, name) in names if
- len({m for (m, n) in names if n == name}) > 1}
-
def mentioned(line, mod, name, prefixes, file_mod):
"""Does this line show production reaching `mod::name`?
@@ -458,6 +447,13 @@ def analyse():
`review`, and production calls it `candidates::mark_viewed`. And the
unresolvable cases are mostly std and local names wearing a crate item's
name: `Vec::new()`, `v.parse::<u64>()`, `stop.load(..)`.
+
+ A name declared in several modules — `new`, `parse` and `open` are
+ declared all over the crate — is the hard case: a line saying
+ `Foo::new()` in `http` says nothing about `db::open`, so a mention of a
+ colliding name counts only when the line routes through the declaring
+ module, and an unqualified mention of one is flagged for a human rather
+ than guessed at.
"""
top = mod.split(os.sep)[0]
# A method name declared in exactly one module is safe to credit: there
@@ -634,7 +630,6 @@ def render(rows):
"already-gated": "Already gated",
"interface": "Public because a public signature requires it; no test asked for it",
"narrowed": "Feature-conditional visibility — production uses it, only from inside its module"}
- out = [open(DOC).read().split("## gate-marker")[0]] if False else []
L = []
A = L.append
A("# The test surface: every `pub` item that exists because a test names it\n")