Skip to content

cli: no test checks that diagnostics stay off stdout #953

Closed as not planned

Description

@bpowers

The CLI promises that stdout carries only the results table and every diagnostic goes to stderr, so simlin simulate model.xmile > out.tsv gives a clean file.
No test checks this: a change that printed warnings to stdout passed the whole test suite.
The proposal is a small integration test that runs the built binary and checks the two streams separately.

Example

simlin simulate --ltm test/conveyors/minimal_conveyor.xmile > out.tsv

This prints a conveyor_ltm_degraded warning.
Today it goes to stderr (print_formatted_error), and out.tsv is just the table; nothing would catch it moving to stdout.
The MDL export warnings in convert follow the same rule (#856).

Why it matters

A regression would corrupt piped or redirected output, the main scripted use of the CLI.
No such regression has shipped; the gap was found by deliberately breaking the code and seeing no test fail.

Fix

Add src/simlin-cli/tests/integration/main.rs (one harness per crate) that runs the binary via CARGO_BIN_EXE_simlin with std::process::Command on two tiny fixtures: the conveyor model above, asserting stdout parses as TSV with no diagnostic lines and stderr has the warning; and a convert --to mdl run that triggers an export warning, asserting the same split.
Alternative: route all diagnostic printing through one function that takes a writer and unit-test it; cheaper, but it does not check what the binary actually does.

Pointers

  • src/simlin-cli/src/main.rs: print_formatted_error, the MDL export warning eprintln! in Command::Convert
  • src/simlin-cli/CLAUDE.md: "Diagnostic reporting"

Activity

  1. changed the title [-]cli: stdout/stderr stream discipline is documented but unpinned by any test[/-] [+]cli: no test checks that diagnostics stay off stdout[/+] on Oct 12, 2026
  2. added
    engine
    hygiene
    wontfix
    on Oct 12, 2026
  3. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing as won't fix.

    No such regression has shipped. The gap was found only by deliberately breaking the code. A new harness for a debugging tool's single property is test cost without a defect behind it. Reasonable to do only if a CLI integration harness is wanted for other reasons.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enginehygienewontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions