You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
relay/services: the test fakes are pub mod and ship in every production build #1210
Measured on rewrite/main at ff045445: crates/nostream-relay/src/testing.rs (2,188 lines) and crates/nostream-services/src/testing.rs (1,939 lines) are declared pub mod from their lib.rs — relay/src/lib.rs:59, services/src/lib.rs:45 — and are not#[cfg(test)]. pub mod unavailable ships beside them in both crates.
Both modules carry a second implementation of the same traits, including two separate InMemoryEventRepositorys. They are compiled into every production build, they are part of the public API surface whether or not anyone wants them, and the two copies will drift apart with nothing to notice: they are not the same code under two names, so a fix to one is not a fix to the other.
This is test scaffolding that has become load-bearing. It is presumably there because integration tests in other crates need a fake, which is a legitimate need; the defect is that production builds pay for it and the API promises it.
Acceptance:
One in-memory implementation exists, not two, and it lives behind a feature (testing or test-support) that [dev-dependencies] enables — so a release build contains none of it.
cargo tree -e features -p nostream-relay in a release configuration shows no test-support code path.
The in-process tests that use the fakes still pass through the feature, and the pub surface of both crates is smaller after the change by exactly those modules.
Activity