<feed xmlns='http://www.w3.org/2005/Atom'>
<title>aur-build/tools/test-surface-reasons.json, branch ai/main</title>
<subtitle>Unnamed repository
</subtitle>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/aur-build/'/>
<entry>
<title>tools: key items by (module, name), and prove the surface by compiling</title>
<updated>2026-11-21T09:38:33+00:00</updated>
<author>
<name>aur-build</name>
<email>aur-build@localhost</email>
</author>
<published>2026-11-21T09:38:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/aur-build/commit/?id=d3da3a1882999a80db34089153f9684fd8d7bbee'/>
<id>d3da3a1882999a80db34089153f9684fd8d7bbee</id>
<content type='text'>
The auditor's two counterexamples were both detector bugs, and they were the
same class of bug as the ones before: the instrument was reading the source in a
way that flattered the number.

- Rows are keyed by `(module, name)`. Keyed by bare name,
  `pipeline::dispatch::Pool::shutdown` merged into the `db::Writer::shutdown`
  row, which is gated, so an ungated item was reported `already-gated`.
- The production-mention index is built from lines with comments and string
  literals removed. Searching raw text made `review::approve::withdraw` look
  production-used because the *string* "withdraw" appears in an HTTP route
  pattern and an audit action; every real caller named `withdraw_package` or
  `withdraw_release_in`, which are different items.
- A `pub` declaration inside a private module is not a public declaration.
  Without that, the inner-module narrowing made the detector report an
  `http::new` nobody could name.
- For a name declared in several modules — `new`, `open`, `record`, `parse` — a
  bare mention elsewhere cannot be resolved, so the row is kept and flagged
  `ambiguous` rather than silently dropped, and
  `tools/test-surface-ambiguous.json` holds the human verdict. An ambiguous row
  with no verdict fails the architecture test; "the tool could not tell" is not a
  disposition.
- The count rule was duplicated between `--json` and `--write-budget` and the
  two drifted the moment a rule was added to one. `tally()` is now the one place.

`tools/release-surface-probe.py` replaces inference with compilation for the
final claim. It writes a throwaway crate depending on `aur-build` twice, with and
without `test-support`, and tries to name every dispositioned item from outside.
A path that compiles with the feature proves the path is real; every such path
must fail without it. Current result: 28 real external paths, 27 closed in a
release build, and the one that stays open is `db::Writer`, which is public
because `Db` has a `pub writer: Writer` field and Rust will not type a public
field with a private type. That is recorded as `interface` in
`tools/test-surface-interface.json` — a disposition that admits reachability and
names the signature that forces it — and the probe fails if the file claims an
item that is not in fact reachable, so it cannot quietly rot.

The tool's own docstring and the generated table claimed "Rust has no
test-conditional visibility". That was false and is gone, replaced with the two
shapes that do it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The auditor's two counterexamples were both detector bugs, and they were the
same class of bug as the ones before: the instrument was reading the source in a
way that flattered the number.

- Rows are keyed by `(module, name)`. Keyed by bare name,
  `pipeline::dispatch::Pool::shutdown` merged into the `db::Writer::shutdown`
  row, which is gated, so an ungated item was reported `already-gated`.
- The production-mention index is built from lines with comments and string
  literals removed. Searching raw text made `review::approve::withdraw` look
  production-used because the *string* "withdraw" appears in an HTTP route
  pattern and an audit action; every real caller named `withdraw_package` or
  `withdraw_release_in`, which are different items.
- A `pub` declaration inside a private module is not a public declaration.
  Without that, the inner-module narrowing made the detector report an
  `http::new` nobody could name.
- For a name declared in several modules — `new`, `open`, `record`, `parse` — a
  bare mention elsewhere cannot be resolved, so the row is kept and flagged
  `ambiguous` rather than silently dropped, and
  `tools/test-surface-ambiguous.json` holds the human verdict. An ambiguous row
  with no verdict fails the architecture test; "the tool could not tell" is not a
  disposition.
