Skip to content

Fix/corrupted json output - #100

Merged
HMythical merged 5 commits into
rootdevfrom
fix/corrupted-json-output
Nov 13, 2026
Merged

HMythical merged 5 commits into
rootdevfrom
fix/corrupted-json-output

Conversation

@HMythical

Copy link
Copy Markdown
Owner

Description

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Test addition

Platform

  • Linux
  • Windows
  • Both

Testing

  • All existing tests pass
  • New tests added (if applicable)
  • Tested on [platform]

Checklist

  • Code follows project conventions
  • Self-reviewed code
  • Documentation updated
  • No new warnings
  • Changes limited to one platform (if applicable)
  • Commit messages follow project style

Related Issues

Closes #

Screenshots/Videos

The flag promised a singular document, but broke in the following
functions/files

1. confirm()
2. src/utils/fs.rs
3. help <command>
4. version

Now outputs to stderr and the 4 sources of the bug no longer
ask for that document. Instead throwing a new error:

BallError::ConfirmationRequired

Tested on Windows and Linux
`baller --json roster <name>` printed "Searching '<name>' not found
locally, searching registries..." on stdout ahead of the search document
whenever the name was not on the roster, so the output failed jq. The
notice is progress output and now goes through tracing: on stderr, and
hidden by -q and --json. The same match fell back to a registry search
on any lookup error; only PackageNotFound does now, so a roster that
cannot be read is reported rather than searched.

Child processes inherit stdout too: hook scripts, sudo apt-get/dnf/
pacman and cargo install wrote ahead of the JSON document. Under --json
their stdout now goes to stderr (utils::output::child_stdout, with the
mode set once in main); text mode is unchanged.

--quiet keeps printing `version`: it hides progress, never a command's
result. Documented, and pinned by a test.

Tested with three new tests in tests/json_output.rs, each failing when
its fix is reverted, on Linux and on a Windows 11 VM. The hook test
fails under Wine only, whose powershell is a stub.

Closes #40
Closes #41
Installing a system package printed "System installing via apt...
quiet=false" on stderr. The tracing migration (#32) kept the quiet
argument of the old output::info(quiet, msg) helper on one call in
draft.rs, and tracing reads it as a field to print. The tracer already
drops info lines under -q and --json, so the argument is removed; the
leftover test_info_is_quiet_safe, which still exercised
tracing::info!(bool, ...), goes with it.

Two Referee integration tests failed intermittently on the Windows CI
runner. MockServer polls a non-blocking listener, and on Windows an
accepted socket inherits that mode, voiding read_request's read
timeout: a request still in flight at accept time read as WouldBlock
and was dropped unrecorded. read_request now restores blocking mode.

The new test_the_mock_server_waits_for_a_request_that_arrives_late
sends its request 200 ms after connecting. Built without the fix it
failed 3 of 3 runs on a Windows 11 VM and under Wine; with the fix it
passed 3 of 3. Linux does not inherit the mode, so the test passes
there either way.
@HMythical
HMythical merged commit f0ded86 into rootdev Nov 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant