fix(logging): load .env before building the log filter

`tracing_subscriber::fmt::init()` reads RUST_LOG when it is called, and it
was called one line before `dotenvy::dotenv()`. The systemd unit sets no
EnvironmentFile on purpose, so RUST_LOG exists only in .env: the filter was
built with no directive and fell back to its default, ERROR.

Production has logged nothing but errors since the 2026-09-20 build. On
smirk-backend, `configuration loaded` has appeared zero times since, and
the 01:53 restart today produced no application output at all. It hides
only in production, since a developer usually has RUST_LOG exported
already.

This also defeats the legacy sign-in migration's designed verification.
`LegacyDirectory::connect` deliberately connects at boot rather than per
request so an operator reads "enabled" or "staying disabled" once, in the
log. Both are `info!`, and the failure branch is a `warn!`, so all three
were being dropped exactly when we need them.

The guard asserts the ordering property and locates the two calls by
crate rather than by line, and carries a test proving it fails on the
inverted order.

Also unbreak the test targets, which have not compiled on main: `AppState`
gained `legacy` and `NewSocialTip` gained `recipient_user_id` without
their fixtures following. Both take the closed value, off and public.
This commit is contained in:
2026-09-24 20:49:47 -04:00
parent e24dd44c69
commit 73d7730c33
4 changed files with 87 additions and 1 deletions
+9
View File
@@ -124,6 +124,9 @@ async fn db_create_draft_roundtrips_all_columns() {
use smirk_backend_core::infra::db::NewSocialTip;
let enc = hex::decode("cdcd").unwrap();
let new = NewSocialTip {
// Public tip: these predate targeted tips and are claimable by whoever
// holds the share URL.
recipient_user_id: None,
sender_user_id: uid,
asset: "btc",
amount: 100_000,
@@ -227,6 +230,9 @@ async fn make_draft(
view_key: Option<&str>,
) -> uuid::Uuid {
let new = NewSocialTip {
// Public tip: these predate targeted tips and are claimable by whoever
// holds the share URL.
recipient_user_id: None,
sender_user_id: uid,
asset,
amount,
@@ -1336,6 +1342,9 @@ async fn grin_tip_db_lifecycle_columns() {
use smirk_backend_core::infra::db::NewSocialTip;
let new = NewSocialTip {
// Public tip: these predate targeted tips and are claimable by whoever
// holds the share URL.
recipient_user_id: None,
sender_user_id: uid,
asset: "grin",
amount: 500,