fix(server): close silent auto→simulated fallback path (sibling of #937)#979
Merged
Conversation
Background Issue #937 in the cognitum-v0 appliance repo flagged that the `cognitum-csi-capture` systemd unit shipped `--simulate` by 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 `auto` source resolver at main.rs:6425-6440 silently fell back to synthetic with only an `info!` log line as the signal. Downstream consumers calling `/api/v1/sensing/latest` or `/ws/sensing` had no in-band way to know they were being served fake data. Fix `auto` now refuses to fall back. When neither ESP32 UDP nor host WiFi is detected, the server logs a clear `error!` 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=simulated` explicitly. Existing operators who already use `--source simulated` (or its legacy `simulate` alias) 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 its `simulated` default because it's an explicit demo product — the value passed downstream is the *explicit* `simulated`, not `auto`, 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 → simulated` silent 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=simulated` explicitly; the error message and the docker-compose comment both point them there. Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #937 in the cognitum-v0 appliance flagged that
cognitum-csi-captureshipped--simulateby default. A grep across this tree found the same anti-pattern:CSI_SOURCE=auto(the Docker default) silently fell back to synthetic CSI when no ESP32 or Windows WiFi was detected, and the only signal was a singleinfo!log line at startup. Downstream consumers of/api/v1/sensing/latestand/ws/sensinghad no in-band way to know they were being served fake data.Fix
autonow refuses to fall back. When no real source is detected the server logs a clearerror!with two explicit ways to proceed, then exits 78 (EX_CONFIG):Existing operators who explicitly set
--source simulated(or the legacysimulatealias) are unaffected — the alias is preserved for back-compat.What changed
wifi-densepose-sensing-server/src/main.rsautono longer falls back; exits 78 with actionable error.simulate→simulatedalias preserved.docker/docker-entrypoint.shCSI_SOURCEhelp text rewritten to reflect fail-loudauto.docker/docker-compose.ymlCSI_SOURCE=autocorrected.wifi-densepose-desktop/src/commands/server.rssimulated(notauto), so the server tags the data correctly. Desktop app keeps demo-mode default — it's an explicit demo product.Test plan
cargo build -p wifi-densepose-sensing-server --no-default-features --bin sensing-server→ clean (existing pre-fix warnings unchanged).cargo test -p wifi-densepose-sensing-server --no-default-features --bin sensing-server→ 122 / 122 pass (no regressions in the existing test suite).match args.source.as_str()arm replacement; CI build covers it. An end-to-end Docker smoke test (build image, run with no ESP32, expect exit 78) would be nice-to-have.Deployment
⚠ Breaking change for unattended deployments that relied on the
auto → simulatedsilent fallback. That's exactly the failure mode this PR closes: pretending to serve real sensing data when the source is fake. Three escape hatches printed in the error message:🤖 Generated with claude-flow