- The count rule was duplicated between `--json` and `--write-budget` and the
  two drifted the moment a rule was added to one. `tally()` is now the one place.

`tools/release-surface-probe.py` replaces inference with compilation for the
final claim. It writes a throwaway crate depending on `aur-build` twice, with and
without `test-support`, and tries to name every dispositioned item from outside.
A path that compiles with the feature proves the path is real; every such path
must fail without it. Current result: 28 real external paths, 27 closed in a
release build, and the one that stays open is `db::Writer`, which is public
because `Db` has a `pub writer: Writer` field and Rust will not type a public
field with a private type. That is recorded as `interface` in
`tools/test-surface-interface.json` — a disposition that admits reachability and
names the signature that forces it — and the probe fails if the file claims an
item that is not in fact reachable, so it cannot quietly rot.

The tool's own docstring and the generated table claimed "Rust has no
test-conditional visibility". That was false and is gone, replaced with the two
shapes that do it.
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: the detector learns to see through a private inner module</title>
<updated>2026-11-20T23:53:49+00:00</updated>
<author>
<name>aur-build</name>
<email>aur-build@localhost</email>
</author>
<published>2026-11-20T23:53:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/aur-build/commit/?id=28023ba17adbe6fc096a31d5e2c62d017a88fc4c'/>
<id>28023ba17adbe6fc096a31d5e2c62d017a88fc4c</id>
<content type='text'>
`aliased_behind_private_module` reports an item as not release-exposed only when
both halves of the pattern hold: a `pub use ..::NAME;` whose attribute block
carries the test-support gate, and every `pub` declaration of the name sitting
inside a module that is itself private. Either half alone is not enough — a
gated alias to a genuinely public type says nothing, and a `pub` type in a
public module is reachable whatever the alias says.

The census still counts the inner `pub` as a public declaration, which is the
honest reading of the text and the reason this needed a second check rather than
a change to the first.

New `narrowed` disposition, distinct from `already-gated`: production *does* use
these items, just never from outside their module. `residue` and `ungated` are
now 0 and the ratchet records it.

Every one of the 46 items carries a hand-written reason naming its production
caller or explaining why it has none.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`aliased_behind_private_module` reports an item as not release-exposed only when
both halves of the pattern hold: a `pub use ..::NAME;` whose attribute block
carries the test-support gate, and every `pub` declaration of the name sitting
inside a module that is itself private. Either half alone is not enough — a
gated alias to a genuinely public type says nothing, and a `pub` type in a
public module is reachable whatever the alias says.

The census still counts the inner `pub` as a public declaration, which is the
honest reading of the text and the reason this needed a second check rather than
a change to the first.

New `narrowed` disposition, distinct from `already-gated`: production *does* use
these items, just never from outside their module. `residue` and `ungated` are
now 0 and the ratchet records it.

Every one of the 46 items carries a hand-written reason naming its production
caller or explaining why it has none.
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: the test-surface detector credited four items with callers they lack</title>
<updated>2026-11-20T22:13:44+00:00</updated>
<author>
<name>aur-build</name>
<email>aur-build@localhost</email>
</author>
<published>2026-11-20T22:13:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/aur-build/commit/?id=92ecaabd7c62d029eba239e95cc8a7d2520fe4a9'/>
<id>92ecaabd7c62d029eba239e95cc8a7d2520fe4a9</id>
<content type='text'>
An audit found that `internal` — the check deciding whether a test-only item
has a real production caller — was crediting non-calls. Four items were
sorted into `residue` on false evidence, and each false credit was a
different mistake:

  db::cas_accepted_release   a `pub use` continuation line at db/mod.rs:55.
                             Production does this CAS through
                             `cas_accepted_release_in` inside a transaction;
                             the two names differ by three characters.
  shims::invocations         the string "invocations.jsonl", plus a call from
                             `called_with`, which is itself test-support
                             gated. A test-only function cannot be evidence
                             that another function is production-used.
  sandbox::LocalAgentProvisioner   its own struct and impl headers.
                             Production selects `K8sSandboxProvisioner`.
  sandbox::local_addr        `listener.local_addr()` — std's method on a
                             TcpListener, in sibling files. The census treats
                             all of src/sandbox as one module, and a name
                             match cannot tell a receiver's type.

All four are gated now. `KataBackend::local_addr` had zero callers in src and
zero in tests — `tests/remote_agent.rs` calls `RemoteBackend::local_addr`, a
different type — so it is deleted rather than gated.

The detector now strips string literals and comments, skips `use` statements
including the continuation lines of a brace-delimited block, skips an item's
own impl headers, and refuses to count a call made inside a `#[cfg(test)]`
module or a `test-support`-gated item.

The case a regex cannot resolve is `self.store_dir()` versus
`listener.local_addr()`: identical to a name match. Rows whose only evidence
is a call in method position are flagged `⚑`, listed in
`tools/test-surface-confirmed.json` only after a human read the cited line,
and `the_test_surface_is_disposed_of` fails on any unconfirmed one. Four rows
are confirmed that way — `config.store_dir`, `http.cookie`,
`ops.build_success_rate`, `watch.needs_stage_b`.

The table now prints each item's in-module call sites as its own column,
because the residue count is the one number this work cannot eliminate and the
claim underneath it has to be checkable rather than asserted.

Suite: 284 passed, 0 failed. Clippy clean. Release build clean.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An audit found that `internal` — the check deciding whether a test-only item
has a real production caller — was crediting non-calls. Four items were
sorted into `residue` on false evidence, and each false credit was a
different mistake:

  db::cas_accepted_release   a `pub use` continuation line at db/mod.rs:55.
                             Production does this CAS through
                             `cas_accepted_release_in` inside a transaction;
                             the two names differ by three characters.
  shims::invocations         the string "invocations.jsonl", plus a call from
                             `called_with`, which is itself test-support
                             gated. A test-only function cannot be evidence
                             that another function is production-used.
  sandbox::LocalAgentProvisioner   its own struct and impl headers.
                             Production selects `K8sSandboxProvisioner`.
  sandbox::local_addr        `listener.local_addr()` — std's method on a
                             TcpListener, in sibling files. The census treats
                             all of src/sandbox as one module, and a name
                             match cannot tell a receiver's type.

All four are gated now. `KataBackend::local_addr` had zero callers in src and
zero in tests — `tests/remote_agent.rs` calls `RemoteBackend::local_addr`, a
different type — so it is deleted rather than gated.

The detector now strips string literals and comments, skips `use` statements
including the continuation lines of a brace-delimited block, skips an item's
own impl headers, and refuses to count a call made inside a `#[cfg(test)]`
module or a `test-support`-gated item.

The case a regex cannot resolve is `self.store_dir()` versus
`listener.local_addr()`: identical to a name match. Rows whose only evidence
is a call in method position are flagged `⚑`, listed in
`tools/test-surface-confirmed.json` only after a human read the cited line,
and `the_test_surface_is_disposed_of` fails on any unconfirmed one. Four rows
are confirmed that way — `config.store_dir`, `http.cookie`,
`ops.build_success_rate`, `watch.needs_stage_b`.

The table now prints each item's in-module call sites as its own column,
because the residue count is the one number this work cannot eliminate and the
claim underneath it has to be checkable rather than asserted.

Suite: 284 passed, 0 failed. Clippy clean. Release build clean.
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: decide the disposition of every test-only pub item</title>
<updated>2026-11-20T20:47:21+00:00</updated>
<author>
<name>aur-build</name>
<email>aur-build@localhost</email>
</author>
<published>2026-11-20T20:47:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/aur-build/commit/?id=289560d196b65b0b257b59a92c956f088eb29fad'/>
<id>289560d196b65b0b257b59a92c956f088eb29fad</id>
<content type='text'>
The census could say which `pub` items nothing outside their module
names, and which of those a test names. It could not say what to do about
them, because the two questions that actually decide it are ones a
raw-source name match cannot answer:

  Does a test *call* it, or merely mention it inside a string?
  Does production code *inside* the declaring module call it?

