发布

  • v1609 b6420ac9ba

    fix(server): make synthetic CSI opt-in only (sibling fix to #937) (#979)

    frostbyte_neo 发布于 2026-06-08 16:07:39 +00:00

    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.

    下载附件