Skip to content

eprintln! diagnostics are silently discarded on Windows (daemon stderr piped to null, desktop app has no console) #2129

Closed as not planned

Description

@mstomar125

Context

While reviewing PR #2128 (fix for #2107 — nodespace_types::SchemaNode::from_node silently swallowing a fields JSON parse failure), the adversarial review surfaced a platform-specific gap in the chosen fix.

PR #2128 fixed the silent-swallow bug by having SchemaNode::from_node print a diagnostic via an unconditional eprintln! — chosen specifically because nodespace-types deliberately carries no logging dependency, and (per the PR's own rationale) an always-on eprintln! "fires the same way no matter which binary embeds this crate," unlike a #[cfg]-gated flag that could be forgotten.

That claim does not hold on Windows:

  • packages/desktop-app/src-tauri/src/daemon_setup.rs::spawn_daemon_windows spawns nodespaced with .stdout(Stdio::null()).stderr(Stdio::null()) — any eprintln! reached via node_to_typed_value/nodes_to_typed_values inside the Windows daemon process is discarded outright, never reaching a log file the way it does on macOS (launchd StandardErrorPath) or Linux (systemd StandardError=append:...).
  • packages/desktop-app/src-tauri/src/main.rs sets #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] — a release build has no console at all on Windows, so eprintln! from the two direct SchemaNode::from_node call sites in packages/desktop-app/src-tauri/src/commands/schemas.rs (get_all_schemas/get_schema_definition) also goes nowhere in that process.

Net effect: on a production Windows build, a malformed schema's fields-parse-failure diagnostic is exactly as invisible as it was before #2107's fix — not because of a forgotten opt-in flag (the failure mode the fix was designed against), but because of pre-existing, unrelated daemon/app stdio plumbing.

Suggested approaches (not prescribing)

  • Route the Windows daemon's child-process stderr to a log file (mirroring the launchd/systemd behavior on macOS/Linux) instead of Stdio::null().
  • Have the daemon (which already depends on tracing) capture/re-emit anything written to its own process's stderr before the schema-parsing code path executes, rather than relying on eprintln! reaching an OS-level destination.
  • Something narrower scoped to just this diagnostic if a general stdio-routing fix is out of scope.

Acceptance criteria

  • A nodespace_types::SchemaNode::from_node fields-parse-failure diagnostic (or any other eprintln!-based diagnostic reachable from the daemon/desktop-app on Windows) is visible somewhere actionable on a Windows build — a log file, Event Log, or equivalent — not silently discarded.

Activity

  1. added 2 commits that reference this issue on Aug 18, 2026
    8d988f9
    84567cf
  2. mstomar125 commented on Aug 18, 2026

    @mstomar125
    ContributorAuthor

    Feasibility assessment + partial fix

    Opened PR #2136 for the daemon-child-process half of this issue: spawn_daemon_windows now routes nodespaced's stdout/stderr to ~/.nodespace/logs/nodespaced.log/nodespaced-error.log (append mode) instead of Stdio::null(), mirroring the launchd/systemd patterns already in the same file. This covers the daemon-side call path (tracing_subscriber::fmt()'s default stdout writer, plus SchemaNode::from_node's eprintln! diagnostic reached via packages/core's node_ops/query_ops on every schema/node read the daemon serves).

    This does NOT close the issue — two things remain open:

    1. The desktop-app GUI process's own console-less stderr is unaddressed. The two direct SchemaNode::from_node calls in packages/desktop-app/src-tauri/src/commands/schemas.rs run inside the Tauri GUI process itself, which is a windows_subsystem = "windows" release build with no console at all — this is a different mechanism than the daemon's child-process stdio (there's no child process to redirect; it's the GUI process's own stderr handle). Fixing it would need either an OS-level SetStdHandle redirect at GUI startup (Windows FFI in main.rs — meaningfully higher blast radius, touches app startup on all platforms) or restructuring SchemaNode::from_node to return the diagnostic instead of printing it internally (which PR #2128 explicitly chose against, for uniformity across its three callers). I didn't attempt either here given I have no way to runtime-verify a startup-level change on Windows from this machine.

    2. No live Windows validation was possible. This machine is macOS with no Windows box, VM, or existing cross-compilation setup (rustup target list --installed had no Windows target before I added x86_64-pc-windows-msvc myself; no cross/cargo-xwin; CI builds Windows on a real windows-latest runner, not by cross-compiling from macOS). I verified what I honestly could:

    • Native macOS cargo check/test/clippy --all-targets/fmt on the full crate — clean.
    • A full cargo check --target x86_64-pc-windows-msvc on the whole crate fails on a pre-existing, unrelated issue (ring's C build needs a Windows SDK/MSVC toolchain this sandbox doesn't have).
    • To still get real signal, I copied the new #[cfg(windows)] code verbatim into an isolated scratch crate (no tauri/ring in its tree) and ran cargo check/cargo clippy --target x86_64-pc-windows-msvc against it — clean. This confirms the Windows API usage type-checks, but proves nothing about runtime handle-inheritance/file-locking behavior in the actual spawned child.

    Filing a follow-up issue now covering both: live-validate PR #2136's fix on a real Windows box, and scope/implement the GUI-console half. Leaving this issue open (not closing) and will mark it Blocked on the project board pending Windows access, per the board-hygiene convention for environment-blocked work.

  3. mstomar125 commented on Sep 12, 2026

    @mstomar125
    ContributorAuthor

    Closing as superseded by #2137, not fixed-and-verified — board-accuracy triage (2026-09-12).

    What's actually resolved here: PR #2136 (merged 2026-08-18) fixed the daemon-child-process half — spawn_daemon_windows now routes nodespaced's stdout/stderr to ~/.nodespace/logs/nodespaced*.log instead of Stdio::null().

    What's not resolved, and why closing anyway: the PR's own author was explicit that this "does NOT close the issue" — two things remained: (1) live Windows validation of PR #2136/#2140, and (2) the desktop-app GUI process's own console-less stderr (a distinct mechanism, no child process to redirect). Both were then filed as a dedicated follow-up, #2137, whose body covers exactly those two items point-for-point (its "1. Live-validate PR #2136 (and #2140)" and "2. Fix the desktop-app GUI process's own console-less stderr" sections).

    Keeping both #2129 and #2137 open double-tracks the identical remaining work under two numbers. #2137 is the more complete, currently-accurate tracking issue (it also folds in #2138/#2140's edition-aware taskkill validation, which #2129 never mentioned) — closing this one in its favor. No new code changes; #2137 remains open and Blocked pending Windows access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions