Module: utils/ephemeralStorage

Best-effort detection of ephemeral DB storage at boot (INF-006).

Render / Fly / Railway free-tier web service filesystems are ephemeral — every redeploy gets a fresh disk and backend/data/sentri.db resets to empty, silently wiping accounts, projects, tests, and runs. This module surfaces the symptom as a single visible log line at boot so operators notice the misconfiguration before they lose data on their second deploy.

The probe is skipped entirely when DATABASE_URL is set (Postgres mode); otherwise it resolves the SQLite DB path the same way the SQLite adapter (backend/src/database/adapters/sqlite-adapter.js) does, then writes a *.boot-marker file alongside the DB. On a redeploy where the disk survived, the marker's mtime is older than the freshness window and the warning is suppressed; on ephemeral storage the marker is missing and the warning fires.

Source:

Methods

(static) warnIfEphemeralStorage(optsopt) → {Object}

Emit a warning if the configured SQLite DB path looks ephemeral.

No-op (returns early) when DATABASE_URL is set — Postgres deployments are always durable, regardless of the host filesystem.

Parameters:
Name Type Attributes Description
opts Object <optional>
Properties
Name Type Attributes Description
env NodeJS.ProcessEnv <optional>

Override env (defaults to process.env).

logger Console <optional>

Override logger (defaults to console).

Source:
Returns:

Outcome for tests/callers.

Type
Object

(inner) defaultDbPath() → {string}

Resolve the default SQLite DB path. Mirrors the SQLite adapter's default at backend/src/database/adapters/sqlite-adapter.js so this probe and the adapter never disagree about where the DB lives.

Source:
Returns:

Absolute path to the default SQLite DB file.

Type
string