`tools/test-surface.py` asks both, and `tools/test-surface.md` records the
answer for all 61 items. Four dispositions, each with a hand-written
reason kept in `tools/test-surface-reasons.json`:

  gate (9)         production never calls it; a test does
  move-test (9)    the test that names it builds no fixture, so it is a
                   unit test in the wrong file
  narrow (6)       no test calls it at all — census false positives, the
                   name appears only inside a string literal
  residue (34)     stays pub, and the honest column

`residue` needs saying out loud. Rust has no test-conditional visibility:
no attribute makes an item `pub` under one feature and `pub(crate)` under
another, and `pub use` cannot re-export a `pub(crate)` item. An item that
production needs *inside* its own module and a fixture-bound integration
test needs from outside cannot be narrowed without breaking one side or
the other. That is not a gap in this analysis; it is a gap in the language,
and the way to close those 34 rows is to change the tests — move them into
the module, or exercise the behaviour through the module's real entry
point — not to invent a visibility that does not exist.

So the column is ratcheted rather than wished away.
`the_test_surface_is_disposed_of` fails if any row lacks a hand-written
reason, and if any count — including `gate_pending`, items decided to be
gated but not yet gated — exceeds its budget. It can only shrink.

Two census limitations surfaced and are now written down rather than
silently trusted: "module" means the top-level directory, so an item used
only from a sibling file in the same module reads as dead; and mentions
are matched over raw source, so a string counts as a reference. Six items
were being counted as test-pinned on the strength of a string alone.

No source file is edited here. This is the decision record the next
commits apply.

Suite: 284 passed, 0 failed. Release build: zero warnings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The census could say which `pub` items nothing outside their module
names, and which of those a test names. It could not say what to do about
them, because the two questions that actually decide it are ones a
raw-source name match cannot answer:

  Does a test *call* it, or merely mention it inside a string?
  Does production code *inside* the declaring module call it?

`tools/test-surface.py` asks both, and `tools/test-surface.md` records the
answer for all 61 items. Four dispositions, each with a hand-written
reason kept in `tools/test-surface-reasons.json`:

  gate (9)         production never calls it; a test does
  move-test (9)    the test that names it builds no fixture, so it is a
                   unit test in the wrong file
  narrow (6)       no test calls it at all — census false positives, the
                   name appears only inside a string literal
  residue (34)     stays pub, and the honest column

`residue` needs saying out loud. Rust has no test-conditional visibility:
no attribute makes an item `pub` under one feature and `pub(crate)` under
another, and `pub use` cannot re-export a `pub(crate)` item. An item that
production needs *inside* its own module and a fixture-bound integration
test needs from outside cannot be narrowed without breaking one side or
the other. That is not a gap in this analysis; it is a gap in the language,
and the way to close those 34 rows is to change the tests — move them into
the module, or exercise the behaviour through the module's real entry
point — not to invent a visibility that does not exist.

So the column is ratcheted rather than wished away.
`the_test_surface_is_disposed_of` fails if any row lacks a hand-written
reason, and if any count — including `gate_pending`, items decided to be
gated but not yet gated — exceeds its budget. It can only shrink.

Two census limitations surfaced and are now written down rather than
silently trusted: "module" means the top-level directory, so an item used
only from a sibling file in the same module reads as dead; and mentions
are matched over raw source, so a string counts as a reference. Six items
were being counted as test-pinned on the strength of a string alone.

No source file is edited here. This is the decision record the next
commits apply.

Suite: 284 passed, 0 failed. Release build: zero warnings.
</pre>
</div>
</content>
</entry>
</feed>
