-
fix(server): make synthetic CSI opt-in only (sibling fix to #937) (#979)
发布于
2026-06-08 16:07:39 +00:00 Background
Issue #937 in the cognitum-v0 appliance repo flagged that the
cognitum-csi-capturesystemd unit shipped--simulateby default,
silently serving synthetic CSI tagged as production telemetry on
/api/v1/sensor/stream. That's a textbook trust-eroding pattern — the
single most-cited "where's the real data?" evidence external reviewers
(#943, #934) point at when they call the project AI-slop.A grep across THIS tree surfaced the exact same anti-pattern in three
places:docker/docker-compose.yml:27 # auto (default) — probe ESP32, fall back to simulation
docker/docker-entrypoint.sh:14 # CSI_SOURCE — data source: auto (default), ...
main.rs:6435 info!("No hardware detected, using simulation"); "simulate"The sensing-server's
autosource resolver at main.rs:6425-6440
silently fell back to synthetic with only aninfo!log line as the
signal. Downstream consumers calling/api/v1/sensing/latestor
/ws/sensinghad no in-band way to know they were being served fake
data.Fix
autonow refuses to fall back. When neither ESP32 UDP nor host WiFi
is detected, the server logs a clearerror!explaining the situation
and exits 78 (EX_CONFIG). The error message names the two ways to
proceed: provision real hardware, or set--source simulated/
CSI_SOURCE=simulatedexplicitly. Existing operators who already use
--source simulated(or its legacysimulatealias) are unaffected —
the alias is preserved for back-compat.Docker entrypoint comment, docker-compose comment, and the Tauri
desktop app's source-default path also updated to reflect the new
posture. The desktop app keeps itssimulateddefault because it's
an explicit demo product — the value passed downstream is the
explicitsimulated, notauto, so the server tags it correctly
and never lies about its data source.Validation
cargo build -p wifi-densepose-sensing-server --no-default-features
cargo test -p wifi-densepose-sensing-server --no-default-features
→ 122 / 122 pass, build clean (existing pre-fix warnings unchanged).Deployment
⚠ Breaking change for unattended deployments that relied on the
auto → simulatedsilent fallback. That is exactly the failure mode
this PR fixes: pretending to serve real sensing data when the source
is fake. Operators who genuinely want demo mode set
CSI_SOURCE=simulatedexplicitly; the error message and the
docker-compose comment both point them there.下载附件